| eRPC API Reference Rev. 1.8.1 NXP Semiconductors

- Main Page
- API Reference
- Classes
- Files

- File List
- File Members

erpc_spi_slave_transport.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2014-2016, Freescale Semiconductor, Inc.
3 * Copyright 2016-2021 NXP
4 * All rights reserved.
5 *
6 *
7 * SPDX-License-Identifier: BSD-3-Clause
8 */
9
10 #ifndef _EMBEDDED_RPC__SPI_SLAVE_TRANSPORT_H_
11 #define _EMBEDDED_RPC__SPI_SLAVE_TRANSPORT_H_
12
13 #include "erpc_config_internal.h"
14 #if ERPC_THREADS
15 #include "erpc_threading.h"
16 #endif
17 #include "erpc_framed_transport.h"
18
19 #include "fsl_gpio.h"
20 #include "fsl_spi.h"
21
22 #include <stdlib.h>
23
30 // Classes
33
34 namespace erpc {
40 class SpiSlaveTransport : public FramedTransport
41 {
42 public:
50 SpiSlaveTransport(SPI_Type *spiBaseAddr, uint32_t baudRate, uint32_t srcClock_Hz);
51
55 virtual ~SpiSlaveTransport(void);
56
62 virtual erpc_status_t init(void);
63
69 void transfer_cb(void);
70
71 protected:
72 SPI_Type *m_spiBaseAddr;
73 uint32_t m_baudRate;
74 uint32_t m_srcClock_Hz;
75 bool m_isInited;
76 #if ERPC_THREADS
77 Semaphore m_txrxSemaphore;
78 #endif
79
80 private:
90 virtual erpc_status_t underlyingReceive(uint8_t *data, uint32_t size);
91
101 virtual erpc_status_t underlyingSend(const uint8_t *data, uint32_t size);
102 };
103
104 } // namespace erpc
105
108 #endif // _EMBEDDED_RPC__SPI_SLAVE_TRANSPORT_H_
erpc::SpiSlaveTransport::m_isInited
bool m_isInited
Definition: erpc_spi_slave_transport.h:75
erpc::FramedTransport
Base class for framed transport layers.
Definition: erpc_framed_transport.h:56
erpc::SpiSlaveTransport::m_srcClock_Hz
uint32_t m_srcClock_Hz
Definition: erpc_spi_slave_transport.h:74
erpc_status_t
enum _erpc_status erpc_status_t
Type used for all status and error return values.
Definition: erpc_common.h:87
erpc_framed_transport.h
erpc::SpiSlaveTransport::transfer_cb
void transfer_cb(void)
Function called from SPI_SlaveUserCallback when SPI transfer is completed.
Definition: erpc_spi_slave_transport.cpp:92
erpc::SpiSlaveTransport::m_txrxSemaphore
Semaphore m_txrxSemaphore
Definition: erpc_spi_slave_transport.h:77
erpc::SpiSlaveTransport
Very basic transport to send/receive messages via SPI.
Definition: erpc_spi_slave_transport.h:40
erpc
Definition: erpc_arbitrated_client_manager.h:25
erpc::SpiSlaveTransport::m_spiBaseAddr
SPI_Type * m_spiBaseAddr
Definition: erpc_spi_slave_transport.h:72
erpc_threading.h
erpc::SpiSlaveTransport::init
virtual erpc_status_t init(void)
Initialize SPI peripheral configuration structure with values specified in SpiTransport constructor...
Definition: erpc_spi_slave_transport.cpp:137
erpc::SpiSlaveTransport::~SpiSlaveTransport
virtual ~SpiSlaveTransport(void)
Destructor.
Definition: erpc_spi_slave_transport.cpp:125
erpc::SpiSlaveTransport::SpiSlaveTransport
SpiSlaveTransport(SPI_Type *spiBaseAddr, uint32_t baudRate, uint32_t srcClock_Hz)
Constructor.
Definition: erpc_spi_slave_transport.cpp:113
erpc::SpiSlaveTransport::m_baudRate
uint32_t m_baudRate
Definition: erpc_spi_slave_transport.h:73
erpc::Semaphore
Simple semaphore class.
Definition: erpc_threading.h:411