mbed library sources. Supersedes mbed-src. removed serial

Fork of mbed-dev by mbed official

Committer:
mrcrsch
Date:
Mon Feb 13 14:26:36 2017 +0000
Revision:
158:aa577577efe0
Parent:
157:ff67d9f36b67
removed stdio and serial to reduce size

Who changed what in which revision?

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