Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

sdmmc_host: support multiblock transfers

Change-Id: I6414028bbafd4ea4ef469f9a387f4bd52ec227e5

+37 -6
+34 -6
firmware/drivers/sdmmc_host.c
··· 677 677 if (start + count > host->cardinfo.numblocks) 678 678 goto out; 679 679 680 + int max_nr_blocks = MAX(host->config.max_nr_blocks, 1); 680 681 while (count > 0) 681 682 { 682 - /* TODO: multiple block transfers */ 683 - int xfer_count = 1; 683 + int xfer_count = count; 684 + if (xfer_count > max_nr_blocks) 685 + xfer_count = max_nr_blocks; 684 686 685 687 /* Set block length for non-HCS cards */ 686 688 if (!host->is_hcs_card) ··· 692 694 693 695 struct sdmmc_host_command cmd = { 694 696 .buffer = buf, 695 - .nr_blocks = 1, 697 + .nr_blocks = xfer_count, 696 698 .block_len = SD_BLOCK_SIZE, 697 699 .flags = SDMMC_RESP_SHORT | data_dir, 698 700 }; 699 701 700 - if (data_dir == SDMMC_DATA_WRITE) 701 - cmd.command = SD_WRITE_BLOCK; 702 + if (xfer_count > 1) 703 + { 704 + if (data_dir == SDMMC_DATA_WRITE) 705 + cmd.command = SD_WRITE_MULTIPLE_BLOCK; 706 + else 707 + cmd.command = SD_READ_MULTIPLE_BLOCK; 708 + } 702 709 else 703 - cmd.command = SD_READ_SINGLE_BLOCK; 710 + { 711 + if (data_dir == SDMMC_DATA_WRITE) 712 + cmd.command = SD_WRITE_BLOCK; 713 + else 714 + cmd.command = SD_READ_SINGLE_BLOCK; 715 + } 704 716 705 717 if (host->cardinfo.sd2plus) 706 718 cmd.argument = start; ··· 710 722 rc = sdmmc_host_submit_cmd(host, &cmd, NULL); 711 723 if (rc) 712 724 goto out; 725 + 726 + /* 727 + * NOTE: some controllers can send CMD12 automatically after 728 + * the end of a transfer, eg. X1000; it might be worth 729 + * supporting that via a feature flag. 730 + */ 731 + if (xfer_count > 1) 732 + { 733 + memset(&cmd, 0, sizeof(cmd)); 734 + cmd.command = SD_STOP_TRANSMISSION; 735 + cmd.flags = SDMMC_RESP_SHORT | SDMMC_RESP_BUSY; 736 + 737 + rc = sdmmc_host_submit_cmd(host, &cmd, NULL); 738 + if (rc) 739 + goto out; 740 + } 713 741 714 742 buf += xfer_count * SD_BLOCK_SIZE; 715 743 start += xfer_count;
+3
firmware/export/sdmmc_host.h
··· 207 207 uint32_t bus_widths; 208 208 uint32_t bus_clocks; 209 209 210 + /* Max number of blocks in a multiblock transfer */ 211 + int max_nr_blocks; 212 + 210 213 /* Set to true if the device is removable at runtime */ 211 214 bool is_removable; 212 215 };