Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
spi_slave_hs_arch.c File Reference

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"
+ Include dependency graph for spi_slave_hs_arch.c:

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)
 

Variables

struct spi_slave_hs spi_slave_hs
 
uint16_t spi_slave_hs_rx_insert_idx
 
uint16_t spi_slave_hs_rx_extract_idx
 
uint8_t spi_slave_hs_rx_buffer [SPI_SLAVE_HS_RX_BUFFER_SIZE]
 
uint8_t spi_slave_hs_tx_insert_idx
 
uint8_t spi_slave_hs_tx_extract_idx
 
uint8_t spi_slave_hs_tx_buffer [SPI_SLAVE_HS_TX_BUFFER_SIZE]
 

Detailed Description

Highspeed SPI Slave Interface.

Definition in file spi_slave_hs_arch.c.

Macro Definition Documentation

#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().

#define SSPCR0_VAL   (SSP_DDS | SSP_FRF | SSP_CPOL | SSP_CPHA | SSP_SCR )

Definition at line 60 of file spi_slave_hs_arch.c.

Referenced by max11040_hw_init(), micromag_hw_init(), and spi_slave_hs_init().

#define SSPCR1_VAL   (SSP_LBM | SSP_SSE | SSP_MS | SSP_SOD )

Definition at line 68 of file spi_slave_hs_arch.c.

Referenced by max11040_hw_init(), micromag_hw_init(), and spi_slave_hs_init().

Function Documentation

static int spi_slave_hs_char_available ( struct spi_slave_hs p)
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().

+ Here is the caller graph for this function:

static int spi_slave_hs_check_free_space ( struct spi_slave_hs p,
long *  fd,
uint16_t  len 
)
static

Definition at line 108 of file spi_slave_hs_arch.c.

Referenced by spi_slave_hs_init().

+ Here is the caller graph for this function:

static uint8_t spi_slave_hs_getch ( struct spi_slave_hs p)
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().

+ Here is the caller graph for this function:

static void spi_slave_hs_send ( struct spi_slave_hs p,
long  fd 
)
static

Definition at line 131 of file spi_slave_hs_arch.c.

Referenced by spi_slave_hs_init().

+ Here is the caller graph for this function:

static void spi_slave_hs_transmit ( struct spi_slave_hs p,
long  fd,
uint8_t  byte 
)
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().

+ Here is the caller graph for this function:

static void spi_slave_hs_transmit_buffer ( struct spi_slave_hs p,
long  fd,
uint8_t data,
uint16_t  len 
)
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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

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().