Paparazzi UAS
v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
|
Highspeed SPI Slave Interface. More...
#include "spi_slave_hs_arch.h"
#include "mcu_periph/spi.h"
#include <BOARD_CONFIG>
#include "std.h"
#include "mcu.h"
#include "led.h"
#include "LPC21xx.h"
#include "ssp_hw.h"
#include "pprz_debug.h"
#include "armVIC.h"
Go to the source code of this file.
Macros | |
#define | SSP_DDS 0x07 << 0 /* data size : 8 bits */ |
#define | SSP_FRF 0x00 << 4 /* frame format : SPI */ |
#define | SSP_CPOL 0x00 << 6 /* clock polarity : data captured on first clock transition */ |
#define | SSP_CPHA 0x00 << 7 /* clock phase : SCK idles low */ |
#define | SSP_SCR 0x00 << 8 /* serial clock rate : divide by 1 */ |
#define | SSPCR0_VAL (SSP_DDS | SSP_FRF | SSP_CPOL | SSP_CPHA | SSP_SCR ) |
#define | SSP_LBM 0x00 << 0 /* loopback mode : disabled */ |
#define | SSP_SSE 0x00 << 1 /* SSP enable : enable later when init ready */ |
#define | SSP_MS 0x01 << 2 /* master slave mode : slave */ |
#define | SSP_SOD 0x00 << 3 /* slave output disable : don't care when master */ |
#define | SSPCR1_VAL (SSP_LBM | SSP_SSE | SSP_MS | SSP_SOD ) |
#define | SSP_PINSEL1_SCK (2<<2) |
#define | SSP_PINSEL1_MISO (2<<4) |
#define | SSP_PINSEL1_MOSI (2<<6) |
#define | SSP_PINSEL1_SSEL (2<<8) |
#define | SSP_Write(X) SSPDR=(X) |
#define | SSP_Read() SSPDR |
#define | SSP_Status() SSPSR |
#define | SPI1_VIC_SLOT 7 |
default initial settings More... | |
Functions | |
static void | SSP_ISR (void) |
static int | spi_slave_hs_check_free_space (struct spi_slave_hs *p, long *fd, uint16_t len) |
static void | spi_slave_hs_transmit (struct spi_slave_hs *p, long fd, uint8_t byte) |
static void | spi_slave_hs_transmit_buffer (struct spi_slave_hs *p, long fd, uint8_t *data, uint16_t len) |
static void | spi_slave_hs_send (struct spi_slave_hs *p, long fd) |
static int | spi_slave_hs_char_available (struct spi_slave_hs *p) |
static uint8_t | spi_slave_hs_getch (struct spi_slave_hs *p) |
void | spi_slave_hs_init (void) |
Highspeed SPI Slave Interface.
Definition in file spi_slave_hs_arch.c.
#define SPI1_VIC_SLOT 7 |
default initial settings
Definition at line 103 of file spi_slave_hs_arch.c.
Referenced by spi_slave_hs_init().
#define SSP_CPHA 0x00 << 7 /* clock phase : SCK idles low */ |
Definition at line 57 of file spi_slave_hs_arch.c.
#define SSP_CPOL 0x00 << 6 /* clock polarity : data captured on first clock transition */ |
Definition at line 56 of file spi_slave_hs_arch.c.
#define SSP_DDS 0x07 << 0 /* data size : 8 bits */ |
Definition at line 53 of file spi_slave_hs_arch.c.
#define SSP_FRF 0x00 << 4 /* frame format : SPI */ |
Definition at line 55 of file spi_slave_hs_arch.c.
#define SSP_LBM 0x00 << 0 /* loopback mode : disabled */ |
Definition at line 63 of file spi_slave_hs_arch.c.
#define SSP_MS 0x01 << 2 /* master slave mode : slave */ |
Definition at line 65 of file spi_slave_hs_arch.c.
#define SSP_PINSEL1_MISO (2<<4) |
Definition at line 92 of file spi_slave_hs_arch.c.
Referenced by spi_slave_hs_init().
#define SSP_PINSEL1_MOSI (2<<6) |
Definition at line 93 of file spi_slave_hs_arch.c.
Referenced by spi_slave_hs_init().
#define SSP_PINSEL1_SCK (2<<2) |
Definition at line 91 of file spi_slave_hs_arch.c.
Referenced by spi_slave_hs_init().
#define SSP_PINSEL1_SSEL (2<<8) |
Definition at line 94 of file spi_slave_hs_arch.c.
Referenced by spi_slave_hs_init().
#define SSP_Read | ( | ) | SSPDR |
Definition at line 98 of file spi_slave_hs_arch.c.
Referenced by SSP_ISR().
#define SSP_SCR 0x00 << 8 /* serial clock rate : divide by 1 */ |
Definition at line 58 of file spi_slave_hs_arch.c.
#define SSP_SOD 0x00 << 3 /* slave output disable : don't care when master */ |
Definition at line 66 of file spi_slave_hs_arch.c.
#define SSP_SSE 0x00 << 1 /* SSP enable : enable later when init ready */ |
Definition at line 64 of file spi_slave_hs_arch.c.
#define SSP_Status | ( | ) | SSPSR |
Definition at line 99 of file spi_slave_hs_arch.c.
#define SSP_Write | ( | X | ) | SSPDR=(X) |
Definition at line 97 of file spi_slave_hs_arch.c.
Referenced by SSP_ISR().
Definition at line 60 of file spi_slave_hs_arch.c.
Referenced by max11040_hw_init(), micromag_hw_init(), and spi_slave_hs_init().
Definition at line 68 of file spi_slave_hs_arch.c.
Referenced by max11040_hw_init(), micromag_hw_init(), and spi_slave_hs_init().
|
static |
Definition at line 133 of file spi_slave_hs_arch.c.
References spi_slave_hs_rx_extract_idx, and spi_slave_hs_rx_insert_idx.
Referenced by spi_slave_hs_init().
|
static |
Definition at line 108 of file spi_slave_hs_arch.c.
Referenced by spi_slave_hs_init().
|
static |
Definition at line 138 of file spi_slave_hs_arch.c.
References spi_slave_hs_rx_buffer, SPI_SLAVE_HS_RX_BUFFER_SIZE, and spi_slave_hs_rx_extract_idx.
Referenced by spi_slave_hs_init().
void spi_slave_hs_init | ( | void | ) |
Definition at line 145 of file spi_slave_hs_arch.c.
References _VIC_ADDR, _VIC_CNTL, spi_slave_hs::device, PINSEL1, RXIM, SPI1_VIC_SLOT, spi_slave_hs_char_available(), spi_slave_hs_check_free_space(), spi_slave_hs_getch(), spi_slave_hs_send(), spi_slave_hs_transmit(), spi_slave_hs_transmit_buffer(), SSE, SSP_ISR(), SSP_PINSEL1_MISO, SSP_PINSEL1_MOSI, SSP_PINSEL1_SCK, SSP_PINSEL1_SSEL, SSPCPSR, SSPCR0, SSPCR0_VAL, SSPCR1, SSPCR1_VAL, SSPIMSC, VIC_BIT, VIC_ENABLE, VIC_SPI1, VICIntEnable, and VICIntSelect.
Referenced by mcu_init().
|
static |
Definition at line 131 of file spi_slave_hs_arch.c.
Referenced by spi_slave_hs_init().
|
static |
Definition at line 113 of file spi_slave_hs_arch.c.
References byte, spi_slave_hs_tx_buffer, SPI_SLAVE_HS_TX_BUFFER_SIZE, spi_slave_hs_tx_extract_idx, and spi_slave_hs_tx_insert_idx.
Referenced by spi_slave_hs_init(), and spi_slave_hs_transmit_buffer().
|
static |
Definition at line 123 of file spi_slave_hs_arch.c.
References p, and spi_slave_hs_transmit().
Referenced by spi_slave_hs_init().
|
static |
Definition at line 193 of file spi_slave_hs_arch.c.
References ISR_ENTRY, ISR_EXIT, spi_slave_hs_rx_buffer, SPI_SLAVE_HS_RX_BUFFER_SIZE, spi_slave_hs_rx_extract_idx, spi_slave_hs_rx_insert_idx, spi_slave_hs_tx_buffer, SPI_SLAVE_HS_TX_BUFFER_SIZE, spi_slave_hs_tx_extract_idx, spi_slave_hs_tx_insert_idx, SSP_Read, SSP_Write, and VICVectAddr.
Referenced by spi_slave_hs_init().
struct spi_slave_hs spi_slave_hs |
Definition at line 41 of file spi_slave_hs_arch.c.
uint8_t spi_slave_hs_rx_buffer[SPI_SLAVE_HS_RX_BUFFER_SIZE] |
Definition at line 45 of file spi_slave_hs_arch.c.
Referenced by spi_slave_hs_getch(), and SSP_ISR().
uint16_t spi_slave_hs_rx_extract_idx |
Definition at line 44 of file spi_slave_hs_arch.c.
Referenced by spi_slave_hs_char_available(), spi_slave_hs_getch(), and SSP_ISR().
uint16_t spi_slave_hs_rx_insert_idx |
Definition at line 44 of file spi_slave_hs_arch.c.
Referenced by spi_slave_hs_char_available(), and SSP_ISR().
uint8_t spi_slave_hs_tx_buffer[SPI_SLAVE_HS_TX_BUFFER_SIZE] |
Definition at line 47 of file spi_slave_hs_arch.c.
Referenced by spi_slave_hs_transmit(), and SSP_ISR().
uint8_t spi_slave_hs_tx_extract_idx |
Definition at line 46 of file spi_slave_hs_arch.c.
Referenced by spi_slave_hs_transmit(), and SSP_ISR().
uint8_t spi_slave_hs_tx_insert_idx |
Definition at line 46 of file spi_slave_hs_arch.c.
Referenced by spi_slave_hs_transmit(), and SSP_ISR().