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 @@
- 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 ===
- failed gain stage change cannot be identified in software due to DMA use
......
/**
* Copyright 2016-2023
* Copyright 2016-2024
*
* Bernd-Christian Renner,
* Jan Heitmann, and
......@@ -46,6 +46,7 @@
#include "csrc/aci_batvoltage.c"
#include "csrc/aci_bootloader.c"
#include "csrc/aci_reset.c"
#include "csrc/aci_sleep.c"
#include "csrc/aci_pktpin.c"
#include "csrc/aci_rxthresh.c"
#include "csrc/aci_bitspread.c"
......@@ -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_BOOTLOADER-PACKET_TYPE_CMD_OFFSET] = aci_bootloader_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_RXTHRESH-PACKET_TYPE_CMD_OFFSET] = aci_rxthresh_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;
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_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_RXTHRESH-PACKET_TYPE_CMD_OFFSET] = aci_rxthresh_fillReply;
rspTbl[ACI_TYPE_BITSPREAD-PACKET_TYPE_CMD_OFFSET] = aci_bitspread_fillReply;
......@@ -167,34 +170,21 @@ bool
//__attribute__ ((noinline))
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) {
mm_type_t type = pkt->header.type - PACKET_TYPE_CMD_OFFSET;
// TODO assert(type < PACKET_TYPE_CMD_NUM);
if (cmdTbl[type] != NULL) {
mm_packet_t rsp;
// process cmd
cmdTbl[type](pkt);
// send response
packet_clear(&rsp);
rsp.header.type = pkt->header.type;
rsp.header.len = rspTbl[type](rsp.payload);
aci_sendReply(&rsp);
if (cmdTbl[type](pkt)) {
mm_packet_t rsp;
// send response
packet_clear(&rsp);
rsp.header.type = pkt->header.type;
rsp.header.len = rspTbl[type](rsp.payload);
aci_sendReply(&rsp);
} else {
aci_sendNack(pkt->header.type);
}
} else {
aci_sendNack(pkt->header.type);
}
......
/**
* Copyright 2016-2023
* Copyright 2016-2024
*
* Bernd-Christian Renner,
* Jan Heitmann, and
......@@ -68,34 +68,21 @@ bool
//__attribute__ ((noinline))
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) {
mm_type_t type = pkt->header.type - PACKET_TYPE_CMD_OFFSET;
// TODO assert(type < PACKET_TYPE_CMD_NUM);
if (cmdTbl[type] != NULL) {
mm_packet_t rsp;
// process cmd
cmdTbl[type](pkt);
// send response
packet_clear(&rsp);
rsp.header.type = pkt->header.type;
rsp.header.len = rspTbl[type](rsp.payload);
aci_sendReply(&rsp);
if (cmdTbl[type](pkt)) {
mm_packet_t rsp;
// send response
packet_clear(&rsp);
rsp.header.type = pkt->header.type;
rsp.header.len = rspTbl[type](rsp.payload);
aci_sendReply(&rsp);
} else {
aci_sendNack(pkt->header.type);
}
} else {
aci_sendNack(pkt->header.type);
}
......
......@@ -49,8 +49,8 @@
#include <stdint.h>
typedef void (*cmd_handler_t)(const mm_packet_t *);
typedef uint8_t (*rsp_handler_t)(uint8_t *);
typedef bool (* cmd_handler_t)(const mm_packet_t *);
typedef uint8_t (* rsp_handler_t)(uint8_t *);
extern void
......
......@@ -46,6 +46,7 @@ ACI_TYPE_ID = 0x84,
ACI_TYPE_BATVOLTAGE = 0x85,
ACI_TYPE_BOOTLOADER = 0x86,
ACI_TYPE_RESET = 0x87,
ACI_TYPE_SLEEP = 0x88,
ACI_TYPE_PKTPIN = 0x89,
ACI_TYPE_RXTHRESH = 0x94,
ACI_TYPE_BITSPREAD = 0x95,
......
......@@ -5,6 +5,7 @@ ID = 0x84 // setup modem id
BATVOLTAGE = 0x85 // get voltage
BOOTLOADER = 0x86 // jump to bootloader
RESET = 0x87 // reset modem
SLEEP = 0x88 // sleep mode
PKTPIN = 0x89 // configure packet pin behavior
// setup
......
......@@ -67,9 +67,10 @@ aci_agc_fillReply(uint8_t * payload)
* public functions
*/
void
bool
aci_agc_processCmd(const mm_packet_t * pkt)
{
// optional action, always return current state
if (pkt->header.len == sizeof(aci_agc_cmd_t)) {
aci_agc_cmd_t * a = (aci_agc_cmd_t *)pkt->payload;
if (a->en) {
......@@ -78,6 +79,7 @@ aci_agc_processCmd(const mm_packet_t * pkt)
agc_disable();
}
}
return true;
}
......
......@@ -43,7 +43,7 @@
/**
* gets/sets the preamble/sync length (in symbols)
*/
extern void
extern bool
aci_agc_processCmd(const mm_packet_t * pkt);
extern uint8_t
......
......@@ -68,7 +68,9 @@ aci_batvoltage_fillReply(uint8_t * payload)
* public functions
*/
void
bool
aci_batvoltage_processCmd(__attribute__ ((unused)) const mm_packet_t * pkt)
{
// read-only
return true;
}
......@@ -39,7 +39,7 @@
#define ACI_BATVOLTAGE_H
#include <batvoltage.h>
extern void
extern bool
aci_batvoltage_processCmd(const mm_packet_t * pkt);
extern uint8_t
......
......@@ -67,12 +67,14 @@ aci_bitspread_fillReply(uint8_t * payload)
* public functions
*/
void
bool
aci_bitspread_processCmd(const mm_packet_t * pkt)
{
// optional action, always return current state
if (pkt->header.len == sizeof(aci_bitspread_cmd_t)) {
spreader_setSpreadLength(((aci_bitspread_cmd_t *)pkt->payload)->chips);
}
return true;
}
......
......@@ -43,7 +43,7 @@
/**
* change spread code /chipping
*/
extern void
extern bool
aci_bitspread_processCmd(const mm_packet_t * pkt);
extern uint8_t
......
......@@ -63,8 +63,9 @@ aci_bootloader_fillReply(__attribute__ ((unused)) uint8_t * payload)
* public functions
*/
void
bool
aci_bootloader_processCmd(__attribute__ ((unused)) const mm_packet_t * pkt)
{
bootloader_run();
return false; // FIXME we never reach this point
}
......@@ -45,7 +45,7 @@
/**
* get firmware version
*/
extern void
extern bool
aci_bootloader_processCmd(const mm_packet_t * pkt);
extern uint8_t
......
/**
* Copyright 2016-2023
*
* Copyright 2016-2024
*
* Bernd-Christian Renner, and
* Hamburg University of Technology (TUHH).
* All rights reserved.
......@@ -11,7 +11,7 @@
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
......@@ -115,21 +115,26 @@ aci_config_fillReply(uint8_t * payload)
#else
strcat((char *)payload, "lo-sp,");
#endif
// wideband vs. narrowband
#ifdef WIDEBAND
strcat((char *)payload, "wb,");
#else
strcat((char *)payload, "nb,");
#endif
// freq table origin
strcat((char *)payload, LUT_SRC);
#ifdef INVERT_FREQBAND
strcat((char *)payload, ",inv");
#endif
strcat((char *)payload, ",");
// sleep support
#ifdef SLEEP_ENABLE
strcat((char *)payload, "slp,");
#endif
// tx amp board
#ifndef SIM
strcat((char *)payload, TXAMP_NAME);
......@@ -137,7 +142,7 @@ aci_config_fillReply(uint8_t * payload)
#endif
// rx amp board
#ifndef SIM
#ifndef SIM
strcat((char *)payload, RXAMP_NAME);
strcat((char *)payload, ",");
#endif
......@@ -149,7 +154,13 @@ aci_config_fillReply(uint8_t * payload)
void
/**************************************************************************
* public functions
*/
bool
aci_config_processCmd(__attribute__ ((unused)) const mm_packet_t * pkt)
{
// read-only
return true;
}
......@@ -43,7 +43,7 @@
/**
* get firmware version
*/
extern void
extern bool
aci_config_processCmd(const mm_packet_t * pkt);
extern uint8_t
......
......@@ -65,13 +65,15 @@ aci_fec_fillReply(uint8_t * payload)
* public functions
*/
void
bool
aci_fec_processCmd(const mm_packet_t * pkt)
{
// optional action, always return current state
if (pkt->header.len == sizeof(aci_fec_cmd_t)) {
//aci_fec_cmd_t * a = (aci_fec_cmd_t *)pkt->payload;
// FIXME fec_setFec(a->fec);
}
return true;
}
......
......@@ -43,7 +43,7 @@
/**
* gets/sets the preamble/sync length (in symbols)
*/
extern void
extern bool
aci_fec_processCmd(const mm_packet_t * pkt);
extern uint8_t
......
......@@ -73,13 +73,15 @@ aci_filterraw_fillReply(uint8_t * payload)
* public functions
*/
void
bool
aci_filterraw_processCmd(const mm_packet_t * pkt)
{
// optional action, always return current state
if (pkt->header.len == sizeof(aci_filterraw_cmd_t)) {
aci_filterraw_cmd_t * p = (aci_filterraw_cmd_t *)(pkt->payload);
filterraw_set(p->stage, p->value);
}
return true;
}
......
......@@ -43,7 +43,7 @@
/**
* configure filter
*/
extern void
extern bool
aci_filterraw_processCmd(const mm_packet_t * pkt);
extern uint8_t
......