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

#ifndef __BOARD_INIT_H__
#define __BOARD_INIT_H__

#include <stdio.h>
#include <stdint.h>

#include "hal_common.h"
#include "hal_rcc.h"
#include "hal_uart.h"
#include "hal_gpio.h"
#include "hal_spi.h"
#include "hal_i2s.h"
#include "hal_dma.h"
#include "hal_dma_request.h"

#include "clock_init.h"
#include "pin_init.h"

#include "audio_i2s_dma.h"

/* DEBUG UART. */
#define BOARD_DEBUG_UART_PORT           UART1
#define BOARD_DEBUG_UART_BAUDRATE       115200u
#define BOARD_DEBUG_UART_FREQ           CLOCK_APB2_FREQ

#define BOARD_AUDIO_I2S_PORT            SPI2
#define BOARD_AUDIO_DMA_PORT            DMA1
#define BOARD_AUDIO_DMA_CHN             DMA_REQ_DMA1_SPI2_TX
#define BOARD_AUDIO_DMA_IRQn            DMA1_CH5_IRQn
#define BOARD_AUDIO_DMA_IRQHandler      DMA1_CH5_IRQHandler

#define BOARD_SDSPI_TX_GPIO_PORT        GPIOC
#define BOARD_SDSPI_TX_GPIO_PIN         GPIO_PIN_12

#define BOARD_SDSPI_RX_GPIO_PORT        GPIOC
#define BOARD_SDSPI_RX_GPIO_PIN         GPIO_PIN_11

#define BOARD_SDSPI_CLK_GPIO_PORT       GPIOC
#define BOARD_SDSPI_CLK_GPIO_PIN        GPIO_PIN_10

#define BOARD_SDSPI_CS_GPIO_PORT        GPIOA
#define BOARD_SDSPI_CS_GPIO_PIN         GPIO_PIN_15

#define BOARD_SDSPI_SPI_PORT            SPI3

void BOARD_Init(void);

#endif /* __BOARD_INIT_H__ */
