| 1 | /***************************************************************************//** |
| 2 | * @file Command.h |
| 3 | * @brief Header file of the commands driver. |
| 4 | * @author Istvan Csomortani ([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 |
| 12 | * modification, 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 |
| 30 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, |
| 31 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 32 | * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 33 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 34 | * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 35 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 36 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 37 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 39 | * |
| 40 | *******************************************************************************/ |
| 41 | #ifndef __COMMAND_H__ |
| 42 | #define __COMMAND_H__ |
| 43 | |
| 44 | /******************************************************************************/ |
| 45 | /********************** Macros and Constants Definitions **********************/ |
| 46 | /******************************************************************************/ |
| 47 | #define NULL ((void *)0) |
| 48 | #define SUCCESS 0 |
| 49 | #define ERROR -1 |
| 50 | |
| 51 | /******************************************************************************/ |
| 52 | /*************************** Types Declarations *******************************/ |
| 53 | /******************************************************************************/ |
| 54 | typedef void (*cmdFunction)(double* param, char paramNo); |
| 55 | |
| 56 | struct cmd_info { |
| 57 | char* name; |
| 58 | char* description; |
| 59 | char* acceptedValue; |
| 60 | char* example; |
| 61 | }; |
| 62 | /******************************************************************************/ |
| 63 | /************************ Functions Declarations ******************************/ |
| 64 | /******************************************************************************/ |
| 65 | |
| 66 | /* Initializes the device. */ |
| 67 | char DoDeviceInit(void); |
| 68 | |
| 69 | /* Set the current device type */ |
| 70 | void DoDeviceLock(void); |
| 71 | |
| 72 | /* Displays all available commands. */ |
| 73 | void GetHelp(double* param, char paramNo); |
| 74 | |
| 75 | /* Set resistor value */ |
| 76 | void SetRdac(double* param, char paramNo); |
| 77 | |
| 78 | /* Get resistor value */ |
| 79 | void GetRdac(double* param, char paramNo); |
| 80 | |
| 81 | /* Reset all wiper register to its stored values */ |
| 82 | void DoReset(double* param, char paramNo); |
| 83 | |
| 84 | /* Restore the specified wiper register setting form the memory */ |
| 85 | void DoRestore(double* param, char paramNo); |
| 86 | |
| 87 | /* Save the current wiper register settings to the memory */ |
| 88 | void SaveSettings(double* param, char paramNo); |
| 89 | |
| 90 | /* Write to a given memory address */ |
| 91 | void WriteToMem(double* param, char paramNo); |
| 92 | |
| 93 | /* Read from a given memory address */ |
| 94 | void ReadFromMem(double* param, char paramNo); |
| 95 | |
| 96 | /* Decrement a wiper register by 6dB */ |
| 97 | void DecRdac6dB(double* param, char paramNo); |
| 98 | |
| 99 | /* Decrement all wiper register by 6dB */ |
| 100 | void DecAllRdac6dB(double* param, char paramNo); |
| 101 | |
| 102 | /* Decrement a wiper register by one */ |
| 103 | void DecRdac(double* param, char paramNo); |
| 104 | |
| 105 | /* Decrement all wiper register by one */ |
| 106 | void DecAllRdac(double* param, char paramNo); |
| 107 | |
| 108 | /* Increment a wiper register by 6dB */ |
| 109 | void IncRdac6dB(double* param, char paramNo); |
| 110 | |
| 111 | /* Increment all wiper register by 6dB */ |
| 112 | void IncAllRdac6dB(double* param, char paramNo); |
| 113 | |
| 114 | /* Increment a wiper register by one */ |
| 115 | void IncRdac(double* param, char paramNo); |
| 116 | |
| 117 | /* Increment all wiper register by one */ |
| 118 | void IncAllRdac(double* param, char paramNo); |
| 119 | |
| 120 | /* Set the state of the Write Protect (WP) pin */ |
| 121 | void SetWrPin(double* param, char paramNo); |
| 122 | |
| 123 | /* Return the current value of the Write Protect (WP) pin */ |
| 124 | void GetWrPin(double* param, char paramNo); |
| 125 | |
| 126 | /* Set the state of the Hardware Override Preset (PR) pin */ |
| 127 | void SetPrPin(double* param, char paramNo); |
| 128 | |
| 129 | /* Return the current value of the Hardware Override Preset (PR) pin */ |
| 130 | void GetPrPin(double* param, char paramNo); |
| 131 | |
| 132 | /* Read one of the Tolerance register */ |
| 133 | void GetTolerance(double* param, char paramNo); |
| 134 | |
| 135 | #endif // __COMMAND_H__ |