ESOS32
ESOSOn32-bitProcessors
|
Files | |
file | esos_spi.c |
Hardware independent support for ESOS32 SPI services. | |
file | esos_hwxxx_spi.c |
Template for creating hardware-specific support for ESOS32 SPI communications service. | |
file | esos_hwxxx_spi.c |
Template for creating hardware-specific support for ESOS32 SPI communications service. | |
file | esos_stm32l4_spi.c |
Hardware-specific support for ESOS32 SPI services on the STM32L4xx MCUs (tested on STM32L452RE) ESOS32. | |
file | esos_stm32l4_spi.c |
Hardware-specific support for ESOS32 SPI services on the STM32L4xx MCUs (tested on STM32L452RE) ESOS32. | |
file | esos_spi.h |
file | esos_hwxxx_spi.h |
This file contains templates for routines which define, configure and allow use of the SPI service on the target hardware (hwxxxx) | |
file | esos_stm32l4_spi.h |
This file contains routines which define, configure and allow use of the SPI service on the ST Microelectronics STM32L452RE MCU. | |
Macros | |
#define | ESOS_TASK_WAIT_ON_AVAILABLE_SPI() |
#define | ESOS_SIGNAL_AVAILABLE_SPI() |
#define | ESOS_IS_SPI_AVAILABLE() |
#define | ESOS_TASK_WAIT_ON_WRITE1SPI1(u16_d1) |
#define | ESOS_TASK_WAIT_ON_WRITE2SPI1(u16_d1, u16_d2) |
#define | ESOS_TASK_WAIT_ON_WRITENSPI1(pu16_out, u16_cnt) ESOS_TASK_SPAWN_AND_WAIT( (ESOS_TASK_HANDLE)&__stChildTaskSPI, __esos_spi_hw_xferNSPI1, (pu16_out), NULLPTR, (u16_cnt) ) |
#define | ESOS_TASK_WAIT_ON_XFERNSPI1(pu16_out, pu16_in, u16_cnt) ESOS_TASK_SPAWN_AND_WAIT( (ESOS_TASK_HANDLE)&__stChildTaskSPI, __esos_spi_hw_xferNSPI1, (pu16_out), (pu16_in), (u16_cnt) ) |
#define | ESOS_TASK_WAIT_ON_READ1SPI1(u16_d1) |
#define | ESOS_TASK_WAIT_ON_READ2SPI1(u16_d1, u16_d2) |
#define | ESOS_TASK_WAIT_ON_READNSPI1(pu16_in, u16_cnt) ESOS_TASK_SPAWN_AND_WAIT( (ESOS_TASK_HANDLE)&__stChildTaskSPI, __esos_spi_hw_xferNSPI1, NULLPTR, (pu16_in), (u16_cnt) ) |
#define | DISABLE_SCK_PIN 0x1000 /* SCK pin is not used by module */ |
#define | ENABLE_SCK_PIN 0x0000 /* SCK pin is used by module */ |
#define | SCK_PIN_MASK (~DISABLE_SCK_PIN) |
#define | DISABLE_SDO_PIN 0x0800 /* SDO pin is not used by module */ |
#define | ENABLE_SDO_PIN 0x0000 /* SDO pin is used by module */ |
#define | SDO_PIN_MASK (~DISABLE_SDO_PIN) |
#define | SPI_MODE16_ON 0x0400 /* Communication is word wide */ |
#define | SPI_MODE8_ON 0x0000 /* Communication is byte wide */ |
#define | SPI_MODE_MASK (~SPI_MODE16_ON) |
#define | SPI_SMP_ON 0x0200 /* Input data sampled at end of data output time */ |
#define | SPI_SMP_OFF 0x0000 /* Input data sampled at middle of data output time */ |
#define | SPI_SMP_MASK (~SPI_SMP_ON) |
#define | SPI_CKE_ON 0x0100 /* Transmit happens from active clock state to idle clock state*/ |
#define | SPI_CKE_OFF 0x0000 /* Transmit happens on transition from idle clock state to active clock state */ |
#define | SPI_CKE_MASK (~SPI_CKE_ON) |
#define | SLAVE_ENABLE_ON 0x0080 /* Slave Select enbale */ |
#define | SLAVE_ENABLE_OFF 0x0000 /* Slave Select not used by module */ |
#define | SLAVE_ENABLE_MASK (~SLAVE_ENABLE_ON) |
#define | CLK_POL_ACTIVE_LOW 0x0040 /* Idle state for clock is high, active is low */ |
#define | CLK_POL_ACTIVE_HIGH 0x0000 /* Idle state for clock is low, active is high */ |
#define | CLK_POL_ACTIVE_MASK (~CLK_POL_ACTIVE_LOW) |
#define | MASTER_ENABLE_ON 0x0020 /* Master Mode */ |
#define | MASTER_ENABLE_OFF 0x0000 /* Slave Mode */ |
#define | MASTER_ENABLE_MASK (~MASTER_ENABLE_ON) |
#define | SEC_PRESCAL_1_1 0x001c /* Secondary Prescale 1:1 */ |
#define | SEC_PRESCAL_2_1 0x0018 /* Secondary Prescale 2:1 */ |
#define | SEC_PRESCAL_3_1 0x0014 /* Secondary Prescale 3:1 */ |
#define | SEC_PRESCAL_4_1 0x0010/* Secondary Prescale 4:1 */ |
#define | SEC_PRESCAL_5_1 0x000c /* Secondary Prescale 5:1 */ |
#define | SEC_PRESCAL_6_1 0x0008/* Secondary Prescale 6:1 */ |
#define | SEC_PRESCAL_7_1 0x0004 /* Secondary Prescale 7:1 */ |
#define | SEC_PRESCAL_8_1 0x0000 /* Secondary Prescale 8:1 */ |
#define | SEC_PRESCAL_MASK (~SEC_PRESCAL_1_1) |
#define | PRI_PRESCAL_1_1 0x0003 /* Primary Prescale 1:1 */ |
#define | PRI_PRESCAL_4_1 0x0002 /* Primary Prescale 4:1 */ |
#define | PRI_PRESCAL_16_1 0x0001 /* Primary Prescale 16:1 */ |
#define | PRI_PRESCAL_64_1 0x0000 /* Primary Prescale 64:1 */ |
#define | PRI_PRESCAL_MASK (~PRI_PRESCAL_1_1) |
#define | SPI_ENABLE 0x8000 /* Enable module */ |
#define | SPI_DISABLE 0x0000 /* Disable module */ |
#define | SPI_ENBL_DSBL_MASK (~SPI_ENABLE) |
#define | SPI_IDLE_STOP 0x2000 /* Discontinue module operation in idle mode */ |
#define | SPI_IDLE_CON 0x0000 /* Continue module operation in idle mode */ |
#define | SPI_IDLE_MASK (~SPI_IDLE_STOP) |
#define | SPI_RX_OVFLOW 0x0040 |
#define | SPI_RX_OVFLOW_CLR 0x0000 /* Clear receive overflow bit */ |
#define | SPI_TX_BUFFER_FULL 0x0002 /* TX not started yet; SPIxTXB is full */ |
#define | SPI_TX_BUFFER_FULL_CLR (~SPI_TX_BUFFER_FULL) /* TX underway; SPIxTXB is empty */ |
#define | SPI_RX_BUFFER_FULL 0x0001 /* RX complete; SPIxRXB is full */ |
#define | SPI_RX_BUFFER_FULL_CLR (~SPI_RX_BUFFER_FULL) /* RX complete; SPIxRXB is full */ |
#define | FRAME_ENABLE_ON 0x8000 /* Frame SPI support enable */ |
#define | FRAME_ENABLE_OFF 0x0000 /* Frame SPI support Disable */ |
#define | FRAME_ENABLE_MASK (~FRAME_ENABLE_ON) |
#define | FRAME_SYNC_INPUT 0x4000 /* Frame sync pulse Input (slave) */ |
#define | FRAME_SYNC_OUTPUT 0x0000 /* Frame sync pulse Output (master)*/ |
#define | FRAME_SYNC_MASK (~FRAME_SYNC_INPUT) |
#define | FRAME_SYNC_ACTIVE_HIGH 0x2000 /* Frame sync pulse Input (slave) */ |
#define | FRAME_SYNC_ACTIVE_LOW 0x0000 /* Frame sync pulse Output (master)*/ |
#define | FRAME_SYNC_POL_MASK (~FRAME_SYNC_ACTIVE_HIGH) |
#define | SPI_FRM_PULSE_FIRST_CLK 0x0002 /* frame pulse coincides with the first bit clock */ |
#define | SPI_FRM_PULSE_PREV_CLK 0x0000 /* frame pulse precedes the first bit clock */ |
#define | SPI_FRM_PULSE_MASK (~SPI_FRM_PULSE_FIRST_CLK) |
#define | SPI_ENH_BUFF_ENABLE 0x0001 /* enable enhanced buffer */ |
#define | SPI_ENH_BUFF_DISABLE 0x0000 /* disable enhanced buffer */ |
#define | SPI_ENH_BUFF_MASK (~SPI_ENH_BUFF_ENABLE) |
#define | ESOS_TASK_WAIT_ON_AVAILABLE_SPI() |
#define | ESOS_TASK_SIGNAL_AVAILABLE_SPI() __esos_ClearSystemFlag(__ESOS_SYS_SPI_IS_BUSY) |
#define | ESOS_TASK_WAIT_ON_WRITE1SPI1(u16_d1) |
#define | ESOS_TASK_WAIT_ON_WRITE2SPI1(u16_d1, u16_d2) |
#define | ESOS_TASK_WAIT_ON_WRITENSPI1(pu16_out, u16_cnt) ESOS_TASK_SPAWN_AND_WAIT( (ESOS_TASK_HANDLE)&__stChildTaskSPI, __esos_hwxxx_xferNSPI1, (pu16_out), NULLPTR, (u16_cnt) ) |
#define | ESOS_TASK_WAIT_ON_XFERNSPI1(pu16_out, pu16_in, u16_cnt) ESOS_TASK_SPAWN_AND_WAIT( (ESOS_TASK_HANDLE)&__stChildTaskSPI, __esos_hwxxx_xferNSPI1, (pu16_out), (pu16_in), (u16_cnt) ) |
#define | ESOS_TASK_WAIT_ON_READ1SPI1(u16_d1) |
#define | ESOS_TASK_WAIT_ON_READ2SPI1(u16_d1, u16_d2) |
#define | ESOS_TASK_WAIT_ON_READNSPI1(pu16_in, u16_cnt) ESOS_TASK_SPAWN_AND_WAIT( (ESOS_TASK_HANDLE)&__stChildTaskSPI, __esos_hwxxx_xferNSPI1, NULLPTR, (pu16_in), (u16_cnt) ) |
#define | __ESOS_SPI_STM32L4_IS_BUSY() ( SPI_SR(SPI1) & SPI_SR_BSY ) |
#define | __ESOS_SPI_STM32L4_IS_OVR() ( SPI_SR(SPI1) & SPI_SR_OVR ) |
#define | __ESOS_SPI_STM32L4_IS_TXE() ( SPI_SR(SPI1) & SPI_SR_TXE ) |
#define | __ESOS_SPI_STM32L4_IS_RXNE() ( SPI_SR(SPI1) & SPI_SR_RXNE ) |
Functions | |
void | __esos_spi_config (uint32_t u32_spibps) |
void | __esos_spi_hw_config (uint32_t u32_spibps) |
ESOS_CHILD_TASK (__esos_hw_xferNSPI, uint16_t *pu16_out, uint16_t *pu16_in, uint16_t u16_cnt) | |
ESOS_CHILD_TASK (__esos_spi_hw_xferNSPI1, uint16_t *pu16_out, uint16_t *pu16_in, uint16_t u16_cnt) | |
ESOS_CHILD_TASK (__esos_hwxxx_xferNSPI1, uint16_t *pu16_out, uint16_t *pu16_in, uint16_t u16_cnt) | |
Variables | |
struct stTask | __stChildTaskSPI |
uint16_t | __esos_spi_u16s [2] |
struct stTask | __stChildTaskSPI |
uint16_t | __esos_spi_u16s [2] |
struct stTask | __stChildTaskSPI |
uint16_t | __esos_spi_u16s [2] |
#define ESOS_IS_SPI_AVAILABLE | ( | ) |
Returns TRUE if the ESOS SPI resource is available, else returns FALSE.
TRUE | ESOS SPI is not in use; available |
Definition at line 99 of file esos_spi.h.
#define ESOS_SIGNAL_AVAILABLE_SPI | ( | ) |
Release ESOS SPI resource for use by other tasks.
Definition at line 83 of file esos_spi.h.
#define ESOS_TASK_WAIT_ON_AVAILABLE_SPI | ( | ) |
Current task waits until the ESOS SPI resource becomes available for use.
Definition at line 66 of file esos_spi.h.
#define ESOS_TASK_WAIT_ON_AVAILABLE_SPI | ( | ) |
Definition at line 156 of file esos_hwxxx_spi.h.
#define ESOS_TASK_WAIT_ON_READ1SPI1 | ( | u16_d1 | ) |
Transaction: Read 1 (ONE) "word" from SPI device and stores result in variable u16_d1
u16_d1 | Variable containing word (byte or 16-bits) to hold read results |
Definition at line 209 of file esos_spi.h.
#define ESOS_TASK_WAIT_ON_READ1SPI1 | ( | u16_d1 | ) |
Transaction: Read 1 (ONE) "word" from SPI device and stores result in variable u16_d1
u16_d1 | Variable containing word (byte or 16-bits) to hold read results |
Definition at line 247 of file esos_hwxxx_spi.h.
#define ESOS_TASK_WAIT_ON_READ2SPI1 | ( | u16_d1, | |
u16_d2 | |||
) |
Transaction: Read 2 (TWO) "words" (bytes or 16-bits) from SPI device. Stores results in variables u16_d1 and u16_d2
u16_d1 | Variable containing first word/byte read |
u16_d2 | Variable containing second word/byte read |
Definition at line 232 of file esos_spi.h.
#define ESOS_TASK_WAIT_ON_READ2SPI1 | ( | u16_d1, | |
u16_d2 | |||
) |
Transaction: Read 2 (TWO) "words" (bytes or 16-bits) from SPI device. Stores results in variables u16_d1 and u16_d2
u16_d1 | Variable containing first word/byte read |
u16_d2 | Variable containing second word/byte read |
Definition at line 265 of file esos_hwxxx_spi.h.
#define ESOS_TASK_WAIT_ON_READNSPI1 | ( | pu16_in, | |
u16_cnt | |||
) | ESOS_TASK_SPAWN_AND_WAIT( (ESOS_TASK_HANDLE)&__stChildTaskSPI, __esos_spi_hw_xferNSPI1, NULLPTR, (pu16_in), (u16_cnt) ) |
Transaction: Reads u16_cnt "words" (bytes or 16-bits) from SPI device. Results are written to buffer pointed to by pu16_d
pu16_in | Pointer to buffer to catch read results |
u16_cnt | Number of bytes to read |
Definition at line 256 of file esos_spi.h.
#define ESOS_TASK_WAIT_ON_READNSPI1 | ( | pu16_in, | |
u16_cnt | |||
) | ESOS_TASK_SPAWN_AND_WAIT( (ESOS_TASK_HANDLE)&__stChildTaskSPI, __esos_hwxxx_xferNSPI1, NULLPTR, (pu16_in), (u16_cnt) ) |
Transaction: Reads u16_cnt "words" (bytes or 16-bits) from SPI device. Results are written to buffer pointed to by pu16_d
pu16_in | Pointer to buffer to catch read results |
u16_cnt | Number of bytes to read |
Definition at line 284 of file esos_hwxxx_spi.h.
#define ESOS_TASK_WAIT_ON_WRITE1SPI1 | ( | u16_d1 | ) |
Transaction: Write 1 (ONE) "word" stored in variable u16_d1 to SPI device.
u16_d1 | Variable containing word (byte or 16-bits) to write |
Definition at line 116 of file esos_spi.h.
#define ESOS_TASK_WAIT_ON_WRITE1SPI1 | ( | u16_d1 | ) |
Transaction: Write 1 (ONE) "word" stored in variable u16_d1 to SPI device.
u16_d1 | Variable containing word (byte or 16-bits) to write |
Definition at line 174 of file esos_hwxxx_spi.h.
#define ESOS_TASK_WAIT_ON_WRITE2SPI1 | ( | u16_d1, | |
u16_d2 | |||
) |
Transaction: Write 2 (TWO) "words" (bytes or 16-bits) stored in variables u16_d1 and u16_d2 to SPI device.
u16_d1 | Variable containing first byte to write |
u16_d2 | Variable containing second byte to write |
Definition at line 143 of file esos_spi.h.
#define ESOS_TASK_WAIT_ON_WRITE2SPI1 | ( | u16_d1, | |
u16_d2 | |||
) |
Transaction: Write 2 (TWO) "words" (bytes or 16-bits) stored in variables u16_d1 and u16_d2 to SPI device.
u16_d1 | Variable containing first byte to write |
u16_d2 | Variable containing second byte to write |
Definition at line 196 of file esos_hwxxx_spi.h.
#define ESOS_TASK_WAIT_ON_WRITENSPI1 | ( | pu16_out, | |
u16_cnt | |||
) | ESOS_TASK_SPAWN_AND_WAIT( (ESOS_TASK_HANDLE)&__stChildTaskSPI, __esos_spi_hw_xferNSPI1, (pu16_out), NULLPTR, (u16_cnt) ) |
Transaction: Write u16_cnt "words" (bytes or 16-bits) to SPI device
pu16_out | Pointer to buffer containing words to send |
u16_cnt | Number of bytes to send |
Definition at line 166 of file esos_spi.h.
#define ESOS_TASK_WAIT_ON_WRITENSPI1 | ( | pu16_out, | |
u16_cnt | |||
) | ESOS_TASK_SPAWN_AND_WAIT( (ESOS_TASK_HANDLE)&__stChildTaskSPI, __esos_hwxxx_xferNSPI1, (pu16_out), NULLPTR, (u16_cnt) ) |
Transaction: Write u16_cnt "words" (bytes or 16-bits) to SPI device
pu16_out | Pointer to buffer containing words to send |
u16_cnt | Number of bytes to send |
Definition at line 214 of file esos_hwxxx_spi.h.
#define ESOS_TASK_WAIT_ON_XFERNSPI1 | ( | pu16_out, | |
pu16_in, | |||
u16_cnt | |||
) | ESOS_TASK_SPAWN_AND_WAIT( (ESOS_TASK_HANDLE)&__stChildTaskSPI, __esos_spi_hw_xferNSPI1, (pu16_out), (pu16_in), (u16_cnt) ) |
Transaction: Transfer (Read and write SPI simultaneously) u16_cnt "words" (bytes or 16-bits) to SPI device
pu16_out | Pointer to buffer containing words to send |
pu16_in | Pointer to buffer to catch incoming words |
u16_cnt | Number of bytes to send |
Definition at line 190 of file esos_spi.h.
#define ESOS_TASK_WAIT_ON_XFERNSPI1 | ( | pu16_out, | |
pu16_in, | |||
u16_cnt | |||
) | ESOS_TASK_SPAWN_AND_WAIT( (ESOS_TASK_HANDLE)&__stChildTaskSPI, __esos_hwxxx_xferNSPI1, (pu16_out), (pu16_in), (u16_cnt) ) |
Transaction: Transfer (Read and write SPI simultaneously) u16_cnt "words" (bytes or 16-bits) to SPI device
pu16_out | Pointer to buffer containing words to send |
pu16_in | Pointer to buffer to catch incoming words |
u16_cnt | Number of bytes to send |
Definition at line 233 of file esos_hwxxx_spi.h.
void __esos_spi_config | ( | uint32_t | u32_spibps | ) |
Configure and enable the ESOS SPI service for operation at u32_spibbps bits per second clock speed.
u32_spibps | specifies clock speed in bits per second |
Definition at line 70 of file esos_spi.c.