MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rthw_sdctrl_create

Function rthw_sdctrl_create

bsp/ft2004/drivers/drv_sdctrl.c:550–576  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

548}
549
550static rt_err_t rthw_sdctrl_create(ft_sdctrl_class_t *class_p)
551{
552 struct rt_mmcsd_host *host;
553
554 host = mmcsd_alloc_host();
555 if (host == RT_NULL)
556 {
557 LOG_E("L:%d F:%s mmcsd alloc host fail");
558 return -RT_ENOMEM;
559 }
560
561 class_p->ft_sdctrl.config = *(FSdCtrl_Config_t *)FSdCtrl_LookupConfig(0);
562 rt_event_init(&class_p->event, "sdctrl", RT_IPC_FLAG_FIFO);
563 rt_mutex_init(&class_p->mutex, "sdctrl", RT_IPC_FLAG_PRIO);
564
565 class_p->host = host;
566 host->ops = &ops;
567 /* range of sd work speed */
568 host->freq_min = 400 * 1000;
569 host->freq_max = 48 * 1000000;
570 host->valid_ocr = 0X00FFFF80; /* The voltage range supported is 1.65v-3.6v */
571 host->flags = MMCSD_BUSWIDTH_4;
572 host->private_data = class_p;
573 /* ready to change */
574
575 return RT_EOK;
576}
577
578int rthw_sdctrl_init(void)
579{

Callers 1

rthw_sdctrl_initFunction · 0.85

Calls 4

mmcsd_alloc_hostFunction · 0.85
FSdCtrl_LookupConfigFunction · 0.85
rt_event_initFunction · 0.85
rt_mutex_initFunction · 0.85

Tested by

no test coverage detected