|  | Paparazzi UAS v7.0_unstable
    Paparazzi is a free software Unmanned Aircraft System. | 
Implementation of SPI interface for ChibiOS arch. More...
#include "mcu_periph/spi.h"#include "mcu_periph/gpio.h"#include <BOARD_CONFIG>#include <string.h>#include "mcu_periph/ram_arch.h" Include dependency graph for spi_arch.c:
 Include dependency graph for spi_arch.c:Go to the source code of this file.
| Data Structures | |
| struct | spi_init | 
| Macros | |
| #define | SPI_THREAD_STACK_SIZE 512 | 
| #define | SPI_DMA_BUF_LEN 512 | 
Implementation of SPI interface for ChibiOS arch.
Only Master mode is allowed in ChibiOS.
Definition in file spi_arch.c.
| struct spi_init | 
Definition at line 58 of file spi_arch.c.
| Data Fields | ||
|---|---|---|
| char * | name | |
| semaphore_t | sem | |
| #define SPI_DMA_BUF_LEN 512 | 
Definition at line 54 of file spi_arch.c.
| #define SPI_THREAD_STACK_SIZE 512 | 
Definition at line 49 of file spi_arch.c.
| 
 | static | 
main thread function
| [in] | p | pointer to an i2c peripheral | 
Definition at line 312 of file spi_arch.c.
References foo, p, pprz_bsem_signal(), spi_init::sem, spi_resolve_CR1(), spi_resolve_CR2(), spi_resolve_slave_pin(), spi_resolve_slave_port(), SPI_TRANSACTION_QUEUE_LEN, SPIIdle, SPIRunning, SPISelect, SPISelectUnselect, SPITransSuccess, SPIUnselect, and spi_transaction::status.
Referenced by thd_spi().
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:Configure SPI peripherals.
References foo.
| 
 | inlinestatic | 
Resolve CR1 (or CFG1)
Given the transaction settings, returns the right configuration of SPIx_CR1 register.
This function is currently architecture dependent (for STM32F1xx STM32F4xx, STM32F7xx and STM32H7xx only) TODO: extend for other architectures too
| [in] | t | pointer to a spi_transactionstruct | 
Definition at line 213 of file spi_arch.c.
References foo, SPICphaEdge2, SPICpolIdleHigh, SPIDiv128, SPIDiv16, SPIDiv2, SPIDiv256, SPIDiv32, SPIDiv4, SPIDiv64, SPIDiv8, SPIDss16bit, and SPILSBFirst.
Referenced by handle_spi_thd().
 Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | inlinestatic | 
Resolve CR2 (or CFG2)
Given the transaction settings, returns the right configuration of SPIx_CR2 register.
This function is currently architecture dependent (for STM32F1xx STM32F4xx, STM32F7xx and STM32H7xx only) TODO: extend for other architectures too
| [in] | t | pointer to a spi_transactionstruct | 
Definition at line 283 of file spi_arch.c.
References foo, SPICphaEdge2, SPICpolIdleHigh, SPIDss16bit, and SPILSBFirst.
Referenced by handle_spi_thd().
 Here is the caller graph for this function:
 Here is the caller graph for this function:Resolve slave pin.
Given the slave number and the board config file, returns the right pin (i.e. 12)
| [in] | slave | index number of a slave | 
Definition at line 142 of file spi_arch.c.
References foo, SPI_SELECT_SLAVE0_PIN, SPI_SELECT_SLAVE1_PIN, SPI_SELECT_SLAVE2_PIN, SPI_SELECT_SLAVE3_PIN, SPI_SELECT_SLAVE4_PIN, and SPI_SELECT_SLAVE5_PIN.
Referenced by handle_spi_thd().
 Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | inlinestatic | 
Resolve slave port.
Given the slave number and the board config file, returns the right port (i.e. GPIOC)
| [in] | slave | index number of a slave | 
Definition at line 75 of file spi_arch.c.
References foo, SPI_SELECT_SLAVE0_PORT, SPI_SELECT_SLAVE1_PORT, SPI_SELECT_SLAVE2_PORT, SPI_SELECT_SLAVE3_PORT, SPI_SELECT_SLAVE4_PORT, and SPI_SELECT_SLAVE5_PORT.
Referenced by handle_spi_thd().
 Here is the caller graph for this function:
 Here is the caller graph for this function:Default spi thread.
| arg | The SPI perpheral (struct spi_periph) | 
Definition at line 410 of file spi_arch.c.
References foo, handle_spi_thd(), and TRUE.
Referenced by spi1_arch_init(), and spi2_arch_init().
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
| 
 | static |