Lines Matching refs:slot
110 static void sdmmc_host_clock_update_command(int slot) in sdmmc_host_clock_update_command() argument
114 .card_num = slot, in sdmmc_host_clock_update_command()
120 sdmmc_host_start_command(slot, cmd_val, 0); in sdmmc_host_clock_update_command()
139 esp_err_t sdmmc_host_set_card_clk(int slot, uint32_t freq_khz) in sdmmc_host_set_card_clk() argument
141 if (!(slot == 0 || slot == 1)) { in sdmmc_host_set_card_clk()
147 SDMMC.clkena.cclk_enable &= ~BIT(slot); in sdmmc_host_set_card_clk()
148 sdmmc_host_clock_update_command(slot); in sdmmc_host_set_card_clk()
169 slot, host_div, card_div, in sdmmc_host_set_card_clk()
173 switch(slot) { in sdmmc_host_set_card_clk()
184 sdmmc_host_clock_update_command(slot); in sdmmc_host_set_card_clk()
187 SDMMC.clkena.cclk_enable |= BIT(slot); in sdmmc_host_set_card_clk()
188 SDMMC.clkena.cclk_low_power |= BIT(slot); in sdmmc_host_set_card_clk()
189 sdmmc_host_clock_update_command(slot); in sdmmc_host_set_card_clk()
204 esp_err_t sdmmc_host_start_command(int slot, sdmmc_hw_cmd_t cmd, uint32_t arg) { in sdmmc_host_start_command() argument
205 if (!(slot == 0 || slot == 1)) { in sdmmc_host_start_command()
208 if ((SDMMC.cdetect.cards & BIT(slot)) != 0) { in sdmmc_host_start_command()
211 if (cmd.data_expected && cmd.rw && (SDMMC.wrtprt.cards & BIT(slot)) != 0) { in sdmmc_host_start_command()
218 cmd.card_num = slot; in sdmmc_host_start_command()
311 esp_err_t sdmmc_host_init_slot(int slot, const sdmmc_slot_config_t* slot_config) in sdmmc_host_init_slot() argument
316 if (!(slot == 0 || slot == 1)) { in sdmmc_host_init_slot()
324 sdmmc_host_pullup_en(slot, slot_config->width); in sdmmc_host_init_slot()
331 const sdmmc_slot_info_t* pslot = &sdmmc_slot_info[slot]; in sdmmc_host_init_slot()
339 s_slot_width[slot] = slot_width; in sdmmc_host_init_slot()
400 esp_err_t ret = sdmmc_host_set_card_clk(slot, 400); in sdmmc_host_init_slot()
404 ret = sdmmc_host_set_bus_width(slot, 1); in sdmmc_host_init_slot()
443 esp_err_t sdmmc_host_set_bus_width(int slot, size_t width) in sdmmc_host_set_bus_width() argument
445 if (!(slot == 0 || slot == 1)) { in sdmmc_host_set_bus_width()
448 if (sdmmc_slot_info[slot].width < width) { in sdmmc_host_set_bus_width()
451 const uint16_t mask = BIT(slot); in sdmmc_host_set_bus_width()
459 configure_pin(sdmmc_slot_info[slot].d3_gpio); in sdmmc_host_set_bus_width()
463 configure_pin(sdmmc_slot_info[slot].d3_gpio); in sdmmc_host_set_bus_width()
467 ESP_LOGD(TAG, "slot=%d width=%d", slot, width); in sdmmc_host_set_bus_width()
471 size_t sdmmc_host_get_slot_width(int slot) in sdmmc_host_get_slot_width() argument
473 assert( slot == 0 || slot == 1 ); in sdmmc_host_get_slot_width()
474 return s_slot_width[slot]; in sdmmc_host_get_slot_width()
477 esp_err_t sdmmc_host_set_bus_ddr_mode(int slot, bool ddr_enabled) in sdmmc_host_set_bus_ddr_mode() argument
479 if (!(slot == 0 || slot == 1)) { in sdmmc_host_set_bus_ddr_mode()
482 if (s_slot_width[slot] == 8 && ddr_enabled) { in sdmmc_host_set_bus_ddr_mode()
487 uint32_t mask = BIT(slot); in sdmmc_host_set_bus_ddr_mode()
495 ESP_LOGD(TAG, "slot=%d ddr=%d", slot, ddr_enabled ? 1 : 0); in sdmmc_host_set_bus_ddr_mode()
543 esp_err_t sdmmc_host_io_int_enable(int slot) in sdmmc_host_io_int_enable() argument
545 configure_pin(sdmmc_slot_info[slot].d1_gpio); in sdmmc_host_io_int_enable()
549 esp_err_t sdmmc_host_io_int_wait(int slot, TickType_t timeout_ticks) in sdmmc_host_io_int_wait() argument
559 SDMMC.intmask.sdio &= ~BIT(slot); /* Disable SDIO interrupt */ in sdmmc_host_io_int_wait()
560 SDMMC.rintsts.sdio = BIT(slot); in sdmmc_host_io_int_wait()
561 if (gpio_get_level(sdmmc_slot_info[slot].d1_gpio) == 0) { in sdmmc_host_io_int_wait()
568 SDMMC.intmask.sdio |= BIT(slot); /* Re-enable SDIO interrupt */ in sdmmc_host_io_int_wait()
622 esp_err_t sdmmc_host_pullup_en(int slot, int width) in sdmmc_host_pullup_en() argument
624 if (width > sdmmc_slot_info[slot].width) { in sdmmc_host_pullup_en()
629 gpio_pullup_en(sdmmc_slot_info[slot].cmd_gpio); in sdmmc_host_pullup_en()
630 gpio_pullup_en(sdmmc_slot_info[slot].d0_gpio); in sdmmc_host_pullup_en()
632 gpio_pullup_en(sdmmc_slot_info[slot].d1_gpio); in sdmmc_host_pullup_en()
633 gpio_pullup_en(sdmmc_slot_info[slot].d2_gpio); in sdmmc_host_pullup_en()
634 gpio_pullup_en(sdmmc_slot_info[slot].d3_gpio); in sdmmc_host_pullup_en()
637 gpio_pullup_en(sdmmc_slot_info[slot].d4_gpio); in sdmmc_host_pullup_en()
638 gpio_pullup_en(sdmmc_slot_info[slot].d5_gpio); in sdmmc_host_pullup_en()
639 gpio_pullup_en(sdmmc_slot_info[slot].d6_gpio); in sdmmc_host_pullup_en()
640 gpio_pullup_en(sdmmc_slot_info[slot].d7_gpio); in sdmmc_host_pullup_en()