/****************************************************************************** * Copyright (C) 2021, Xiaohua Semiconductor Co., Ltd. All rights reserved. * * This software component is licensed by XHSC under BSD 3-Clause license * (the "License"); You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ******************************************************************************/ /****************************************************************************** * @file spi.h * * @brief Header file for SPI functions * * @author MADS Team * ******************************************************************************/ #ifndef __SPI_H__ #define __SPI_H__ /****************************************************************************** * Include files *****************************************************************************/ #include "ddl.h" /* C binding of definitions if building with C++ compiler */ #ifdef __cplusplus extern "C" { #endif //@{ /****************************************************************************** * Global type definitions *****************************************************************************/ /** ****************************************************************************** ** \brief SPI 功能通道选择设置 ******************************************************************************/ /** ****************************************************************************** ** \brief SPI 功能使能设置 ******************************************************************************/ typedef enum en_spi_en { SpiMskEnable = 0x4u, ///< SPI模块使能 SpiMskDisable = 0u, ///< SPI模块禁止 }en_spi_en_t; /** ****************************************************************************** ** \brief SPI 模式配置 ******************************************************************************/ typedef enum en_spi_mode { SpiMskMaster = 0x10u, ///<主机 SpiMskSlave = 0x00u, ///<从机 }en_spi_mode_t; /** ****************************************************************************** ** \brief SPI 时钟极性设置 ******************************************************************************/ typedef enum en_spi_cpol { SpiMskcpollow = 0u, ///<极性为低 SpiMskcpolhigh = 0x08u, ///<极性为高 }en_spi_cpol_t; /** ****************************************************************************** ** \brief SPI 时钟相位设置 ******************************************************************************/ typedef enum en_spi_cpha { SpiMskCphafirst = 0u, ///<第一边沿采样 SpiMskCphasecond = 0x4u, ///<第二边沿采样 }en_spi_cpha_t; /** ****************************************************************************** ** \brief SPI 时钟分频配置 *****************************************************************************/ typedef enum en_spi_clk_div { SpiClkMskDiv2 = 0x00u, ///