- Minor fix to ?aprsd command.
- Changes to beacon.c to accomodate chnage in ?aprsd.
- Add thread terminator capability to idle thread.
- More tidy up in portab files.
pull/4/head
bob 2018-06-28 10:11:48 +10:00
rodzic e1c937bff5
commit 499dd6986f
8 zmienionych plików z 52 dodań i 29 usunięć

Wyświetl plik

@ -557,8 +557,11 @@
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
#define PORT_IDLE_THREAD_STACK_SIZE 256
#define CH_CFG_IDLE_LOOP_HOOK() { \
/* Idle loop code here.*/ \
extern void pktIdleThread(void); \
pktIdleThread(); \
}
/**

Wyświetl plik

@ -149,7 +149,7 @@
* Number of general AX25/APRS processing & frame send buffers.
* Can configured as being in CCM to save system core memory use.
*/
#define NUMBER_COMMON_PKT_BUFFERS 10U
#define NUMBER_COMMON_PKT_BUFFERS 15U
#define RESERVE_BUFFERS_FOR_INTERNAL 2U
#define MAX_BUFFERS_FOR_BURST_SEND 5U
#if (MAX_BUFFERS_FOR_BURST_SEND > \

Wyświetl plik

@ -557,8 +557,11 @@
* @brief Idle Loop hook.
* @details This hook is continuously invoked by the idle thread loop.
*/
#define PORT_IDLE_THREAD_STACK_SIZE 256
#define CH_CFG_IDLE_LOOP_HOOK() { \
/* Idle loop code here.*/ \
extern void pktIdleThread(void); \
pktIdleThread(); \
}
/**

Wyświetl plik

@ -139,9 +139,9 @@
#define NUMBER_RX_PKT_BUFFERS 3U
/* Number of general AX25/APRS processing & frame send buffers. */
#define NUMBER_COMMON_PKT_BUFFERS 10U
#define NUMBER_COMMON_PKT_BUFFERS 15U
#define RESERVE_BUFFERS_FOR_INTERNAL 2U
#define MAX_BUFFERS_FOR_BURST_SEND 3U
#define MAX_BUFFERS_FOR_BURST_SEND 5U
#if (MAX_BUFFERS_FOR_BURST_SEND > \
(NUMBER_COMMON_PKT_BUFFERS - RESERVE_BUFFERS_FOR_INTERNAL))
#warning "Can not allocate requested buffers for burst send - set to 50%"

Wyświetl plik

@ -1,4 +1,4 @@
/* trackuino copyright (C) 2010 EA5HAV Javi
/* Certain parts from trackuino copyright (C) 2010 EA5HAV Javi
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -27,6 +27,7 @@
#include "flash.h"
#include "image.h"
#include "beacon.h"
#include "threads.h"
#define METER_TO_FEET(m) (((m)*26876) / 8192)

Wyświetl plik

@ -31,9 +31,8 @@ THD_FUNCTION(bcnThread, arg) {
sysinterval_t time = chVTGetSystemTime();
/* Now wait for our delay before starting. */
sysinterval_t delay = conf->beacon.init_delay;
chThdSleep(delay);
chThdSleepUntil(chVTGetSystemTime() + conf->beacon.init_delay);
while(true) {
@ -96,7 +95,7 @@ THD_FUNCTION(bcnThread, arg) {
conf->symbol,
dataPoint, true);
if(packet == NULL) {
TRACE_WARN("BCN > No free packet objects"
TRACE_ERROR("BCN > No free packet objects"
" for position transmission");
} else {
if(!transmitOnRadio(packet,
@ -129,7 +128,7 @@ THD_FUNCTION(bcnThread, arg) {
*/
packet = aprs_compose_aprsd_message(conf->call, path, call);
if(packet == NULL) {
TRACE_WARN("BCN > No free packet objects "
TRACE_ERROR("BCN > No free packet objects "
"or badly formed APRSD message");
} else {
if(!transmitOnRadio(packet,
@ -159,7 +158,7 @@ thread_t * start_beacon_thread(bcn_app_conf_t *conf, const char *name) {
name, LOWPRIO, bcnThread, conf);
if(!th) {
// Print startup error, do not start watchdog for this thread
TRACE_ERROR("BCN > Could not start thread (not enough memory available)");
TRACE_ERROR("BCN > Could not start thread (insufficient memory)");
}
return th;
}

Wyświetl plik

@ -23,8 +23,7 @@ void start_essential_threads(void)
chThdSleep(TIME_MS2I(300)); // Wait for tracking manager to initialize
}
void start_user_threads(void)
{
void start_user_threads(void) {
conf_t *conf_flash = (conf_t*)0x08060000;
/* Check if a user update has been made to configuration in flash. */
if(conf_flash->magic != CONFIG_MAGIC_UPDATED) {
@ -69,21 +68,35 @@ void start_user_threads(void)
0,
conf_sram.aprs.rx.radio_conf.rssi);
}
/**
* General thread termination and cleanup.
* Called by the thread that is terminating.
*/
/* void pktTerminateThread(thread_t *th) {
(void)th;
}*/
/**
* General thread termination and cleanup.
* Handled from the idle thread hook.
*/
/* void release_terminated_thread(thread_t *th) {
(void)th;
}*/
}
/**
* General thread termination and cleanup.
* Called by the thread that is terminating.
* A message is posted to the idle thread.
* Idle then releases the calling thread.
*/
void pktTerminateSelf(void) {
/* Post self thread to idle for termination cleanup. */
msg_t msg = chMsgSend(chSysGetIdleThreadX(), MSG_OK);
chThdExit(msg);
}
/**
* General thread termination and cleanup.
* Called from the idle thread hook.
*/
void pktIdleThread(void) {
chSysLock();
if(!chMsgIsPendingI(chThdGetSelfX())) {
chSysUnlock();
return;
}
/* Get the message from the terminating thread. */
chSysUnlock();
thread_t *tp = chMsgWait();
(void)chMsgGet(tp);
chMsgRelease(tp, MSG_OK);
(void)chThdWait(tp);
}

Wyświetl plik

@ -5,8 +5,12 @@
void start_essential_threads(void);
void start_user_threads(void);
void pktTerminateThread(thread_t *th);
void release_terminated_thread(thread_t *th);
void pktTerminateSelf(void);
void pktIdleThread(void);
/*===========================================================================*/
/* Module inline functions. */
/*===========================================================================*/
extern sysinterval_t watchdog_tracking; // Last update time for module TRACKING