Vybhav Kadaba
/
EV-PRO-MW1001_Development_code_cleaup
Removed unwanted enums and unused functions
inc/admw_gpio.h@64:d89d9728ba95, 2020-04-09 (annotated)
- Committer:
- Vkadaba
- Date:
- Thu Apr 09 12:39:43 2020 +0000
- Revision:
- 64:d89d9728ba95
- Parent:
- 32:52445bef314d
code clean up part-2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Vkadaba | 5:0728bde67bdb | 1 | /* |
Vkadaba | 5:0728bde67bdb | 2 | Copyright 2019 (c) Analog Devices, Inc. |
Vkadaba | 5:0728bde67bdb | 3 | |
Vkadaba | 5:0728bde67bdb | 4 | All rights reserved. |
Vkadaba | 5:0728bde67bdb | 5 | |
Vkadaba | 5:0728bde67bdb | 6 | Redistribution and use in source and binary forms, with or without |
Vkadaba | 5:0728bde67bdb | 7 | modification, are permitted provided that the following conditions are met: |
Vkadaba | 5:0728bde67bdb | 8 | - Redistributions of source code must retain the above copyright |
Vkadaba | 5:0728bde67bdb | 9 | notice, this list of conditions and the following disclaimer. |
Vkadaba | 5:0728bde67bdb | 10 | - Redistributions in binary form must reproduce the above copyright |
Vkadaba | 5:0728bde67bdb | 11 | notice, this list of conditions and the following disclaimer in |
Vkadaba | 5:0728bde67bdb | 12 | the documentation and/or other materials provided with the |
Vkadaba | 5:0728bde67bdb | 13 | distribution. |
Vkadaba | 5:0728bde67bdb | 14 | - Neither the name of Analog Devices, Inc. nor the names of its |
Vkadaba | 5:0728bde67bdb | 15 | contributors may be used to endorse or promote products derived |
Vkadaba | 5:0728bde67bdb | 16 | from this software without specific prior written permission. |
Vkadaba | 5:0728bde67bdb | 17 | - The use of this software may or may not infringe the patent rights |
Vkadaba | 5:0728bde67bdb | 18 | of one or more patent holders. This license does not release you |
Vkadaba | 5:0728bde67bdb | 19 | from the requirement that you obtain separate licenses from these |
Vkadaba | 5:0728bde67bdb | 20 | patent holders to use this software. |
Vkadaba | 5:0728bde67bdb | 21 | - Use of the software either in source or binary form, must be run |
Vkadaba | 5:0728bde67bdb | 22 | on or directly connected to an Analog Devices Inc. component. |
Vkadaba | 5:0728bde67bdb | 23 | |
Vkadaba | 5:0728bde67bdb | 24 | THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR |
Vkadaba | 5:0728bde67bdb | 25 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, |
Vkadaba | 5:0728bde67bdb | 26 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
Vkadaba | 5:0728bde67bdb | 27 | IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, |
Vkadaba | 5:0728bde67bdb | 28 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
Vkadaba | 5:0728bde67bdb | 29 | LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR |
Vkadaba | 5:0728bde67bdb | 30 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Vkadaba | 5:0728bde67bdb | 31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Vkadaba | 5:0728bde67bdb | 32 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Vkadaba | 5:0728bde67bdb | 33 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Vkadaba | 5:0728bde67bdb | 34 | */ |
Vkadaba | 5:0728bde67bdb | 35 | |
Vkadaba | 5:0728bde67bdb | 36 | /*! |
Vkadaba | 5:0728bde67bdb | 37 | ****************************************************************************** |
Vkadaba | 5:0728bde67bdb | 38 | * @file: admw_gpio.h |
Vkadaba | 5:0728bde67bdb | 39 | * @brief: ADMW OS-dependent wrapper layer for GPIO interface |
Vkadaba | 5:0728bde67bdb | 40 | *----------------------------------------------------------------------------- |
Vkadaba | 5:0728bde67bdb | 41 | */ |
Vkadaba | 5:0728bde67bdb | 42 | |
Vkadaba | 5:0728bde67bdb | 43 | #ifndef __ADMW_GPIO_H__ |
Vkadaba | 5:0728bde67bdb | 44 | #define __ADMW_GPIO_H__ |
Vkadaba | 5:0728bde67bdb | 45 | |
Vkadaba | 5:0728bde67bdb | 46 | #include "inc/admw_types.h" |
Vkadaba | 5:0728bde67bdb | 47 | #include "inc/admw_platform.h" |
Vkadaba | 5:0728bde67bdb | 48 | |
Vkadaba | 5:0728bde67bdb | 49 | /*! @ingroup ADMW_Host */ |
Vkadaba | 5:0728bde67bdb | 50 | |
Vkadaba | 5:0728bde67bdb | 51 | /*! @addtogroup ADMW_Gpio ADMW Host GPIO interface functions |
Vkadaba | 5:0728bde67bdb | 52 | * @{ |
Vkadaba | 5:0728bde67bdb | 53 | */ |
Vkadaba | 5:0728bde67bdb | 54 | |
Vkadaba | 5:0728bde67bdb | 55 | /*! GPIO pin identifiers */ |
Vkadaba | 5:0728bde67bdb | 56 | typedef enum |
Vkadaba | 5:0728bde67bdb | 57 | { |
Vkadaba | 5:0728bde67bdb | 58 | ADMW_GPIO_PIN_RESET = 0, /*!< RESET GPIO output signal */ |
Vkadaba | 5:0728bde67bdb | 59 | ADMW_GPIO_PIN_ALERT_ERROR, /*!< ALERT GPIO input signal */ |
Vkadaba | 5:0728bde67bdb | 60 | ADMW_GPIO_PIN_DATAREADY, /*!< DATAREADY GPIO input signal */ |
Vkadaba | 32:52445bef314d | 61 | ADMW_GPIO_PIN_CS, /*!< CS GPIO output signal */ |
Vkadaba | 5:0728bde67bdb | 62 | } ADMW_GPIO_PIN; |
Vkadaba | 5:0728bde67bdb | 63 | |
Vkadaba | 5:0728bde67bdb | 64 | /*! |
Vkadaba | 5:0728bde67bdb | 65 | * GPIO callback function signature |
Vkadaba | 5:0728bde67bdb | 66 | * |
Vkadaba | 5:0728bde67bdb | 67 | * @param[in] ePinId The GPIO pin which triggered the interrupt notification |
Vkadaba | 5:0728bde67bdb | 68 | * @param[in] pArg Optional opaque parameter to be passed to the callback |
Vkadaba | 5:0728bde67bdb | 69 | */ |
Vkadaba | 5:0728bde67bdb | 70 | typedef void (*ADMW_GPIO_CALLBACK)( |
Vkadaba | 5:0728bde67bdb | 71 | ADMW_GPIO_PIN ePinId, |
Vkadaba | 5:0728bde67bdb | 72 | void * pArg); |
Vkadaba | 5:0728bde67bdb | 73 | |
Vkadaba | 5:0728bde67bdb | 74 | /*! A handle used in all API functions to identify the GPIO interface context */ |
Vkadaba | 5:0728bde67bdb | 75 | typedef void* ADMW_GPIO_HANDLE; |
Vkadaba | 5:0728bde67bdb | 76 | |
Vkadaba | 5:0728bde67bdb | 77 | #ifdef __cplusplus |
Vkadaba | 5:0728bde67bdb | 78 | extern "C" |
Vkadaba | 5:0728bde67bdb | 79 | { |
Vkadaba | 5:0728bde67bdb | 80 | #endif |
Vkadaba | 5:0728bde67bdb | 81 | |
Vkadaba | 5:0728bde67bdb | 82 | /*! |
Vkadaba | 5:0728bde67bdb | 83 | * @brief Open the SPI interface and allocate resources |
Vkadaba | 5:0728bde67bdb | 84 | * |
Vkadaba | 5:0728bde67bdb | 85 | * @param[in] pConfig Pointer to platform-specific GPIO interface details |
Vkadaba | 5:0728bde67bdb | 86 | * @param[out] phDevice Pointer to return a GPIO interface context handle |
Vkadaba | 5:0728bde67bdb | 87 | * |
Vkadaba | 5:0728bde67bdb | 88 | * @return Status |
Vkadaba | 5:0728bde67bdb | 89 | * - #ADMW_SUCCESS Call completed successfully |
Vkadaba | 5:0728bde67bdb | 90 | * - #ADMW_NO_MEM Failed to allocate memory for interface context |
Vkadaba | 5:0728bde67bdb | 91 | */ |
Vkadaba | 5:0728bde67bdb | 92 | ADMW_RESULT admw_GpioOpen( |
Vkadaba | 5:0728bde67bdb | 93 | ADMW_PLATFORM_GPIO_CONFIG * pConfig, |
Vkadaba | 5:0728bde67bdb | 94 | ADMW_GPIO_HANDLE * phDevice); |
Vkadaba | 5:0728bde67bdb | 95 | |
Vkadaba | 5:0728bde67bdb | 96 | /*! |
Vkadaba | 5:0728bde67bdb | 97 | * @brief Close GPIO interface and free resources |
Vkadaba | 5:0728bde67bdb | 98 | * |
Vkadaba | 5:0728bde67bdb | 99 | * @param[in] hDevice GPIO interface context handle (@ref admw_GpioOpen) |
Vkadaba | 5:0728bde67bdb | 100 | */ |
Vkadaba | 5:0728bde67bdb | 101 | void admw_GpioClose( |
Vkadaba | 5:0728bde67bdb | 102 | ADMW_GPIO_HANDLE hDevice); |
Vkadaba | 5:0728bde67bdb | 103 | |
Vkadaba | 5:0728bde67bdb | 104 | /*! |
Vkadaba | 5:0728bde67bdb | 105 | * @brief Get the state of the specified GPIO pin |
Vkadaba | 5:0728bde67bdb | 106 | * |
Vkadaba | 5:0728bde67bdb | 107 | * @param[in] hDevice GPIO interface context handle (@ref admw_GpioOpen) |
Vkadaba | 5:0728bde67bdb | 108 | * @param[in] ePinId GPIO pin to be read |
Vkadaba | 5:0728bde67bdb | 109 | * @param[out] pbState Pointer to return the state of the GPIO pin |
Vkadaba | 5:0728bde67bdb | 110 | * |
Vkadaba | 5:0728bde67bdb | 111 | * @return Status |
Vkadaba | 5:0728bde67bdb | 112 | * - #ADMW_SUCCESS Call completed successfully |
Vkadaba | 5:0728bde67bdb | 113 | * - #ADMW_INVALID_DEVICE_NUM Invalid GPIO pin specified |
Vkadaba | 5:0728bde67bdb | 114 | */ |
Vkadaba | 5:0728bde67bdb | 115 | ADMW_RESULT admw_GpioGet( |
Vkadaba | 5:0728bde67bdb | 116 | ADMW_GPIO_HANDLE hDevice, |
Vkadaba | 5:0728bde67bdb | 117 | ADMW_GPIO_PIN ePinId, |
Vkadaba | 5:0728bde67bdb | 118 | bool * pbState); |
Vkadaba | 5:0728bde67bdb | 119 | |
Vkadaba | 5:0728bde67bdb | 120 | /*! |
Vkadaba | 5:0728bde67bdb | 121 | * @brief Set the state of the specified GPIO pin |
Vkadaba | 5:0728bde67bdb | 122 | * |
Vkadaba | 5:0728bde67bdb | 123 | * @param[in] hDevice GPIO interface context handle (@ref admw_GpioOpen) |
Vkadaba | 5:0728bde67bdb | 124 | * @param[in] ePinId GPIO pin to be set |
Vkadaba | 5:0728bde67bdb | 125 | * @param[in] bState The state to set for GPIO pin |
Vkadaba | 5:0728bde67bdb | 126 | * |
Vkadaba | 5:0728bde67bdb | 127 | * @return Status |
Vkadaba | 5:0728bde67bdb | 128 | * - #ADMW_SUCCESS Call completed successfully |
Vkadaba | 5:0728bde67bdb | 129 | * - #ADMW_INVALID_DEVICE_NUM Invalid GPIO pin specified |
Vkadaba | 5:0728bde67bdb | 130 | */ |
Vkadaba | 5:0728bde67bdb | 131 | ADMW_RESULT admw_GpioSet( |
Vkadaba | 5:0728bde67bdb | 132 | ADMW_GPIO_HANDLE hDevice, |
Vkadaba | 5:0728bde67bdb | 133 | ADMW_GPIO_PIN ePinId, |
Vkadaba | 5:0728bde67bdb | 134 | bool bState); |
Vkadaba | 5:0728bde67bdb | 135 | |
Vkadaba | 5:0728bde67bdb | 136 | /*! |
Vkadaba | 5:0728bde67bdb | 137 | * @brief Enable interrupt notifications on the specified GPIO pin |
Vkadaba | 5:0728bde67bdb | 138 | * |
Vkadaba | 5:0728bde67bdb | 139 | * @param[in] hDevice GPIO interface context handle (@ref admw_GpioOpen) |
Vkadaba | 5:0728bde67bdb | 140 | * @param[in] ePinId GPIO pin on which to enable interrupt notifications |
Vkadaba | 5:0728bde67bdb | 141 | * @param[in] callback Callback function to invoke when the GPIO is asserted |
Vkadaba | 5:0728bde67bdb | 142 | * @param[in] arg Optional opaque parameter to be passed to the callback |
Vkadaba | 5:0728bde67bdb | 143 | * |
Vkadaba | 5:0728bde67bdb | 144 | * @return Status |
Vkadaba | 5:0728bde67bdb | 145 | * - #ADMW_SUCCESS Call completed successfully |
Vkadaba | 5:0728bde67bdb | 146 | * - #ADMW_INVALID_DEVICE_NUM Invalid GPIO pin specified |
Vkadaba | 5:0728bde67bdb | 147 | */ |
Vkadaba | 5:0728bde67bdb | 148 | ADMW_RESULT admw_GpioIrqEnable( |
Vkadaba | 5:0728bde67bdb | 149 | ADMW_GPIO_HANDLE hDevice, |
Vkadaba | 5:0728bde67bdb | 150 | ADMW_GPIO_PIN ePinId, |
Vkadaba | 5:0728bde67bdb | 151 | ADMW_GPIO_CALLBACK callback, |
Vkadaba | 5:0728bde67bdb | 152 | void * arg); |
Vkadaba | 5:0728bde67bdb | 153 | |
Vkadaba | 5:0728bde67bdb | 154 | /*! |
Vkadaba | 5:0728bde67bdb | 155 | * @brief Disable interrupt notifications on the specified GPIO pin |
Vkadaba | 5:0728bde67bdb | 156 | * |
Vkadaba | 5:0728bde67bdb | 157 | * @param[in] hDevice GPIO interface context handle (@ref admw_GpioOpen) |
Vkadaba | 5:0728bde67bdb | 158 | * @param[in] ePinId GPIO pin on which to disable interrupt notifications |
Vkadaba | 5:0728bde67bdb | 159 | * |
Vkadaba | 5:0728bde67bdb | 160 | * @return Status |
Vkadaba | 5:0728bde67bdb | 161 | * - #ADMW_SUCCESS Call completed successfully |
Vkadaba | 5:0728bde67bdb | 162 | * - #ADMW_INVALID_DEVICE_NUM Invalid GPIO pin specified |
Vkadaba | 5:0728bde67bdb | 163 | */ |
Vkadaba | 5:0728bde67bdb | 164 | ADMW_RESULT admw_GpioIrqDisable( |
Vkadaba | 5:0728bde67bdb | 165 | ADMW_GPIO_HANDLE hDevice, |
Vkadaba | 5:0728bde67bdb | 166 | ADMW_GPIO_PIN ePinId); |
Vkadaba | 5:0728bde67bdb | 167 | |
Vkadaba | 5:0728bde67bdb | 168 | #ifdef __cplusplus |
Vkadaba | 5:0728bde67bdb | 169 | } |
Vkadaba | 5:0728bde67bdb | 170 | #endif |
Vkadaba | 5:0728bde67bdb | 171 | |
Vkadaba | 5:0728bde67bdb | 172 | /*! |
Vkadaba | 5:0728bde67bdb | 173 | * @} |
Vkadaba | 5:0728bde67bdb | 174 | */ |
Vkadaba | 5:0728bde67bdb | 175 | |
Vkadaba | 5:0728bde67bdb | 176 | #endif /* __ADMW_GPIO_H__ */ |