mbed library sources. Supersedes mbed-src. Edited target satm32f446 for user USART3 pins
Fork of mbed-dev by
targets/TARGET_Maxim/TARGET_MAX32620C/mxc/spis.h@188:3f10722804f9, 2018-07-30 (annotated)
- Committer:
- ua1arn
- Date:
- Mon Jul 30 12:31:10 2018 +0000
- Revision:
- 188:3f10722804f9
- Parent:
- 186:707f6e361f3e
before add multi-configuration USB descriptors
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Anna Bridge |
186:707f6e361f3e | 1 | /** |
Anna Bridge |
186:707f6e361f3e | 2 | * @file |
Anna Bridge |
186:707f6e361f3e | 3 | * @brief SPI Slave High Level API. |
Anna Bridge |
186:707f6e361f3e | 4 | */ |
Anna Bridge |
186:707f6e361f3e | 5 | |
Anna Bridge |
186:707f6e361f3e | 6 | /* **************************************************************************** |
Anna Bridge |
186:707f6e361f3e | 7 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
Anna Bridge |
186:707f6e361f3e | 8 | * |
Anna Bridge |
186:707f6e361f3e | 9 | * Permission is hereby granted, free of charge, to any person obtaining a |
Anna Bridge |
186:707f6e361f3e | 10 | * copy of this software and associated documentation files (the "Software"), |
Anna Bridge |
186:707f6e361f3e | 11 | * to deal in the Software without restriction, including without limitation |
Anna Bridge |
186:707f6e361f3e | 12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
Anna Bridge |
186:707f6e361f3e | 13 | * and/or sell copies of the Software, and to permit persons to whom the |
Anna Bridge |
186:707f6e361f3e | 14 | * Software is furnished to do so, subject to the following conditions: |
Anna Bridge |
186:707f6e361f3e | 15 | * |
Anna Bridge |
186:707f6e361f3e | 16 | * The above copyright notice and this permission notice shall be included |
Anna Bridge |
186:707f6e361f3e | 17 | * in all copies or substantial portions of the Software. |
Anna Bridge |
186:707f6e361f3e | 18 | * |
Anna Bridge |
186:707f6e361f3e | 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
Anna Bridge |
186:707f6e361f3e | 20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
Anna Bridge |
186:707f6e361f3e | 21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
Anna Bridge |
186:707f6e361f3e | 22 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
Anna Bridge |
186:707f6e361f3e | 23 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
Anna Bridge |
186:707f6e361f3e | 24 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
Anna Bridge |
186:707f6e361f3e | 25 | * OTHER DEALINGS IN THE SOFTWARE. |
Anna Bridge |
186:707f6e361f3e | 26 | * |
Anna Bridge |
186:707f6e361f3e | 27 | * Except as contained in this notice, the name of Maxim Integrated |
Anna Bridge |
186:707f6e361f3e | 28 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
Anna Bridge |
186:707f6e361f3e | 29 | * Products, Inc. Branding Policy. |
Anna Bridge |
186:707f6e361f3e | 30 | * |
Anna Bridge |
186:707f6e361f3e | 31 | * The mere transfer of this software does not imply any licenses |
Anna Bridge |
186:707f6e361f3e | 32 | * of trade secrets, proprietary technology, copyrights, patents, |
Anna Bridge |
186:707f6e361f3e | 33 | * trademarks, maskwork rights, or any other form of intellectual |
Anna Bridge |
186:707f6e361f3e | 34 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
Anna Bridge |
186:707f6e361f3e | 35 | * ownership rights. |
Anna Bridge |
186:707f6e361f3e | 36 | * |
Anna Bridge |
186:707f6e361f3e | 37 | * $Date: 2016-10-03 14:23:55 -0500 (Mon, 03 Oct 2016) $ |
Anna Bridge |
186:707f6e361f3e | 38 | * $Revision: 24550 $ |
Anna Bridge |
186:707f6e361f3e | 39 | * |
Anna Bridge |
186:707f6e361f3e | 40 | **************************************************************************** */ |
Anna Bridge |
186:707f6e361f3e | 41 | |
Anna Bridge |
186:707f6e361f3e | 42 | /* Define to prevent redundant inclusion */ |
Anna Bridge |
186:707f6e361f3e | 43 | #ifndef _SPIS_H_ |
Anna Bridge |
186:707f6e361f3e | 44 | #define _SPIS_H_ |
Anna Bridge |
186:707f6e361f3e | 45 | |
Anna Bridge |
186:707f6e361f3e | 46 | /* **** Includes **** */ |
Anna Bridge |
186:707f6e361f3e | 47 | #include "mxc_config.h" |
Anna Bridge |
186:707f6e361f3e | 48 | #include "mxc_sys.h" |
Anna Bridge |
186:707f6e361f3e | 49 | #include "spis_regs.h" |
Anna Bridge |
186:707f6e361f3e | 50 | |
Anna Bridge |
186:707f6e361f3e | 51 | #ifdef __cplusplus |
Anna Bridge |
186:707f6e361f3e | 52 | extern "C" { |
Anna Bridge |
186:707f6e361f3e | 53 | #endif |
Anna Bridge |
186:707f6e361f3e | 54 | |
Anna Bridge |
186:707f6e361f3e | 55 | /** |
Anna Bridge |
186:707f6e361f3e | 56 | * @defgroup spis SPI Slave |
Anna Bridge |
186:707f6e361f3e | 57 | * @ingroup spi_comm |
Anna Bridge |
186:707f6e361f3e | 58 | * @brief SPI Slave (SPIS) Communications Interface API. |
Anna Bridge |
186:707f6e361f3e | 59 | * @{ |
Anna Bridge |
186:707f6e361f3e | 60 | */ |
Anna Bridge |
186:707f6e361f3e | 61 | |
Anna Bridge |
186:707f6e361f3e | 62 | /* **** Definitions **** */ |
Anna Bridge |
186:707f6e361f3e | 63 | |
Anna Bridge |
186:707f6e361f3e | 64 | /** |
Anna Bridge |
186:707f6e361f3e | 65 | * Enumeration type for setting the number data lines to use for communication. |
Anna Bridge |
186:707f6e361f3e | 66 | */ |
Anna Bridge |
186:707f6e361f3e | 67 | typedef enum { |
Anna Bridge |
186:707f6e361f3e | 68 | SPIS_WIDTH_1 = 0, /**< 1 Data Line */ |
Anna Bridge |
186:707f6e361f3e | 69 | SPIS_WIDTH_2 = 1, /**< 2 Data Lines (x2) */ |
Anna Bridge |
186:707f6e361f3e | 70 | SPIS_WIDTH_4 = 2 /**< 4 Data Lines (x4) */ |
Anna Bridge |
186:707f6e361f3e | 71 | } spis_width_t; |
Anna Bridge |
186:707f6e361f3e | 72 | |
Anna Bridge |
186:707f6e361f3e | 73 | /** |
Anna Bridge |
186:707f6e361f3e | 74 | * Structure type for an SPI Slave transaction request. |
Anna Bridge |
186:707f6e361f3e | 75 | */ |
Anna Bridge |
186:707f6e361f3e | 76 | typedef struct spis_req spis_req_t; |
Anna Bridge |
186:707f6e361f3e | 77 | |
Anna Bridge |
186:707f6e361f3e | 78 | /** |
Anna Bridge |
186:707f6e361f3e | 79 | * Callback function type used in asynchromous SPIS communications requests. |
Anna Bridge |
186:707f6e361f3e | 80 | * The function declaration for the SPI Slave callback is: |
Anna Bridge |
186:707f6e361f3e | 81 | * \code |
Anna Bridge |
186:707f6e361f3e | 82 | * void callback(spis_req_t * req, int error_code); |
Anna Bridge |
186:707f6e361f3e | 83 | * \endcode |
Anna Bridge |
186:707f6e361f3e | 84 | * | | | |
Anna Bridge |
186:707f6e361f3e | 85 | * | -----: | :----------------------------------------- | |
Anna Bridge |
186:707f6e361f3e | 86 | * | \p req | Pointer to an #spis_req object representing the active SPIS active transaction. | |
Anna Bridge |
186:707f6e361f3e | 87 | * | \p error_code | An error code if the active transaction had a failure or #E_NO_ERROR if successful. | |
Anna Bridge |
186:707f6e361f3e | 88 | * @addtogroup spis_async |
Anna Bridge |
186:707f6e361f3e | 89 | * @{ |
Anna Bridge |
186:707f6e361f3e | 90 | */ |
Anna Bridge |
186:707f6e361f3e | 91 | typedef void (*callback_fn)(spis_req_t*, int); |
Anna Bridge |
186:707f6e361f3e | 92 | /**@} end of async group for this prototype */ |
Anna Bridge |
186:707f6e361f3e | 93 | |
Anna Bridge |
186:707f6e361f3e | 94 | |
Anna Bridge |
186:707f6e361f3e | 95 | /** |
Anna Bridge |
186:707f6e361f3e | 96 | * Struture for the SPI Slave transaction request. |
Anna Bridge |
186:707f6e361f3e | 97 | */ |
Anna Bridge |
186:707f6e361f3e | 98 | struct spis_req { |
Anna Bridge |
186:707f6e361f3e | 99 | uint8_t deass; /**< End the transaction when SS is deasserted. */ |
Anna Bridge |
186:707f6e361f3e | 100 | const uint8_t *tx_data; /**< TX buffer. */ |
Anna Bridge |
186:707f6e361f3e | 101 | uint8_t *rx_data; /**< RX buffer. */ |
Anna Bridge |
186:707f6e361f3e | 102 | spis_width_t width; /**< Number of data lines to use. */ |
Anna Bridge |
186:707f6e361f3e | 103 | unsigned len; /**< Number of bytes to send. */ |
Anna Bridge |
186:707f6e361f3e | 104 | unsigned read_num; /**< Number of bytes transacted. */ |
Anna Bridge |
186:707f6e361f3e | 105 | unsigned write_num; /**< Number of bytes transacted. */ |
Anna Bridge |
186:707f6e361f3e | 106 | callback_fn callback; /**< Function pointer to a callback function if desired, NULL otherwise */ |
Anna Bridge |
186:707f6e361f3e | 107 | }; |
Anna Bridge |
186:707f6e361f3e | 108 | |
Anna Bridge |
186:707f6e361f3e | 109 | /* **** Globals **** */ |
Anna Bridge |
186:707f6e361f3e | 110 | |
Anna Bridge |
186:707f6e361f3e | 111 | /* **** Function Prototypes **** */ |
Anna Bridge |
186:707f6e361f3e | 112 | |
Anna Bridge |
186:707f6e361f3e | 113 | /** |
Anna Bridge |
186:707f6e361f3e | 114 | * @brief Initialize SPIS module. |
Anna Bridge |
186:707f6e361f3e | 115 | * @param spis Pointer to the SPIS register structure. |
Anna Bridge |
186:707f6e361f3e | 116 | * @param mode SPI Mode to configure the slave, 0 to 3. |
Anna Bridge |
186:707f6e361f3e | 117 | * @param sys_cfg Pointer to system configuration object, see #sys_cfg_spis_t. |
Anna Bridge |
186:707f6e361f3e | 118 | * @return #E_NO_ERROR if everything is successful. |
Anna Bridge |
186:707f6e361f3e | 119 | */ |
Anna Bridge |
186:707f6e361f3e | 120 | int SPIS_Init(mxc_spis_regs_t *spis, uint8_t mode, const sys_cfg_spis_t *sys_cfg); |
Anna Bridge |
186:707f6e361f3e | 121 | |
Anna Bridge |
186:707f6e361f3e | 122 | |
Anna Bridge |
186:707f6e361f3e | 123 | /** |
Anna Bridge |
186:707f6e361f3e | 124 | * @brief Shutdown SPIS module. |
Anna Bridge |
186:707f6e361f3e | 125 | * @param spis Pointer to SPIS regs. |
Anna Bridge |
186:707f6e361f3e | 126 | * @return #E_NO_ERROR if everything is successful |
Anna Bridge |
186:707f6e361f3e | 127 | */ |
Anna Bridge |
186:707f6e361f3e | 128 | int SPIS_Shutdown(mxc_spis_regs_t *spis); |
Anna Bridge |
186:707f6e361f3e | 129 | |
Anna Bridge |
186:707f6e361f3e | 130 | /** |
Anna Bridge |
186:707f6e361f3e | 131 | * @brief Read/write SPIS data. Will block until transaction is complete. |
Anna Bridge |
186:707f6e361f3e | 132 | * @note Callback is ignored. |
Anna Bridge |
186:707f6e361f3e | 133 | * |
Anna Bridge |
186:707f6e361f3e | 134 | * @param spis Pointer to the SPIS register structure. |
Anna Bridge |
186:707f6e361f3e | 135 | * @param req Pointer to a request structure for a SPI Slave transaction. |
Anna Bridge |
186:707f6e361f3e | 136 | * @return Bytes transacted if everything is successful, @ref |
Anna Bridge |
186:707f6e361f3e | 137 | * MXC_Error_Codes "error" if unsuccessful. |
Anna Bridge |
186:707f6e361f3e | 138 | */ |
Anna Bridge |
186:707f6e361f3e | 139 | int SPIS_Trans(mxc_spis_regs_t *spis, spis_req_t *req); |
Anna Bridge |
186:707f6e361f3e | 140 | |
Anna Bridge |
186:707f6e361f3e | 141 | /** |
Anna Bridge |
186:707f6e361f3e | 142 | * @defgroup spis_async SPI Slave Asynchrous Functions |
Anna Bridge |
186:707f6e361f3e | 143 | * @{ |
Anna Bridge |
186:707f6e361f3e | 144 | */ |
Anna Bridge |
186:707f6e361f3e | 145 | |
Anna Bridge |
186:707f6e361f3e | 146 | /** |
Anna Bridge |
186:707f6e361f3e | 147 | * @brief Asynchronously read/write SPIS data. |
Anna Bridge |
186:707f6e361f3e | 148 | * @note Request struct, @p req must remain allocated until callback. |
Anna Bridge |
186:707f6e361f3e | 149 | * @param spis Pointer to the SPIS register structure. |
Anna Bridge |
186:707f6e361f3e | 150 | * @param req Pointer to a request structure for a SPI Slave transaction. |
Anna Bridge |
186:707f6e361f3e | 151 | * @return #E_NO_ERROR if everything is successful, @ref |
Anna Bridge |
186:707f6e361f3e | 152 | * MXC_Error_Codes "error" if unsuccessful. |
Anna Bridge |
186:707f6e361f3e | 153 | */ |
Anna Bridge |
186:707f6e361f3e | 154 | int SPIS_TransAsync(mxc_spis_regs_t *spis, spis_req_t *req); |
Anna Bridge |
186:707f6e361f3e | 155 | |
Anna Bridge |
186:707f6e361f3e | 156 | /** |
Anna Bridge |
186:707f6e361f3e | 157 | * @brief Abort asynchronous request. |
Anna Bridge |
186:707f6e361f3e | 158 | * @param req Pointer to request for a SPIS transaction. |
Anna Bridge |
186:707f6e361f3e | 159 | * @returns #E_NO_ERROR if request aborted, error if unsuccessful. |
Anna Bridge |
186:707f6e361f3e | 160 | */ |
Anna Bridge |
186:707f6e361f3e | 161 | int SPIS_AbortAsync(spis_req_t *req); |
Anna Bridge |
186:707f6e361f3e | 162 | |
Anna Bridge |
186:707f6e361f3e | 163 | /** |
Anna Bridge |
186:707f6e361f3e | 164 | * @brief SPI Slave interrupt handler. |
Anna Bridge |
186:707f6e361f3e | 165 | * @details This function should be called by the application from the interrupt |
Anna Bridge |
186:707f6e361f3e | 166 | * handler if SPIS interrupts are enabled. Alternately, this function |
Anna Bridge |
186:707f6e361f3e | 167 | * can be periodically called by the application if SPIS interrupts are |
Anna Bridge |
186:707f6e361f3e | 168 | * disabled. |
Anna Bridge |
186:707f6e361f3e | 169 | * @param spis Pointer to the base address of the SPIS[n] module. |
Anna Bridge |
186:707f6e361f3e | 170 | */ |
Anna Bridge |
186:707f6e361f3e | 171 | void SPIS_Handler(mxc_spis_regs_t *spis); |
Anna Bridge |
186:707f6e361f3e | 172 | |
Anna Bridge |
186:707f6e361f3e | 173 | /** |
Anna Bridge |
186:707f6e361f3e | 174 | * @brief Check the SPIS to see if it's busy. |
Anna Bridge |
186:707f6e361f3e | 175 | * @param spis Pointer to the SPIS register structure. |
Anna Bridge |
186:707f6e361f3e | 176 | * @return #E_NO_ERROR if idle. |
Anna Bridge |
186:707f6e361f3e | 177 | * @return #E_BUSY if in use. |
Anna Bridge |
186:707f6e361f3e | 178 | */ |
Anna Bridge |
186:707f6e361f3e | 179 | int SPIS_Busy(mxc_spis_regs_t *spis); |
Anna Bridge |
186:707f6e361f3e | 180 | /**@} end of group spis_async*/ |
Anna Bridge |
186:707f6e361f3e | 181 | |
Anna Bridge |
186:707f6e361f3e | 182 | /** |
Anna Bridge |
186:707f6e361f3e | 183 | * @brief Attempt to prepare the SPI Slave for sleep. |
Anna Bridge |
186:707f6e361f3e | 184 | * @param spis Pointer to the SPIS register structure. |
Anna Bridge |
186:707f6e361f3e | 185 | * @details Checks for any ongoing transactions. Disables interrupts if the |
Anna Bridge |
186:707f6e361f3e | 186 | * SPI Slave is idle. |
Anna Bridge |
186:707f6e361f3e | 187 | * @return #E_NO_ERROR if ready to sleep. |
Anna Bridge |
186:707f6e361f3e | 188 | * @return #E_BUSY if not ready for sleep. |
Anna Bridge |
186:707f6e361f3e | 189 | */ |
Anna Bridge |
186:707f6e361f3e | 190 | int SPIS_PrepForSleep(mxc_spis_regs_t *spis); |
Anna Bridge |
186:707f6e361f3e | 191 | |
Anna Bridge |
186:707f6e361f3e | 192 | /** |
Anna Bridge |
186:707f6e361f3e | 193 | * @brief Inline function that enables the SPI Slave without overwriting the existing configuration. |
Anna Bridge |
186:707f6e361f3e | 194 | * @param spis Pointer to the SPIS register structure. |
Anna Bridge |
186:707f6e361f3e | 195 | */ |
Anna Bridge |
186:707f6e361f3e | 196 | __STATIC_INLINE void SPIS_Enable(mxc_spis_regs_t *spis) |
Anna Bridge |
186:707f6e361f3e | 197 | { |
Anna Bridge |
186:707f6e361f3e | 198 | spis->gen_ctrl |= (MXC_F_SPIS_GEN_CTRL_SPI_SLAVE_EN | |
Anna Bridge |
186:707f6e361f3e | 199 | MXC_F_SPIS_GEN_CTRL_TX_FIFO_EN | MXC_F_SPIS_GEN_CTRL_RX_FIFO_EN); |
Anna Bridge |
186:707f6e361f3e | 200 | } |
Anna Bridge |
186:707f6e361f3e | 201 | |
Anna Bridge |
186:707f6e361f3e | 202 | /** |
Anna Bridge |
186:707f6e361f3e | 203 | * @brief Inline function that drains all of the data in the Receive FIFO. |
Anna Bridge |
186:707f6e361f3e | 204 | * @param spis Pointer to the SPIS register structure. |
Anna Bridge |
186:707f6e361f3e | 205 | */ |
Anna Bridge |
186:707f6e361f3e | 206 | __STATIC_INLINE void SPIS_DrainRX(mxc_spis_regs_t *spis) |
Anna Bridge |
186:707f6e361f3e | 207 | { |
Anna Bridge |
186:707f6e361f3e | 208 | uint32_t ctrl_save = spis->gen_ctrl; |
Anna Bridge |
186:707f6e361f3e | 209 | spis->gen_ctrl = (ctrl_save & ~MXC_F_SPIS_GEN_CTRL_RX_FIFO_EN); |
Anna Bridge |
186:707f6e361f3e | 210 | spis->gen_ctrl = ctrl_save; |
Anna Bridge |
186:707f6e361f3e | 211 | } |
Anna Bridge |
186:707f6e361f3e | 212 | |
Anna Bridge |
186:707f6e361f3e | 213 | /** |
Anna Bridge |
186:707f6e361f3e | 214 | * @brief Inline function that drains all of the data in the Transmit FIFO. |
Anna Bridge |
186:707f6e361f3e | 215 | * @param spis Pointer to the SPIS register structure. |
Anna Bridge |
186:707f6e361f3e | 216 | */ |
Anna Bridge |
186:707f6e361f3e | 217 | __STATIC_INLINE void SPIS_DrainTX(mxc_spis_regs_t *spis) |
Anna Bridge |
186:707f6e361f3e | 218 | { |
Anna Bridge |
186:707f6e361f3e | 219 | uint32_t ctrl_save = spis->gen_ctrl; |
Anna Bridge |
186:707f6e361f3e | 220 | spis->gen_ctrl = (ctrl_save & ~MXC_F_SPIS_GEN_CTRL_TX_FIFO_EN); |
Anna Bridge |
186:707f6e361f3e | 221 | spis->gen_ctrl = ctrl_save; |
Anna Bridge |
186:707f6e361f3e | 222 | } |
Anna Bridge |
186:707f6e361f3e | 223 | |
Anna Bridge |
186:707f6e361f3e | 224 | /** |
Anna Bridge |
186:707f6e361f3e | 225 | * @brief Inline function that returns the Transmit FIFO availability. |
Anna Bridge |
186:707f6e361f3e | 226 | * @param spis Pointer to the SPIS register structure. |
Anna Bridge |
186:707f6e361f3e | 227 | * @return Number of empty bytes available in write FIFO. |
Anna Bridge |
186:707f6e361f3e | 228 | */ |
Anna Bridge |
186:707f6e361f3e | 229 | __STATIC_INLINE unsigned SPIS_NumWriteAvail(mxc_spis_regs_t *spis) |
Anna Bridge |
186:707f6e361f3e | 230 | { |
Anna Bridge |
186:707f6e361f3e | 231 | return (MXC_CFG_SPIS_FIFO_DEPTH - ((spis->fifo_stat & |
Anna Bridge |
186:707f6e361f3e | 232 | MXC_F_SPIS_FIFO_STAT_TX_FIFO_USED) >> MXC_F_SPIS_FIFO_STAT_TX_FIFO_USED_POS)); |
Anna Bridge |
186:707f6e361f3e | 233 | } |
Anna Bridge |
186:707f6e361f3e | 234 | |
Anna Bridge |
186:707f6e361f3e | 235 | /** |
Anna Bridge |
186:707f6e361f3e | 236 | * @brief Inline function that returns the Receive FIFO availability. |
Anna Bridge |
186:707f6e361f3e | 237 | * @param spis Pointer to the SPIS register structure. |
Anna Bridge |
186:707f6e361f3e | 238 | * @return Number of bytes in read FIFO. |
Anna Bridge |
186:707f6e361f3e | 239 | */ |
Anna Bridge |
186:707f6e361f3e | 240 | __STATIC_INLINE unsigned SPIS_NumReadAvail(mxc_spis_regs_t *spis) |
Anna Bridge |
186:707f6e361f3e | 241 | { |
Anna Bridge |
186:707f6e361f3e | 242 | return ((spis->fifo_stat & MXC_F_SPIS_FIFO_STAT_RX_FIFO_USED) >> |
Anna Bridge |
186:707f6e361f3e | 243 | MXC_F_SPIS_FIFO_STAT_RX_FIFO_USED_POS); |
Anna Bridge |
186:707f6e361f3e | 244 | } |
Anna Bridge |
186:707f6e361f3e | 245 | |
Anna Bridge |
186:707f6e361f3e | 246 | /** |
Anna Bridge |
186:707f6e361f3e | 247 | * @brief Inline function that clears the specified interrupt flags. |
Anna Bridge |
186:707f6e361f3e | 248 | * @param spis Pointer to the SPIS register structure. |
Anna Bridge |
186:707f6e361f3e | 249 | * @param mask Mask of interrupts to clear, see the @ref SPIS_INTFL_Register Register for details. |
Anna Bridge |
186:707f6e361f3e | 250 | */ |
Anna Bridge |
186:707f6e361f3e | 251 | __STATIC_INLINE void SPIS_ClearFlags(mxc_spis_regs_t *spis, uint32_t mask) |
Anna Bridge |
186:707f6e361f3e | 252 | { |
Anna Bridge |
186:707f6e361f3e | 253 | spis->intfl = mask; |
Anna Bridge |
186:707f6e361f3e | 254 | } |
Anna Bridge |
186:707f6e361f3e | 255 | |
Anna Bridge |
186:707f6e361f3e | 256 | /** |
Anna Bridge |
186:707f6e361f3e | 257 | * @brief Inline function to get the currently interrupt flags. |
Anna Bridge |
186:707f6e361f3e | 258 | * @param spis Pointer to the SPIS register structure. |
Anna Bridge |
186:707f6e361f3e | 259 | * @returns Mask of active flags, see the @ref SPIS_INTFL_Register Register for details. |
Anna Bridge |
186:707f6e361f3e | 260 | */ |
Anna Bridge |
186:707f6e361f3e | 261 | __STATIC_INLINE unsigned SPIS_GetFlags(mxc_spis_regs_t *spis) |
Anna Bridge |
186:707f6e361f3e | 262 | { |
Anna Bridge |
186:707f6e361f3e | 263 | return (spis->intfl); |
Anna Bridge |
186:707f6e361f3e | 264 | } |
Anna Bridge |
186:707f6e361f3e | 265 | /**@} end of group spis */ |
Anna Bridge |
186:707f6e361f3e | 266 | #ifdef __cplusplus |
Anna Bridge |
186:707f6e361f3e | 267 | } |
Anna Bridge |
186:707f6e361f3e | 268 | #endif |
Anna Bridge |
186:707f6e361f3e | 269 | |
Anna Bridge |
186:707f6e361f3e | 270 | #endif /* _SPIS_H_ */ |