Fork of mbed-dev build 137, last build before FAT file system appears to be broken. Also reduced HSE timeout time in STM4XX HAL
Fork of mbed-dev by
targets/TARGET_Maxim/TARGET_MAX32625/mxc/spix.h@167:356ef919c855, 2017-06-20 (annotated)
- Committer:
- kkado
- Date:
- Tue Jun 20 11:06:37 2017 +0000
- Revision:
- 167:356ef919c855
- Parent:
- 150:02e0a0aed4ec
Build 137 with reduced HSE timeout
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 150:02e0a0aed4ec | 1 | /******************************************************************************* |
<> | 150:02e0a0aed4ec | 2 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
<> | 150:02e0a0aed4ec | 3 | * |
<> | 150:02e0a0aed4ec | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
<> | 150:02e0a0aed4ec | 5 | * copy of this software and associated documentation files (the "Software"), |
<> | 150:02e0a0aed4ec | 6 | * to deal in the Software without restriction, including without limitation |
<> | 150:02e0a0aed4ec | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
<> | 150:02e0a0aed4ec | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
<> | 150:02e0a0aed4ec | 9 | * Software is furnished to do so, subject to the following conditions: |
<> | 150:02e0a0aed4ec | 10 | * |
<> | 150:02e0a0aed4ec | 11 | * The above copyright notice and this permission notice shall be included |
<> | 150:02e0a0aed4ec | 12 | * in all copies or substantial portions of the Software. |
<> | 150:02e0a0aed4ec | 13 | * |
<> | 150:02e0a0aed4ec | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
<> | 150:02e0a0aed4ec | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
<> | 150:02e0a0aed4ec | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
<> | 150:02e0a0aed4ec | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
<> | 150:02e0a0aed4ec | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
<> | 150:02e0a0aed4ec | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
<> | 150:02e0a0aed4ec | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
<> | 150:02e0a0aed4ec | 21 | * |
<> | 150:02e0a0aed4ec | 22 | * Except as contained in this notice, the name of Maxim Integrated |
<> | 150:02e0a0aed4ec | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
<> | 150:02e0a0aed4ec | 24 | * Products, Inc. Branding Policy. |
<> | 150:02e0a0aed4ec | 25 | * |
<> | 150:02e0a0aed4ec | 26 | * The mere transfer of this software does not imply any licenses |
<> | 150:02e0a0aed4ec | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
<> | 150:02e0a0aed4ec | 28 | * trademarks, maskwork rights, or any other form of intellectual |
<> | 150:02e0a0aed4ec | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
<> | 150:02e0a0aed4ec | 30 | * ownership rights. |
<> | 150:02e0a0aed4ec | 31 | * |
<> | 150:02e0a0aed4ec | 32 | * $Date: 2016-05-26 11:38:10 -0500 (Thu, 26 May 2016) $ |
<> | 150:02e0a0aed4ec | 33 | * $Revision: 23065 $ |
<> | 150:02e0a0aed4ec | 34 | * |
<> | 150:02e0a0aed4ec | 35 | ******************************************************************************/ |
<> | 150:02e0a0aed4ec | 36 | |
<> | 150:02e0a0aed4ec | 37 | /** |
<> | 150:02e0a0aed4ec | 38 | * @file spix.h |
<> | 150:02e0a0aed4ec | 39 | * @brief This is the high level API for the serial peripheral interface execute in place module. |
<> | 150:02e0a0aed4ec | 40 | * @warning If using this SPIX with IAR Embedded Workbench for Arm, it is required to define |
<> | 150:02e0a0aed4ec | 41 | * <tt>IAR_SPIX_PRAGMA=1</tt>. This should be done under Project->Options-> |
<> | 150:02e0a0aed4ec | 42 | * C/C++ Compiler->Preprocessor in the Defined Symbols input box. See the IAR documentation |
<> | 150:02e0a0aed4ec | 43 | * for additional information on how to set a preprocessor define in a project. |
<> | 150:02e0a0aed4ec | 44 | */ |
<> | 150:02e0a0aed4ec | 45 | |
<> | 150:02e0a0aed4ec | 46 | #include "mxc_sys.h" |
<> | 150:02e0a0aed4ec | 47 | #include "spix_regs.h" |
<> | 150:02e0a0aed4ec | 48 | |
<> | 150:02e0a0aed4ec | 49 | #ifndef _SPIX_H_ |
<> | 150:02e0a0aed4ec | 50 | #define _SPIX_H_ |
<> | 150:02e0a0aed4ec | 51 | |
<> | 150:02e0a0aed4ec | 52 | #ifdef __cplusplus |
<> | 150:02e0a0aed4ec | 53 | extern "C" { |
<> | 150:02e0a0aed4ec | 54 | #endif |
<> | 150:02e0a0aed4ec | 55 | |
<> | 150:02e0a0aed4ec | 56 | /***** Definitions *****/ |
<> | 150:02e0a0aed4ec | 57 | |
<> | 150:02e0a0aed4ec | 58 | /// @brief Options for number of I/O pins to use during for each fetch stage |
<> | 150:02e0a0aed4ec | 59 | typedef enum { |
<> | 150:02e0a0aed4ec | 60 | SPIX_SINGLE_IO = MXC_V_SPIX_FETCH_CTRL_CMD_WIDTH_SINGLE, |
<> | 150:02e0a0aed4ec | 61 | SPIX_DUAL_IO = MXC_V_SPIX_FETCH_CTRL_CMD_WIDTH_DUAL_IO, |
<> | 150:02e0a0aed4ec | 62 | SPIX_QUAD_IO = MXC_V_SPIX_FETCH_CTRL_CMD_WIDTH_QUAD_IO |
<> | 150:02e0a0aed4ec | 63 | } spix_width_t; |
<> | 150:02e0a0aed4ec | 64 | |
<> | 150:02e0a0aed4ec | 65 | /// @brief Options for number of address bytes to use during fetch |
<> | 150:02e0a0aed4ec | 66 | typedef enum { |
<> | 150:02e0a0aed4ec | 67 | SPIX_3BYTE_FETCH_ADDR = 0, |
<> | 150:02e0a0aed4ec | 68 | SPIX_4BYTE_FETCH_ADDR = 1 |
<> | 150:02e0a0aed4ec | 69 | } spix_addr_size_t; |
<> | 150:02e0a0aed4ec | 70 | |
<> | 150:02e0a0aed4ec | 71 | /// @brief SPIX fetch configuration. |
<> | 150:02e0a0aed4ec | 72 | typedef struct { |
<> | 150:02e0a0aed4ec | 73 | spix_width_t cmd_width; ///< Number of I/O lines used for command SPI transaction. |
<> | 150:02e0a0aed4ec | 74 | spix_width_t addr_width; ///< Number of I/O lines used for address SPI transaction. |
<> | 150:02e0a0aed4ec | 75 | spix_width_t data_width; ///< Number of I/O lines used for data SPI transaction. |
<> | 150:02e0a0aed4ec | 76 | spix_addr_size_t addr_size; ///< Use 3 or 4 byte addresses for fetches. |
<> | 150:02e0a0aed4ec | 77 | uint8_t cmd; ///< Command value to initiate fetch. |
<> | 150:02e0a0aed4ec | 78 | uint8_t mode_clocks; ///< Number of SPI clocks required during mode phase of fetch. |
<> | 150:02e0a0aed4ec | 79 | uint8_t no_cmd_mode; ///< Read command sent only once. |
<> | 150:02e0a0aed4ec | 80 | uint16_t mode_data; ///< Data sent with mode clocks. |
<> | 150:02e0a0aed4ec | 81 | } spix_fetch_t; |
<> | 150:02e0a0aed4ec | 82 | |
<> | 150:02e0a0aed4ec | 83 | /***** Globals *****/ |
<> | 150:02e0a0aed4ec | 84 | |
<> | 150:02e0a0aed4ec | 85 | /***** Function Prototypes *****/ |
<> | 150:02e0a0aed4ec | 86 | |
<> | 150:02e0a0aed4ec | 87 | /** |
<> | 150:02e0a0aed4ec | 88 | * @brief Configure SPI execute in place clocking. |
<> | 150:02e0a0aed4ec | 89 | * @param sys_cfg Pointer to system level configuration structure. |
<> | 150:02e0a0aed4ec | 90 | * @param mode SPI mode to use for the clocking. |
<> | 150:02e0a0aed4ec | 91 | * @param baud Frequency in hertz to set the clock to. May not be able to achieve with |
<> | 150:02e0a0aed4ec | 92 | * the given clock divider. |
<> | 150:02e0a0aed4ec | 93 | * @param sample Number of SPIX clocks to delay the sampling of the SDIO lines. Will use |
<> | 150:02e0a0aed4ec | 94 | * feedback mode if set to 0. |
<> | 150:02e0a0aed4ec | 95 | * @returns #E_NO_ERROR if everything is successful |
<> | 150:02e0a0aed4ec | 96 | */ |
<> | 150:02e0a0aed4ec | 97 | int SPIX_ConfigClock(const sys_cfg_spix_t *sys_cfg, uint32_t baud, uint8_t sample); |
<> | 150:02e0a0aed4ec | 98 | |
<> | 150:02e0a0aed4ec | 99 | /** |
<> | 150:02e0a0aed4ec | 100 | * @brief Configure SPI execute in place slave select. |
<> | 150:02e0a0aed4ec | 101 | * @param ssel Index of which slave select line to use. |
<> | 150:02e0a0aed4ec | 102 | * @param pol Polarity of slave select (0 for active low, 1 for active high). |
<> | 150:02e0a0aed4ec | 103 | * @param act_delay SPIX clocks between slave select assert and active SPI clock. |
<> | 150:02e0a0aed4ec | 104 | * @param inact_delay SPIX clocks between active SPI clock and slave select deassert. |
<> | 150:02e0a0aed4ec | 105 | */ |
<> | 150:02e0a0aed4ec | 106 | void SPIX_ConfigSlave(uint8_t ssel, uint8_t pol, uint8_t act_delay, uint8_t inact_delay); |
<> | 150:02e0a0aed4ec | 107 | |
<> | 150:02e0a0aed4ec | 108 | /** |
<> | 150:02e0a0aed4ec | 109 | * @brief Configure how the SPIX fetches data. |
<> | 150:02e0a0aed4ec | 110 | * @param fetch Pointer to configuration struct that describes how to fetch data. |
<> | 150:02e0a0aed4ec | 111 | */ |
<> | 150:02e0a0aed4ec | 112 | void SPIX_ConfigFetch(const spix_fetch_t *fetch); |
<> | 150:02e0a0aed4ec | 113 | |
<> | 150:02e0a0aed4ec | 114 | /** |
<> | 150:02e0a0aed4ec | 115 | * @brief Shutdown SPIX module. |
<> | 150:02e0a0aed4ec | 116 | * @param spix Pointer to SPIX regs. |
<> | 150:02e0a0aed4ec | 117 | * @returns #E_NO_ERROR if everything is successful |
<> | 150:02e0a0aed4ec | 118 | */ |
<> | 150:02e0a0aed4ec | 119 | int SPIX_Shutdown(mxc_spix_regs_t *spix); |
<> | 150:02e0a0aed4ec | 120 | |
<> | 150:02e0a0aed4ec | 121 | |
<> | 150:02e0a0aed4ec | 122 | #ifdef __cplusplus |
<> | 150:02e0a0aed4ec | 123 | } |
<> | 150:02e0a0aed4ec | 124 | #endif |
<> | 150:02e0a0aed4ec | 125 | |
<> | 150:02e0a0aed4ec | 126 | #endif /* _SPIX_H */ |