Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.6.0 Host Inferface #3

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8475689
Test FOTA intergration
swohlerLL Jun 4, 2019
5593612
Fix return length variable
swohlerLL Jun 4, 2019
524dcd4
Fix length variable size for uplink calls
swohlerLL Jun 6, 2019
ef632e3
Fix return values for length on FTP messages
swohlerLL Jun 6, 2019
75f3f3b
Check error codes from message return values
swohlerLL Jun 6, 2019
ffcb4a3
Experiment with header bytes
swohlerLL Jun 12, 2019
30aa82b
WIP: Build mono repo
swohlerLL Jun 27, 2019
ead1dad
Remove PACKED def, add new types
swohlerLL Jun 28, 2019
127d004
incremental change
JBB677 Aug 9, 2019
3c9b351
save changes
JBB677 Aug 9, 2019
7cd5381
Wake up Bytes
JBB677 Aug 12, 2019
e95c1d2
allow access to scan functions
JBB677 Aug 16, 2019
cd297e5
Add extra wake up bytes
JBB677 Aug 20, 2019
5c4740e
added Alt typedef
JBB677 Aug 26, 2019
5e0e2e8
Delete ll_ifc_consts.h.bak
tsteinholz Oct 25, 2019
941962e
Delete ll_ifc_consts.h.bak.bak
tsteinholz Oct 25, 2019
ffa64cc
Delete ifc_struct_defs.h.bak
tsteinholz Oct 25, 2019
fb080b7
Delete ll_ifc_symphony.h.bak
tsteinholz Oct 25, 2019
8290599
Delete ifc_struct_defs.c.bak
tsteinholz Oct 25, 2019
51f9e67
Delete ll_ifc.c.bak
tsteinholz Oct 25, 2019
6217153
Delete ll_ifc_ftp.c.bak
tsteinholz Oct 25, 2019
b69a39f
Delete ll_ifc_no_mac.c.bak
tsteinholz Oct 25, 2019
3885ca9
Delete ll_ifc_symphony.c.bak
tsteinholz Oct 25, 2019
6f07265
Delete ll_ifc_symphony.c.bak.bak
tsteinholz Oct 25, 2019
a5b6379
Update ll_ifc.c
tsteinholz Oct 25, 2019
6930a7c
Minor cleanup
swohlerLL Oct 29, 2019
24ef8b6
Clean up and include compile-time for gateway builds
swohlerLL Oct 29, 2019
dc9b19c
Adding Xmodem Functions, Trying Rx data mods
JBB677 Dec 12, 2019
de4f428
updating with critical section and mutex
JBB677 Jan 9, 2020
7606b54
Merge branch 'Xmodem_and_Rx_mods' into develop
JBB677 Jan 20, 2020
459d7c3
fix transport pc
tsteinholz Jan 31, 2020
a2a6308
Add an IRQ flag to indicate failed Sync
JBB677 Feb 4, 2020
44671ae
QOS Request error fix
JBB677 Apr 2, 2020
6d57ebf
Add Defines for the DFU DAT File
jeg22 May 7, 2020
a94d6cc
Merge branch 'Feature/DFU' into develop
JBB677 Jul 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 49 additions & 12 deletions inc/ifc_struct_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@

#include <stdint.h>

#define NET_INFO_BUFF_SIZE (30)
#define NET_INFO_BUFF_SIZE (31)
#define DL_BAND_CFG_SIZE (3 * 4 + 2)
#define STATS_SIZE (10 * 4)
#define TIME_INFO_SIZE (6 * 2 + 1)
#define GW_SCAN_INFO_SIZE (13)
#define MAX_GW_SCAN_RESULTS (16)
#define NUM_GW_SCANS_TO_KEEP (8) // sort through the list and find the best
#define MAX_GW_KEY_LIST (16) // number of gateways to keep keys in gw_list

#define GW_SCAN_INFO_BUFF_SIZE (MAX_GW_SCAN_RESULTS * GW_SCAN_INFO_SIZE + 1)

#ifndef PACKED
#if defined ( __CC_ARM )
Expand Down Expand Up @@ -56,6 +62,7 @@ typedef struct PACKED llabs_network_info_t
llabs_connect_status_t connection_status;
uint8_t is_scanning_gateways;
uint64_t gateway_id;
uint8_t is_repeater;
} llabs_network_info_t;

// Defines the band-specific frequency parameters (FCC 902-928, etc...)
Expand All @@ -82,6 +89,30 @@ typedef struct llabs_stats
uint32_t num_rx_errors; ///< Number of times we received a Rx error from the back end
} llabs_stats_t;

typedef struct PACKED llabs_gateway_scan_results
{
uint64_t id;
int16_t rssi;
int8_t snr;
int8_t channel;
uint8_t is_repeater;
} llabs_gateway_scan_results_t;

typedef struct PACKED llabs_gateway_scan_results_alt
{
uint64_t id;
int16_t rssi;
int8_t error_count;
int8_t channel;
uint8_t is_active;
} llabs_gateway_scan_results_alt_t;

typedef union llabs_gateway_list_data
{
llabs_gateway_scan_results_t gw_results;
llabs_gateway_scan_results_alt_t gw_data;
}llabs_gateway_list_data_t;

typedef struct PACKED llabs_time
{
uint32_t seconds; ///< Seconds since UNIX epoch 00:00:00 UTC on 1 January 1970
Expand All @@ -95,16 +126,22 @@ typedef struct PACKED llabs_time_info
llabs_time_t last_sync;
} llabs_time_info_t;

void ll_net_info_deserialize(const uint8_t buff[NET_INFO_BUFF_SIZE], llabs_network_info_t * net_info);
uint16_t ll_net_info_serialize(const llabs_network_info_t * net_info, uint8_t buff[NET_INFO_BUFF_SIZE]);
void ll_dl_band_cfg_deserialize(const uint8_t buff[DL_BAND_CFG_SIZE], llabs_dl_band_cfg_t * dl_cfg);
uint16_t ll_dl_band_cfg_serialize(const llabs_dl_band_cfg_t * dl_cfg, uint8_t buff[DL_BAND_CFG_SIZE]);
void ll_stats_deserialize(const uint8_t buff[STATS_SIZE], llabs_stats_t * stats);
uint16_t ll_stats_serialize(const llabs_stats_t * stats, uint8_t buff[STATS_SIZE]);
void ll_net_info_deserialize(const uint8_t buff[NET_INFO_BUFF_SIZE],
llabs_network_info_t *net_info);
uint16_t ll_net_info_serialize(const llabs_network_info_t *net_info,
uint8_t buff[NET_INFO_BUFF_SIZE]);
void ll_gw_scan_result_deserialize(const uint8_t buff[GW_SCAN_INFO_BUFF_SIZE],
llabs_gateway_scan_results_t *scan_result, uint8_t *num_gw);
uint16_t ll_gw_scan_result_serialize(llabs_gateway_scan_results_t scan_result,
uint8_t num_gw, uint8_t buff[GW_SCAN_INFO_BUFF_SIZE]);
void ll_dl_band_cfg_deserialize(const uint8_t buff[DL_BAND_CFG_SIZE], llabs_dl_band_cfg_t *dl_cfg);
uint16_t ll_dl_band_cfg_serialize(const llabs_dl_band_cfg_t *dl_cfg,
uint8_t buff[DL_BAND_CFG_SIZE]);
void ll_stats_deserialize(const uint8_t buff[STATS_SIZE], llabs_stats_t *stats);
uint16_t ll_stats_serialize(const llabs_stats_t *stats, uint8_t buff[STATS_SIZE]);
void ll_time_deserialize(const uint8_t buff[TIME_INFO_SIZE], llabs_time_info_t *time_info);
uint16_t ll_time_serialize(const llabs_time_info_t *time_info, uint8_t buff[TIME_INFO_SIZE]);


/** @} (end addtogroup Module_Interface) */

/*
Expand All @@ -118,14 +155,14 @@ uint16_t ll_time_serialize(const llabs_time_info_t *time_info, uint8_t buff[TIME
* messages over the host interface. The write_* functions serialize an
* integer into a byte stream , and the read_* functions deserialize an
* integer from a byte stream.
*
*
* See <a href="https://en.wikipedia.org/wiki/Serialization">
* serialization</a> on Wikipedia for more details about why these functions
* exist.
*/
/**
* @{
*/
/**
* @{
*/

/**
* @brief
Expand Down
37 changes: 30 additions & 7 deletions inc/ll_ifc_consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
*/

#define IFC_VERSION_MAJOR (0)
#define IFC_VERSION_MINOR (6)
#define IFC_VERSION_MINOR (8)
#define IFC_VERSION_TAG (0)

#define APP_TOKEN_LEN (10)
#define APP_TOKEN_LEN (10)
#define UNIQUE_ID_LEN (8)
#define MAX_RX_MSG_LEN (128)

extern const uint32_t OPEN_NET_TOKEN; ///< Open network token (0x4f50454e)
Expand Down Expand Up @@ -64,7 +65,7 @@ typedef enum
OP_CONN_FILT_SET = 93, ///< 0x5D
OP_CONN_FILT_GET = 94, ///< 0x5E
//STRIPTHIS!START
OP_RESERVED0 = 96, ///< 0x60
OP_RESERVED0 = 96, ///< 0x5F
OP_RESERVED1 = 97, ///< 0x60
//STRIPTHIS!STOP
OP_TX_CW = 98, ///< 0x61
Expand Down Expand Up @@ -94,7 +95,25 @@ typedef enum
OP_TIMESTAMP = 131, ///< 0x83 reserved, not fully implemented
OP_SEND_TIMESTAMP = 132, ///< 0x84 reserved, not fully implemented
//STRIPTHIS!STOP

OP_GET_SCAN_INFO = 133, ///< 0x85
OP_CONN_TO_GW_CH = 134, ///< 0x86
OP_DISCONNECT = 135, ///< 0x87
OP_SCAN_MODE_GET = 136, ///< 0x88
OP_SCAN_MODE_SET = 137, ///< 0x89
OP_SCAN_THRESHOLD_GET = 138, ///< 0x8A
OP_SCAN_THRESHOLD_SET = 139, ///< 0x8B
OP_SCAN_ATTEMPTS_GET = 140, ///< 0x8C
OP_SCAN_ATTEMPTS_SET = 141, ///< 0x8D
OP_SCAN_ATTEMPTS_LEFT = 142, ///< 0x8E
OP_RSSI_OFFSET_GET = 143, ///< 0x8F
OP_RSSI_OFFSET_SET = 144, ///< 0x90
OP_CTRL_MSG_ENABLED_SET = 145, ///< 0x91
OP_CTRL_MSG_ENABLED_GET = 146, ///< 0x92
OP_GPIO_ENABLE_PIN = 147, ///< 0x93
OP_GPIO_DISABLE_PIN = 148, ///< 0x94
OP_GPIO_PIN_STATUS = 149, ///< 0x95
OP_GPIO_SET_HIGH = 150, ///< 0x96
OP_GPIO_SET_LOW = 151, ///< 0x97
//STRIPTHIS!START
OP_FCC_TEST = 245, ///< 0xF5
OP_PER_TEST_TX = 246, ///< 0xF6
Expand Down Expand Up @@ -289,12 +308,16 @@ typedef enum ll_ifc_error_codes_e {
#define IRQ_FLAGS_INITIALIZATION_COMPLETE (0x00080000UL) ///< Set every time the MAC has completed initialization
#define IRQ_FLAGS_CRYPTO_ERROR (0x00100000UL) ///< Set when a crypto exchange attempt fails
#define IRQ_FLAGS_APP_TOKEN_ERROR (0x00200000UL) ///< Set when an application token registration fails
#define IRQ_FLAGS_DOWNLINK_ERROR (0x00400000UL) ///< Set when a downlink registration fails
#define IRQ_CLOUD_GPIO_2_INTERRUPT (0x01000000UL) ///< Set when the cloud GPIO input is triggered
#define IRQ_CLOUD_GPIO_3_INTERRUPT (0x02000000UL) ///< Set when the cloud GPIO input is triggered
#define IRQ_FLAGS_ASSERT (0x80000000UL) ///< Set every time we transition from the connected->disconnected state
//STRIPTHIS!START
// LifeRaft IRQ flags
#define IRQ_FLAGS_STATUS_REQ (0x00400000UL) ///< Set when we want to request the status of the host controller
#define IRQ_FLAGS_FIRMWARE_REQ (0x00800000UL) ///< Set when we want to request the firmware data of the host controller
//#define IRQ_FLAGS_STATUS_REQ (0x00400000UL) ///< Set when we want to request the status of the host controller
//#define IRQ_FLAGS_FIRMWARE_REQ (0x00800000UL) ///< Set when we want to request the firmware data of the host controller
//STRIPTHIS!STOP
#define IRQ_FLAGS_ASSERT (0x80000000UL) ///< Set every time we transition from the connected->disconnected state


/**
* @brief
Expand Down
12 changes: 7 additions & 5 deletions inc/ll_ifc_ftp.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ extern "C" {
* @{
*/

#define MAX_NUM_SEGMENTS (2400)
#define MAX_NUM_SEGMENTS (9800) // Can support a 1MB image
#define MAX_FILE_SEGMENT_BYTES (107)
#define NUM_RX_SEGS_BITMASK (MAX_NUM_SEGMENTS / 32)
//#define NUM_RX_SEGS_BITMASK (MAX_NUM_SEGMENTS / 32)
#define NUM_RX_SEGS_BITMASK (((MAX_NUM_SEGMENTS % 32) == 0) ? (MAX_NUM_SEGMENTS >> 5) : ((MAX_NUM_SEGMENTS >> 5) + 1))
#define BASE_UL_MSG_LEN (14)
#define MAX_NUM_RETRY_SEGS (16)
#define LL_FTP_TX_BUF_SIZE (BASE_UL_MSG_LEN + MAX_NUM_RETRY_SEGS * 2)
#define MAX_NUM_RETRY_SEGS (1024)
//#define LL_FTP_TX_BUF_SIZE (BASE_UL_MSG_LEN + MAX_NUM_RETRY_SEGS * 2)
#define LL_FTP_TX_BUF_SIZE (256) // Can fit 121 segment requests per payload


// The file header contains the crc, file size, file id, and file version
Expand Down Expand Up @@ -221,7 +223,7 @@ typedef ll_ftp_return_code_t (*ll_ftp_apply_t)(uint32_t file_id, uint32_t file_v
* @return
* LL_FTP_OK - success, see ::ll_ftp_return_code.
*/
typedef ll_ftp_return_code_t (*ll_ftp_send_uplink_t)(const uint8_t* buf, uint8_t len, bool acked, uint8_t port);
typedef ll_ftp_return_code_t (*ll_ftp_send_uplink_t)(const uint8_t* buf, uint16_t len, bool acked, uint8_t port);

/**
* @brief
Expand Down
Loading