Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
epacket_dummy.h
Go to the documentation of this file.
1
10#ifndef INFUSE_SDK_INCLUDE_INFUSE_EPACKET_INTERFACE_EPACKET_DUMMY_H_
11#define INFUSE_SDK_INCLUDE_INFUSE_EPACKET_INTERFACE_EPACKET_DUMMY_H_
12
13#include <stdint.h>
14
15#include <zephyr/kernel.h>
16#include <zephyr/toolchain.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
28/* Expected size of the dummy frame header */
29#define EPACKET_DUMMY_FRAME_EXPECTED_SIZE 3
30
31/* ePacket dummy data frame */
33 /* Payload type */
34 uint8_t type;
35 /* Payload auth */
36 uint8_t auth;
37 /* Payload flags */
38 uint16_t flags;
39 /* Payload bytes */
40 uint8_t payload[];
41} __packed;
42
48void epacket_dummy_reset_callbacks(const struct device *dev);
49
56
62void epacket_dummy_set_tx_failure(int error_code);
63
69void epacket_dummy_set_max_packet(uint16_t packet_size);
70
77void epacket_dummy_set_interface_state(const struct device *dev, bool state);
78
86
93void epacket_dummy_receive_api_override(bool func_exists, int rc);
94
105void epacket_dummy_receive_extra(const struct device *dev, const struct epacket_dummy_frame *header,
106 const void *payload, size_t payload_len, const void *extra,
107 size_t extra_len);
108
117static inline void epacket_dummy_receive(const struct device *dev,
118 const struct epacket_dummy_frame *header,
119 const void *payload, size_t payload_len)
120{
121 epacket_dummy_receive_extra(dev, header, payload, payload_len, NULL, 0);
122}
123
128#ifdef __cplusplus
129}
130#endif
131
132#endif /* INFUSE_SDK_INCLUDE_INFUSE_EPACKET_INTERFACE_EPACKET_DUMMY_H_ */
struct k_fifo * epacket_dummmy_transmit_fifo_get(void)
Get the FIFO that the dummy interface "sends" packets on.
void epacket_dummy_receive_api_override(bool func_exists, int rc)
Override the behaviour of .receive_ctrl
void epacket_dummy_reset_callbacks(const struct device *dev)
Reset registered epacket callbacks.
void epacket_dummy_set_max_packet(uint16_t packet_size)
Set the maximum packet size for the interface.
void epacket_dummy_set_interface_state(const struct device *dev, bool state)
Set the interface state and run callbacks.
static void epacket_dummy_receive(const struct device *dev, const struct epacket_dummy_frame *header, const void *payload, size_t payload_len)
Simulate the dummy interface receiving a packet.
Definition epacket_dummy.h:117
bool epacket_dummy_receive_scheduled(void)
Is receiving currently scheduled on the interface.
void epacket_dummy_receive_extra(const struct device *dev, const struct epacket_dummy_frame *header, const void *payload, size_t payload_len, const void *extra, size_t extra_len)
Simulate the dummy interface receiving a packet.
void epacket_dummy_set_tx_failure(int error_code)
If set to a non-zero value, treat all sends as errors.
Definition epacket_dummy.h:32
uint8_t type
Definition epacket_dummy.h:34
uint16_t flags
Definition epacket_dummy.h:38
uint8_t auth
Definition epacket_dummy.h:36
uint8_t payload[]
Definition epacket_dummy.h:40