WE310F5  39.00.000
m2mb_spi_frame.h
Go to the documentation of this file.
1 /*===============================================================================================*/
2 /* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
26 #ifndef M2M_M2MB_SPI_FMT_API_H
27 #define M2M_M2MB_SPI_FMT_API_H
28 
29 /* Global declarations ==========================================================================*/
30 #ifndef NULL
31 #define NULL 0
32 #endif
33 
34 /* Global enums ==============================================================================*/
35 
36 
37 /* Global typedefs ==============================================================================*/
38 
39 /* SPI Frame callback.
40  This type defines the SPI frame callback prototype.
41 */
42 typedef void (*M2MB_SPI_FRAME_DATA_RECV_T)( VOID* ctx, UINT8* data,
43  UINT32 length );
44 
45 /* SPI Frame configuration.
46  This type defines the SPI frame configuration structure.
47 */
48 typedef struct M2MB_SPI_FRAME_CFG_S
49 {
55  VOID* ctx;
57 
58 
59 /* Global functions =============================================================================*/
60 
61 /*-----------------------------------------------------------------------------------------------*/
62 /* m2mb_spi_fmt_init:
63  description:
64  Initialize the SPI Framing module
65  arguments:
66  h: Handle returned by m2mb_spi_fmt_init
67  spi: Handle of the SPI driver opened by user.
68  pCfg: Pointer to the configuration structure.
69 
70  return:
71  0 on SUCCESS
72  -1 on FAILURE
73 */
75 
76 /*-----------------------------------------------------------------------------------------------*/
77 /* m2mb_spi_fmt_read:
78  description:
79  Read user data from SPI
80  arguments:
81  h: Handle given in m2mb_spi_fmt_init
82  len: Pointer to the length field. This is filled by the module
83  return:
84  Pointer to the buffer when data is received.
85  note: This API will block the user till it received data over SPI.
86 */
88 
89 /*-----------------------------------------------------------------------------------------------*/
90 /* m2mb_spi_fmt_write:
91  description:
92  Write over SPI
93  arguments:
94  h: Handle given in m2mb_spi_fmt_init
95  buf: Pointer to the buffer containing data that has to be sent.
96  length: Length of the data to be sent
97  return:
98  0 on SUCCESS
99  -1 on FAILURE
100 */
101 INT32 m2mb_spi_fmt_write( HANDLE h, UINT8* buf, UINT32 length );
102 
103 
104 #endif /* M2M_M2MB_SPI_FMT_API_H */
105 
106 
unsigned char UINT8
Definition: m2mb_types.h:86
INT32 m2mb_spi_fmt_write(HANDLE h, UINT8 *buf, UINT32 length)
unsigned short UINT16
Definition: m2mb_types.h:87
INT32 m2mb_spi_fmt_init(HANDLE *h, HANDLE spi, M2MB_SPI_FRAME_CFG_T *pCfg)
M2MB_SPI_FRAME_DATA_RECV_T rcb
void(* M2MB_SPI_FRAME_DATA_RECV_T)(VOID *ctx, UINT8 *data, UINT32 length)
struct M2MB_SPI_FRAME_CFG_S M2MB_SPI_FRAME_CFG_T
UINT8 * m2mb_spi_fmt_read(HANDLE h, UINT32 *len)
void VOID
Definition: m2mb_types.h:74
unsigned long int UINT32
Definition: m2mb_types.h:88
signed int INT32
Definition: m2mb_types.h:82
void * HANDLE
Definition: m2mb_types.h:98