sd_api.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // Authors: Epson Shanghai
  3. // Marek Lindner <marek@openmoko.com>
  4. //
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU General Public License
  7. // as published by the Free Software Foundation; either version
  8. // 3 of the License, or (at your option) any later version.
  9. //
  10. #if !defined_SD_API_H_
  11. #define _SD_API_H_ 1
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #ifndef NULL
  16. #define NULL ((void*)0)
  17. #endif
  18. enum {
  19. SD_TYPE_NONE,
  20. SD_TYPE_MMC,
  21. SD_TYPE_SDSC,
  22. SD_TYPE_SDHC,
  23. };
  24. #define SD_SUCCESS 0
  25. #define SD_FAILURE -1
  26. #include <inttypes.h>
  27. #include <regs.h>
  28. #include <samo.h>
  29. #define SD_CS_L SDCARD_CS_LO()
  30. #define SD_CS_H SDCARD_CS_HI()
  31. // Functions
  32. extern int SdMediaReset(void);
  33. extern int SdInitialize(void);
  34. extern int SdClose(void);
  35. extern int SdGetDeviceInfo(void* pData);
  36. extern void SdGetDevicePara(unsigned long *ulSectors, unsigned long *ulSectorSize);
  37. extern int SdGetErrCode(void);
  38. extern int SdPhyFormat(void);
  39. extern int SdCardDetect(void);
  40. extern int SdCardWriteProtected(void);
  41. extern int SdRdSect(unsigned short uwDeviceNo, unsigned long ulSectAddr, unsigned long ulDataLen, unsigned char * pDataBuf);
  42. extern int SdWtSect(unsigned short uwDeviceNo, unsigned long ulSectAddr, unsigned long ulDataLen, unsigned char *pDataBuf,unsigned char bVerify);
  43. #ifdef __cplusplus
  44. }
  45. #endif
  46. #endif