Lines Matching full:cmd

68 static esp_err_t start_command_read_blocks(slot_info_t *slot, sdspi_hw_cmd_t *cmd,
71 static esp_err_t start_command_write_blocks(slot_info_t *slot, sdspi_hw_cmd_t *cmd,
74 static esp_err_t start_command_default(slot_info_t *slot, int flags, sdspi_hw_cmd_t *cmd);
76 static esp_err_t shift_cmd_response(sdspi_hw_cmd_t *cmd, int sent_bytes);
445 esp_err_t sdspi_host_start_command(sdspi_dev_handle_t handle, sdspi_hw_cmd_t *cmd, void *data, in sdspi_host_start_command() argument
455 // save some parts of cmd, as its contents will be overwritten in sdspi_host_start_command()
456 int cmd_index = cmd->cmd_index; in sdspi_host_start_command()
458 memcpy(&cmd_arg, cmd->arguments, sizeof(cmd_arg)); in sdspi_host_start_command()
460 …ESP_LOGV(TAG, "%s: slot=%i, CMD%d, arg=0x%08"PRIx32" flags=0x%x, data=%p, data_size=%"PRIu32" crc=… in sdspi_host_start_command()
461 __func__, handle, cmd_index, cmd_arg, flags, data, data_size, cmd->crc7); in sdspi_host_start_command()
480 … ret = start_command_write_blocks(slot, cmd, data, data_size, multi_block, stop_transmission); in sdspi_host_start_command()
482 ret = start_command_read_blocks(slot, cmd, data, data_size, stop_transmission); in sdspi_host_start_command()
485 ret = start_command_default(slot, flags, cmd); in sdspi_host_start_command()
493 ESP_LOGD(TAG, "%s: cmd=%d error=0x%x", __func__, cmd_index, ret); in sdspi_host_start_command()
504 static esp_err_t start_command_default(slot_info_t *slot, int flags, sdspi_hw_cmd_t *cmd) in start_command_default() argument
527 .tx_buffer = cmd, in start_command_default()
528 .rx_buffer = cmd, in start_command_default()
531 if (cmd->cmd_index == MMC_STOP_TRANSMISSION) { in start_command_default()
533 cmd->r1 = 0xff; in start_command_default()
542 cmd->r1 = 0x00; in start_command_default()
546 ret = shift_cmd_response(cmd, cmd_size); in start_command_default()
550 ret = poll_busy(slot, cmd->timeout_ms, no_use_polling); in start_command_default()
638 static esp_err_t shift_cmd_response(sdspi_hw_cmd_t* cmd, int sent_bytes) in shift_cmd_response() argument
640 uint8_t* pr1 = &cmd->r1; in shift_cmd_response()
650 memcpy(&cmd->r1, pr1, copy_bytes); in shift_cmd_response()
698 static esp_err_t start_command_read_blocks(slot_info_t *slot, sdspi_hw_cmd_t *cmd, in start_command_read_blocks() argument
703 .tx_buffer = cmd, in start_command_read_blocks()
704 .rx_buffer = cmd, in start_command_read_blocks()
711 uint8_t* cmd_u8 = (uint8_t*) cmd; in start_command_read_blocks()
716 * This loop searches for the response and writes it to cmd->r1. in start_command_read_blocks()
718 while ((cmd->r1 & SD_SPI_R1_NO_RESPONSE) != 0 && pre_scan_data_size > 0) { in start_command_read_blocks()
719 cmd->r1 = *pre_scan_data_ptr; in start_command_read_blocks()
723 if (cmd->r1 & SD_SPI_R1_NO_RESPONSE) { in start_command_read_blocks()
744 … ret = poll_data_token(slot, cmd_u8 + SDSPI_CMD_R1_SIZE, &extra_data_size, cmd->timeout_ms); in start_command_read_blocks()
810 make_hw_cmd(MMC_STOP_TRANSMISSION, 0, cmd->timeout_ms, &stop_cmd); in start_command_read_blocks()
818 ret = poll_busy(slot, cmd->timeout_ms, use_polling); in start_command_read_blocks()
831 static esp_err_t start_command_write_blocks(slot_info_t *slot, sdspi_hw_cmd_t *cmd, in start_command_write_blocks() argument
844 .tx_buffer = cmd, in start_command_write_blocks()
845 .rx_buffer = cmd, in start_command_write_blocks()
853 ret = shift_cmd_response(cmd, send_bytes); in start_command_write_blocks()
927 ret = poll_busy(slot, cmd->timeout_ms, no_use_polling); in start_command_write_blocks()
950 ret = poll_busy(slot, cmd->timeout_ms, use_polling); in start_command_write_blocks()