?? sd_includes.h
字號:
/*********************************************************************
(c) copyright Freescale Semiconductor Hong Kong Ltd 2004
ALL RIGHTS RESERVED
*********************************************************************
SD Driver Module for S12 MCUs
*********************************************************************
File: sd_include.h
Description: Define my System Configuration & Compiler Options.
Date: May. 2003
Author: Taine Chang
********************************************************************/
#include "FreescaleDef.h" // get my Constant & Type definitions.
#ifndef _H_SD_INCLUDES_ // To avoid multiple defining
#define _H_SD_INCLUDES_ // start of Constants & Macros definition
#include "Hidef.h"
//#include "sd_def.h"
//#pragma CODE_SEG default // the same as MS-USB project
// ======================================================
//
// Register Definition for MS Module
//
// ======================================================
#pragma DATA_SEG DEFAULT
//-----------------------------
// additional SD codes
extern muint8 gSD_ECR_flag;
// ======================================================
//
// Register Definition for SDHC Module
//
// ======================================================
void SD_AllSendCID(void);
void SD_AllSendRCA(void);
void SD_SendCSD(void);
void SD_SelectSDcard(muint16 kSD_RCA);
void SD_SetBlockLength(muint16 SD_BlockLength);
void SD_SetBusWidth(muint16 SD_BusWidth);
muint8 SD_CheckStatus(void);
muint8 SD_CheckWriteProtect(void);
muint8 SD_TEST(void);
muint32 SD_CheckResponse(void);
void SD_SendCommand(muint16 SD_CMDNo, muint16 SD_argh, muint16 SD_argl, muint16 SD_RespNo);
mErrorCode SD_LBASDCommand(muint8 Block);
mErrorCode SD_SCSIReadCapacity(void);
// ==================================================================
// SD_PreInit() -
//
// Step 1. To initialize the SD Driver module.
// ==================================================================
extern void SD_PreInit(void);
// ==================================================================
// SD_Identification() -
//
// Step 2.To identify whether the card is SD or MMC
//
// Returned value list:
//
// 0: no error
// 1: an error occurred while SD_Identification
// If the card is MMC: gSD_SDcard=0, 1 bit mode
// If the card is SD : gSD_SDcard=1, switch to 4-bits mode
//
// ==================================================================
extern muint8 SD_Identification(void);
// ==================================================================
// SD_PreInit() -
//
// Step 3. To initialize the SD Driver module.
//
// Returned value list:
// 0: no error
// 1: An error happened while SD_AllSendCID
// 2: An error happened while SD_AllSendRCA
// 3: An error happened while SD_SendCSD
// 4: An error happened while SD_SelectSDcard
// 5: An error happened while SD_SetBlockLength
// 6: An error happened while SD_SetBusWidth
//
// ==================================================================
extern muint8 SD_Init(void);
// ==================================================================
// SD_EraseBlock() -
//
// Input - SD_EraseBlock(Start block address, number of erase blocks) 32-bits block addres (byte)
// example:
// SD_EraseBlock(1024, 1)..............erase 1 block starts from byte address 1024
// SD_EraseBlock(1024, 6)..............erase 6 blocks starts from byte address 1024
//
//
// To erase a block of SD flash
// ==================================================================
extern void SD_EraseBlock(muint32 SD_BlockAddrsStart, muint8 SD_BlockNumbers);
// ==================================================================
// SD_QUE_WriteMultipleBlock() -
//
// Input- SD_QUE_WriteMultipleBlock(Start address, number of write blocks);
// example:
// SD_QUE_WriteMultipleBlock(1024, 1)...........write 1 block of data starts from address 1024
// SD_QUE_WriteMultipleBlock(1024, 6)...........write 6 blocks of data starts from address 1024
//
// To write multiple blocks of SD flash
// ==================================================================
//mErrorCode SD_QUE_WriteSingleBlockFromQram2Card(muint32 SD_BlockAddress);
mErrorCode SD_QUE_WriteMultipleBlock(muint32 SD_BlockAddress, muint16 SD_NoOfBlocks);
mErrorCode SD_QUE_ReadMultipleBlock(muint32 SD_BlockAddress, muint16 SD_BlockNumber);
//mErrorCode SD_QUE_WriteSingleBlock(muint32 SD_BlockAddress);
mErrorCode SD_QUE_ReadSingleBlock(muint32 SD_BlockAddress);
mErrorCode SD_QUE_ReadSingleBlock_FS(muint32 SD_BlockAddress);
mErrorCode SD_QUE_WriteSingleBlockFromQram2Card();
muint8 SD_LBACommand1(muint8 Block, muint8 *pLBA, muint8 QueBuffer);
#define kSDNoError 0x00 // no specific sense error found
//------------------------
// additional SD codes
// copy from ms_def.h
struct SD_bits{
unsigned BIT8:1; // MSB first
unsigned BIT9:1;
unsigned BIT10:1;
unsigned BIT11:1;
unsigned BIT12:1;
unsigned BIT13:1;
unsigned BIT14:1;
unsigned BIT15:1;
unsigned BIT0:1;
unsigned BIT1:1;
unsigned BIT2:1;
unsigned BIT3:1;
unsigned BIT4:1;
unsigned BIT5:1;
unsigned BIT6:1;
unsigned BIT7:1;
} ;
struct SD_bits56{
unsigned BIT8:1; // MSB first
unsigned BIT9:1;
unsigned BIT10:1;
unsigned BIT11:1;
unsigned BIT12:1;
unsigned BIT13:1;
unsigned BIT14:1;
unsigned BIT15:1;
unsigned BIT0:1;
unsigned BIT1:1;
unsigned BIT2:1;
unsigned BIT3:1;
unsigned BIT4:1;
unsigned BIT56:2;
unsigned BIT7:1;
} ;
struct SD_bits02{
unsigned BIT8:1; // MSB first
unsigned BIT9:1;
unsigned BIT10:1;
unsigned BIT11:1;
unsigned BIT12:1;
unsigned BIT13:1;
unsigned BIT14:1;
unsigned BIT15:1;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -