48 #define USD_SEL_PORT_BASE GPIO_PORT_TO_BASE(USD_SEL_PORT) 49 #define USD_SEL_PIN_MASK GPIO_PIN_MASK(USD_SEL_PIN) 55 static uint8_t init_done;
80 }
else if(
GPIO_READ_PIN(USD_SEL_PORT_BASE, USD_SEL_PIN_MASK)) {
101 SPIX_CS_CLR(USD_CSN_PORT, USD_CSN_PIN);
103 SPIX_CS_SET(USD_CSN_PORT, USD_CSN_PIN);
115 void *rx_buf,
size_t rx_cnt)
117 const uint8_t *tx_buf_u8 = tx_buf;
118 uint8_t *rx_buf_u8 = rx_buf;
120 while(tx_cnt || rx_cnt) {
121 SPIX_WAITFORTxREADY(USD_SPI_INSTANCE);
123 SPIX_BUF(USD_SPI_INSTANCE) = *tx_buf_u8++;
126 SPIX_BUF(USD_SPI_INSTANCE) = 0;
128 SPIX_WAITFOREOTx(USD_SPI_INSTANCE);
129 SPIX_WAITFOREORx(USD_SPI_INSTANCE);
131 *rx_buf_u8++ = SPIX_BUF(USD_SPI_INSTANCE);
134 SPIX_BUF(USD_SPI_INSTANCE);
bool mmc_arch_get_wp(uint8_t dev)
Gets the state of the write-protection signal.
void spix_init(uint8_t spi)
Initialize the SPI bus for the instance given.
bool mmc_arch_get_cd(uint8_t dev)
Gets the state of the card-detection signal.
#define GPIO_IS_OUTPUT(PORT_BASE, PIN_MASK)
Return whether pins with PIN_MASK of port with PORT_BASE are set to output.
Header file with register and macro declarations for the cc2538 GPIO module.
#define GPIO_CLR_PIN(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE low.
Header file with declarations for the I/O Control module.
void mmc_arch_spi_select(uint8_t dev, bool sel)
Sets the SPI /CS signal as indicated.
Header file for the SD/MMC device driver architecture-specific definitions.
void mmc_arch_spi_set_clock_freq(uint8_t dev, uint32_t freq)
Sets the SPI clock frequency.
#define IOC_OVERRIDE_DIS
Override Disabled.
void spix_set_mode(uint8_t spi, uint32_t frame_format, uint32_t clock_polarity, uint32_t clock_phase, uint32_t data_size)
Configure the SPI data and clock polarity and the data size for the instance given.
#define GPIO_READ_PIN(PORT_BASE, PIN_MASK)
Read pins with PIN_MASK of port with PORT_BASE.
#define GPIO_SOFTWARE_CONTROL(PORT_BASE, PIN_MASK)
Configure the pin to be software controlled with PIN_MASK of port with PORT_BASE. ...
void mmc_arch_spi_xfer(uint8_t dev, const void *tx_buf, size_t tx_cnt, void *rx_buf, size_t rx_cnt)
Performs an SPI transfer.
void ioc_set_over(uint8_t port, uint8_t pin, uint8_t over)
Set Port:Pin override function.
void spix_set_clock_freq(uint8_t spi, uint32_t freq)
Sets the SPI clock frequency of the given SSI instance.
#define GPIO_SET_INPUT(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE to input.
#define GPIO_SET_OUTPUT(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE to output.
void spix_cs_init(uint8_t port, uint8_t pin)
Configure a GPIO to be the chip select pin.
#define SSI_CR0_FRF_MOTOROLA
Motorola frame format.
Header file for the cc2538 SPI driver, including macros for the implementation of the low-level SPI p...