X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fcpu%2Farm%2Fdrv%2Fspi_dma_at91.h;fp=bertos%2Fcpu%2Farm%2Fdrv%2Fspi_dma_at91.h;h=6ceef4aa7c266007b40d862d26e68cb687c9a7f9;hb=bb26872e115380a4354346bce26a0e1ec94f7628;hp=0000000000000000000000000000000000000000;hpb=1fb9b95e56d03933e5b38709a497b5f5f892ea23;p=bertos.git diff --git a/bertos/cpu/arm/drv/spi_dma_at91.h b/bertos/cpu/arm/drv/spi_dma_at91.h new file mode 100644 index 00000000..6ceef4aa --- /dev/null +++ b/bertos/cpu/arm/drv/spi_dma_at91.h @@ -0,0 +1,73 @@ +/** + * \file + * + * + * \brief SPI driver with DMA. + * + * \note Only one copy of SpiDmaAt91 is allowed for each application. + * + * \version $Id$ + * \author Francesco Sacchi + * \author Luca Ottaviano + */ + +#ifndef DRV_SPI_DMA_AT91_H +#define DRV_SPI_DMA_AT91_H + +#include + +typedef struct SpiDmaAt91 +{ + KFile fd; +} SpiDmaAt91; + +#define KFT_SPIDMAAT91 MAKE_ID('S', 'P', 'I', 'A') + +INLINE SpiDmaAt91 * SPIDMAAT91_CAST(KFile *fd) +{ + ASSERT(fd->_type == KFT_SPIDMAAT91); + return (SpiDmaAt91 *)fd; +} + +/** + * Init DMA SPI driver. + * \param spi A pointer to a SpiDmaAt91 structure. + */ +void spi_dma_init(SpiDmaAt91 *spi); + +/** + * Set the clock rate for SPI bus. + * + * \param rate The rate you want to set for SPI. + */ +void spi_dma_setclock(uint32_t rate); + +#endif /* DRV_SPI_DMA_AT91_H */