mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
Merge pull request #2071 from g-oikonomou/bugfix/cc13xx/no-acks
Make the number of Prop Mode RX Buffers easy to configure
This commit is contained in:
commit
7b7781360f
@ -219,14 +219,23 @@ const output_config_t *tx_power_current = &output_power[1];
|
|||||||
#define PROP_MODE_LO_DIVIDER 0x05
|
#define PROP_MODE_LO_DIVIDER 0x05
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
#ifdef PROP_MODE_CONF_RX_BUF_CNT
|
||||||
|
#define PROP_MODE_RX_BUF_CNT PROP_MODE_CONF_RX_BUF_CNT
|
||||||
|
#else
|
||||||
|
#define PROP_MODE_RX_BUF_CNT 4
|
||||||
|
#endif
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
#define DATA_ENTRY_LENSZ_NONE 0
|
#define DATA_ENTRY_LENSZ_NONE 0
|
||||||
#define DATA_ENTRY_LENSZ_BYTE 1
|
#define DATA_ENTRY_LENSZ_BYTE 1
|
||||||
#define DATA_ENTRY_LENSZ_WORD 2 /* 2 bytes */
|
#define DATA_ENTRY_LENSZ_WORD 2 /* 2 bytes */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* RX buffers.
|
||||||
|
* PROP_MODE_RX_BUF_CNT buffers of RX_BUF_SIZE bytes each. The start of each
|
||||||
|
* buffer must be 4-byte aligned, therefore RX_BUF_SIZE must divide by 4
|
||||||
|
*/
|
||||||
#define RX_BUF_SIZE 140
|
#define RX_BUF_SIZE 140
|
||||||
/* Receive buffers: 1 frame in each */
|
static uint8_t rx_buf[PROP_MODE_RX_BUF_CNT][RX_BUF_SIZE] CC_ALIGN(4);
|
||||||
static uint8_t rx_buf_0[RX_BUF_SIZE] CC_ALIGN(4);
|
|
||||||
static uint8_t rx_buf_1[RX_BUF_SIZE] CC_ALIGN(4);
|
|
||||||
|
|
||||||
/* The RX Data Queue */
|
/* The RX Data Queue */
|
||||||
static dataQueue_t rx_data_queue = { 0 };
|
static dataQueue_t rx_data_queue = { 0 };
|
||||||
@ -427,6 +436,24 @@ rf_cmd_prop_rx()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
init_rx_buffers(void)
|
||||||
|
{
|
||||||
|
rfc_dataEntry_t *entry;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for(i = 0; i < PROP_MODE_RX_BUF_CNT; i++) {
|
||||||
|
entry = (rfc_dataEntry_t *)rx_buf[i];
|
||||||
|
entry->status = DATA_ENTRY_STATUS_PENDING;
|
||||||
|
entry->config.type = DATA_ENTRY_TYPE_GEN;
|
||||||
|
entry->config.lenSz = DATA_ENTRY_LENSZ_WORD;
|
||||||
|
entry->length = RX_BUF_SIZE - 8;
|
||||||
|
entry->pNextEntry = rx_buf[i + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
((rfc_dataEntry_t *)rx_buf[PROP_MODE_RX_BUF_CNT - 1])->pNextEntry = rx_buf[0];
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
rx_on_prop(void)
|
rx_on_prop(void)
|
||||||
{
|
{
|
||||||
@ -564,8 +591,6 @@ static const rf_core_primary_mode_t mode_prop = {
|
|||||||
static int
|
static int
|
||||||
init(void)
|
init(void)
|
||||||
{
|
{
|
||||||
rfc_dataEntry_t *entry;
|
|
||||||
|
|
||||||
lpm_register_module(&prop_lpm_module);
|
lpm_register_module(&prop_lpm_module);
|
||||||
|
|
||||||
if(ti_lib_chipinfo_chip_family_is_cc13xx() == false) {
|
if(ti_lib_chipinfo_chip_family_is_cc13xx() == false) {
|
||||||
@ -575,29 +600,14 @@ init(void)
|
|||||||
rf_core_set_modesel();
|
rf_core_set_modesel();
|
||||||
|
|
||||||
/* Initialise RX buffers */
|
/* Initialise RX buffers */
|
||||||
memset(rx_buf_0, 0, RX_BUF_SIZE);
|
memset(rx_buf, 0, sizeof(rx_buf));
|
||||||
memset(rx_buf_1, 0, RX_BUF_SIZE);
|
|
||||||
|
|
||||||
entry = (rfc_dataEntry_t *)rx_buf_0;
|
|
||||||
entry->status = DATA_ENTRY_STATUS_PENDING;
|
|
||||||
entry->config.type = DATA_ENTRY_TYPE_GEN;
|
|
||||||
entry->config.lenSz = DATA_ENTRY_LENSZ_WORD;
|
|
||||||
entry->length = RX_BUF_SIZE - 8;
|
|
||||||
entry->pNextEntry = rx_buf_1;
|
|
||||||
|
|
||||||
entry = (rfc_dataEntry_t *)rx_buf_1;
|
|
||||||
entry->status = DATA_ENTRY_STATUS_PENDING;
|
|
||||||
entry->config.type = DATA_ENTRY_TYPE_GEN;
|
|
||||||
entry->config.lenSz = DATA_ENTRY_LENSZ_WORD;
|
|
||||||
entry->length = RX_BUF_SIZE - 8;
|
|
||||||
entry->pNextEntry = rx_buf_0;
|
|
||||||
|
|
||||||
/* Set of RF Core data queue. Circular buffer, no last entry */
|
/* Set of RF Core data queue. Circular buffer, no last entry */
|
||||||
rx_data_queue.pCurrEntry = rx_buf_0;
|
rx_data_queue.pCurrEntry = rx_buf[0];
|
||||||
rx_data_queue.pLastEntry = NULL;
|
rx_data_queue.pLastEntry = NULL;
|
||||||
|
|
||||||
/* Initialize current read pointer to first element (used in ISR) */
|
/* Initialize current read pointer to first element (used in ISR) */
|
||||||
rx_read_entry = rx_buf_0;
|
rx_read_entry = rx_buf[0];
|
||||||
|
|
||||||
smartrf_settings_cmd_prop_rx_adv.pQueue = &rx_data_queue;
|
smartrf_settings_cmd_prop_rx_adv.pQueue = &rx_data_queue;
|
||||||
smartrf_settings_cmd_prop_rx_adv.pOutput = (uint8_t *)&rx_stats;
|
smartrf_settings_cmd_prop_rx_adv.pOutput = (uint8_t *)&rx_stats;
|
||||||
@ -904,6 +914,8 @@ on(void)
|
|||||||
|
|
||||||
rf_core_setup_interrupts(false);
|
rf_core_setup_interrupts(false);
|
||||||
|
|
||||||
|
init_rx_buffers();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Trigger a switch to the XOSC, so that we can subsequently use the RF FS
|
* Trigger a switch to the XOSC, so that we can subsequently use the RF FS
|
||||||
* This will block until the XOSC is actually ready, but give how we
|
* This will block until the XOSC is actually ready, but give how we
|
||||||
@ -927,8 +939,6 @@ on(void)
|
|||||||
static int
|
static int
|
||||||
off(void)
|
off(void)
|
||||||
{
|
{
|
||||||
rfc_dataEntry_t *entry;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we are in the middle of a BLE operation, we got called by ContikiMAC
|
* If we are in the middle of a BLE operation, we got called by ContikiMAC
|
||||||
* from within an interrupt context. Abort, but pretend everything is OK.
|
* from within an interrupt context. Abort, but pretend everything is OK.
|
||||||
@ -948,12 +958,6 @@ off(void)
|
|||||||
/* We pulled the plug, so we need to restore the status manually */
|
/* We pulled the plug, so we need to restore the status manually */
|
||||||
smartrf_settings_cmd_prop_rx_adv.status = RF_CORE_RADIO_OP_STATUS_IDLE;
|
smartrf_settings_cmd_prop_rx_adv.status = RF_CORE_RADIO_OP_STATUS_IDLE;
|
||||||
|
|
||||||
entry = (rfc_dataEntry_t *)rx_buf_0;
|
|
||||||
entry->status = DATA_ENTRY_STATUS_PENDING;
|
|
||||||
|
|
||||||
entry = (rfc_dataEntry_t *)rx_buf_1;
|
|
||||||
entry->status = DATA_ENTRY_STATUS_PENDING;
|
|
||||||
|
|
||||||
return RF_CORE_CMD_OK;
|
return RF_CORE_CMD_OK;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -93,6 +93,11 @@
|
|||||||
#define RF_CORE_CONF_CHANNEL RF_CHANNEL
|
#define RF_CORE_CONF_CHANNEL RF_CHANNEL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Number of Prop Mode RX buffers */
|
||||||
|
#ifndef PROP_MODE_CONF_RX_BUF_CNT
|
||||||
|
#define PROP_MODE_CONF_RX_BUF_CNT 4
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Auto-configure Prop-mode radio if we are running on CC13xx, unless the
|
* Auto-configure Prop-mode radio if we are running on CC13xx, unless the
|
||||||
* project has specified otherwise. Depending on the final mode, determine a
|
* project has specified otherwise. Depending on the final mode, determine a
|
||||||
|
Loading…
Reference in New Issue
Block a user