VSF Documented
spi_interface.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 __VSF_TEMPLATE_SPI_H__
19#define __VSF_TEMPLATE_SPI_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "hal/vsf_hal_cfg.h"
24
25#if VSF_HAL_USE_SPI == ENABLED
26
27#include "utilities/ooc_class.h"
28
29/*============================ MACROS ========================================*/
30/*============================ MACROFIED FUNCTIONS ===========================*/
31/*============================ TYPES =========================================*/
32
33
35
36typedef void vsf_i_spi_isrhandler_t(void *target_ptr,
37 const i_spi_t *i_spi_ptr,
39
41typedef struct vsf_i_spi_isr_t {
42 vsf_i_spi_isrhandler_t *handler_fn;
46
47
49typedef struct i_spi_cfg_t {
54
57 union {
58 implement(i_peripheral_t);
59 struct {
60 vsf_spi_status_t (*Status)(void);
62 } SPI;
63 };
65
66 struct {
67 void (*Set)(uintalu_t tIndex);
68 void (*Clear)(uintalu_t tIndex);
69 } CS;
70
71 struct {
73 void (*Transfer)(void *pOutput,
74 uint_fast32_t* pOutCount,
75 void *pInput,
76 uint_fast32_t* pInCount);
78 bool (*Flush)(void);
80
81 struct {
93 vsf_err_t (*RequestTransfer)(void *pOutput, void *pInput, uint_fast32_t nCount);
94
96 vsf_err_t (*Cancel)(void);
97
101
102 struct {
106end_def_interface(i_spi_t)
107
108/*============================ GLOBAL VARIABLES ==============================*/
109/*============================ INCLUDES ======================================*/
110/*============================ PROTOTYPES ====================================*/
111/*============================ IMPLEMENTATION ================================*/
112
113#endif
114
115#endif
116/* EOF */
vsf_err_t
Definition __type.h:42
uint_fast8_t uintalu_t
Definition type.h:88
bool
Definition type.h:60
vsf_arch_prio_t
Definition cortex_a_generic.h:88
end_def_interface(i_pm_wakeup_t) struct vsf_pm_pclk_cfg_t
Definition device.h:249
void(* Enable)(vsf_spi_irq_mask_t mask)
Definition spi_interface.h:103
struct @506 Block
void(* Set)(uintalu_t tIndex)
Definition spi_interface.h:67
vsf_err_t(* Cancel)(void)
cancel on going communication
Definition spi_interface.h:96
const i_spi_t vsf_spi_irq_mask_t irq_mask
Definition spi_interface.h:38
struct @507 IRQ
vsf_err_t(* RequestTransfer)(void *pOutput, void *pInput, uint_fast32_t nCount)
request a block exchanging access !
Definition spi_interface.h:93
int_fast32_t(* GetTransferedCount)(void)
get transferred count
Definition spi_interface.h:99
def_interface(i_spi_t) union
class: spi_t
Definition spi_interface.h:56
void(* Transfer)(void *pOutput, uint_fast32_t *pOutCount, void *pInput, uint_fast32_t *pInCount)
< read/write of fifo
Definition spi_interface.h:73
struct @504 CS
void(* Clear)(uintalu_t tIndex)
Definition spi_interface.h:68
bool(* Flush)(void)
Definition spi_interface.h:78
vsf_err_t(* Init)(i_spi_cfg_t *cfg_ptr)
Definition spi_interface.h:64
void(* Disable)(vsf_spi_irq_mask_t mask)
Definition spi_interface.h:104
dcl_interface(i_spi_t) typedef void vsf_i_spi_isrhandler_t(void *target_ptr
const i_spi_t * i_spi_ptr
Definition spi_interface.h:37
struct @505 FIFO
unsigned uint32_t
Definition stdint.h:9
unsigned int uint_fast32_t
Definition stdint.h:27
int int_fast32_t
Definition stdint.h:26
spi configuration for interface
Definition spi_interface.h:49
vsf_i_spi_isr_t isr
Definition spi_interface.h:52
uint32_t clock_hz
Definition spi_interface.h:51
uint32_t mode
spi working mode
Definition spi_interface.h:50
spi isr for interface
Definition spi_interface.h:41
void * target_ptr
Definition spi_interface.h:43
vsf_i_spi_isrhandler_t * handler_fn
Definition spi_interface.h:42
vsf_arch_prio_t prio
Definition spi_interface.h:44
Definition vsf_template_spi.h:495
Definition vsf_template_spi.h:484
struct @749 Capability
vsf_spi_irq_mask_t
Predefined VSF SPI interrupt that can be reimplemented in specific hal drivers.
Definition vsf_template_spi.h:454