eRPC API Reference  Rev. 1.12.0
NXP Semiconductors
erpc_lpspi_slave_transport.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2022 NXP
3  *
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef _EMBEDDED_RPC__LPSPI_SLAVE_TRANSPORT_H_
9 #define _EMBEDDED_RPC__LPSPI_SLAVE_TRANSPORT_H_
10 
11 #include "erpc_config_internal.h"
12 
13 #include <cstdlib>
14 #if ERPC_THREADS
15 #include "erpc_threading.h"
16 #endif
18 
19 extern "C" {
20 #include "fsl_gpio.h"
21 #include "fsl_lpspi.h"
22 }
23 
30 // Classes
33 
34 namespace erpc {
41 {
42 public:
50  LPSpiSlaveTransport(LPSPI_Type *lpspiBaseAddr, uint32_t baudRate, uint32_t srcClock_Hz);
51 
55  virtual ~LPSpiSlaveTransport(void);
56 
62  virtual erpc_status_t init(void);
63 
69  void transfer_cb(void);
70 
71 protected:
72  LPSPI_Type *m_lpspiBaseAddr;
73  uint32_t m_baudRate;
74  uint32_t m_srcClock_Hz;
75  bool m_isInited;
76 #if ERPC_THREADS
78 #endif
79 
80 private:
83 
93  virtual erpc_status_t underlyingReceive(uint8_t *data, uint32_t size) override;
94 
104  virtual erpc_status_t underlyingSend(const uint8_t *data, uint32_t size) override;
105 };
106 
107 } // namespace erpc
108 
111 #endif // _EMBEDDED_RPC__LPSPI_SLAVE_TRANSPORT_H_
LPSpiSlaveTransport(LPSPI_Type *lpspiBaseAddr, uint32_t baudRate, uint32_t srcClock_Hz)
Constructor.
Definition: erpc_lpspi_slave_transport.cpp:111
Base class for framed transport layers.
Definition: erpc_framed_transport.hpp:56
LPSPI_Type * m_lpspiBaseAddr
Definition: erpc_lpspi_slave_transport.hpp:72
enum _erpc_status erpc_status_t
Type used for all status and error return values.
Definition: erpc_common.h:85
uint32_t m_baudRate
Definition: erpc_lpspi_slave_transport.hpp:73
virtual erpc_status_t init(void)
Initialize LPSPI peripheral configuration structure with values specified in LPSpiTransport construct...
Definition: erpc_lpspi_slave_transport.cpp:133
Semaphore m_txrxSemaphore
Definition: erpc_lpspi_slave_transport.hpp:77
virtual erpc_status_t underlyingReceive(MessageBuffer *message, uint32_t size, uint32_t offset)
Adds ability to framed transport to overwrite MessageBuffer when receiving data.
Definition: erpc_framed_transport.cpp:177
Definition: erpc_arbitrated_client_manager.hpp:25
uint32_t m_srcClock_Hz
Definition: erpc_lpspi_slave_transport.hpp:74
bool m_isInited
Definition: erpc_lpspi_slave_transport.hpp:75
virtual erpc_status_t underlyingSend(MessageBuffer *message, uint32_t size, uint32_t offset)
Adds ability to framed transport to overwrite MessageBuffer when sending data.
Definition: erpc_framed_transport.cpp:170
void transfer_cb(void)
Function called from LPSPI_SlaveUserCallback when LPSPI transfer is completed.
Definition: erpc_lpspi_slave_transport.cpp:90
Very basic transport to send/receive messages via LPSPI.
Definition: erpc_lpspi_slave_transport.hpp:40
virtual ~LPSpiSlaveTransport(void)
Destructor.
Definition: erpc_lpspi_slave_transport.cpp:121
Simple semaphore class.
Definition: erpc_threading.h:442