capi/sd_modules.h File Reference

#include "type.h"
Include dependency graph for sd_modules.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SDCardData

Defines

#define SD_DATAline   4
#define SD_CMDline   2
#define SD_All   1
#define CMD0   0
#define CMD1   1
#define CMD2   2
#define CMD3   3
#define CMD4   4
#define CMD5   5
#define CMD6   6
#define CMD7   7
#define CMD8   8
#define CMD9   9
#define CMD10   10
#define CMD12   12
#define CMD13   13
#define CMD15   15
#define CMD16   16
#define CMD17   17
#define CMD18   18
#define CMD23   23
#define CMD24   24
#define CMD25   25
#define CMD27   27
#define CMD28   28
#define CMD29   29
#define CMD30   30
#define CMD32   32
#define CMD33   33
#define CMD38   38
#define CMD42   42
#define CMD50   50
#define CMD52   52
#define CMD53   53
#define CMD55   55
#define CMD56   56
#define CMD57   57
#define ACMD6   6
#define ACMD13   13
#define ACMD22   22
#define ACMD23   23
#define ACMD41   41
#define ACMD42   42
#define ACMD51   51
#define NORM_CMD   0x00
#define wResp_CMD   0x02
#define R2_Resp_CMD   0x01
#define R1bR5b_Resp_CMD   0x03
#define abort_cmd   0xC0
#define resume_cmd   0x80
#define suspend_cmd   0x40
#define normal_cmd   0x00
#define data_present   0x20
#define cmd_index_chk   0x10
#define cmd_crc_chk   0x08
#define cmd_check   cmd_index_chk|cmd_crc_chk
#define no_resp   0x00
#define r1_resp   0x02
#define r1b_resp   0x03
#define r2_resp   0x01
#define r3_resp   0x02
#define r6_resp   0x02
#define r7_resp   0x02
#define TMR_DMA_EN   1<<0
#define TMR_BLKCNT_EN   1<<1
#define TMR_AUTOCMD12_EN   1<<2
#define TMR_RD_EN   1<<4
#define TMR_MULTI_EN   1<<5

Enumerations

enum  SRESULT {
  SD_OK = 0, SD_NOT_READY, SD_NOT_PRESENT, SD_CLK_E,
  SD_WRITE_E, SD_READ_E, SD_READ_DMA_E, SD_UNKNOWN_E,
  SD_WRONG_CARD
}

Functions

void SD_clear_int_1130 (UINT8 d)
void SD_clear_int_1132 (UINT8 d)
void SD_clear_int (void)
void SD_clear_int_ff (void)
UINT8 SD_wait_cmd_complete (void)
UINT8 SD_wait_cmd_complete_val (UINT8 val)
UINT8 SD_wait_cmd_resp_check (void)
UINT8 Init_SD (SDCardData *sdcd)
UINT8 SD_init (SDCardData *sdcd)
UINT8 Select_card (SDCardData *sdcd)
UINT8 Deselect_card (void)
UINT32 SD_Get_CSD (SDCardData *sdcd)
UINT8 SD_reset_quick (UINT8 reset_type)
UINT8 SD_reset (UINT8 reset_type)
void SD_Power_On (void)
void SD_Power_Off (void)
void SD_Clck_Off (void)
UINT8 SD_Clck_Ctrl (char value)
UINT8 Card_Detect (void)
UINT8 set_SD_parameters (UINT16 rca)
UINT32 get_cardstatus (UINT16 rca)
UINT8 SD_Send_CMD (UINT8 cmd, UINT32 cmd_argu, UINT8 cmd_resp_type)
void SD_Send_appCMD (UINT16 rca, UINT8 cmd, UINT32 cmd_argu, UINT8 cmd_resp_type)
void SD_send_csd (UINT16 rca)
UINT8 SD_xfer512bytes (UINT32 address)
UINT8 SD_read512bytes (UINT32 SD_data_address)
UINT8 SD_csd (UINT16 rca)
UINT8 SD_write (SDCardData *sdcd, UINT32 LBA_address, const UINT8 *buf, UINT8 count)
UINT8 SD_read (SDCardData *sdcd, UINT32 LBA_address, UINT8 *buf, UINT8 count, UINT8 bToSSDMem)
UINT8 SD_read_multiple (SDCardData *sdcd, UINT32 LBA_address, UINT8 *buf, UINT8 rcount, UINT16 count)
UINT8 SD_write_multiple (SDCardData *sdcd, UINT32 LBA_address, const UINT8 *buf, UINT8 count)
UINT8 Show_SD_Content (void)

Define Documentation

#define abort_cmd   0xC0
#define ACMD13   13
#define ACMD22   22
#define ACMD23   23
#define ACMD41   41

Referenced by SD_init().

#define ACMD42   42
#define ACMD51   51
#define ACMD6   6

Referenced by set_SD_parameters().

#define CMD0   0

Referenced by SD_base_init().

#define CMD1   1
#define CMD10   10
#define CMD12   12

Referenced by SD_read_multiple().

#define CMD13   13

Referenced by get_cardstatus(), and SD_Get_CSD().

#define CMD15   15
#define CMD16   16

Referenced by set_SD_parameters().

#define CMD17   17

Referenced by SD_read().

#define CMD18   18

Referenced by SD_read_multiple().

#define CMD2   2

Referenced by SD_init().

#define CMD23   23
#define CMD24   24

Referenced by SD_write().

#define CMD25   25
#define CMD27   27
#define CMD28   28
#define CMD29   29
#define CMD3   3

Referenced by SD_init().

#define CMD30   30
#define CMD32   32
#define CMD33   33
#define CMD38   38
#define CMD4   4
#define CMD42   42
#define CMD5   5
#define CMD50   50
#define CMD52   52
#define CMD53   53
#define CMD55   55

Referenced by SD_Send_appCMD(), and SD_send_csd().

#define CMD56   56
#define CMD57   57
#define CMD6   6
#define CMD7   7

Referenced by Deselect_card(), and Select_card().

#define CMD8   8

Referenced by SD_init().

#define CMD9   9

Referenced by SD_Get_CSD().

#define cmd_check   cmd_index_chk|cmd_crc_chk
#define cmd_crc_chk   0x08

Referenced by SD_Get_CSD(), and SD_init().

#define cmd_index_chk   0x10
#define data_present   0x20

Referenced by SD_read(), SD_read_multiple(), and SD_write().

#define no_resp   0x00
#define NORM_CMD   0x00

Referenced by SD_base_init().

#define normal_cmd   0x00
#define r1_resp   0x02
#define r1b_resp   0x03

Referenced by SD_read_multiple(), and Select_card().

#define R1bR5b_Resp_CMD   0x03
#define r2_resp   0x01

Referenced by SD_Get_CSD(), and SD_init().

#define R2_Resp_CMD   0x01

Referenced by SD_send_csd().

#define r3_resp   0x02
#define r6_resp   0x02

Referenced by SD_init().

#define r7_resp   0x02

Referenced by SD_init().

#define resume_cmd   0x80
#define SD_All   1

Referenced by SD_base_init().

#define SD_CMDline   2

Referenced by get_cardstatus().

#define SD_DATAline   4

Referenced by SD_reset_inhibit_DAT().

#define suspend_cmd   0x40
#define TMR_AUTOCMD12_EN   1<<2

Referenced by SD_read_multiple().

#define TMR_BLKCNT_EN   1<<1
#define TMR_DMA_EN   1<<0

Referenced by SD_read(), and SD_read_multiple().

#define TMR_MULTI_EN   1<<5

Referenced by SD_read_multiple().

#define TMR_RD_EN   1<<4

Referenced by SD_read(), and SD_read_multiple().

#define wResp_CMD   0x02

Referenced by SD_init(), and SD_Send_appCMD().


Enumeration Type Documentation

enum SRESULT
Enumerator:
SD_OK 
SD_NOT_READY 
SD_NOT_PRESENT 
SD_CLK_E 
SD_WRITE_E 
SD_READ_E 
SD_READ_DMA_E 
SD_UNKNOWN_E 
SD_WRONG_CARD 

Function Documentation

UINT8 Card_Detect ( void   ) 

References SD_NOT_PRESENT, SD_NOT_READY, SD_OK, SSD_REGRB, and TRACE.

Referenced by Init_SD().

Here is the caller graph for this function:

UINT8 Deselect_card ( void   ) 

References CMD7, cmd_check, SD_clear_int(), SD_clear_int_ff(), SD_Send_CMD(), and SD_wait_cmd_complete().

Here is the call graph for this function:

UINT32 get_cardstatus ( UINT16  rca  ) 

myprintf("\r\nSD RCA = 0x%x", SD_RCA);

myprintf("\r\nStatus = 0x%x\r\n", status); // shall be 0x900

References CMD13, cmd_check, r1_resp, SD_clear_int_1130(), SD_CMDline, SD_get_response(), SD_NOT_READY, SD_reset_quick(), SD_Send_CMD(), SD_wait_cmd_complete(), SD_wait_cmd_resp_check(), SSD_REGRB, SSD_REGRW, SSD_REGWB, and SSD_REGWW.

Referenced by SD_write().

Here is the call graph for this function:

Here is the caller graph for this function:

UINT8 Init_SD ( SDCardData sdcd  ) 

References Card_Detect(), SDCardData::rca, SD_init(), Select_card(), set_SD_parameters(), and TRACE.

Referenced by disk_initialize(), and Write_JPEG_data_to_SD().

Here is the call graph for this function:

Here is the caller graph for this function:

UINT8 SD_Clck_Ctrl ( char  value  ) 

References SD_CLK_E, SD_OK, SSD_REGRB, and SSD_REGWB.

Referenced by SD_reset().

Here is the caller graph for this function:

void SD_Clck_Off ( void   ) 

References SSD_REGRB, and SSD_REGWB.

void SD_clear_int ( void   ) 

References SD_clear_int_1130(), and SD_clear_int_1132().

Referenced by Deselect_card(), SD_Get_CSD(), SD_reset(), and Select_card().

Here is the call graph for this function:

Here is the caller graph for this function:

void SD_clear_int_1130 ( UINT8  d  ) 

References SSD_REGWB.

Referenced by get_cardstatus(), SD_clear_int(), SD_clear_int_ff(), SD_read(), SD_read_multiple(), SD_Send_CMD(), and SD_write().

Here is the caller graph for this function:

void SD_clear_int_1132 ( UINT8  d  ) 

References SSD_REGWB.

Referenced by SD_clear_int(), SD_clear_int_ff(), and SD_Send_CMD().

Here is the caller graph for this function:

void SD_clear_int_ff ( void   ) 

References SD_clear_int_1130(), and SD_clear_int_1132().

Referenced by Deselect_card(), and Select_card().

Here is the call graph for this function:

Here is the caller graph for this function:

UINT8 SD_csd ( UINT16  rca  ) 
UINT32 SD_Get_CSD ( SDCardData sdcd  ) 
UINT8 SD_init ( SDCardData sdcd  ) 
void SD_Power_Off ( void   ) 

References delay_ns(), DELAYFACTOR, and SSD_REGWB.

Referenced by SD_reset().

Here is the call graph for this function:

Here is the caller graph for this function:

void SD_Power_On ( void   ) 

References SSD_REGRB, and SSD_REGWB.

Referenced by SD_reset().

Here is the caller graph for this function:

UINT8 SD_read ( SDCardData sdcd,
UINT32  LBA_address,
UINT8 buf,
UINT8  count,
UINT8  bToSSDMem 
)
UINT8 SD_read512bytes ( UINT32  SD_data_address  ) 
UINT8 SD_read_multiple ( SDCardData sdcd,
UINT32  LBA_address,
UINT8 buf,
UINT8  rcount,
UINT16  count 
)
UINT8 SD_reset ( UINT8  reset_type  ) 

References SD_Clck_Ctrl(), SD_clear_int(), SD_NOT_READY, SD_OK, SD_Power_Off(), SD_Power_On(), SD_reset_quick(), SD_UNKNOWN_E, SSD_REGRB, and SSD_REGWB.

Referenced by SD_base_init().

Here is the call graph for this function:

Here is the caller graph for this function:

UINT8 SD_reset_quick ( UINT8  reset_type  ) 

References SD_NOT_READY, SD_OK, SSD_REGRB, SSD_REGWB, and TRACE1.

Referenced by get_cardstatus(), SD_reset(), and SD_reset_inhibit_DAT().

Here is the caller graph for this function:

void SD_Send_appCMD ( UINT16  rca,
UINT8  cmd,
UINT32  cmd_argu,
UINT8  cmd_resp_type 
)

References CMD55, delay_ns(), DELAYFACTOR, SD_Send_CMD(), SD_wait_cmd_resp_check(), TRACE, TRACE3, and wResp_CMD.

Referenced by SD_init(), and set_SD_parameters().

Here is the call graph for this function:

Here is the caller graph for this function:

UINT8 SD_Send_CMD ( UINT8  cmd,
UINT32  cmd_argu,
UINT8  cmd_resp_type 
)

References SD_clear_int_1130(), SD_clear_int_1132(), SSD_REGRB, SSD_REGWB, TRACE, and TRACE3.

Referenced by Deselect_card(), get_cardstatus(), SD_base_init(), SD_Get_CSD(), SD_init(), SD_read(), SD_read_multiple(), SD_Send_appCMD(), SD_send_csd(), SD_write(), Select_card(), and set_SD_parameters().

Here is the call graph for this function:

Here is the caller graph for this function:

void SD_send_csd ( UINT16  rca  ) 

References CMD55, R2_Resp_CMD, and SD_Send_CMD().

Here is the call graph for this function:

UINT8 SD_wait_cmd_complete ( void   ) 

References SD_wait_cmd_complete_val().

Referenced by Deselect_card(), get_cardstatus(), SD_base_init(), SD_Get_CSD(), SD_init(), SD_read(), SD_read_multiple(), SD_write(), Select_card(), and set_SD_parameters().

Here is the call graph for this function:

Here is the caller graph for this function:

UINT8 SD_wait_cmd_complete_val ( UINT8  val  ) 

References SD_NOT_READY, SD_OK, SSD_REGRB, and TRACE.

Referenced by SD_read(), SD_wait_cmd_complete(), and SD_write().

Here is the caller graph for this function:

UINT8 SD_wait_cmd_resp_check ( void   ) 

References SD_NOT_READY, SD_OK, SSD_REGRB, and TRACE.

Referenced by get_cardstatus(), SD_Get_CSD(), SD_init(), SD_read(), SD_Send_appCMD(), and Select_card().

Here is the caller graph for this function:

UINT8 SD_write ( SDCardData sdcd,
UINT32  LBA_address,
const UINT8 buf,
UINT8  count 
)
UINT8 SD_write_multiple ( SDCardData sdcd,
UINT32  LBA_address,
const UINT8 buf,
UINT8  count 
)
UINT8 SD_xfer512bytes ( UINT32  address  ) 
UINT8 Select_card ( SDCardData sdcd  ) 

References CMD7, cmd_check, r1b_resp, SDCardData::rca, SD_clear_int(), SD_clear_int_ff(), SD_Send_CMD(), SD_wait_cmd_complete(), and SD_wait_cmd_resp_check().

Referenced by Init_SD().

Here is the call graph for this function:

Here is the caller graph for this function:

UINT8 set_SD_parameters ( UINT16  rca  ) 

References ACMD6, CMD16, cmd_check, r1_resp, SD_Send_appCMD(), SD_Send_CMD(), SD_wait_cmd_complete(), and SSD_REGWB.

Referenced by Init_SD().

Here is the call graph for this function:

Here is the caller graph for this function:

UINT8 Show_SD_Content ( void   ) 
Generated on Wed Mar 23 11:08:32 2011 for Omnima LCD by  doxygen 1.6.3