1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #ifndef SPI_SERVICE_H
10 #define SPI_SERVICE_H
11 
12 #include "hdf_base.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #define SPI_USER_MSG_READ  (0x1 << 1)
19 #define SPI_USER_MSG_WRITE (0x1 << 2)
20 
21 #pragma pack(push, 4)
22 struct SpiUserMsg {
23     uint8_t rwFlag;   /**< the msg read write flag */
24     uint32_t len;     /**< Length of the read and write buffers. The read buffer and the write
25                        * buffer have the same length.
26                        */
27     uint32_t speed;   /**< Current message transfer speed */
28     uint16_t delayUs; /**< Delay (in microseconds) before starting the next transfer.
29                        * The value <b>0</b> indicates there is no delay between transfers.
30                        */
31     uint8_t keepCs;   /**< Whether to keep CS active after current transfer has been
32                        * completed. <b>1</b> indicates to keeps CS; <b>0</b> indicates to switch off the CS.
33                        */
34 };
35 #pragma pack(pop)
36 
37 #ifdef __cplusplus
38 }
39 #endif
40 
41 #endif /* SPI_SERVICE_H */
42