Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
uavcan_allocator.c File Reference
#include "uavcan/uavcan.h"
#include "uavcan/uavcan_allocator.h"
#include "uavcan.protocol.dynamic_node_id.Allocation.h"
#include "uavcan.protocol.GetNodeInfo.h"
+ Include dependency graph for uavcan_allocator.c:

Go to the source code of this file.

Macros

#define UAVCAN_MAX_NODES   50
 Dynamic node ID allocation.
 
#define INVALID_STAGE   -1
 

Functions

static int detectRequestStage (struct uavcan_protocol_dynamic_node_id_Allocation *msg)
 
static int getExpectedStage (void)
 
static int findFreeNodeID (const uint8_t preferred)
 
static bool unique_id_identical (int index)
 
static void handleAllocationRequest (struct uavcan_iface_t *iface, uint8_t preferred_node_id)
 
static void id_alloc_uavcan_cb (struct uavcan_iface_t *iface, CanardRxTransfer *transfer)
 
struct uavcan_node_mapping_tuavcan_get_node_id_mapping (const uint8_t id)
 
static struct uavcan_node_mapping_tget_free_id_mapping (void)
 
static void node_info_resp_cb (struct uavcan_iface_t *iface, CanardRxTransfer *transfer)
 
void request_node_info (struct uavcan_iface_t *iface, uint8_t destination_node_id)
 
void uavcan_allocator_init (void)
 

Variables

static uavcan_event id_alloc_ev
 
static uavcan_event node_info_ev
 
static struct uavcan_node_mapping_t uavcan_node_ids [UAVCAN_MAX_NODES] = {0}
 
struct uavcan_unique_id_t current_unique_id = {0}
 
uint32_t last_message_timestamp = 0
 

Macro Definition Documentation

◆ INVALID_STAGE

#define INVALID_STAGE   -1

Definition at line 20 of file uavcan_allocator.c.

◆ UAVCAN_MAX_NODES

#define UAVCAN_MAX_NODES   50

Function Documentation

◆ detectRequestStage()

static int detectRequestStage ( struct uavcan_protocol_dynamic_node_id_Allocation msg)
static

Definition at line 79 of file uavcan_allocator.c.

References foo, INVALID_STAGE, and msg.

Referenced by id_alloc_uavcan_cb().

+ Here is the caller graph for this function:

◆ findFreeNodeID()

static int findFreeNodeID ( const uint8_t  preferred)
static

Definition at line 56 of file uavcan_allocator.c.

References foo, and uavcan_get_node_id_mapping().

Referenced by handleAllocationRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_free_id_mapping()

static struct uavcan_node_mapping_t * get_free_id_mapping ( void  )
static

Definition at line 51 of file uavcan_allocator.c.

References uavcan_get_node_id_mapping().

Referenced by node_info_resp_cb().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExpectedStage()

static int getExpectedStage ( void  )
static

Definition at line 92 of file uavcan_allocator.c.

References current_unique_id, foo, INVALID_STAGE, and uavcan_unique_id_t::len.

Referenced by id_alloc_uavcan_cb().

+ Here is the caller graph for this function:

◆ handleAllocationRequest()

static void handleAllocationRequest ( struct uavcan_iface_t iface,
uint8_t  preferred_node_id 
)
static

◆ id_alloc_uavcan_cb()

static void id_alloc_uavcan_cb ( struct uavcan_iface_t iface,
CanardRxTransfer transfer 
)
static

◆ node_info_resp_cb()

static void node_info_resp_cb ( struct uavcan_iface_t iface,
CanardRxTransfer transfer 
)
static

Definition at line 222 of file uavcan_allocator.c.

References foo, get_free_id_mapping(), msg, transfer(), and uavcan_get_node_id_mapping().

Referenced by uavcan_allocator_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ request_node_info()

void request_node_info ( struct uavcan_iface_t iface,
uint8_t  destination_node_id 
)

Definition at line 244 of file uavcan_allocator.c.

References foo, transfer(), and uavcan_request().

Referenced by node_status_cb().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uavcan_allocator_init()

void uavcan_allocator_init ( void  )

Definition at line 256 of file uavcan_allocator.c.

References foo, id_alloc_ev, id_alloc_uavcan_cb(), node_info_ev, node_info_resp_cb(), and uavcan_bind().

Referenced by uavcan_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uavcan_get_node_id_mapping()

struct uavcan_node_mapping_t * uavcan_get_node_id_mapping ( const uint8_t  id)

Definition at line 42 of file uavcan_allocator.c.

References uavcan_node_mapping_t::allocated_id, foo, UAVCAN_MAX_NODES, and uavcan_node_ids.

Referenced by findFreeNodeID(), get_free_id_mapping(), node_info_resp_cb(), and node_status_cb().

+ Here is the caller graph for this function:

◆ unique_id_identical()

static bool unique_id_identical ( int  index)
static

Definition at line 105 of file uavcan_allocator.c.

References current_unique_id, uavcan_unique_id_t::data, foo, uavcan_unique_id_t::len, uavcan_node_ids, and uavcan_node_mapping_t::unique_id.

Referenced by handleAllocationRequest().

+ Here is the caller graph for this function:

Variable Documentation

◆ current_unique_id

struct uavcan_unique_id_t current_unique_id = {0}

◆ id_alloc_ev

uavcan_event id_alloc_ev
static

Definition at line 30 of file uavcan_allocator.c.

Referenced by uavcan_allocator_init().

◆ last_message_timestamp

uint32_t last_message_timestamp = 0

Definition at line 39 of file uavcan_allocator.c.

Referenced by id_alloc_uavcan_cb().

◆ node_info_ev

uavcan_event node_info_ev
static

Definition at line 31 of file uavcan_allocator.c.

Referenced by uavcan_allocator_init().

◆ uavcan_node_ids

struct uavcan_node_mapping_t uavcan_node_ids[UAVCAN_MAX_NODES] = {0}
static