SPI.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * SPI - unified FLASH and SD Card SPI driver
  3. *
  4. * Copyright (c) 2009 Openmoko Inc.
  5. *
  6. * Authors Christopher Hall <hsw@openmoko.com>
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #if !defined(_SPI_H_)
  22. #define _SPI_H_ 1
  23. void SPI_initialise(void);
  24. typedef enum {
  25. SPI_SELECT_NONE, // turns off SD card
  26. SPI_SELECT_FLASH, // affect SD card buffer enable
  27. SPI_SELECT_SDCARD, // turns on SD card if off
  28. } SPI_SelectType;
  29. typedef int SPI_StateType;
  30. SPI_StateType SPI_select(SPI_SelectType select);
  31. void SPI_deselect(SPI_StateType enable);
  32. // exchanger a byte via SPI
  33. uint8_t SPI_exchange(uint8_t out);
  34. #endif