| 1 | /**************************************************************************//** |
| 2 | * @file Command.h |
| 3 | * @brief Header file of the commands driver. |
| 4 | * @author Lucian Sin ([email protected]) |
| 5 | * |
| 6 | ******************************************************************************* |
| 7 | * Copyright 2013(c) Analog Devices, Inc. |
| 8 | * |
| 9 | * All rights reserved. |
| 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without modification, |
| 12 | * are permitted provided that the following conditions are met: |
| 13 | * - Redistributions of source code must retain the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer. |
| 15 | * - Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in |
| 17 | * the documentation and/or other materials provided with the |
| 18 | * distribution. |
| 19 | * - Neither the name of Analog Devices, Inc. nor the names of its |
| 20 | * contributors may be used to endorse or promote products derived |
| 21 | * from this software without specific prior written permission. |
| 22 | * - The use of this software may or may not infringe the patent rights |
| 23 | * of one or more patent holders. This license does not release you |
| 24 | * from the requirement that you obtain separate licenses from these |
| 25 | * patent holders to use this software. |
| 26 | * - Use of the software either in source or binary form, must be run |
| 27 | * on or directly connected to an Analog Devices Inc. component. |
| 28 | * |
| 29 | * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED |
| 30 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY |
| 31 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 32 | * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 34 | * INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 35 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 36 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 38 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 39 | * |
| 40 | ******************************************************************************/ |
| 41 | |
| 42 | #ifndef __COMMAND_H__ |
| 43 | #define __COMMAND_H__ |
| 44 | |
| 45 | /******************************************************************************/ |
| 46 | /********************** Macros and Constants Definitions **********************/ |
| 47 | /******************************************************************************/ |
| 48 | #define NULL ((void *)0) |
| 49 | #define SUCCESS 0 |
| 50 | #define ERROR -1 |
| 51 | |
| 52 | /******************************************************************************/ |
| 53 | /*************************** Types Declarations *******************************/ |
| 54 | /******************************************************************************/ |
| 55 | typedef void (*cmdFunction)(double* param, char paramNo); |
| 56 | |
| 57 | struct cmd_info { |
| 58 | char* name; |
| 59 | char* description; |
| 60 | char* acceptedValue; |
| 61 | char* example; |
| 62 | }; |
| 63 | |
| 64 | /******************************************************************************/ |
| 65 | /************************ Functions Declarations ******************************/ |
| 66 | /******************************************************************************/ |
| 67 | |
| 68 | /* Initializes the device. */ |
| 69 | char DoDeviceInit(void); |
| 70 | /* Displays all available commands. */ |
| 71 | void GetHelp(double* param, char paramNo); |
| 72 | /* Selects the type of output. */ |
| 73 | void SetOutput(double* param, char paramNo); |
| 74 | /* Displays the type of output. */ |
| 75 | void GetOutput(double* param, char paramNo); |
| 76 | /* Loads a frequency value in one selected register. */ |
| 77 | void LoadFreqReg(double* param, char paramNo); |
| 78 | /* Displays the value from one selected frequency register. */ |
| 79 | void GetFreqRegVal(double* param, char paramNo); |
| 80 | /* Loads a phase value in one selected register. */ |
| 81 | void LoadPhaseReg(double* param, char paramNo); |
| 82 | /* Displays the value from one selected phase register. */ |
| 83 | void GetPhaseRegVal(double* param, char paramNo); |
| 84 | /* Select the frequency register to be used. */ |
| 85 | void SelFreqRegNo(double* param, char paramNo); |
| 86 | /* Displays the selected frequency register. */ |
| 87 | void GetFreqRegNo(double* param, char paramNo); |
| 88 | /* Select the phase register to be used. */ |
| 89 | void SelPhaseRegNo(double* param, char paramNo); |
| 90 | /* Displays the selected phase register. */ |
| 91 | void GetPhaseRegNo(double* param, char paramNo); |
| 92 | /* Select one sleep mode. */ |
| 93 | void SetSleepMode(double* param, char paramNo); |
| 94 | /* Displays the selected sleep mode. */ |
| 95 | void GetSleepMode(double* param, char paramNo); |
| 96 | /* Sets the programming method. (only for AD9834 & AD9838) */ |
| 97 | void SetProgram(double* param, char paramNo); |
| 98 | /* Displays the programming method. */ |
| 99 | void GetProgram(double* param, char paramNo); |
| 100 | /* Sets the logic output type. (only for AD9834 & AD9838) */ |
| 101 | void SetLogicOut(double* param, char paramNo); |
| 102 | /* Displays the logic output type. (only for AD9834 & AD9838) */ |
| 103 | void GetLogicOut(double* param, char paramNo); |
| 104 | |
| 105 | |
| 106 | #endif // __COMMAND_H__ |