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