| 78 | } |
| 79 | |
| 80 | static void rthw_sdctrl_transfer_by_dma(ft_sdctrl_class_t *class_p, struct mmcsd_pkg *pkg) |
| 81 | { |
| 82 | struct rt_mmcsd_data *data; |
| 83 | struct rt_mmcsd_cmd *cmd; |
| 84 | u32 rasp; |
| 85 | u32 *buff; |
| 86 | FtsdCtrl_t *ft_sdctrl_p; |
| 87 | |
| 88 | if ((RT_NULL == class_p)) |
| 89 | { |
| 90 | LOG_E("rthw_sdctrl_transfer_by_dma invalid class_p"); |
| 91 | return; |
| 92 | } |
| 93 | ft_sdctrl_p = &class_p->ft_sdctrl; |
| 94 | |
| 95 | if ((RT_NULL == pkg)) |
| 96 | { |
| 97 | LOG_E("rthw_sdctrl_transfer_by_dma invalid args"); |
| 98 | return; |
| 99 | } |
| 100 | |
| 101 | data = pkg->cmd->data; |
| 102 | if (RT_NULL == data) |
| 103 | { |
| 104 | LOG_E("rthw_sdctrl_transfer_by_dma invalid args"); |
| 105 | return; |
| 106 | } |
| 107 | |
| 108 | buff = pkg->buff; |
| 109 | if (RT_NULL == buff) |
| 110 | { |
| 111 | LOG_E("rthw_sdctrl_transfer_by_dma invalid args"); |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | cmd = pkg->cmd; |
| 116 | rasp = resp_type(pkg->cmd); |
| 117 | rasp = rthw_sdctrl_rasp2type(rasp); |
| 118 | |
| 119 | if (data->flags & DATA_DIR_WRITE) |
| 120 | { |
| 121 | #ifdef BSP_SDC_DEBUG_PRINT |
| 122 | rt_kprintf("DATA_DIR_WRITE %x \r\n", cmd->arg); |
| 123 | #endif |
| 124 | FCache_cpuDcacheClean(buff, data->blks * data->blksize); |
| 125 | |
| 126 | /* data, card, blk: card : data + blk */ |
| 127 | FSdCtrl_WriteData(ft_sdctrl_p, (UINTPTR)buff, cmd->arg, data->blks); |
| 128 | cmd->err = FSdCtrl_WaitCmdEnd(ft_sdctrl_p, (pFtsdCtrl_delayTimer_t)rthw_sdctrl_delay, rasp, cmd->resp); |
| 129 | |
| 130 | #ifdef BSP_SDC_DEBUG_PRINT |
| 131 | for (int i = 0; i < 4; i++) |
| 132 | { |
| 133 | rt_kprintf("cmdRsp[%d] %x \r\n", i, cmd->resp[i]); |
| 134 | } |
| 135 | Ft_DumpHexWord(buff, 256); |
| 136 | #endif |
| 137 | FSdCtrl_WaitWriteDataEnd(ft_sdctrl_p, (pFtsdCtrl_delayTimer_t)rthw_sdctrl_delay, data->blks); |
no test coverage detected