| 962 | } |
| 963 | |
| 964 | rt_int32_t init_sdio(struct rt_mmcsd_host *host, rt_uint32_t ocr) |
| 965 | { |
| 966 | rt_int32_t err; |
| 967 | rt_uint32_t current_ocr; |
| 968 | |
| 969 | RT_ASSERT(host != RT_NULL); |
| 970 | |
| 971 | if (ocr & 0x7F) |
| 972 | { |
| 973 | LOG_W("Card ocr below the defined voltage rang."); |
| 974 | ocr &= ~0x7F; |
| 975 | } |
| 976 | |
| 977 | if (ocr & VDD_165_195) |
| 978 | { |
| 979 | LOG_W("Can't support the low voltage SDIO card."); |
| 980 | ocr &= ~VDD_165_195; |
| 981 | } |
| 982 | |
| 983 | current_ocr = mmcsd_select_voltage(host, ocr); |
| 984 | |
| 985 | if (!current_ocr) |
| 986 | { |
| 987 | err = -RT_ERROR; |
| 988 | goto err; |
| 989 | } |
| 990 | |
| 991 | err = sdio_init_card(host, current_ocr); |
| 992 | if (err) |
| 993 | goto err; |
| 994 | |
| 995 | return 0; |
| 996 | |
| 997 | err: |
| 998 | |
| 999 | LOG_E("init SDIO card failed"); |
| 1000 | |
| 1001 | return err; |
| 1002 | } |
| 1003 | |
| 1004 | static void sdio_irq_thread(void *param) |
| 1005 | { |
no test coverage detected