spidrv.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* ========================================================================
  2. * [PROJECT] SIR100
  3. * [MODULE] SPI
  4. * [TITLE] spi header file
  5. * [FILE] spi.h
  6. * [VSN] 1.0
  7. * [CREATED] 12052007
  8. * [LASTCHNGD] 12052007
  9. * [COPYRIGHT] Copyright (C) STREAMIT BV 2010
  10. * [PURPOSE] API and global defines for SPI module
  11. * ======================================================================== */
  12. #ifndef _SPI_H
  13. #define _SPI_H
  14. /*-------------------------------------------------------------------------*/
  15. /* global defines */
  16. /*-------------------------------------------------------------------------*/
  17. #define SPEED_SLOW 0
  18. #define SPEED_FAST 1
  19. #define SPEED_ULTRA_FAST 2
  20. /*-------------------------------------------------------------------------*/
  21. /* typedefs & structs */
  22. /*-------------------------------------------------------------------------*/
  23. typedef enum
  24. {
  25. SPI_DEV_VS10XX=0,
  26. SPI_DEV_FLASH,
  27. SPI_DEV_MMC,
  28. SPI_NROF_DEVICES // keep last
  29. }TSPIDevice;
  30. /*--------------------------------------------------------------------------*/
  31. /* Global variables */
  32. /*--------------------------------------------------------------------------*/
  33. /*-------------------------------------------------------------------------*/
  34. /* export global routines (interface) */
  35. /*-------------------------------------------------------------------------*/
  36. extern void SPIselect(TSPIDevice Device);
  37. extern void SPIdeselect(void);
  38. extern void SPIputByte(u_char bByte); // send byte using SPI, ignore result
  39. extern u_char SPIgetByte(void); // read byte using SPI, don't use any input
  40. extern u_char SPItransferByte(u_char); // send byte using SPI, return result
  41. extern void SPIinit(void); // initialise SPI-registers (speed, mode)
  42. extern void SPImode(u_char data);
  43. extern u_char SPIgetmode(void);
  44. #endif /* _SPI_H */
  45. /* ÍÍÍÍ End Of File ÍÍÍÍÍÍÍÍ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */