#include "pic_utils.h"
#include "pic_serial.h"
#include "pic_tick.h"
#include "config.h"
#include <memory.h>
#include "pic_rf_2401a.h"
Go to the source code of this file.
#define PKT_CONFIG_ADDR 0xfffe |
Definition at line 66 of file pic_packet.h.
#define PKT_FLAG_DELETED 0xff |
Definition at line 63 of file pic_packet.h.
Referenced by pkt_init(), pkt_load_rx(), pkt_process_tx_queue(), and pkt_queue_packet().
#define PKT_FLAG_NO_RESEND 0 |
Definition at line 61 of file pic_packet.h.
Referenced by pkt_load_rx(), and pkt_process_tx_queue().
#define PKT_FLAG_RESEND 1 |
Definition at line 62 of file pic_packet.h.
#define PKT_PACKET_SIZE 21 |
Definition at line 68 of file pic_packet.h.
Referenced by pkt_calc_check_byte(), pkt_check_check_byte(), pkt_load_rx(), pkt_queue_packet(), and pkt_send_packet().
#define PKT_STATUS_CHECK_FAIL 12 |
#define PKT_STATUS_DIRECT_SEND 6 |
#define PKT_STATUS_I_AM_SENDER 2 |
#define PKT_STATUS_NEED_TO_REBROADCAST 9 |
#define PKT_STATUS_PKT_IS_ACK_FOR_ME 4 |
#define PKT_STATUS_PKT_IS_FACK_FOR_ME 5 |
#define PKT_STATUS_PKT_IS_FOR_ME 3 |
#define PKT_STATUS_PREVIOUS_ROUTED_VIA_ME 7 |
#define PKT_STATUS_QUEUED 10 |
#define PKT_STATUS_ROUTING_FULL 8 |
#define PKT_STATUS_SEEN_BEFORE 1 |
#define PKT_STATUS_TX_QUEUE_FULL 11 |
#define RF_RX_BUFFER_SIZE PKT_PACKET_SIZE |
Definition at line 70 of file pic_packet.h.
#define RF_TX_BUFFER_SIZE PKT_PACKET_SIZE + 1 |
Definition at line 72 of file pic_packet.h.
typedef union _rf_packet rf_packet |
Definition at line 93 of file pic_packet.h.
typedef struct _rf_packet_det rf_packet_det |
Definition at line 86 of file pic_packet.h.
typedef struct _seen_packet seen_packet |
Definition at line 112 of file pic_packet.h.
typedef struct _sending_item sending_item |
Definition at line 105 of file pic_packet.h.
void pkt_calc_check_byte | ( | rf_packet * | packet | ) |
Definition at line 310 of file pic_packet.c.
References _rf_packet::a, _rf_packet_det::check_byte, _rf_packet::d, PKT_PACKET_SIZE, and uns8.
Referenced by pkt_load_rx(), and pkt_send().
uns8 pkt_check_check_byte | ( | rf_packet * | packet | ) |
Definition at line 321 of file pic_packet.c.
References _rf_packet::a, _rf_packet_det::check_byte, _rf_packet::d, PKT_PACKET_SIZE, and uns8.
Referenced by pkt_load_rx().
void pkt_init | ( | uns16 | my_addr | ) |
Definition at line 263 of file pic_packet.c.
References _sending_item::flag, PKT_FLAG_DELETED, pkt_my_addr, _seen_packet::source_addr, uns16, and uns8.
uns8 pkt_load_rx | ( | rf_packet * | pkt | ) |
Definition at line 38 of file pic_packet.c.
References _sending_item::flag, pkt_calc_check_byte(), pkt_check_check_byte(), PKT_FLAG_DELETED, PKT_FLAG_NO_RESEND, _seen_packet::pkt_id, pkt_my_addr, PKT_PACKET_SIZE, pkt_print_packet(), pkt_process_payload(), pkt_queue_packet(), pkt_seen(), pkt_seen_list_last, pkt_send(), PKT_STATUS_CHECK_FAIL, PKT_STATUS_DIRECT_SEND, PKT_STATUS_I_AM_SENDER, PKT_STATUS_NEED_TO_REBROADCAST, PKT_STATUS_PKT_IS_ACK_FOR_ME, PKT_STATUS_PKT_IS_FACK_FOR_ME, PKT_STATUS_PKT_IS_FOR_ME, PKT_STATUS_PREVIOUS_ROUTED_VIA_ME, PKT_STATUS_ROUTING_FULL, PKT_STATUS_SEEN_BEFORE, serial_print_str(), _seen_packet::source_addr, uns16, and uns8.
uns8 pkt_print_packet | ( | rf_packet * | my_packet | ) |
Definition at line 338 of file pic_packet.c.
References _rf_packet::d, _rf_packet_det::dest_addr, _rf_packet_det::payload, _rf_packet_det::pkt_id, _rf_packet_det::r1_addr, _rf_packet_det::r2_addr, _rf_packet_det::r3_addr, serial_print_int(), serial_print_str(), serial_putc(), and _rf_packet_det::source_addr.
Referenced by pkt_load_rx(), pkt_process_tx_queue(), pkt_send(), and pkt_send_packet().
void pkt_process_payload | ( | uns16 | source_addr, | |
uns16 | pkt_id, | |||
uns8 * | payload | |||
) |
void pkt_process_tx_queue | ( | ) |
Definition at line 208 of file pic_packet.c.
References _rf_packet::d, _sending_item::flag, _sending_item::packet, PKT_FLAG_DELETED, PKT_FLAG_NO_RESEND, pkt_print_packet(), pkt_send_packet(), _rf_packet_det::r1_addr, _sending_item::sent_count, serial_print_int(), serial_print_str(), tick_calc_diff(), tick_get_count(), _sending_item::tick_sent, uns16, and uns8.
uns8 pkt_queue_packet | ( | rf_packet * | packet, | |
uns8 | resend | |||
) |
Definition at line 168 of file pic_packet.c.
References _sending_item::flag, PKT_FLAG_DELETED, PKT_PACKET_SIZE, PKT_STATUS_QUEUED, PKT_STATUS_TX_QUEUE_FULL, _sending_item::sent_count, serial_print_int(), serial_print_str(), and uns8.
Referenced by pkt_load_rx(), and pkt_send().
uns8 pkt_rx_avail | ( | ) |
uns8 pkt_send | ( | uns16 | dest_addr, | |
uns8 * | payload, | |||
uns8 | resend | |||
) |
Definition at line 280 of file pic_packet.c.
References _rf_packet::d, _rf_packet_det::dest_addr, _rf_packet_det::payload, pkt_calc_check_byte(), _rf_packet_det::pkt_id, pkt_my_addr, pkt_my_next_pkt_id, pkt_print_packet(), pkt_queue_packet(), _rf_packet_det::r1_addr, _rf_packet_det::r2_addr, _rf_packet_det::r3_addr, serial_print_str(), _rf_packet_det::source_addr, and uns8.
Referenced by pkt_load_rx().
void pkt_send_packet | ( | rf_packet * | packet | ) | [inline] |
Definition at line 151 of file pic_packet.h.
References _rf_packet::a, pic_rf_transmit(), PKT_PACKET_SIZE, pkt_print_packet(), serial_print_str(), tx_buffer, and uns8.
Referenced by pkt_process_tx_queue().