Contiki-NG
|
Files | |
file | spi-arch.c |
Implementation of the SPI HAL driver for CC13xx/CC26xx. | |
Functions | |
bool | spi_arch_has_lock (const spi_device_t *dev) |
Checks if a device has locked an SPI controller. | |
bool | spi_arch_is_bus_locked (const spi_device_t *dev) |
Checks if an SPI controller is locked by any device. | |
spi_status_t | spi_arch_lock_and_open (const spi_device_t *dev) |
Locks and opens an SPI controller to the configuration specified. | |
spi_status_t | spi_arch_close_and_unlock (const spi_device_t *dev) |
Closes and unlocks an SPI controller. | |
spi_status_t | spi_arch_transfer (const spi_device_t *dev, const uint8_t *write_buf, int wlen, uint8_t *inbuf, int rlen, int ignore_len) |
Performs an SPI transfer. | |
spi_status_t spi_arch_close_and_unlock | ( | const spi_device_t * | dev | ) |
Closes and unlocks an SPI controller.
dev | An SPI device configuration that specifies the controller. |
This should turn off the SPI controller to put it in low power mode and unlock it. It should work only if the device has already locked the SPI controller.
< SSI[1:0] clocks - active mode
Definition at line 170 of file spi-arch.c.
References spi_arch_has_lock().
bool spi_arch_has_lock | ( | const spi_device_t * | dev | ) |
Checks if a device has locked an SPI controller.
dev | An SPI device configuration which defines the controller to be checked if it is locked and the respective device. |
Definition at line 99 of file spi-arch.c.
bool spi_arch_is_bus_locked | ( | const spi_device_t * | dev | ) |
Checks if an SPI controller is locked by any device.
dev | An SPI device configuration which defines the controller to be checked. |
Definition at line 110 of file spi-arch.c.
spi_status_t spi_arch_lock_and_open | ( | const spi_device_t * | dev | ) |
Locks and opens an SPI controller to the configuration specified.
dev | An SPI device configuration. |
This should work only if the device has already locked the SPI controller.
< Serial clock phase (H)
< Serial clock phase (O)
< GPIO_A
< Mode control select
< Override Disabled
< GPIO_A
< Data direction register
< GPIO_A
< Data register
< SSI[1:0] clocks - active mode
< Control register 1
< Clock configuration
< GPIO_A
< Mode control select
< GPIO_A
< Mode control select
< GPIO_A
< Mode control select
< Override Disabled
< Override Disabled
< Override Disabled
< Clock divider
< Control register 0
< Control register 0
< Control register 0
< Serial clock rate mask
< Serial clock rate shift
< Control register 1
< Synchronous serial port enable
Definition at line 121 of file spi-arch.c.
References spi_arch_is_bus_locked().
spi_status_t spi_arch_transfer | ( | const spi_device_t * | dev, |
const uint8_t * | data, | ||
int | wlen, | ||
uint8_t * | buf, | ||
int | rlen, | ||
int | ignore_len ) |
Performs an SPI transfer.
dev | An SPI device configuration that specifies the controller. |
data | A pointer to the data to be written. Set it to NULL to skip writing. |
wlen | Length of data to write. |
buf | A pointer to buffer to copy the data read. Set to NULL to skip reading. |
rlen | Length of data to read. |
ignore_len | Length of data to read and ignore. |
It should work only if the device has already locked the SPI controller. A total of rlen+ignore_len bytes will be read. The first rlen bytes will be copied to buf. The remaining ignore_len bytes won't be copied to the buffer. The maximum of wlen and rlen+ignore_len of bytes will be transfered.
Definition at line 199 of file spi-arch.c.
References spi_arch_has_lock().