sam7s-spi.h
00001 #ifndef __CORE_SPI_H__KBMMOKI6CG__
00002 #define __CORE_SPI_H__KBMMOKI6CG__
00003 #include <stdint.h>
00004
00005 void
00006 spi_init();
00007
00008 #define SPI_POLARITY_INACTIVE_HIGH 1
00009 #define SPI_POLARITY_INACTIVE_LOW 1
00010
00011 #define SPI_PHASE_CHANGE_CAPTURE 0
00012 #define SPI_PHASE_CAPTURE_CHANGE 1
00013
00014 struct spi_block {
00015 const uint8_t *send;
00016 uint8_t *receive;
00017 uint16_t len;
00018 };
00019
00020 void
00021 spi_transfer(unsigned int chip, const struct spi_block *block, unsigned int blocks);
00022
00023 void
00024 spi_init_chip_select(unsigned int chip, unsigned int speed,
00025 unsigned int dlybct,
00026 unsigned int dlybs, unsigned int phase,
00027 unsigned int polarity);
00028
00029 #endif