4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-20 03:33:31 +08:00
Wayne Lin 4fcb87a8aa Support M2354 platform.
1. Add NuMaker-M2354 BSP.
2. Fix SLCD library and modify its demo.
2021-02-05 18:52:13 +08:00

52 lines
1.2 KiB
C

/**************************************************************************//**
*
* @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-6-15 YHKuo First version
*
******************************************************************************/
#ifndef __DRV_SPI_H__
#define __DRV_SPI_H__
#include <rtconfig.h>
#include <rtdevice.h>
#include <NuMicro.h>
#include <nu_bitutil.h>
#if defined(BSP_USING_SPI_PDMA)
#include <drv_pdma.h>
#endif
struct nu_spi
{
struct rt_spi_bus dev;
char *name;
SPI_T *spi_base;
uint32_t dummy;
#if defined(BSP_USING_SPI_PDMA)
int16_t pdma_perp_tx;
int8_t pdma_chanid_tx;
int16_t pdma_perp_rx;
int8_t pdma_chanid_rx;
rt_sem_t m_psSemBus;
#endif
struct rt_qspi_configuration configuration;
};
typedef struct nu_spi *nu_spi_t;
void nu_spi_drain_rxfifo(SPI_T *spi_base);
void nu_spi_transfer(struct nu_spi *spi_bus, uint8_t *tx, uint8_t *rx, int length, uint8_t bytes_per_word);
#if defined(BSP_USING_SPI_PDMA)
rt_err_t nu_hw_spi_pdma_allocate(struct nu_spi *spi_bus);
#endif
#endif // __DRV_SPI_H___