mbed library sources. Supersedes mbed-src. Edited target satm32f446 for user USART3 pins
Fork of mbed-dev by
targets/TARGET_Maxim/TARGET_MAX32620C/mxc/ioman.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 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
Anna Bridge |
186:707f6e361f3e | 3 | * |
Anna Bridge |
186:707f6e361f3e | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
Anna Bridge |
186:707f6e361f3e | 5 | * copy of this software and associated documentation files (the "Software"), |
Anna Bridge |
186:707f6e361f3e | 6 | * to deal in the Software without restriction, including without limitation |
Anna Bridge |
186:707f6e361f3e | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
Anna Bridge |
186:707f6e361f3e | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
Anna Bridge |
186:707f6e361f3e | 9 | * Software is furnished to do so, subject to the following conditions: |
Anna Bridge |
186:707f6e361f3e | 10 | * |
Anna Bridge |
186:707f6e361f3e | 11 | * The above copyright notice and this permission notice shall be included |
Anna Bridge |
186:707f6e361f3e | 12 | * in all copies or substantial portions of the Software. |
Anna Bridge |
186:707f6e361f3e | 13 | * |
Anna Bridge |
186:707f6e361f3e | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
Anna Bridge |
186:707f6e361f3e | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
Anna Bridge |
186:707f6e361f3e | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
Anna Bridge |
186:707f6e361f3e | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
Anna Bridge |
186:707f6e361f3e | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
Anna Bridge |
186:707f6e361f3e | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
Anna Bridge |
186:707f6e361f3e | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
Anna Bridge |
186:707f6e361f3e | 21 | * |
Anna Bridge |
186:707f6e361f3e | 22 | * Except as contained in this notice, the name of Maxim Integrated |
Anna Bridge |
186:707f6e361f3e | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
Anna Bridge |
186:707f6e361f3e | 24 | * Products, Inc. Branding Policy. |
Anna Bridge |
186:707f6e361f3e | 25 | * |
Anna Bridge |
186:707f6e361f3e | 26 | * The mere transfer of this software does not imply any licenses |
Anna Bridge |
186:707f6e361f3e | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
Anna Bridge |
186:707f6e361f3e | 28 | * trademarks, maskwork rights, or any other form of intellectual |
Anna Bridge |
186:707f6e361f3e | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
Anna Bridge |
186:707f6e361f3e | 30 | * ownership rights. |
Anna Bridge |
186:707f6e361f3e | 31 | * |
Anna Bridge |
186:707f6e361f3e | 32 | * $Date: 2016-06-03 16:02:37 -0500 (Fri, 03 Jun 2016) $ |
Anna Bridge |
186:707f6e361f3e | 33 | * $Revision: 23203 $ |
Anna Bridge |
186:707f6e361f3e | 34 | * |
Anna Bridge |
186:707f6e361f3e | 35 | ******************************************************************************/ |
Anna Bridge |
186:707f6e361f3e | 36 | |
Anna Bridge |
186:707f6e361f3e | 37 | /** |
Anna Bridge |
186:707f6e361f3e | 38 | * @file ioman.h |
Anna Bridge |
186:707f6e361f3e | 39 | * @brief IOMAN provides IO Management to the device. The functions in this |
Anna Bridge |
186:707f6e361f3e | 40 | * API enable requesting port pin assignment and release for all peripherals |
Anna Bridge |
186:707f6e361f3e | 41 | * with external I/O. Port pin mapping support is included for peripherals |
Anna Bridge |
186:707f6e361f3e | 42 | * that can support more than one pin mapping in a package. |
Anna Bridge |
186:707f6e361f3e | 43 | */ |
Anna Bridge |
186:707f6e361f3e | 44 | |
Anna Bridge |
186:707f6e361f3e | 45 | #ifndef _IOMAN_H_ |
Anna Bridge |
186:707f6e361f3e | 46 | #define _IOMAN_H_ |
Anna Bridge |
186:707f6e361f3e | 47 | |
Anna Bridge |
186:707f6e361f3e | 48 | #include "mxc_config.h" |
Anna Bridge |
186:707f6e361f3e | 49 | #include "ioman_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 | /***** Definitions *****/ |
Anna Bridge |
186:707f6e361f3e | 56 | |
Anna Bridge |
186:707f6e361f3e | 57 | /** @brief Aliases for IOMAN package mapping field values. Refer to the |
Anna Bridge |
186:707f6e361f3e | 58 | * User's Guide for pinouts for each mapping. |
Anna Bridge |
186:707f6e361f3e | 59 | */ |
Anna Bridge |
186:707f6e361f3e | 60 | typedef enum { |
Anna Bridge |
186:707f6e361f3e | 61 | IOMAN_MAP_UNUSED = 0, /**< Pin is not used */ |
Anna Bridge |
186:707f6e361f3e | 62 | IOMAN_MAP_A = 0, /**< Pin Mapping A */ |
Anna Bridge |
186:707f6e361f3e | 63 | IOMAN_MAP_B = 1, /**< Pin Mapping B */ |
Anna Bridge |
186:707f6e361f3e | 64 | IOMAN_MAP_C = 2, /**< Pin Mapping C */ |
Anna Bridge |
186:707f6e361f3e | 65 | IOMAN_MAP_D = 3, /**< Pin Mapping D */ |
Anna Bridge |
186:707f6e361f3e | 66 | IOMAN_MAP_E = 4, /**< Pin Mapping E */ |
Anna Bridge |
186:707f6e361f3e | 67 | IOMAN_MAP_F = 5, /**< Pin Mapping F */ |
Anna Bridge |
186:707f6e361f3e | 68 | IOMAN_MAP_G = 6 /**< Pin Mapping G */ |
Anna Bridge |
186:707f6e361f3e | 69 | } |
Anna Bridge |
186:707f6e361f3e | 70 | ioman_map_t; |
Anna Bridge |
186:707f6e361f3e | 71 | |
Anna Bridge |
186:707f6e361f3e | 72 | /** @brief Typing of IOMAN Req and Ack register fields */ |
Anna Bridge |
186:707f6e361f3e | 73 | typedef union { |
Anna Bridge |
186:707f6e361f3e | 74 | uint32_t value; |
Anna Bridge |
186:707f6e361f3e | 75 | mxc_ioman_spix_req_t spix; /**< SPIX IOMAN configuration struct */ |
Anna Bridge |
186:707f6e361f3e | 76 | mxc_ioman_uart0_req_t uart; /**< UART IOMAN configuration struct, see mxc_ioman_uart0_req_t */ |
Anna Bridge |
186:707f6e361f3e | 77 | mxc_ioman_i2cm0_req_t i2cm0; /**< I2C Master 0 IOMAN configuration struct, see mxc_ioman_i2cm0_req_t */ |
Anna Bridge |
186:707f6e361f3e | 78 | mxc_ioman_i2cm1_req_t i2cm1; /**< I2C Master 1 IOMAN configuration struct, see mxc_ioman_i2cm1_req_t */ |
Anna Bridge |
186:707f6e361f3e | 79 | mxc_ioman_i2cm2_req_t i2cm2; /**< I2C Master 2 IOMAN configuration struct, see mxc_ioman_i2cm2_req_t */ |
Anna Bridge |
186:707f6e361f3e | 80 | mxc_ioman_i2cs_req_t i2cs; /**< I2C Slave IOMAN configuration struct, see mxc_ioman_i2cs_req_t */ |
Anna Bridge |
186:707f6e361f3e | 81 | mxc_ioman_spim0_req_t spim0; /**< SPI Master 0 IOMAN configuration struct, see mxc_ioman_spim0_req_t */ |
Anna Bridge |
186:707f6e361f3e | 82 | mxc_ioman_spim1_req_t spim1; /**< SPI Master 1 IOMAN configuration struct, see mxc_ioman_spim1_req_t */ |
Anna Bridge |
186:707f6e361f3e | 83 | mxc_ioman_spim2_req_t spim2; /**< SPI Master 2 IOMAN configuration struct, see mxc_ioman_spim1_req_t */ |
Anna Bridge |
186:707f6e361f3e | 84 | mxc_ioman_spis_req_t spis; /**< SPI Slave IOMAN configuration struct, see mxc_ioman_spis_req_t */ |
Anna Bridge |
186:707f6e361f3e | 85 | mxc_ioman_owm_req_t owm; /**< 1-Wire Master IOMAN configuration struct, see mxc_ioman_owm_req_t */ |
Anna Bridge |
186:707f6e361f3e | 86 | } ioman_req_t; |
Anna Bridge |
186:707f6e361f3e | 87 | |
Anna Bridge |
186:707f6e361f3e | 88 | /** @brief IOMAN configuration object */ |
Anna Bridge |
186:707f6e361f3e | 89 | typedef struct { |
Anna Bridge |
186:707f6e361f3e | 90 | volatile uint32_t *req_reg; /** Pointer to an IOMAN request register */ |
Anna Bridge |
186:707f6e361f3e | 91 | volatile uint32_t *ack_reg; /** Pointer to an IOMAN acknowledge register */ |
Anna Bridge |
186:707f6e361f3e | 92 | ioman_req_t req_val; /** IOMAN request register value, see ioman_req_t */ |
Anna Bridge |
186:707f6e361f3e | 93 | } ioman_cfg_t; |
Anna Bridge |
186:707f6e361f3e | 94 | |
Anna Bridge |
186:707f6e361f3e | 95 | |
Anna Bridge |
186:707f6e361f3e | 96 | /***** Function Prototypes *****/ |
Anna Bridge |
186:707f6e361f3e | 97 | |
Anna Bridge |
186:707f6e361f3e | 98 | /** |
Anna Bridge |
186:707f6e361f3e | 99 | * @brief Configure the IO Manager using the specified configuration object. |
Anna Bridge |
186:707f6e361f3e | 100 | * @param cfg IOMAN configuration object |
Anna Bridge |
186:707f6e361f3e | 101 | * @returns E_NO_ERROR Configuration successful |
Anna Bridge |
186:707f6e361f3e | 102 | */ |
Anna Bridge |
186:707f6e361f3e | 103 | int IOMAN_Config(const ioman_cfg_t *cfg); |
Anna Bridge |
186:707f6e361f3e | 104 | |
Anna Bridge |
186:707f6e361f3e | 105 | /** |
Anna Bridge |
186:707f6e361f3e | 106 | * @brief Create an IOMAN configuration object for the SPI XIP module. Call IOMAN_Config with this object. |
Anna Bridge |
186:707f6e361f3e | 107 | * @param core Request (1) or release (0) SPIX core external pins |
Anna Bridge |
186:707f6e361f3e | 108 | * @param ss0 Request (1) or release (0) slave select 0 active out |
Anna Bridge |
186:707f6e361f3e | 109 | * @param ss1 Request (1) or release (0) slave select 1 active out |
Anna Bridge |
186:707f6e361f3e | 110 | * @param ss2 Request (1) or release (0) slave select 2 active out |
Anna Bridge |
186:707f6e361f3e | 111 | * @param quad Request (1) or release (0) quad IO |
Anna Bridge |
186:707f6e361f3e | 112 | * @param fast Request (1) or release (0) fast mode |
Anna Bridge |
186:707f6e361f3e | 113 | * @returns io_man_cfg_t IOMAN configuration object for the SPI XIP module. |
Anna Bridge |
186:707f6e361f3e | 114 | */ |
Anna Bridge |
186:707f6e361f3e | 115 | ioman_cfg_t IOMAN_SPIX(int core, int ss0, int ss1, int ss2, int quad, int fast); |
Anna Bridge |
186:707f6e361f3e | 116 | |
Anna Bridge |
186:707f6e361f3e | 117 | /** |
Anna Bridge |
186:707f6e361f3e | 118 | * @brief Create an IOMAN configuration object for a UART module. Call IOMAN_Config with this object. |
Anna Bridge |
186:707f6e361f3e | 119 | * @param idx Index of the UART module |
Anna Bridge |
186:707f6e361f3e | 120 | * @param io_map Set the pin mapping for RX/TX pins, see ioman_map_t |
Anna Bridge |
186:707f6e361f3e | 121 | * @param cts_map Set the pin mapping for CTS pin, see ioman_map_t |
Anna Bridge |
186:707f6e361f3e | 122 | * @param rts_map Set the pin mapping for RTS pin, see ioman_map_t |
Anna Bridge |
186:707f6e361f3e | 123 | * @param io_en Request (1) or release (0) RX and TX pins |
Anna Bridge |
186:707f6e361f3e | 124 | * @param cts_en Request (1) or release (0) CTS pin |
Anna Bridge |
186:707f6e361f3e | 125 | * @param rts_en Request (1) or release (0) RTS pin |
Anna Bridge |
186:707f6e361f3e | 126 | * @returns ioman_cfg_t IOMAN configuration object for the UART module |
Anna Bridge |
186:707f6e361f3e | 127 | */ |
Anna Bridge |
186:707f6e361f3e | 128 | ioman_cfg_t IOMAN_UART(int idx, ioman_map_t io_map, ioman_map_t cts_map, ioman_map_t rts_map, int io_en, int cts_en, int rts_en); |
Anna Bridge |
186:707f6e361f3e | 129 | |
Anna Bridge |
186:707f6e361f3e | 130 | /** |
Anna Bridge |
186:707f6e361f3e | 131 | * @brief Create an IOMAN configuration object for the I2CM0 module. Call IOMAN_Config with this object. |
Anna Bridge |
186:707f6e361f3e | 132 | * @param core Request (1) or release (0) I2CM0 core external pins |
Anna Bridge |
186:707f6e361f3e | 133 | * @param push_pull (1) Use push/pull driver (0) us open drain driver for the I2CM0 module |
Anna Bridge |
186:707f6e361f3e | 134 | * @returns ioman_cfg_t IOMAN configuration object for the I2CM0 module. |
Anna Bridge |
186:707f6e361f3e | 135 | */ |
Anna Bridge |
186:707f6e361f3e | 136 | ioman_cfg_t IOMAN_I2CM0(int core, int push_pull); |
Anna Bridge |
186:707f6e361f3e | 137 | |
Anna Bridge |
186:707f6e361f3e | 138 | /** |
Anna Bridge |
186:707f6e361f3e | 139 | * @brief Create an IOMAN configuration object for the I2CM1 module. Call IOMAN_Config with this object. |
Anna Bridge |
186:707f6e361f3e | 140 | * @param core Request (1) or release (0) I2CM1 core external pins |
Anna Bridge |
186:707f6e361f3e | 141 | * @param push_pull (1) Use push/pull driver (0) us open drain driver for the I2CM1 module |
Anna Bridge |
186:707f6e361f3e | 142 | * @returns ioman_cfg_t IOMAN configuration object for the I2CM1 module. |
Anna Bridge |
186:707f6e361f3e | 143 | */ |
Anna Bridge |
186:707f6e361f3e | 144 | ioman_cfg_t IOMAN_I2CM1(int core, int push_pull); |
Anna Bridge |
186:707f6e361f3e | 145 | |
Anna Bridge |
186:707f6e361f3e | 146 | /** |
Anna Bridge |
186:707f6e361f3e | 147 | * @brief Create an IOMAN configuration object for the I2CM2 module. Call IOMAN_Config with this object. |
Anna Bridge |
186:707f6e361f3e | 148 | * @param core Request (1) or release (0) I2CM2 core external pins |
Anna Bridge |
186:707f6e361f3e | 149 | * @param push_pull (1) Use push/pull driver (0) us open drain driver for the I2CM2 module |
Anna Bridge |
186:707f6e361f3e | 150 | * @returns ioman_cfg_t IOMAN configuration object for the I2CM2 module. |
Anna Bridge |
186:707f6e361f3e | 151 | */ |
Anna Bridge |
186:707f6e361f3e | 152 | ioman_cfg_t IOMAN_I2CM2(int core, int push_pull); |
Anna Bridge |
186:707f6e361f3e | 153 | |
Anna Bridge |
186:707f6e361f3e | 154 | /** |
Anna Bridge |
186:707f6e361f3e | 155 | * @brief Create an IOMAN configuration object for an I2C slave module. Call IOMAN_Config with this object. |
Anna Bridge |
186:707f6e361f3e | 156 | * @param map Select the pin mapping for all configured pins, see ioman_map_t |
Anna Bridge |
186:707f6e361f3e | 157 | * @param io_en Request (1) or release (0) the I/O for this module |
Anna Bridge |
186:707f6e361f3e | 158 | * @returns ioman_cfg_t IOMAN configuration object for the I2CS module |
Anna Bridge |
186:707f6e361f3e | 159 | */ |
Anna Bridge |
186:707f6e361f3e | 160 | ioman_cfg_t IOMAN_I2CS(ioman_map_t map, int io_en); |
Anna Bridge |
186:707f6e361f3e | 161 | |
Anna Bridge |
186:707f6e361f3e | 162 | /** |
Anna Bridge |
186:707f6e361f3e | 163 | * @brief Create an IOMAN configuration object for a SPI Master (SPIM) module. Call IOMAN_Config with this object. |
Anna Bridge |
186:707f6e361f3e | 164 | * @param io_en Request (1) or release (0) the core IO for the module |
Anna Bridge |
186:707f6e361f3e | 165 | * @param ss0 Request (1) or release (0) slave select 0 |
Anna Bridge |
186:707f6e361f3e | 166 | * @param ss1 Request (1) or release (0) slave select 1 |
Anna Bridge |
186:707f6e361f3e | 167 | * @param ss2 Request (1) or release (0) slave select 2 |
Anna Bridge |
186:707f6e361f3e | 168 | * @param ss3 Request (1) or release (0) slave select 3 |
Anna Bridge |
186:707f6e361f3e | 169 | * @param ss4 Request (1) or release (0) slave select 4 |
Anna Bridge |
186:707f6e361f3e | 170 | * @param quad Request (1) or release (0) quad IO |
Anna Bridge |
186:707f6e361f3e | 171 | * @param fast Request (1) or release (0) fast mode |
Anna Bridge |
186:707f6e361f3e | 172 | * @returns ioman_cfg_t IOMAN configuration object for an SPIM0 module |
Anna Bridge |
186:707f6e361f3e | 173 | */ |
Anna Bridge |
186:707f6e361f3e | 174 | ioman_cfg_t IOMAN_SPIM0(int io_en, int ss0, int ss1, int ss2, int ss3, int ss4, int quad, int fast); |
Anna Bridge |
186:707f6e361f3e | 175 | |
Anna Bridge |
186:707f6e361f3e | 176 | /** |
Anna Bridge |
186:707f6e361f3e | 177 | * @brief Create an IOMAN configuration object for a SPIM module. Call IOMAN_Config with this object. |
Anna Bridge |
186:707f6e361f3e | 178 | * @param io_en Request (1) or release (0) the core IO for the module |
Anna Bridge |
186:707f6e361f3e | 179 | * @param ss0 Request (1) or release (0) slave select 0 |
Anna Bridge |
186:707f6e361f3e | 180 | * @param ss1 Request (1) or release (0) slave select 1 |
Anna Bridge |
186:707f6e361f3e | 181 | * @param ss2 Request (1) or release (0) slave select 2 |
Anna Bridge |
186:707f6e361f3e | 182 | * @param quad Request (1) or release (0) quad IO |
Anna Bridge |
186:707f6e361f3e | 183 | * @param fast Request (1) or release (0) fast mode |
Anna Bridge |
186:707f6e361f3e | 184 | * @returns ioman_cfg_t IOMAN configuration object for the SPIM1 module. |
Anna Bridge |
186:707f6e361f3e | 185 | */ |
Anna Bridge |
186:707f6e361f3e | 186 | ioman_cfg_t IOMAN_SPIM1(int io_en, int ss0, int ss1, int ss2, int quad, int fast); |
Anna Bridge |
186:707f6e361f3e | 187 | |
Anna Bridge |
186:707f6e361f3e | 188 | /** |
Anna Bridge |
186:707f6e361f3e | 189 | * @brief Create an IOMAN configuration object for a SPI module. Call IOMAN_Config with this object. |
Anna Bridge |
186:707f6e361f3e | 190 | * @param map Select the pin mapping, see ioman_map_t |
Anna Bridge |
186:707f6e361f3e | 191 | * @param io_en Request (1) or release (0) the core IO for the module |
Anna Bridge |
186:707f6e361f3e | 192 | * @param ss0 Request (1) or release (0) slave select 0 |
Anna Bridge |
186:707f6e361f3e | 193 | * @param ss1 Request (1) or release (0) slave select 1 |
Anna Bridge |
186:707f6e361f3e | 194 | * @param ss2 Request (1) or release (0) slave select 2 |
Anna Bridge |
186:707f6e361f3e | 195 | * @param sr0 Request (1) or release (0) slave ready 0 |
Anna Bridge |
186:707f6e361f3e | 196 | * @param sr1 Request (1) or release (0) slave ready 1 |
Anna Bridge |
186:707f6e361f3e | 197 | * @param quad Request (1) or release (0) quad IO |
Anna Bridge |
186:707f6e361f3e | 198 | * @param fast Request (1) or release (0) fast mode |
Anna Bridge |
186:707f6e361f3e | 199 | * @returns ioman_cfg_t IOMAN configuration object for the SPIM2 module |
Anna Bridge |
186:707f6e361f3e | 200 | */ |
Anna Bridge |
186:707f6e361f3e | 201 | ioman_cfg_t IOMAN_SPIM2(ioman_map_t map, int io_en, int ss0, int ss1, int ss2, int sr0, int sr1, int quad, int fast); |
Anna Bridge |
186:707f6e361f3e | 202 | |
Anna Bridge |
186:707f6e361f3e | 203 | /** |
Anna Bridge |
186:707f6e361f3e | 204 | * @brief Create an IOMAN configuration object for a SPI module. Call IOMAN_Config with this object. |
Anna Bridge |
186:707f6e361f3e | 205 | * @param io_en Request (1) or release (0) the core IO for the module |
Anna Bridge |
186:707f6e361f3e | 206 | * @param quad Request (1) or release (0) quad IO |
Anna Bridge |
186:707f6e361f3e | 207 | * @param fast Request (1) or release (0) fast mode |
Anna Bridge |
186:707f6e361f3e | 208 | * @returns ioman_cfg_t IOMAN configuration object for the SPIM2 module |
Anna Bridge |
186:707f6e361f3e | 209 | */ |
Anna Bridge |
186:707f6e361f3e | 210 | ioman_cfg_t IOMAN_SPIS(int io_en, int quad, int fast); |
Anna Bridge |
186:707f6e361f3e | 211 | |
Anna Bridge |
186:707f6e361f3e | 212 | /** |
Anna Bridge |
186:707f6e361f3e | 213 | * @brief Create an IOMAN configuration object for the 1-Wire Master module. Call IOMAN_Config with this object. |
Anna Bridge |
186:707f6e361f3e | 214 | * @param io_en Request (1) or release (0) the core IO for the module |
Anna Bridge |
186:707f6e361f3e | 215 | * @param epu Request (1) or release (0) external pullup |
Anna Bridge |
186:707f6e361f3e | 216 | * @returns ioman_cfg_t IOMAN configuration object for the OWM module |
Anna Bridge |
186:707f6e361f3e | 217 | */ |
Anna Bridge |
186:707f6e361f3e | 218 | ioman_cfg_t IOMAN_OWM(int io_en, int epu); |
Anna Bridge |
186:707f6e361f3e | 219 | |
Anna Bridge |
186:707f6e361f3e | 220 | /** |
Anna Bridge |
186:707f6e361f3e | 221 | * @} |
Anna Bridge |
186:707f6e361f3e | 222 | */ |
Anna Bridge |
186:707f6e361f3e | 223 | |
Anna Bridge |
186:707f6e361f3e | 224 | /******************************************************************************/ |
Anna Bridge |
186:707f6e361f3e | 225 | /* All the function prototypes above are implemented as macros below. The |
Anna Bridge |
186:707f6e361f3e | 226 | * above prototypes are for simplicity in doxygen. |
Anna Bridge |
186:707f6e361f3e | 227 | */ |
Anna Bridge |
186:707f6e361f3e | 228 | #define IOMAN_SPIX(c, ss0, ss1, ss2, q, f) { \ |
Anna Bridge |
186:707f6e361f3e | 229 | .req_reg = &MXC_IOMAN->spix_req, \ |
Anna Bridge |
186:707f6e361f3e | 230 | .ack_reg = &MXC_IOMAN->spix_ack, \ |
Anna Bridge |
186:707f6e361f3e | 231 | .req_val.spix = { .core_io_req = c, \ |
Anna Bridge |
186:707f6e361f3e | 232 | .ss0_io_req = ss0, \ |
Anna Bridge |
186:707f6e361f3e | 233 | .ss1_io_req = ss1, \ |
Anna Bridge |
186:707f6e361f3e | 234 | .ss2_io_req = ss2, \ |
Anna Bridge |
186:707f6e361f3e | 235 | .quad_io_req = q, \ |
Anna Bridge |
186:707f6e361f3e | 236 | .fast_mode = f } } |
Anna Bridge |
186:707f6e361f3e | 237 | |
Anna Bridge |
186:707f6e361f3e | 238 | #define IOMAN_UART(i, im, cm, rm, ien, cen, ren) { \ |
Anna Bridge |
186:707f6e361f3e | 239 | .req_reg = (uint32_t*)((unsigned int)(&MXC_IOMAN->uart0_req) + (i * 2*sizeof(uint32_t))), \ |
Anna Bridge |
186:707f6e361f3e | 240 | .ack_reg = (uint32_t*)((unsigned int)(&MXC_IOMAN->uart0_ack) + (i * 2*sizeof(uint32_t))), \ |
Anna Bridge |
186:707f6e361f3e | 241 | .req_val.uart = { .io_map = im, \ |
Anna Bridge |
186:707f6e361f3e | 242 | .cts_map = cm, \ |
Anna Bridge |
186:707f6e361f3e | 243 | .rts_map = rm, \ |
Anna Bridge |
186:707f6e361f3e | 244 | .io_req = ien, \ |
Anna Bridge |
186:707f6e361f3e | 245 | .cts_io_req = cen, \ |
Anna Bridge |
186:707f6e361f3e | 246 | .rts_io_req = ren } } |
Anna Bridge |
186:707f6e361f3e | 247 | |
Anna Bridge |
186:707f6e361f3e | 248 | #define IOMAN_I2CM0(c, p) { \ |
Anna Bridge |
186:707f6e361f3e | 249 | .req_reg = &MXC_IOMAN->i2cm0_req, \ |
Anna Bridge |
186:707f6e361f3e | 250 | .ack_reg = &MXC_IOMAN->i2cm0_ack, \ |
Anna Bridge |
186:707f6e361f3e | 251 | .req_val.i2cm0 = { .core_io_req = c, \ |
Anna Bridge |
186:707f6e361f3e | 252 | .push_pull = p } } |
Anna Bridge |
186:707f6e361f3e | 253 | |
Anna Bridge |
186:707f6e361f3e | 254 | #define IOMAN_I2CM1(c, p) { \ |
Anna Bridge |
186:707f6e361f3e | 255 | .req_reg = &MXC_IOMAN->i2cm1_req, \ |
Anna Bridge |
186:707f6e361f3e | 256 | .ack_reg = &MXC_IOMAN->i2cm1_ack, \ |
Anna Bridge |
186:707f6e361f3e | 257 | .req_val.i2cm1 = { .core_io_req = c, \ |
Anna Bridge |
186:707f6e361f3e | 258 | .push_pull = p } } |
Anna Bridge |
186:707f6e361f3e | 259 | |
Anna Bridge |
186:707f6e361f3e | 260 | #define IOMAN_I2CM2(c, p) { \ |
Anna Bridge |
186:707f6e361f3e | 261 | .req_reg = &MXC_IOMAN->i2cm2_req, \ |
Anna Bridge |
186:707f6e361f3e | 262 | .ack_reg = &MXC_IOMAN->i2cm2_ack, \ |
Anna Bridge |
186:707f6e361f3e | 263 | .req_val.i2cm2 = { .core_io_req = c, \ |
Anna Bridge |
186:707f6e361f3e | 264 | .push_pull = p } } |
Anna Bridge |
186:707f6e361f3e | 265 | |
Anna Bridge |
186:707f6e361f3e | 266 | #define IOMAN_I2CS(m, ien) { \ |
Anna Bridge |
186:707f6e361f3e | 267 | .req_reg = &MXC_IOMAN->i2cs_req, \ |
Anna Bridge |
186:707f6e361f3e | 268 | .ack_reg = &MXC_IOMAN->i2cs_ack, \ |
Anna Bridge |
186:707f6e361f3e | 269 | .req_val.i2cs = { .mapping_req = m, \ |
Anna Bridge |
186:707f6e361f3e | 270 | .core_io_req = ien} } |
Anna Bridge |
186:707f6e361f3e | 271 | |
Anna Bridge |
186:707f6e361f3e | 272 | #define IOMAN_SPIM0(io, ss0, ss1, ss2, ss3, ss4, q, f) { \ |
Anna Bridge |
186:707f6e361f3e | 273 | .req_reg = &MXC_IOMAN->spim0_req, \ |
Anna Bridge |
186:707f6e361f3e | 274 | .ack_reg = &MXC_IOMAN->spim0_ack, \ |
Anna Bridge |
186:707f6e361f3e | 275 | .req_val.spim0 = { .core_io_req = io, \ |
Anna Bridge |
186:707f6e361f3e | 276 | .ss0_io_req = ss0, \ |
Anna Bridge |
186:707f6e361f3e | 277 | .ss1_io_req = ss1, \ |
Anna Bridge |
186:707f6e361f3e | 278 | .ss2_io_req = ss2, \ |
Anna Bridge |
186:707f6e361f3e | 279 | .ss3_io_req = ss3, \ |
Anna Bridge |
186:707f6e361f3e | 280 | .ss4_io_req = ss4, \ |
Anna Bridge |
186:707f6e361f3e | 281 | .quad_io_req = q, \ |
Anna Bridge |
186:707f6e361f3e | 282 | .fast_mode = f } } |
Anna Bridge |
186:707f6e361f3e | 283 | |
Anna Bridge |
186:707f6e361f3e | 284 | #define IOMAN_SPIM1(io, ss0, ss1, ss2, q, f) { \ |
Anna Bridge |
186:707f6e361f3e | 285 | .req_reg = &MXC_IOMAN->spim1_req, \ |
Anna Bridge |
186:707f6e361f3e | 286 | .ack_reg = &MXC_IOMAN->spim1_ack, \ |
Anna Bridge |
186:707f6e361f3e | 287 | .req_val.spim1 = { .core_io_req = io, \ |
Anna Bridge |
186:707f6e361f3e | 288 | .ss0_io_req = ss0, \ |
Anna Bridge |
186:707f6e361f3e | 289 | .ss1_io_req = ss1, \ |
Anna Bridge |
186:707f6e361f3e | 290 | .ss2_io_req = ss2, \ |
Anna Bridge |
186:707f6e361f3e | 291 | .quad_io_req = q, \ |
Anna Bridge |
186:707f6e361f3e | 292 | .fast_mode = f } } |
Anna Bridge |
186:707f6e361f3e | 293 | |
Anna Bridge |
186:707f6e361f3e | 294 | #define IOMAN_SPIM2(m, io, ss0, ss1, ss2, sr0, sr1, q, f) { \ |
Anna Bridge |
186:707f6e361f3e | 295 | .req_reg = &MXC_IOMAN->spim2_req, \ |
Anna Bridge |
186:707f6e361f3e | 296 | .ack_reg = &MXC_IOMAN->spim2_ack, \ |
Anna Bridge |
186:707f6e361f3e | 297 | .req_val.spim2 = { .mapping_req = m, \ |
Anna Bridge |
186:707f6e361f3e | 298 | .core_io_req = io, \ |
Anna Bridge |
186:707f6e361f3e | 299 | .ss0_io_req = ss0, \ |
Anna Bridge |
186:707f6e361f3e | 300 | .ss1_io_req = ss1, \ |
Anna Bridge |
186:707f6e361f3e | 301 | .ss2_io_req = ss2, \ |
Anna Bridge |
186:707f6e361f3e | 302 | .sr0_io_req = sr0, \ |
Anna Bridge |
186:707f6e361f3e | 303 | .sr1_io_req = sr1, \ |
Anna Bridge |
186:707f6e361f3e | 304 | .quad_io_req = q, \ |
Anna Bridge |
186:707f6e361f3e | 305 | .fast_mode = f } } |
Anna Bridge |
186:707f6e361f3e | 306 | |
Anna Bridge |
186:707f6e361f3e | 307 | #define IOMAN_SPIS(io, q, f) { \ |
Anna Bridge |
186:707f6e361f3e | 308 | .req_reg = &MXC_IOMAN->spis_req, \ |
Anna Bridge |
186:707f6e361f3e | 309 | .ack_reg = &MXC_IOMAN->spis_ack, \ |
Anna Bridge |
186:707f6e361f3e | 310 | .req_val.spis = { .core_io_req = io, \ |
Anna Bridge |
186:707f6e361f3e | 311 | .quad_io_req = q, \ |
Anna Bridge |
186:707f6e361f3e | 312 | .fast_mode = f } } |
Anna Bridge |
186:707f6e361f3e | 313 | |
Anna Bridge |
186:707f6e361f3e | 314 | #define IOMAN_OWM(io, p) { \ |
Anna Bridge |
186:707f6e361f3e | 315 | .req_reg = &MXC_IOMAN->owm_req, \ |
Anna Bridge |
186:707f6e361f3e | 316 | .ack_reg = &MXC_IOMAN->owm_ack, \ |
Anna Bridge |
186:707f6e361f3e | 317 | .req_val.owm = { .mapping_req = io, \ |
Anna Bridge |
186:707f6e361f3e | 318 | .epu_io_req = p } } |
Anna Bridge |
186:707f6e361f3e | 319 | |
Anna Bridge |
186:707f6e361f3e | 320 | #ifdef __cplusplus |
Anna Bridge |
186:707f6e361f3e | 321 | } |
Anna Bridge |
186:707f6e361f3e | 322 | #endif |
Anna Bridge |
186:707f6e361f3e | 323 | |
Anna Bridge |
186:707f6e361f3e | 324 | #endif /* _IOMAN_H_ */ |