ITS Mesh networking mode 2. More...
#include "pic_utils.h"
Go to the source code of this file.
Definition in file its_mode2.h.
#define ITS2_FLAG_ACK 0x01 |
Definition at line 112 of file its_mode2.h.
Referenced by its2_transmit().
#define ITS2_FLAG_DELETED 0xff |
Definition at line 114 of file its_mode2.h.
Referenced by its2_delete_item_from_queue(), its2_find_free_queue_slot(), its2_forward_routed_packet(), its2_print_queue(), its2_process_tx_queue(), its2_router_init(), and its2_router_queue_packet().
#define ITS2_FLAG_NO_ACK 0x02 |
Definition at line 113 of file its_mode2.h.
Referenced by its2_forward_routed_packet(), its2_rebroadcast_net_discover_req(), its2_request_local_addr(), its2_request_net_addr(), its2_respond_local_addr(), and its2_respond_net_addr().
#define ITS2_NO_AVAILABLE_SLOTS 0xff |
Definition at line 109 of file its_mode2.h.
Referenced by its2_forward_routed_packet(), and its2_rebroadcast_net_discover_req().
#define ITS2_STATUS_QUEUED 0x00 |
Definition at line 107 of file its_mode2.h.
#define ITS2_STATUS_TX_QUEUE_FULL 0x01 |
Definition at line 108 of file its_mode2.h.
#define ITS2_TX_STATUS_NEXT_HOP_UNKNOWN 0x04 |
Definition at line 100 of file its_mode2.h.
Referenced by its2_process_tx_queue().
#define ITS2_TX_STATUS_NO_ACK 0x02 |
Definition at line 98 of file its_mode2.h.
Referenced by its2_process_tx_queue().
#define ITS2_TX_STATUS_NO_ROUTE 0x01 |
Definition at line 97 of file its_mode2.h.
Referenced by its2_process_tx_queue().
#define ITS2_TX_STATUS_REMOTE_NO_ACK 0x03 |
Definition at line 99 of file its_mode2.h.
#define ITS2_TX_STATUS_SUCCESS 0x00 |
Definition at line 96 of file its_mode2.h.
Referenced by its2_process_tx_queue().
#define ITS2_UPDATE_ROUTE_FAIL 0x01 |
Definition at line 104 of file its_mode2.h.
Referenced by its2_router_queue_packet().
#define ITS2_UPDATE_ROUTE_SUCCESS 0x00 |
Definition at line 103 of file its_mode2.h.
#define POS_DEST_H 0x0a |
Definition at line 78 of file its_mode2.h.
#define POS_DEST_L 0x09 |
Definition at line 77 of file its_mode2.h.
#define POS_HOP_COUNT 0x0d |
Definition at line 81 of file its_mode2.h.
#define POS_KEY1 0x00 |
Definition at line 68 of file its_mode2.h.
#define POS_KEY2 0x01 |
Definition at line 69 of file its_mode2.h.
#define POS_LENGTH_HEADER 0x02 |
Definition at line 70 of file its_mode2.h.
#define POS_MAX_HOP_COUNT 0x0b |
Definition at line 79 of file its_mode2.h.
#define POS_NETWORK_H 0x06 |
Definition at line 74 of file its_mode2.h.
#define POS_NETWORK_L 0x05 |
Definition at line 73 of file its_mode2.h.
#define POS_NUM_ROUTES 0x0c |
Definition at line 80 of file its_mode2.h.
#define POS_PKT_TYPE 0x03 |
Definition at line 71 of file its_mode2.h.
#define POS_ROUTE_START 0x0e |
Definition at line 82 of file its_mode2.h.
#define POS_SEQUENCE 0x04 |
Definition at line 72 of file its_mode2.h.
#define POS_SOURCE_H 0x08 |
Definition at line 76 of file its_mode2.h.
#define POS_SOURCE_L 0x07 |
Definition at line 75 of file its_mode2.h.
#define QS_ACK_RECEIVED 0x04 |
Definition at line 89 of file its_mode2.h.
Referenced by its2_process_tx_queue().
#define QS_READY_TO_SEND 0x02 |
Definition at line 87 of file its_mode2.h.
Referenced by its2_forward_routed_packet(), its2_process_tx_queue(), and its2_rebroadcast_net_discover_req().
#define QS_ROUTING_FAILED 0x06 |
Definition at line 91 of file its_mode2.h.
Referenced by its2_process_tx_queue().
#define QS_SENT 0x05 |
Definition at line 90 of file its_mode2.h.
Referenced by its2_process_tx_queue(), and its2_transmit().
#define QS_WAITING_ON_ACK 0x03 |
Definition at line 88 of file its_mode2.h.
Referenced by its2_process_tx_queue(), and its2_transmit().
#define QS_WAITING_ON_LOCAL_ADDR 0x00 |
Definition at line 85 of file its_mode2.h.
Referenced by its2_forward_routed_packet(), and its2_process_tx_queue().
#define QS_WAITING_ON_NETWORK_ADDR 0x01 |
Definition at line 86 of file its_mode2.h.
Referenced by its2_process_tx_queue().
#define REMOTE_DEVICE 0xffff |
Definition at line 94 of file its_mode2.h.
typedef enum _its2_result its2_result |
Definition at line 152 of file its_mode2.h.
typedef enum _its2_state its2_state |
Definition at line 162 of file its_mode2.h.
enum _its2_result |
RESULT_SUCCESSFUL | |
RESULT_FAILED | |
ITEM_QUEUED | |
QUEUE_FULL | |
ROUTING_TOO_MANY_HOPS | |
NEXT_HOP_NOT_LOCAL |
Definition at line 150 of file its_mode2.h.
enum _its2_state |
Definition at line 154 of file its_mode2.h.
void its2_delete_item_from_queue | ( | queued_item * | item | ) |
Definition at line 1025 of file its_mode2.c.
References queued_item::data, queued_item::data_length, queued_item::flag, and ITS2_FLAG_DELETED.
Referenced by its2_process_tx_queue().
its2_result its2_device_init | ( | uns16 | my_device_id, | |
uns16 | network_id | |||
) |
Definition at line 1136 of file its_mode2.c.
References debug_str, its_init(), its_set_device_id(), its_set_network_id(), mrf24j40_set_pan_id(), mrf24j40_set_short_address(), state, STATE_UNASSOCIATED, and wpan_init().
void its2_device_process | ( | ) |
Definition at line 1163 of file its_mode2.c.
References channel, debug_nl, debug_str, debug_var, ITS_ASSOC_REQ, its_transmit_to_sa(), mrf24j40_set_channel(), MRF_FIRST_CHANNEL, MRF_LAST_CHANNEL, state, STATE_SEARCHING, STATE_UNASSOCIATED, tick_calc_diff(), tick_get_count(), tick_marker, and uns16.
void its2_device_receive_callback | ( | uns8 * | data, | |
uns8 | data_length | |||
) |
its2_result its2_device_transmit | ( | uns16 | device_id, | |
uns8 * | data, | |||
uns8 | data_length | |||
) |
its2_result its2_find_coordinator | ( | ) |
its2_result its2_forward_routed_packet | ( | its2_packet * | pkt, | |
uns8 * | data, | |||
uns8 | data_length | |||
) |
Definition at line 653 of file its_mode2.c.
References its_device_info::addr, queued_item::data, queued_item::data_length, debug_int, debug_int_hex_16bit, debug_spc, debug_str, debug_var, queued_item::dest_device_handle, queued_item::dest_its_device_id, queued_item::flag, its2_packet::hop_count, ITEM_QUEUED, its2_find_free_queue_slot(), ITS2_FLAG_DELETED, ITS2_FLAG_NO_ACK, ITS2_NO_AVAILABLE_SLOTS, its2_print_packet(), its2_packet::its_dest_id, ITS_DEVICE_NONE, its_get_device_handle(), its_get_device_info(), NEXT_HOP_NOT_LOCAL, its2_packet::num_routes, queued_item::packet, QS_READY_TO_SEND, QS_WAITING_ON_LOCAL_ADDR, QUEUE_FULL, its_address::remote, remote_address::remote_indicator, its2_packet::routers, queued_item::sent_count, queued_item::status, and uns8.
void its2_print_packet | ( | its2_packet * | pkt | ) |
Definition at line 580 of file its_mode2.c.
References debug_int, debug_int_hex_16bit, debug_putc, debug_str, its2_packet::hop_count, its2_packet::its_dest_id, its2_packet::its_network_id, its2_packet::its_source_id, its2_packet::max_hop_count, its2_packet::num_routes, its2_packet::packet_type, its2_packet::routers, its2_packet::sequence, and uns8.
Referenced by its2_forward_routed_packet(), and its2_transmit().
void its2_print_queue | ( | ) |
Definition at line 1106 of file its_mode2.c.
References debug_nl, debug_var, queued_item::flag, ITS2_FLAG_DELETED, its2_packet::its_dest_id, its2_packet::its_source_id, queued_item::packet, queued_item::sent_count, queued_item::status, tick_get_count(), queued_item::tick_sent, and uns8.
void its2_process_tx_queue | ( | ) |
Definition at line 904 of file its_mode2.c.
References debug_int, debug_int_hex_16bit, debug_str, queued_item::dest_its_device_id, queued_item::flag, its2_delete_item_from_queue(), ITS2_FLAG_DELETED, its2_request_local_addr(), its2_request_net_addr(), its2_transmit(), its2_transmit_status_callback(), its2_transmitting, ITS2_TX_STATUS_NEXT_HOP_UNKNOWN, ITS2_TX_STATUS_NO_ACK, ITS2_TX_STATUS_NO_ROUTE, ITS2_TX_STATUS_SUCCESS, its_get_device_id(), its2_packet::its_source_id, queued_item::packet, QS_ACK_RECEIVED, QS_READY_TO_SEND, QS_ROUTING_FAILED, QS_SENT, QS_WAITING_ON_ACK, QS_WAITING_ON_LOCAL_ADDR, QS_WAITING_ON_NETWORK_ADDR, queued_item::sent_count, queued_item::status, tick_calc_diff(), tick_get_count(), queued_item::tick_sent, uns16, and uns8.
Referenced by its2_router_process().
its2_result its2_rebroadcast_net_discover_req | ( | its2_packet * | pkt | ) |
Definition at line 613 of file its_mode2.c.
References queued_item::data, queued_item::data_length, debug_str, debug_var, queued_item::dest_device_handle, queued_item::dest_its_device_id, queued_item::flag, its2_packet::hop_count, ITEM_QUEUED, its2_find_free_queue_slot(), ITS2_FLAG_NO_ACK, ITS2_NO_AVAILABLE_SLOTS, ITS_DEVICE_NONE, its_get_device_id(), its2_packet::its_source_id, its2_packet::max_hop_count, its2_packet::num_routes, queued_item::packet, QS_READY_TO_SEND, QUEUE_FULL, its2_packet::routers, ROUTING_TOO_MANY_HOPS, queued_item::sent_count, its2_packet::sequence, queued_item::status, and uns8.
void its2_request_local_addr | ( | uns16 | device_id | ) |
Definition at line 779 of file its_mode2.c.
References ITS2_FLAG_NO_ACK, its2_router_queue_packet(), and ITS_LOCAL_DISCOVER_REQ.
Referenced by its2_process_tx_queue().
void its2_request_net_addr | ( | uns16 | device_id | ) |
Definition at line 792 of file its_mode2.c.
References ITS2_FLAG_NO_ACK, its2_router_queue_packet(), and ITS_NET_DISCOVER_REQ.
Referenced by its2_process_tx_queue().
void its2_respond_local_addr | ( | uns16 | device_id | ) |
Definition at line 783 of file its_mode2.c.
References debug_module, debug_str, ITS2_FLAG_NO_ACK, its2_router_queue_packet(), and ITS_LOCAL_DISCOVER_RES.
void its2_respond_net_addr | ( | uns16 | device_id | ) |
Definition at line 796 of file its_mode2.c.
References ITS2_FLAG_NO_ACK, its2_router_queue_packet(), and ITS_NET_DISCOVER_RES.
its2_result its2_router_handle_association | ( | uns16 | pan_id, | |
uns16 | its_device_id | |||
) |
Definition at line 118 of file its_mode2.c.
References debug_str, its_add_local_device(), ITS_ASSOC_RES, ITS_DEVICE_NONE, its_get_device_handle(), its_transmit_to_handle(), RESULT_FAILED, and RESULT_SUCCESSFUL.
uns8 its2_router_init | ( | uns16 | my_device_id, | |
uns16 | network_id | |||
) |
Definition at line 743 of file its_mode2.c.
References debug_nl, debug_str, debug_var, queued_item::flag, ITS2_FLAG_DELETED, its2_seen_index, its_init(), its_set_device_id(), its_set_network_id(), seen_packet::its_source_id, mrf24j40_set_channel(), mrf24j40_set_pan_id(), mrf24j40_set_short_address(), and uns8.
void its2_router_process | ( | ) |
Definition at line 808 of file its_mode2.c.
References its2_process_tx_queue(), state_timeout, tick_calc_diff(), tick_get_count(), tick_marker, turn_off_mrf_interrupts(), turn_on_mrf_interrupts(), and uns16.
its2_result its2_router_queue_packet | ( | uns16 | device_id, | |
uns8 | packet_type, | |||
uns8 * | data, | |||
uns8 | data_length, | |||
uns8 | ack | |||
) |
Definition at line 823 of file its_mode2.c.
References queued_item::data, queued_item::data_length, debug_str, debug_var, queued_item::dest_its_device_id, queued_item::flag, its2_packet::hop_count, ITEM_QUEUED, ITS2_FLAG_DELETED, ITS2_UPDATE_ROUTE_FAIL, its2_packet::its_dest_id, its_get_device_id(), its_get_network_id(), its_get_next_sequence(), ITS_LOCAL_DISCOVER_REQ, ITS_NET_DISCOVER_REQ, its2_packet::its_network_id, its2_packet::its_source_id, its2_packet::max_hop_count, queued_item::packet, its2_packet::packet_type, QUEUE_FULL, ROUTING_TOO_MANY_HOPS, queued_item::sent_count, its2_packet::sequence, turn_off_mrf_interrupts(), turn_on_mrf_interrupts(), and uns8.
Referenced by its2_request_local_addr(), its2_request_net_addr(), its2_respond_local_addr(), and its2_respond_net_addr().
void its2_router_receive_callback | ( | uns16 | device_id, | |
uns8 * | data, | |||
uns8 | data_length | |||
) |
void its2_setup_io | ( | ) |
Definition at line 95 of file its_mode2.c.
References wpan_setup_io().
void its2_transmit | ( | queued_item * | item | ) |
Definition at line 1035 of file its_mode2.c.
References its_device_info::addr, queued_item::data, queued_item::data_length, debug_int, debug_int_hex_16bit, debug_putc, debug_str, debug_var, queued_item::dest_device_handle, queued_item::dest_its_device_id, queued_item::flag, FRAME_TYPE_DATA, ITS2_FLAG_ACK, its2_print_packet(), its2_transmitting, ITS_DEVICE_NONE, its_get_device_info(), its_address::local, mrf24j40_transmit_to_short_address(), MRF_ACK, MRF_NO_ACK, its2_packet::num_routes, queued_item::packet, local_address::pan_id, QS_SENT, QS_WAITING_ON_ACK, its2_packet::routers, queued_item::sent_count, local_address::short_address, queued_item::status, tick_get_count(), queued_item::tick_sent, and uns8.
Referenced by its2_process_tx_queue().
void its2_transmit_status_callback | ( | its2_packet * | pkt, | |
uns8 | status | |||
) |
bit debug_module |
Definition at line 64 of file its_mode2.c.
Referenced by its2_respond_local_addr().
Definition at line 47 of file its_mode1.c.
Referenced by its1_device_init(), its1_device_process(), its1_find_controller(), its2_device_init(), its2_device_process(), its2_find_controller(), and wpan_data_received_callback().