Subversion Repositories NaviCtrl

Rev

Rev 384 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 384 Rev 450
1
#ifndef _SDC_H
1
#ifndef _SDC_H
2
#define _SDC_H
2
#define _SDC_H
3
 
3
 
4
 
4
 
5
//________________________________________________________________________________________________________________________________________
5
//________________________________________________________________________________________________________________________________________
6
// 
6
// 
7
// Functions needed for accessing the sdcard.
7
// Functions needed for accessing the sdcard.
8
//                              
8
//                              
9
//________________________________________________________________________________________________________________________________________
9
//________________________________________________________________________________________________________________________________________
10
 
10
 
11
typedef enum
11
typedef enum
12
{
12
{
13
  SD_SUCCESS = 0,
13
  SD_SUCCESS = 0,
14
  SD_ERROR_NOCARD,
14
  SD_ERROR_NOCARD,
15
  SD_ERROR_RESET,
15
  SD_ERROR_RESET,
16
  SD_ERROR_INITIALIZE,
16
  SD_ERROR_INITIALIZE,
17
  SD_ERROR_BAD_RESPONSE,
17
  SD_ERROR_BAD_RESPONSE,
18
  SD_ERROR_BAD_VOLTAGE_RANGE,
18
  SD_ERROR_BAD_VOLTAGE_RANGE,
19
  SD_ERROR_NO_SDCARD,
19
  SD_ERROR_NO_SDCARD,
20
  SD_ERROR_TIMEOUT,
20
  SD_ERROR_TIMEOUT,
21
  SD_ERROR_CRC_DATA,
21
  SD_ERROR_CRC_DATA,
22
  SD_ERROR_WRITE_DATA,
22
  SD_ERROR_WRITE_DATA,
23
  SD_ERROR_READ_DATA,
23
  SD_ERROR_READ_DATA,
24
  SD_ERROR_SET_BLOCKLEN,
24
  SD_ERROR_SET_BLOCKLEN,
25
  SD_ERROR_UNKNOWN
25
  SD_ERROR_UNKNOWN
26
} SD_Result_t;
26
} SD_Result_t;
27
 
27
 
28
SD_Result_t     SDC_Init(void);
28
SD_Result_t     SDC_Init(unsigned char print);
29
SD_Result_t SDC_GetSector (u32 ,u8 *);
29
SD_Result_t SDC_GetSector (u32 ,u8 *);
30
SD_Result_t     SDC_PutSector (u32, const u8 *);
30
SD_Result_t     SDC_PutSector (u32, const u8 *);
31
SD_Result_t     SDC_Deinit(void);
31
SD_Result_t     SDC_Deinit(void);
32
 
32
 
33
typedef enum
33
typedef enum
34
{
34
{
35
        VER_UNKNOWN,
35
        VER_UNKNOWN,
36
        VER_1X,
36
        VER_1X,
37
        VER_20
37
        VER_20
38
} SDVersion_t;
38
} SDVersion_t;
39
 
39
 
40
typedef struct
40
typedef struct
41
{
41
{
42
  u8 Valid;
42
  u8 Valid;
43
  SDVersion_t Version;  // HW-Version 
43
  SDVersion_t Version;  // HW-Version 
44
  u32 Capacity;                 // Memory capacity  in bytes
44
  u32 Capacity;                 // Memory capacity  in bytes
45
  u8 CID[16];                   // CID register
45
  u8 CID[16];                   // CID register
46
  u8 CSD[16];                   // CSD register
46
  u8 CSD[16];                   // CSD register
47
} __attribute__((packed)) SDCardInfo_t;
47
} __attribute__((packed)) SDCardInfo_t;
48
 
48
 
49
extern volatile SDCardInfo_t SDCardInfo;
49
extern volatile SDCardInfo_t SDCardInfo;
50
extern u8 SDCardWriteRetryCounterMax;
50
extern u8 SDCardWriteRetryCounterMax;
51
 
51
 
52
#endif // _SDC_H
52
#endif // _SDC_H
53
 
53
 
54
 
54
 
55
 
55