Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • e-24/public/ahoi/firmware
1 result
Show changes
Commits on Source (2)
Showing
with 80 additions and 71 deletions
...@@ -3,6 +3,14 @@ ...@@ -3,6 +3,14 @@
- remove legacy board support! - remove legacy board support!
=== SLEEP MODE ===
- simplify access to: board_enterPowerSaveMode()
- where to call this (not in IRQ, so put all functionality into module and run a check from main)
- change prios ... (SPI, I2C, UART, TIMER, ADC, EXTI)
=== AGC === === AGC ===
- failed gain stage change cannot be identified in software due to DMA use - failed gain stage change cannot be identified in software due to DMA use
......
/** /**
* Copyright 2016-2023 * Copyright 2016-2024
* *
* Bernd-Christian Renner, * Bernd-Christian Renner,
* Jan Heitmann, and * Jan Heitmann, and
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include "csrc/aci_batvoltage.c" #include "csrc/aci_batvoltage.c"
#include "csrc/aci_bootloader.c" #include "csrc/aci_bootloader.c"
#include "csrc/aci_reset.c" #include "csrc/aci_reset.c"
#include "csrc/aci_sleep.c"
#include "csrc/aci_pktpin.c" #include "csrc/aci_pktpin.c"
#include "csrc/aci_rxthresh.c" #include "csrc/aci_rxthresh.c"
#include "csrc/aci_bitspread.c" #include "csrc/aci_bitspread.c"
...@@ -94,6 +95,7 @@ cmdTbl[ACI_TYPE_ID-PACKET_TYPE_CMD_OFFSET] = aci_id_processCmd; ...@@ -94,6 +95,7 @@ cmdTbl[ACI_TYPE_ID-PACKET_TYPE_CMD_OFFSET] = aci_id_processCmd;
cmdTbl[ACI_TYPE_BATVOLTAGE-PACKET_TYPE_CMD_OFFSET] = aci_batvoltage_processCmd; cmdTbl[ACI_TYPE_BATVOLTAGE-PACKET_TYPE_CMD_OFFSET] = aci_batvoltage_processCmd;
cmdTbl[ACI_TYPE_BOOTLOADER-PACKET_TYPE_CMD_OFFSET] = aci_bootloader_processCmd; cmdTbl[ACI_TYPE_BOOTLOADER-PACKET_TYPE_CMD_OFFSET] = aci_bootloader_processCmd;
cmdTbl[ACI_TYPE_RESET-PACKET_TYPE_CMD_OFFSET] = aci_reset_processCmd; cmdTbl[ACI_TYPE_RESET-PACKET_TYPE_CMD_OFFSET] = aci_reset_processCmd;
cmdTbl[ACI_TYPE_SLEEP-PACKET_TYPE_CMD_OFFSET] = aci_sleep_processCmd;
cmdTbl[ACI_TYPE_PKTPIN-PACKET_TYPE_CMD_OFFSET] = aci_pktpin_processCmd; cmdTbl[ACI_TYPE_PKTPIN-PACKET_TYPE_CMD_OFFSET] = aci_pktpin_processCmd;
cmdTbl[ACI_TYPE_RXTHRESH-PACKET_TYPE_CMD_OFFSET] = aci_rxthresh_processCmd; cmdTbl[ACI_TYPE_RXTHRESH-PACKET_TYPE_CMD_OFFSET] = aci_rxthresh_processCmd;
cmdTbl[ACI_TYPE_BITSPREAD-PACKET_TYPE_CMD_OFFSET] = aci_bitspread_processCmd; cmdTbl[ACI_TYPE_BITSPREAD-PACKET_TYPE_CMD_OFFSET] = aci_bitspread_processCmd;
...@@ -130,6 +132,7 @@ rspTbl[ACI_TYPE_ID-PACKET_TYPE_CMD_OFFSET] = aci_id_fillReply; ...@@ -130,6 +132,7 @@ rspTbl[ACI_TYPE_ID-PACKET_TYPE_CMD_OFFSET] = aci_id_fillReply;
rspTbl[ACI_TYPE_BATVOLTAGE-PACKET_TYPE_CMD_OFFSET] = aci_batvoltage_fillReply; rspTbl[ACI_TYPE_BATVOLTAGE-PACKET_TYPE_CMD_OFFSET] = aci_batvoltage_fillReply;
rspTbl[ACI_TYPE_BOOTLOADER-PACKET_TYPE_CMD_OFFSET] = aci_bootloader_fillReply; rspTbl[ACI_TYPE_BOOTLOADER-PACKET_TYPE_CMD_OFFSET] = aci_bootloader_fillReply;
rspTbl[ACI_TYPE_RESET-PACKET_TYPE_CMD_OFFSET] = aci_reset_fillReply; rspTbl[ACI_TYPE_RESET-PACKET_TYPE_CMD_OFFSET] = aci_reset_fillReply;
rspTbl[ACI_TYPE_SLEEP-PACKET_TYPE_CMD_OFFSET] = aci_sleep_fillReply;
rspTbl[ACI_TYPE_PKTPIN-PACKET_TYPE_CMD_OFFSET] = aci_pktpin_fillReply; rspTbl[ACI_TYPE_PKTPIN-PACKET_TYPE_CMD_OFFSET] = aci_pktpin_fillReply;
rspTbl[ACI_TYPE_RXTHRESH-PACKET_TYPE_CMD_OFFSET] = aci_rxthresh_fillReply; rspTbl[ACI_TYPE_RXTHRESH-PACKET_TYPE_CMD_OFFSET] = aci_rxthresh_fillReply;
rspTbl[ACI_TYPE_BITSPREAD-PACKET_TYPE_CMD_OFFSET] = aci_bitspread_fillReply; rspTbl[ACI_TYPE_BITSPREAD-PACKET_TYPE_CMD_OFFSET] = aci_bitspread_fillReply;
...@@ -167,34 +170,21 @@ bool ...@@ -167,34 +170,21 @@ bool
//__attribute__ ((noinline)) //__attribute__ ((noinline))
aci_check(const mm_packet_t * pkt) aci_check(const mm_packet_t * pkt)
{ {
// HACK
// without any of these two lines, we get a linker/assembler error
// which has probably todo with lto option
// appears to work now ...
// if (pkt->header.type == ACI_TYPE_VERSION) {
// aci_version_processCmd(pkt);
// // send response
// packet_clear(&rsp);
// rsp.header.type = pkt->header.type;
// rsp.header.len = rspTbl[type](rsp.payload);
// aci_sendReply(&rsp);
// return true;
// }
if (pkt->header.type >= PACKET_TYPE_CMD_OFFSET) { if (pkt->header.type >= PACKET_TYPE_CMD_OFFSET) {
mm_type_t type = pkt->header.type - PACKET_TYPE_CMD_OFFSET; mm_type_t type = pkt->header.type - PACKET_TYPE_CMD_OFFSET;
// TODO assert(type < PACKET_TYPE_CMD_NUM); // TODO assert(type < PACKET_TYPE_CMD_NUM);
if (cmdTbl[type] != NULL) { if (cmdTbl[type] != NULL) {
mm_packet_t rsp;
// process cmd // process cmd
cmdTbl[type](pkt); if (cmdTbl[type](pkt)) {
mm_packet_t rsp;
// send response // send response
packet_clear(&rsp); packet_clear(&rsp);
rsp.header.type = pkt->header.type; rsp.header.type = pkt->header.type;
rsp.header.len = rspTbl[type](rsp.payload); rsp.header.len = rspTbl[type](rsp.payload);
aci_sendReply(&rsp); aci_sendReply(&rsp);
} else {
aci_sendNack(pkt->header.type);
}
} else { } else {
aci_sendNack(pkt->header.type); aci_sendNack(pkt->header.type);
} }
......
/** /**
* Copyright 2016-2023 * Copyright 2016-2024
* *
* Bernd-Christian Renner, * Bernd-Christian Renner,
* Jan Heitmann, and * Jan Heitmann, and
...@@ -68,34 +68,21 @@ bool ...@@ -68,34 +68,21 @@ bool
//__attribute__ ((noinline)) //__attribute__ ((noinline))
aci_check(const mm_packet_t * pkt) aci_check(const mm_packet_t * pkt)
{ {
// HACK
// without any of these two lines, we get a linker/assembler error
// which has probably todo with lto option
// appears to work now ...
// if (pkt->header.type == ACI_TYPE_VERSION) {
// aci_version_processCmd(pkt);
// // send response
// packet_clear(&rsp);
// rsp.header.type = pkt->header.type;
// rsp.header.len = rspTbl[type](rsp.payload);
// aci_sendReply(&rsp);
// return true;
// }
if (pkt->header.type >= PACKET_TYPE_CMD_OFFSET) { if (pkt->header.type >= PACKET_TYPE_CMD_OFFSET) {
mm_type_t type = pkt->header.type - PACKET_TYPE_CMD_OFFSET; mm_type_t type = pkt->header.type - PACKET_TYPE_CMD_OFFSET;
// TODO assert(type < PACKET_TYPE_CMD_NUM); // TODO assert(type < PACKET_TYPE_CMD_NUM);
if (cmdTbl[type] != NULL) { if (cmdTbl[type] != NULL) {
mm_packet_t rsp;
// process cmd // process cmd
cmdTbl[type](pkt); if (cmdTbl[type](pkt)) {
mm_packet_t rsp;
// send response // send response
packet_clear(&rsp); packet_clear(&rsp);
rsp.header.type = pkt->header.type; rsp.header.type = pkt->header.type;
rsp.header.len = rspTbl[type](rsp.payload); rsp.header.len = rspTbl[type](rsp.payload);
aci_sendReply(&rsp); aci_sendReply(&rsp);
} else {
aci_sendNack(pkt->header.type);
}
} else { } else {
aci_sendNack(pkt->header.type); aci_sendNack(pkt->header.type);
} }
......
...@@ -49,8 +49,8 @@ ...@@ -49,8 +49,8 @@
#include <stdint.h> #include <stdint.h>
typedef void (*cmd_handler_t)(const mm_packet_t *); typedef bool (* cmd_handler_t)(const mm_packet_t *);
typedef uint8_t (*rsp_handler_t)(uint8_t *); typedef uint8_t (* rsp_handler_t)(uint8_t *);
extern void extern void
......
...@@ -46,6 +46,7 @@ ACI_TYPE_ID = 0x84, ...@@ -46,6 +46,7 @@ ACI_TYPE_ID = 0x84,
ACI_TYPE_BATVOLTAGE = 0x85, ACI_TYPE_BATVOLTAGE = 0x85,
ACI_TYPE_BOOTLOADER = 0x86, ACI_TYPE_BOOTLOADER = 0x86,
ACI_TYPE_RESET = 0x87, ACI_TYPE_RESET = 0x87,
ACI_TYPE_SLEEP = 0x88,
ACI_TYPE_PKTPIN = 0x89, ACI_TYPE_PKTPIN = 0x89,
ACI_TYPE_RXTHRESH = 0x94, ACI_TYPE_RXTHRESH = 0x94,
ACI_TYPE_BITSPREAD = 0x95, ACI_TYPE_BITSPREAD = 0x95,
......
...@@ -5,6 +5,7 @@ ID = 0x84 // setup modem id ...@@ -5,6 +5,7 @@ ID = 0x84 // setup modem id
BATVOLTAGE = 0x85 // get voltage BATVOLTAGE = 0x85 // get voltage
BOOTLOADER = 0x86 // jump to bootloader BOOTLOADER = 0x86 // jump to bootloader
RESET = 0x87 // reset modem RESET = 0x87 // reset modem
SLEEP = 0x88 // sleep mode
PKTPIN = 0x89 // configure packet pin behavior PKTPIN = 0x89 // configure packet pin behavior
// setup // setup
......
...@@ -67,9 +67,10 @@ aci_agc_fillReply(uint8_t * payload) ...@@ -67,9 +67,10 @@ aci_agc_fillReply(uint8_t * payload)
* public functions * public functions
*/ */
void bool
aci_agc_processCmd(const mm_packet_t * pkt) aci_agc_processCmd(const mm_packet_t * pkt)
{ {
// optional action, always return current state
if (pkt->header.len == sizeof(aci_agc_cmd_t)) { if (pkt->header.len == sizeof(aci_agc_cmd_t)) {
aci_agc_cmd_t * a = (aci_agc_cmd_t *)pkt->payload; aci_agc_cmd_t * a = (aci_agc_cmd_t *)pkt->payload;
if (a->en) { if (a->en) {
...@@ -78,6 +79,7 @@ aci_agc_processCmd(const mm_packet_t * pkt) ...@@ -78,6 +79,7 @@ aci_agc_processCmd(const mm_packet_t * pkt)
agc_disable(); agc_disable();
} }
} }
return true;
} }
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
/** /**
* gets/sets the preamble/sync length (in symbols) * gets/sets the preamble/sync length (in symbols)
*/ */
extern void extern bool
aci_agc_processCmd(const mm_packet_t * pkt); aci_agc_processCmd(const mm_packet_t * pkt);
extern uint8_t extern uint8_t
......
...@@ -68,7 +68,9 @@ aci_batvoltage_fillReply(uint8_t * payload) ...@@ -68,7 +68,9 @@ aci_batvoltage_fillReply(uint8_t * payload)
* public functions * public functions
*/ */
void bool
aci_batvoltage_processCmd(__attribute__ ((unused)) const mm_packet_t * pkt) aci_batvoltage_processCmd(__attribute__ ((unused)) const mm_packet_t * pkt)
{ {
// read-only
return true;
} }
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#define ACI_BATVOLTAGE_H #define ACI_BATVOLTAGE_H
#include <batvoltage.h> #include <batvoltage.h>
extern void extern bool
aci_batvoltage_processCmd(const mm_packet_t * pkt); aci_batvoltage_processCmd(const mm_packet_t * pkt);
extern uint8_t extern uint8_t
......
...@@ -67,12 +67,14 @@ aci_bitspread_fillReply(uint8_t * payload) ...@@ -67,12 +67,14 @@ aci_bitspread_fillReply(uint8_t * payload)
* public functions * public functions
*/ */
void bool
aci_bitspread_processCmd(const mm_packet_t * pkt) aci_bitspread_processCmd(const mm_packet_t * pkt)
{ {
// optional action, always return current state
if (pkt->header.len == sizeof(aci_bitspread_cmd_t)) { if (pkt->header.len == sizeof(aci_bitspread_cmd_t)) {
spreader_setSpreadLength(((aci_bitspread_cmd_t *)pkt->payload)->chips); spreader_setSpreadLength(((aci_bitspread_cmd_t *)pkt->payload)->chips);
} }
return true;
} }
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
/** /**
* change spread code /chipping * change spread code /chipping
*/ */
extern void extern bool
aci_bitspread_processCmd(const mm_packet_t * pkt); aci_bitspread_processCmd(const mm_packet_t * pkt);
extern uint8_t extern uint8_t
......
...@@ -63,8 +63,9 @@ aci_bootloader_fillReply(__attribute__ ((unused)) uint8_t * payload) ...@@ -63,8 +63,9 @@ aci_bootloader_fillReply(__attribute__ ((unused)) uint8_t * payload)
* public functions * public functions
*/ */
void bool
aci_bootloader_processCmd(__attribute__ ((unused)) const mm_packet_t * pkt) aci_bootloader_processCmd(__attribute__ ((unused)) const mm_packet_t * pkt)
{ {
bootloader_run(); bootloader_run();
return false; // FIXME we never reach this point
} }
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
/** /**
* get firmware version * get firmware version
*/ */
extern void extern bool
aci_bootloader_processCmd(const mm_packet_t * pkt); aci_bootloader_processCmd(const mm_packet_t * pkt);
extern uint8_t extern uint8_t
......
/** /**
* Copyright 2016-2023 * Copyright 2016-2024
* *
* Bernd-Christian Renner, and * Bernd-Christian Renner, and
* Hamburg University of Technology (TUHH). * Hamburg University of Technology (TUHH).
* All rights reserved. * All rights reserved.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
...@@ -115,21 +115,26 @@ aci_config_fillReply(uint8_t * payload) ...@@ -115,21 +115,26 @@ aci_config_fillReply(uint8_t * payload)
#else #else
strcat((char *)payload, "lo-sp,"); strcat((char *)payload, "lo-sp,");
#endif #endif
// wideband vs. narrowband // wideband vs. narrowband
#ifdef WIDEBAND #ifdef WIDEBAND
strcat((char *)payload, "wb,"); strcat((char *)payload, "wb,");
#else #else
strcat((char *)payload, "nb,"); strcat((char *)payload, "nb,");
#endif #endif
// freq table origin // freq table origin
strcat((char *)payload, LUT_SRC); strcat((char *)payload, LUT_SRC);
#ifdef INVERT_FREQBAND #ifdef INVERT_FREQBAND
strcat((char *)payload, ",inv"); strcat((char *)payload, ",inv");
#endif #endif
strcat((char *)payload, ","); strcat((char *)payload, ",");
// sleep support
#ifdef SLEEP_ENABLE
strcat((char *)payload, "slp,");
#endif
// tx amp board // tx amp board
#ifndef SIM #ifndef SIM
strcat((char *)payload, TXAMP_NAME); strcat((char *)payload, TXAMP_NAME);
...@@ -137,7 +142,7 @@ aci_config_fillReply(uint8_t * payload) ...@@ -137,7 +142,7 @@ aci_config_fillReply(uint8_t * payload)
#endif #endif
// rx amp board // rx amp board
#ifndef SIM #ifndef SIM
strcat((char *)payload, RXAMP_NAME); strcat((char *)payload, RXAMP_NAME);
strcat((char *)payload, ","); strcat((char *)payload, ",");
#endif #endif
...@@ -149,7 +154,13 @@ aci_config_fillReply(uint8_t * payload) ...@@ -149,7 +154,13 @@ aci_config_fillReply(uint8_t * payload)
void /**************************************************************************
* public functions
*/
bool
aci_config_processCmd(__attribute__ ((unused)) const mm_packet_t * pkt) aci_config_processCmd(__attribute__ ((unused)) const mm_packet_t * pkt)
{ {
// read-only
return true;
} }
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
/** /**
* get firmware version * get firmware version
*/ */
extern void extern bool
aci_config_processCmd(const mm_packet_t * pkt); aci_config_processCmd(const mm_packet_t * pkt);
extern uint8_t extern uint8_t
......
...@@ -65,13 +65,15 @@ aci_fec_fillReply(uint8_t * payload) ...@@ -65,13 +65,15 @@ aci_fec_fillReply(uint8_t * payload)
* public functions * public functions
*/ */
void bool
aci_fec_processCmd(const mm_packet_t * pkt) aci_fec_processCmd(const mm_packet_t * pkt)
{ {
// optional action, always return current state
if (pkt->header.len == sizeof(aci_fec_cmd_t)) { if (pkt->header.len == sizeof(aci_fec_cmd_t)) {
//aci_fec_cmd_t * a = (aci_fec_cmd_t *)pkt->payload; //aci_fec_cmd_t * a = (aci_fec_cmd_t *)pkt->payload;
// FIXME fec_setFec(a->fec); // FIXME fec_setFec(a->fec);
} }
return true;
} }
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
/** /**
* gets/sets the preamble/sync length (in symbols) * gets/sets the preamble/sync length (in symbols)
*/ */
extern void extern bool
aci_fec_processCmd(const mm_packet_t * pkt); aci_fec_processCmd(const mm_packet_t * pkt);
extern uint8_t extern uint8_t
......
...@@ -73,13 +73,15 @@ aci_filterraw_fillReply(uint8_t * payload) ...@@ -73,13 +73,15 @@ aci_filterraw_fillReply(uint8_t * payload)
* public functions * public functions
*/ */
void bool
aci_filterraw_processCmd(const mm_packet_t * pkt) aci_filterraw_processCmd(const mm_packet_t * pkt)
{ {
// optional action, always return current state
if (pkt->header.len == sizeof(aci_filterraw_cmd_t)) { if (pkt->header.len == sizeof(aci_filterraw_cmd_t)) {
aci_filterraw_cmd_t * p = (aci_filterraw_cmd_t *)(pkt->payload); aci_filterraw_cmd_t * p = (aci_filterraw_cmd_t *)(pkt->payload);
filterraw_set(p->stage, p->value); filterraw_set(p->stage, p->value);
} }
return true;
} }
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
/** /**
* configure filter * configure filter
*/ */
extern void extern bool
aci_filterraw_processCmd(const mm_packet_t * pkt); aci_filterraw_processCmd(const mm_packet_t * pkt);
extern uint8_t extern uint8_t
......