#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
#define BIT |
( |
|
x | ) |
(1 << (x)) |
#define BROADCAST_CID 0xFFFFFFFF |
#define PACKET_CONT_HEADER_SIZE 5 |
#define PACKET_CONT_MAX_SEQ (BIT(7) - 1) |
#define PACKET_INIT_HEADER_SIZE 7 |
struct packet_cont* packet_cont_new |
( |
uint32_t |
cid, |
|
|
uint8_t |
seq |
|
) |
| |
Allocate and initialize a initialisation packet.
- Parameters
-
cid | The channel id |
seq | The packet sequence |
- Returns
- The continuation packet allocated and initialized
void* packet_copy |
( |
const void * |
packet | ) |
|
Copy a packet.
- Parameters
-
- Returns
- The copy
static uint32_t packet_get_cid |
( |
const void * |
packet | ) |
|
|
inlinestatic |
Get the channel id of a packet.
- Parameters
-
- Returns
- The channel id
static void packet_init_add_bcnt |
( |
struct packet_init * |
init_packet, |
|
|
uint16_t |
value |
|
) |
| |
|
inlinestatic |
Add a number to the current bcnt of an init packet.
- Parameters
-
init_packet | The init_packet |
value | The value to add to bcnt |
static uint16_t packet_init_get_bcnt |
( |
const struct packet_init * |
init_packet | ) |
|
|
inlinestatic |
Get the bcnt of an init packet.
- Parameters
-
init_packet | The init packet |
- Returns
- The bcnt
struct packet_init* packet_init_new |
( |
uint32_t |
cid, |
|
|
uint8_t |
cmd, |
|
|
uint16_t |
bcnt |
|
) |
| |
Allocate and initialize a initialisation packet.
- Parameters
-
cid | The channel id |
cmd | The commannd |
bcnt | The payload length |
- Returns
- The initialisation packet allocated and initialized
static void packet_init_set_bcnt |
( |
struct packet_init * |
init_packet, |
|
|
uint16_t |
bcnt |
|
) |
| |
|
inlinestatic |
Set the bcnt of an init packet.
- Parameters
-
init_packet | The init packet |
bcnt | The bcnt to set |
static bool packet_is_init |
( |
const void * |
packet | ) |
|
|
inlinestatic |
Check if a packet is an init packet.
- Parameters
-
- Returns
- true : init packet, false: cont packet
High part of payload length
Low part of the payload length
Command identifier (bit 7 set)
Packet sequence 0x00..0x7f (bit 7 cleared)