/* Read RCA (relative card address) of SD card.  */
static int sd_get_rca(uint32_t instance)
/* Read RCA (relative card address) of SD card.  */
static int sd_get_rca(uint32_t instance)
{
    command_t cmd;
    int port, card_state, status = FAIL;
    command_response_t response;
    port = card_get_port(instance);
    if (port == USDHC_NUMBER_PORTS) {
        printf("Base address: 0x%x not in address table.\n", REGS_USDHC_BASE(instance));
        return status;
    }
    card_cmd_config(&cmd, CMD3, NO_ARG, READ, RESPONSE_48, DATA_PRESENT_NONE, TRUE, TRUE);
    usdhc_printf("Send CMD3.\n");
    if (host_send_cmd(instance, &cmd) == SUCCESS) {
        response.format = RESPONSE_48;
        host_read_response(instance, &response);
        usdhc_device[port].rca = response.cmd_rsp0 >> RCA_SHIFT;
        card_state = CURR_CARD_STATE(response.cmd_rsp0);
        if (card_state == IDENT) {
            status = SUCCESS;
        }
    }
    return status;
}