⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdmmc.h

📁 intel xscale pxa270的完整wince4.2 BSP包
💻 H
📖 第 1 页 / 共 3 页
字号:
        unsigned CSD_Copy : 1;
        unsigned CSD_FileFmtGrp : 1;

        unsigned CSD_Error : 1;
        unsigned CSD_CRC : 7;
} SDCSDFields;


typedef struct _sdCID
{
        unsigned manufact_ID : 8;       /* Manufacturer ID */
        unsigned OEM_ID0 : 16;          /* OEM/Application ID */
        unsigned product_name0 : 8;     /* Card product name */
        unsigned product_name1 : 16;
        unsigned product_name2 : 16;
        unsigned product_revision : 8;  /* Hardware and firmware revision */
        unsigned ser_numb0 :16;         /* serial number */
        unsigned ser_numb1 :16;
        unsigned stop_bit : 1;          /* Always 1 */
        unsigned crc7: 7;               /* CRC7 checksum */
        unsigned date_code : 8;         /* date manufacture */
} SDCIDFields;
#endif


typedef union _myCIDFields {
        MMCCIDFields mCID;      /* MMC card */
#if (USE_SD)
        SDCIDFields sCID;       /* SD card */
#endif
} CIDFields;

typedef union _myCSDFields {
        MMCCSDFields mCSD;      /* MMC card */
#if (USE_SD)
        SDCSDFields sCSD;       /* SD card */
#endif
} CSDFields;



#define SINGLE_BUS_WIDTH        1
#define DOUBLE_BUS_WIDTHH       2
#define QUARUPLE_BUS_WIDTH      4


#if (USE_SD)
/* SD Configuration register */
typedef struct _mySCR
{
        unsigned  sd_spec : 4;          /* SD specification */
        unsigned  scr_structure : 4;    /* SCR structure */
        unsigned  sd_bwidth : 4;        /* Data bus width */
        unsigned  sd_security : 3;      /* SD security */
        unsigned  sd_data_stat : 1;     /* Data status after erase */
        unsigned  scr_reserved0 : 2;
        unsigned  scr_reserved1 : 16;
        unsigned  card_manufacturer0 : 16; /* For manufacturer usage */
        unsigned  card_manufacturer1 : 16;
} SCRFields;

/* SD STATUS structure */
typedef struct _mySDSTATUS
{
        unsigned  sd_bwidth : 2;        /* Data bus width */
        unsigned  secured_mode : 1;     /* Secured mode */
        unsigned  sreserved0 : 5;       /* Reserved */
        unsigned  sreserved1 : 8;
        unsigned  sd_type : 16;
        unsigned  prt_size1 : 16;       /* Size of protected area */
        unsigned  prt_size2 : 16;
        UINT16    data[28];             /* reserved */
} SDSTATUSFields;

#endif /* (USE_SD) */



/*******************************************************************************
* Name: mmcCommandAndResponse
*
* Description:
*       Send command and get response
*
* Input:
*       PDEVICE_CONTROLLER pc
*       UINT32 Arg
*       UINT16 Cmd
*       UINT16 noBlocks
*       RESP_TYPE Resp
*
* Output:
*
* Return:
*       Completion code.
*
********************************************************************************/
MMC_CC mmcCommandAndResponse(PDEVICE_CONTROLLER pc, UINT32 Arg, UINT16 Cmd, UINT16 noBlocks, RESP_TYPE Resp );


/*******************************************************************************
* Name: MMCAnalysisResponse
*
* Description:
*       Analyze the response
*
* Input:
*       PDEVICE_CONTROLLER pc
*       RESP_TYPE Resp
*
* Output:
*
* Return:
*       Completion code.
*
********************************************************************************/
MMC_CC MMCAnalysisResponse( PDEVICE_CONTROLLER pc, RESP_TYPE Resp );



/*******************************************************************************
* Name: receive_data
*
* Description:
*       Handle all data transfer from the target (device) to host.
* Input:
*       PDEVICE_CONTROLLER      pc
*       UINT16  data_length     Length of data to transfer
*
* Output:
*
* Return:
*       Completion code.
*
********************************************************************************/
MMC_CC receive_data(PDEVICE_CONTROLLER pc, UINT16 data_length, UINT16 noBLocks, UINT16 xferMode);


/*******************************************************************************
* Name: send_data
*
* Description:
*       Handle all data transfer from the host to the target (device).
* Input:
*       PDEVICE_CONTROLLER      pc
*       UINT16  data_length     Length of data to transfer
*
* Output:
*
* Return:
*       Completion code.
*
********************************************************************************/
MMC_CC send_data(PDEVICE_CONTROLLER pc, UINT16 data_length, UINT16 noBlocks, UINT16 xferMode);

#if (USE_SD)
/*******************************************************************************
* Name: mmcSDApplCmd
*
* Description:
*       Handle all application commands
*
* Input:
*
* Output:
*       None.
*
* Returns:
*       Completion code
*
******************************************************************************/
MMC_CC mmcSDApplCmd(PDEVICE_CONTROLLER pc, UCHAR *buff, ULONG multipp, UINT16 noBlocks, UINT16 RCA, RESP_TYPE resp, UINT16 Cmd);
#endif

/*******************************************************************************
* Name: mmcReset
*
* Description:
*       Resets the SanDisk card and the  hardware.  It must be called after
*       power before any other command can be used.
*
* Input:
*       SPI time base. The duration (in hundred nanoSeconds of the
*       SPI clock. It will be used for calculating various card and
*       communication time-outs.
*
* Output:
*       None.
*
* Returns:
*       Completion code
*
******************************************************************************/
MMC_CC mmcReset ( PDEVICE_CONTROLLER pc, ULONG setupInfo );


/***********************************************************************************
* Name: mmcIdentify
*
* Description:
*       Available in MMC mode only. Identifiies and sets and RCA
*       for an MMC card on the bus.
*
*       This function starts card identification cycle and (if a
*       valid response is received) sets the RCA of the identified
*       card. The CID of the identified card is returned to the
*       application.                                                                     
*
* Input:
*       RCA     A session address for the identified card.
* 
* Output:
*       None.
*
* Returns:
*       Completion code
*
************************************************************************************/
MMC_CC mmcIdentify ( PDEVICE_CONTROLLER pc, UINT32 cardType, UINT16 RCA );


/*******************************************************************************
* Name: mmcSetStandbyState
*
* Description:
*       In MMC mode A select card command is sent to the card.
*
* Input:
*       RCA             The address of the card to be deselected.
*
* Output:
*       None.
*
* Returns:
*       Completion code.
*
********************************************************************************/
MMC_CC mmcSetStandbyState ( PDEVICE_CONTROLLER pc, UINT16 RCA );

/*******************************************************************************
* Name: mmcSetXferState
*
* Description:
*       In MMC mode A select card command is sent to the card.
*
* Input:
*       RCA             The address of the card to be selected.
*
* Output:
*       None.
*
* Returns:
*       Completion code.
*
********************************************************************************/
MMC_CC mmcSetXferState ( PDEVICE_CONTROLLER pc, UINT16 RCA );

/*******************************************************************************
* mmcGetConfiguration  - Retrieves the card configuration parameters.
*                        (Card Specific Data)
*
* Input:
*       PDEVICE_CONTROLLER      pc.
*       UCHAR   mmcCSD
*                               
* Output:
*       UCHAR   *mmcCSD - Card configuration record.
*
* Returns:
*       Completion code
*
******************************************************************************/
MMC_CC mmcGetConfiguration ( PDEVICE_CONTROLLER pc, UCHAR *mmcCSD, UINT16 RCA );


/*******************************************************************************
* mmcGetCardIdentification  - Retrieves the card Identification parameters.
*                             (Card Identification Data)
*
* output:     *mmcIdent - Card Identification record.
*
* returns:    completion code
*
******************************************************************************/
MMC_CC mmcGetCardIdentification( PDEVICE_CONTROLLER pc, UCHAR *mmcIdent, UINT16 RCA );


/*******************************************************************************
* mmcSetTempWP  -       Set new configuration to CSD register.
*
* input:                RCA and parameters for send to structure CSD
*
* output:               struct FieldCSD
*
* returns:              completion code
*
******************************************************************************/
MMC_CC mmcSetTempWP( PDEVICE_CONTROLLER pc, UINT16 RCA, SDBOOL temp_WP );


MMC_CC mmcBlkLengthConfiguration( PDEVICE_CONTROLLER pc, UINT16 RCA );

/* #if (!USE_MULTI) */
/*******************************************************************************
* Name: mmcRead       -       Reads one card sector
*
* Input:
*       PDEVICE_CONTROLLER      pc
*       UINT16  RCA             Card address
*       ULONG   dataAddress     Sector address
*
* Output:
*       sector data
*
* Returns:
*       Completion code
*
******************************************************************************/
MMC_CC mmcRead ( PDEVICE_CONTROLLER pc, ULONG dataAddress, UINT16 RCA, UINT16 noBlocks );

/*******************************************************************************
* mmcWrite      -       Writes one card sector
*
* Input:
*       PDEVICE_CONTROLLER      pc
*       UINT16  RCA             Card address
*       ULONG   dataAddress     Sector address
*
* Output:
*       None.
*
* Returns:      completion code
*
*****************************************************************************/
MMC_CC mmcWrite ( PDEVICE_CONTROLLER pc, ULONG dataAddress, UINT16 RCA, UINT16 noBlocks );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -