/*
 * Copyright 2021 MindMotion Microelectronics Co., Ltd.
 * All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include "board_init.h"
#include "sdspi.h"

/*
 * Macros.
 */

/*
 * Variables.
 */

SDSPI_ApiRetStatus_Type app_sdspi_ret;
SDSPI_CardHandler_Type app_sdspi_card;
extern const SDSPI_Interface_Type board_sdspi_if;

/*
 * Declerations.
 */

/*
 * Functions.
 */
int main(void)
{
    uint8_t ch;

    BOARD_Init();

    printf("sdspi_basic example.\r\n");
#if 1
    app_sdspi_ret = SDSPI_Init(&app_sdspi_card, &board_sdspi_if);
    if (app_sdspi_ret != SDSPI_ApiRetStatus_Success)
    {
        printf("SDSPI_Init() fail: %d.\r\n", (unsigned)app_sdspi_ret);
        while (1);
    }
    printf("SDSPI_Init() done.\r\n");

    printf("card type: 0x%x\r\n", (unsigned)app_sdspi_card.cardType);
    printf("block count: %d\r\n", (unsigned)app_sdspi_card.blockCount);
#endif
    while (1)
    {
        ch = getchar();
        putchar(ch);
    }
}

/* EOF. */

