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

Function sdio_initialize_function

components/drivers/sdio/dev_sdio.c:693–741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

691}
692
693static rt_int32_t sdio_initialize_function(struct rt_mmcsd_card *card,
694 rt_uint32_t func_num)
695{
696 rt_int32_t ret;
697 struct rt_sdio_function *func;
698
699 RT_ASSERT(func_num <= SDIO_MAX_FUNCTIONS);
700
701 func = rt_malloc(sizeof(struct rt_sdio_function));
702 if (!func)
703 {
704 LOG_E("malloc rt_sdio_function failed");
705 ret = -RT_ENOMEM;
706 goto err;
707 }
708 rt_memset(func, 0, sizeof(struct rt_sdio_function));
709
710 func->card = card;
711 func->num = func_num;
712
713 ret = sdio_read_fbr(func);
714 if (ret)
715 goto err1;
716
717 ret = sdio_read_cis(func);
718 if (ret)
719 goto err1;
720
721 /*
722 * product/manufacturer id is optional for function CIS, so
723 * copy it from the card structure as needed.
724 */
725 if (func->product == 0)
726 {
727 func->manufacturer = card->cis.manufacturer;
728 func->product = card->cis.product;
729 }
730
731 card->sdio_function[func_num] = func;
732
733 return 0;
734
735err1:
736 sdio_free_cis(func);
737 rt_free(func);
738 card->sdio_function[func_num] = RT_NULL;
739err:
740 return ret;
741}
742
743static rt_int32_t sdio_set_highspeed(struct rt_mmcsd_card *card)
744{

Callers 1

sdio_init_cardFunction · 0.85

Calls 6

rt_mallocFunction · 0.85
rt_memsetFunction · 0.85
sdio_free_cisFunction · 0.85
rt_freeFunction · 0.85
sdio_read_fbrFunction · 0.70
sdio_read_cisFunction · 0.70

Tested by

no test coverage detected