Mistake on this page?
Report an issue in GitHub or email us
pal_spi.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief SPI driver definition.
6  *
7  * Copyright (c) 2019-2020 Packetcraft, Inc.
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 /*************************************************************************************************/
22 
23 #ifndef PAL_SPI_H
24 #define PAL_SPI_H
25 
26 #include "pal_types.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /*! \addtogroup PAL_SPI
33  * \{ */
34 
35 /**************************************************************************************************
36  Data Types
37 **************************************************************************************************/
38 
39 /*! \brief Signaling mode. */
40 typedef enum
41 {
42  PAL_SPI_MODE_SLAVE, /*!< Slave mode. */
43  PAL_SPI_MODE_MASTER /*!< Master mode. */
44 } PalSpiMode_t;
45 
46 /*! \brief Data exchange completion callback. */
47 typedef void (*PalSpiCompCback)(void);
48 
49 /*! \brief Peripheral configuration. */
50 typedef struct
51 {
52  uint32_t clkRateHz; /*!< Clock rate in Hz. */
53  PalSpiMode_t mode; /*!< Signaling mode. */
54  PalSpiCompCback compCback; /*!< Data exchange completion callback. */
56 
57 /*! \brief Operational states. */
58 typedef enum
59 {
60  PAL_SPI_STATE_UNINIT = 0, /*!< Uninitialized state. */
61  PAL_SPI_STATE_ERROR = 0, /*!< Error state. */
62  PAL_SPI_STATE_READY, /*!< Ready state. */
63  PAL_SPI_STATE_BUSY /*!< Data exchange in progress. */
65 
66 /**************************************************************************************************
67  Function Declarations
68 **************************************************************************************************/
69 
70 /* Initialization */
71 void PalSpiInit(const PalSpiConfig_t *pCfg);
72 void PalSpiDeInit(void);
73 
74 /* Control and Status */
75 PalSpiState_t PalSpiGetState(void);
76 
77 /* Data Transfer */
78 void PalSpiDataExchange(uint8_t *pRdData, uint16_t rdDataLen, const uint8_t *pWrData, uint16_t wrDataLen);
79 
80 /*! \} */ /* PAL_SPI */
81 
82 #ifdef __cplusplus
83 };
84 #endif
85 
86 #endif /* PAL_SPI_H */
PalSpiMode_t
Signaling mode.
Definition: pal_spi.h:40
PalSpiMode_t mode
Definition: pal_spi.h:53
Peripheral configuration.
Definition: pal_spi.h:50
void(* PalSpiCompCback)(void)
Data exchange completion callback.
Definition: pal_spi.h:47
PalSpiCompCback compCback
Definition: pal_spi.h:54
Platform-independent data types.
PalSpiState_t
Operational states.
Definition: pal_spi.h:58
uint32_t clkRateHz
Definition: pal_spi.h:52
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.