本文整理汇总了C++中SD_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ SD_Init函数的具体用法?C++ SD_Init怎么用?C++ SD_Init使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SD_Init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SDCard_Config
/**
* @brief SD Card Configuration.
* @param None
* @retval None
*/
static void SDCard_Config(void)
{
uint32_t error = 0;
uint32_t counter = 0x100;
/* Configure the IO Expander */
if (IOE16_Config() != IOE16_OK)
{
/* Set the Text Color */
LCD_SetTextColor(LCD_COLOR_RED);
LCD_DisplayStringLine(LCD_LINE_6, (uint8_t*)" IO Expander FAILED ");
LCD_DisplayStringLine(LCD_LINE_7, (uint8_t*)" Please Reset the board and ");
LCD_DisplayStringLine(LCD_LINE_8, (uint8_t*)" Start again... ");
while(1)
{
}
}
/* SDCard initialisation */
SD_Init();
/* Configure the SD detect pin */
IOE16_IOPinConfig(SD_DETECT_PIN, Direction_IN);
if (SD_Detect() == SD_NOT_PRESENT)
{
/* Set the Text Color */
LCD_SetTextColor(LCD_COLOR_RED);
LCD_DisplayStringLine(LCD_LINE_8, (uint8_t*)" Please insert SD Card. ");
while (SD_Detect() == SD_NOT_PRESENT)
{
}
}
/* FAT Initialization */
do
{
/* SDCARD Initialisation */
error = Storage_Init();
}
while ((error != 0) && (counter-- != 0));
/* SD Card not formatted */
if (counter == 0)
{
/* Set the Text Color */
LCD_SetTextColor(LCD_COLOR_RED);
LCD_DisplayStringLine(LCD_LINE_7, (uint8_t*)" SD Card not formatted. ");
LCD_DisplayStringLine(LCD_LINE_8, (uint8_t*)" Reprogram your card. ");
while (1)
{
}
}
}
示例2: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
files (startup_stm32f40_41xxx.s/startup_stm32f427_437xx.s)
before to branch to application main. To reconfigure the default setting
of SystemInit() function, refer to system_stm32f4xx.c file
*/
/* Initialize LEDs available on EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
STM_EVAL_LEDInit(LED3);
STM_EVAL_LEDInit(LED4);
/* NVIC Configuration */
NVIC_Configuration();
/*------------------------------ SD Init ---------------------------------- */
if((Status = SD_Init()) != SD_OK)
{
STM_EVAL_LEDOn(LED4);
}
while((Status == SD_OK) && (uwSDCardOperation != SD_OPERATION_END) && (SD_Detect()== SD_PRESENT))
{
switch(uwSDCardOperation)
{
/*-------------------------- SD Erase Test ---------------------------- */
case (SD_OPERATION_ERASE):
{
SD_EraseTest();
uwSDCardOperation = SD_OPERATION_BLOCK;
break;
}
/*-------------------------- SD Single Block Test --------------------- */
case (SD_OPERATION_BLOCK):
{
SD_SingleBlockTest();
uwSDCardOperation = SD_OPERATION_MULTI_BLOCK;
break;
}
/*-------------------------- SD Multi Blocks Test --------------------- */
case (SD_OPERATION_MULTI_BLOCK):
{
SD_MultiBlockTest();
uwSDCardOperation = SD_OPERATION_END;
break;
}
}
}
/* Infinite loop */
while (1)
{
}
}
示例3: FATFS_SD_SDIO_disk_initialize
DSTATUS FATFS_SD_SDIO_disk_initialize(void)
{
Stat = STA_NOINIT;
/* Configure the SDCARD device */
if (SD_Init() == MSD_OK) Stat &= ~STA_NOINIT;
else Stat |= STA_NOINIT;
return Stat;
}
示例4: Storage_Init
/**
* @brief SDCARD Initialisation for FatFs
* @param None
* @retval err : Error status (0=> success, 1=> fail)
*/
uint32_t Storage_Init(void)
{
SD_Init();
/****************** FatFs Volume Acess ******************************/
if (f_mount(0, &fs))
{
return 1;
}
return 0;
}
示例5: init
/*
This function will be called one time, when the hardware object is
initialized by efs init().
This code should bring the hardware in a ready to use state.
Optionally but recommended you should fill in the file->sectorCount feld
with the number of sectors. This field is used to validate sectorrequests.
*/
esint8 if_initInterface(hwInterface* file, eint8* opts)
{
if (SD_Init() == SD_FALSE)
return (-1);
if (mci_read_configuration() == SD_FALSE)
return (-2);
file->sectorCount = CardConfig.sectorcnt;
return 0;
}
示例6: sdmmc_sdcard_init
void sdmmc_sdcard_init()
{
DEBUGPRINT(topScreen, "sdmmc_sdcard_init ", handelSD.error, 10, 20 + 2*8, RGB(40, 40, 40), RGB(208, 208, 208));
InitSD();
//SD_Init2();
//Nand_Init();
Nand_Init();
DEBUGPRINT(topScreen, "nand_res ", nand_res, 10, 20 + 3*8, RGB(40, 40, 40), RGB(208, 208, 208));
SD_Init();
DEBUGPRINT(topScreen, "sd_res ", sd_res, 10, 20 + 4*8, RGB(40, 40, 40), RGB(208, 208, 208));
}
示例7: disk_initialize
DSTATUS disk_initialize (
BYTE pdrv /* Physical drive nmuber (0..) */
)
{
DSTATUS stat;
int result;
//result = MMC_disk_initialize();
SD_Init();
return 0;
}
示例8: disk_initialize
/*-----------------------------------------------------------------------*/
DSTATUS disk_initialize (
BYTE pdrv /* Physical drive nmuber (0..) */
)
{
SD_Error Status;
Status = SD_Init();
if(Status == SD_OK)
return SD_OK;
else
return STA_NOINIT;
}
示例9: initialisePeripheral
SdioSecureDigitalCard::SdioSecureDigitalCard() {
Nvic::configureIrq(SDIO_IRQn);
errorProvider.clear();
// initialise the peripheral
initialisePeripheral();
// configure peripheral
SD_Init();
}
示例10: bsp_FSInit
u8 bsp_FSInit(void)
{
u8 res=0;
SD_Init();
res=f_mount(&fatfs_SDCARD,"0:/",1 );
if(res) return 1;
res=f_open(&file_sdif, "0:/Akey.bin",FA_OPEN_EXISTING|FA_WRITE|FA_READ);
if(res) return 2;
f_close(&file_sdif);
return 0;
}
示例11: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
file (startup_stm32f0xx.s) before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f0xx.c file
*/
/* Initialize Leds mounted on STM320518-EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
/* Initializes the SD/SPI communication */
Status = SD_Init();
/* If SD is responding */
if (Status == SD_RESPONSE_NO_ERROR)
{
/* Fill the buffer to send */
Fill_Buffer(Buffer_Block_Tx, BUFFERSIZE, 0x0);
/* Write block of 512 bytes on address 0 */
Status = SD_WriteBlock(Buffer_Block_Tx, 0, BUFFERSIZE);
/* Read block of 512 bytes from address 0 */
Status = SD_ReadBlock(Buffer_Block_Rx, 0, BUFFERSIZE);
/* Check the corectness of written dada */
TransferStatus = Buffercmp(Buffer_Block_Tx, Buffer_Block_Rx, BUFFERSIZE);
if (TransferStatus == PASSED)
{
/* OK: Turn on LD1 */
STM_EVAL_LEDOn(LED1);
}
else
{
/* Error: Turn on LD2 */
STM_EVAL_LEDOn(LED2);
}
}
else
{
/* Error: Turn on LD2 */
STM_EVAL_LEDOn(LED2);
}
while (1)
{
}
}
示例12: MOD_LibInit
/**
* @brief Initialize the middleware libraries and stacks
* @param None
* @retval None
*/
void MOD_LibInit(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
MOD_GetParam(GLOBAL_SETTINGS_MEM , &Global_Config.d32);
/* Force settings change to apply them */
Global_Config.b.Configuration_Changed = 1;
/* Starting USB Init. Process */
GL_State_Message((uint8_t *)"USB Host Starting. ");
/*Init USB Host */
USBH_Init(&USB_OTG_Core,
USB_OTG_FS_CORE_ID,
&USB_Host,
&USBH_MSC_cb,
&USBH_USR_cb);
GL_State_Message((uint8_t *)"USB Host Started.");
GL_State_Message((uint8_t *)"RTC and backup Starting. ");
/* Init RTC and Backup */
if ( RTC_Configuration() == 0)
{
GL_State_Message((uint8_t *)"RTC and backup Started.");
CONSOLE_LOG((uint8_t *)"[SYSTEM] RTC and backup Started.");
}
else
{
GL_State_Message((uint8_t *)"ERR : RTC could not be started.");
CONSOLE_LOG((uint8_t *)"[ERR] RTC start-up FAILED .");
}
NVIC_InitStructure.NVIC_IRQChannel = SDIO_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
SD_Init();
if ( f_mount( 1, &MSD_fatfs ) != FR_OK )
{
/* fatfs initialisation fails*/
CONSOLE_LOG((uint8_t *)"[FS] Cannot initialize FS on drive 1.");
}
else
{
CONSOLE_LOG((uint8_t *)"[FS] FS on drive 1 initialized.");
}
}
示例13: SH_Mngr
/*{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}
* Name: SH_Mngr
* Desc: Run Soil simulation. Will run the Duff or the Exp simulation
* code, based on presence of Duff.
* Note Duff Sim:
* The Fuel has to be run before coming here, because the Fuel
* calculates the Post Duff Depth which DUff Sim needs to run.
* Note Exp Heat:
* The Fuel has to be run before coming here, which should
* have detected the no Duff Depth/Load and run burnup which calculates
* the heat and time need by Exp Heat.
* Note-1: There use to be some Error_Window() type logic errors in the
* soil code, it would have been hard and not worth it to do them
* thru the functions so I did a global string.
* In: a_SI......
*
* Ret: 1 Ok, 0 Error
{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{**/
int WINAPI SH_Mngr (d_SI *a_SI, d_SO *a_SO, char cr_TmpFN[], char cr_ErrMes[])
{
d_SD s_SD;
d_SE s_SE;
char cr[40];
strcpy (gcr_SoiErr,"");
SO_Init (a_SO); /* Init the output struct */
if ( !xstrcmpi(a_SI->cr_BrnIg,"NO")) { /* Burnup ran & didn't ignite */
SHA_Init_0 (); /* so 0 out this arrary so that */
return 1; } /* 0s come out in the report */
SHA_Init (); /* Init the Soil Heat Temp Array*/
if ( a_SI->f_DufDepPre > 0 ) /* Prefire Duff depth determines*/
goto DuffSim; /* if we run Duff or Exp simulat*/
/*.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.*/
/* Do the Exp Heat, because there is no duff depth */
strcpy (a_SO->cr_Model,e_SM_ZDuff); /* tells what soil model */
if ( !SE_Init (a_SI, &s_SE, cr_ErrMes)) /* Ready the SE input struct */
return 0;
if ( !SE_Mngr (&s_SE,cr_TmpFN,cr_ErrMes)) /* Run it, makes Pt arrar& File */
return 0;
goto Load;
/*.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.*/
/* Do the Duff Simulation Modes */
DuffSim:
strcpy (a_SO->cr_Model,e_SM_Duff);
if ( !SD_ChkSoiDuf(a_SI->f_DufDepPre, a_SI->f_DufDepPos, cr_ErrMes) )
return 0;
if ( !SD_Init (&s_SD, a_SI, cr_ErrMes))
return 0;
/* Duff Sim is done when there is a Duff Depth to use....................... */
if ( !SD_Mngr(&s_SD,cr_TmpFN,cr_ErrMes)) /* Run Soil Duff Simulation */
return 0;
Load:
SO_Load (a_SI, a_SO); /* Get Soil Outputs */
if ( strcmp (gcr_SoiErr,"") ) { /* See Note-1 above */
strcpy (cr_ErrMes,gcr_SoiErr);
return 0; }
return 1;
}
示例14: MAL_GetStatus
/*******************************************************************************
* Function Name : MAL_GetStatus
* Description : Get status
* Input : None
* Output : None
* Return : None
*******************************************************************************/
uint16_t MAL_GetStatus (uint8_t lun)
{
// NAND_IDTypeDef NAND_ID;
uint32_t DeviceSizeMul = 0, NumberOfBlocks = 0;
if (lun == 0)
{
if (SD_Init() == SD_OK)
{
SD_GetCardInfo(&SDCardInfo);
SD_SelectDeselect((uint32_t) (SDCardInfo.RCA << 16));
DeviceSizeMul = (SDCardInfo.SD_csd.DeviceSizeMul + 2);
if(SDCardInfo.CardType == SDIO_HIGH_CAPACITY_SD_CARD)
{
Mass_Block_Count[0] = (SDCardInfo.SD_csd.DeviceSize + 1) * 1024;
}
else
{
NumberOfBlocks = ((1 << (SDCardInfo.SD_csd.RdBlockLen)) / 512);
Mass_Block_Count[0] = ((SDCardInfo.SD_csd.DeviceSize + 1) * (1 << DeviceSizeMul) << (NumberOfBlocks/2));
}
Mass_Block_Size[0] = 512;
Status = SD_SelectDeselect((uint32_t) (SDCardInfo.RCA << 16));
Status = SD_EnableWideBusOperation(SDIO_BusWide_4b);
if ( Status != SD_OK )
{
return MAL_FAIL;
}
Mass_Memory_Size[0] = Mass_Block_Count[0] * Mass_Block_Size[0];
return MAL_OK;
}
}
// else
// {
// FSMC_NAND_ReadID(&NAND_ID);
// if (NAND_ID.Device_ID != 0 )
// {
// /* only one zone is used */
// Mass_Block_Count[1] = NAND_ZONE_SIZE * NAND_BLOCK_SIZE * NAND_MAX_ZONE ;
// Mass_Block_Size[1] = NAND_PAGE_SIZE;
// Mass_Memory_Size[1] = (Mass_Block_Count[1] * Mass_Block_Size[1]);
// return MAL_OK;
// }
// }
return MAL_FAIL;
}
示例15: MAL_GetStatus
// Status = SD_SelectDeselect((uint32_t) (SDCardInfo.RCA << 16));
// Status = SD_EnableWideBusOperation(SDIO_BusWide_4b);
// if ( Status != SD_OK )
// return MAL_FAIL;
// Status = SD_SetDeviceMode(SD_DMA_MODE);
// if ( Status != SD_OK )
// return MAL_FAIL;
// Mass_Memory_Size[0] = Mass_Block_Count[0] * Mass_Block_Size[0];
// LED1 = 0;
// if (dis_mem == 0) //显示TF卡的容量 由于是周期性更新状态,所以,加了条件,只显示一次容量值
// {
// printf("\r\n Micro SD卡的容量是 %d MBytes\n" ,SDCardInfo.CardCapacity);
// dis_mem = 1;
// }
// return MAL_OK;
// }
// }
// LED1 = 0;
// return MAL_FAIL;
//}
u16 MAL_GetStatus (u8 lun)
{
uint32_t DeviceSizeMul = 0, NumberOfBlocks = 0;
switch (lun)
{
case 0:
if (dis_mem == 0) //显示TF卡的容量 由于是周期性更新状态,所以,加了条件,只显示一次容量值
{
if (SD_Init() == SD_OK)
{
SD_GetCardInfo(&SDCardInfo);
SD_SelectDeselect((uint32_t) (SDCardInfo.RCA << 16));
DeviceSizeMul = (SDCardInfo.SD_csd.DeviceSizeMul + 2);
if (SDCardInfo.CardType == SDIO_HIGH_CAPACITY_SD_CARD)
{
Mass_Block_Count[0] = (SDCardInfo.SD_csd.DeviceSize + 1) * 1024;
}
else
{
NumberOfBlocks = ((1 << (SDCardInfo.SD_csd.RdBlockLen)) / 512);
Mass_Block_Count[0] = ((SDCardInfo.SD_csd.DeviceSize + 1) * (1 << DeviceSizeMul) << (NumberOfBlocks / 2));
}
Mass_Block_Size[0] = 512;
Status = SD_SelectDeselect((uint32_t) (SDCardInfo.RCA << 16));
Status = SD_EnableWideBusOperation(SDIO_BusWide_4b);
if ( Status != SD_OK )
return MAL_FAIL;
Status = SD_SetDeviceMode(SD_DMA_MODE);
if ( Status != SD_OK )
return MAL_FAIL;
Mass_Memory_Size[0] = Mass_Block_Count[0] * Mass_Block_Size[0];
LED1 = 0;
// if (dis_mem == 0) //显示TF卡的容量 由于是周期性更新状态,所以,加了条件,只显示一次容量值
// {
printf("\r\n Micro SD卡的容量是 %lld MBytes\n" , SDCardInfo.CardCapacity >> 20);
dis_mem = 1;
// }
return MAL_OK;
}
dis_mem = 1;
}
return MAL_OK;
case 1:
return MAL_OK;
case 2:
return MAL_FAIL;
default:
return MAL_FAIL;
}