* @brief This function send sdio request. * @param host rt_mmcsd_host * @param req request * @retval None */
| 228 | * @retval None |
| 229 | */ |
| 230 | static void rthw_sdctrl_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *req) |
| 231 | { |
| 232 | struct mmcsd_pkg pkg; |
| 233 | ft_sdctrl_class_t *class_p = host->private_data; |
| 234 | struct rt_mmcsd_data *data; |
| 235 | |
| 236 | RTHW_SDCTRL_LOCK(class_p); |
| 237 | if (req->cmd != RT_NULL) |
| 238 | { |
| 239 | rt_memset(&pkg, 0, sizeof(pkg)); |
| 240 | data = req->cmd->data; |
| 241 | pkg.cmd = req->cmd; |
| 242 | |
| 243 | if (pkg.cmd->cmd_code == 5 || pkg.cmd->cmd_code == 1) |
| 244 | { |
| 245 | rt_kprintf("cmd_code is not vaild %x \r\n", pkg.cmd->cmd_code); |
| 246 | pkg.cmd->err = -RT_EINVAL; |
| 247 | goto _exit; |
| 248 | } |
| 249 | |
| 250 | #ifdef BSP_SDC_DEBUG_PRINT |
| 251 | struct rt_mmcsd_cmd *cmd; |
| 252 | cmd = req->cmd; |
| 253 | LOG_E("CMD:%d ARG:0x%08x RES:%s%s%s%s%s%s%s%s%s rw:%c len:%d blksize:%d", |
| 254 | cmd->cmd_code, |
| 255 | cmd->arg, |
| 256 | resp_type(cmd) == RESP_NONE ? "NONE" : "", |
| 257 | resp_type(cmd) == RESP_R1 ? "R1" : "", |
| 258 | resp_type(cmd) == RESP_R1B ? "R1B" : "", |
| 259 | resp_type(cmd) == RESP_R2 ? "R2" : "", |
| 260 | resp_type(cmd) == RESP_R3 ? "R3" : "", |
| 261 | resp_type(cmd) == RESP_R4 ? "R4" : "", |
| 262 | resp_type(cmd) == RESP_R5 ? "R5" : "", |
| 263 | resp_type(cmd) == RESP_R6 ? "R6" : "", |
| 264 | resp_type(cmd) == RESP_R7 ? "R7" : "", |
| 265 | data ? (data->flags & DATA_DIR_WRITE ? 'w' : 'r') : '-', |
| 266 | data ? data->blks * data->blksize : 0, |
| 267 | data ? data->blksize : 0); |
| 268 | #endif |
| 269 | |
| 270 | if (data != RT_NULL) |
| 271 | { |
| 272 | rt_uint32_t size = data->blks * data->blksize; |
| 273 | |
| 274 | RT_ASSERT(size <= SDCTR_BUFF_SIZE); |
| 275 | pkg.buff = data->buf; |
| 276 | if ((rt_uint32_t)data->buf & (SDCTR_ALIGN_LEN - 1)) |
| 277 | { |
| 278 | pkg.buff = cache_buf; |
| 279 | if (data->flags & DATA_DIR_WRITE) |
| 280 | { |
| 281 | rt_memcpy(cache_buf, data->buf, size); |
| 282 | } |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | rthw_sdctrl_send_command(class_p, &pkg); |
| 287 |
nothing calls this directly
no test coverage detected