VSF Documented
spi.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __HAL_DRIVER_RP2040_SPI_H__
19#define __HAL_DRIVER_RP2040_SPI_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "hal/vsf_hal_cfg.h"
24
25#if VSF_HAL_USE_SPI == ENABLED
26
27#include "../__device.h"
28
29/*============================ MACROS ========================================*/
30
31#define VSF_SPI_CFG_REIMPLEMENT_TYPE_MODE ENABLED
32
33/*============================ MACROFIED FUNCTIONS ===========================*/
34/*============================ TYPES =========================================*/
35
36#if VSF_SPI_CFG_REIMPLEMENT_TYPE_MODE == ENABLED
37typedef enum vsf_spi_mode_t {
38 VSF_SPI_MASTER = 0x00ul << 0,
39 VSF_SPI_SLAVE = 0x01ul << 0,
40 VSF_SPI_MSB_FIRST = 0x00ul << 1,
41 VSF_SPI_LSB_FIRST = 0x01ul << 1,
42
43 /* CPOL/CPHA encoded at PL022 CR0 bit positions (6/7) for direct mask use */
45 VSF_SPI_CPOL_HIGH = (1u << 6), /* PL022 SPO */
47 VSF_SPI_CPHA_HIGH = (1u << 7), /* PL022 SPH */
52
55
56 VSF_SPI_DATASIZE_8 = 0x00ul << 8,
57 VSF_SPI_DATASIZE_16 = 0x01ul << 8,
58 VSF_SPI_DATASIZE_32 = 0x02ul << 8,
60
61/* Masks (VSF_SPI_DIR_MODE_MASK, VSF_SPI_MODE_MASK, etc.) are defined by the
62 * template's anonymous enum after vsf_spi_mode_t is reimplemented. */
63#endif
64
65/*============================ INCLUDES ======================================*/
66/*============================ PROTOTYPES ====================================*/
67
68#endif /* VSF_HAL_USE_SPI */
69#endif /* __HAL_DRIVER_RP2040_SPI_H__ */
70/* EOF */
vsf_spi_mode_t
Definition spi.h:33
@ VSF_SPI_SLAVE
Definition spi.h:34
@ VSF_SPI_DATASIZE_16
Definition spi.h:57
@ VSF_SPI_MODE_1
Definition spi.h:41
@ VSF_SPI_DATASIZE_8
datasize is 8 bits
Definition spi.h:49
@ VSF_SPI_MASTER
Definition spi.h:35
@ VSF_SPI_DATASIZE_32
Definition spi.h:73
@ VSF_SPI_MODE_0
Definition spi.h:39
@ VSF_SPI_MODE_3
Definition spi.h:45
@ VSF_SPI_MODE_2
Definition spi.h:43
#define VSF_SPI_CPOL_HIGH
Definition spi.h:123
#define VSF_SPI_CPHA_HIGH
Definition spi.h:128
@ VSF_SPI_LSB_FIRST
Definition spi.h:78
@ VSF_SPI_MSB_FIRST
Definition spi.h:77
@ VSF_SPI_CS_SOFTWARE_MODE
Definition spi.h:87
@ VSF_SPI_CS_HARDWARE_MODE
Definition spi.h:89
#define VSF_SPI_CPHA_LOW
Definition spi.h:126
#define VSF_SPI_CPOL_LOW
Definition spi.h:121
vsf_spi_mode_t
Definition spi.h:79
Generated from commit: vsfteam/vsf@3b461d0