kopia lustrzana https://github.com/OpenRTX/OpenRTX
Began integrating RTX driver with all the other code
rodzic
4f0ffe8565
commit
0d5a703521
|
@ -30,8 +30,8 @@
|
|||
*/
|
||||
enum mode_t
|
||||
{
|
||||
FM = 0, /**< Analog FM mode */
|
||||
DMR /**< DMR mode */
|
||||
FM = 0, /**< Analog FM mode */
|
||||
DMR = 1 /**< DMR mode */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -41,9 +41,9 @@ enum mode_t
|
|||
enum admit_t
|
||||
{
|
||||
ALWAYS = 0, /**< Always transmit when PTT is pressed */
|
||||
FREE, /**< Transmit only if channel si free */
|
||||
TONE, /**< Transmit on matching tone */
|
||||
COLOR /**< Transmit only if color code is not used yet */
|
||||
FREE = 1, /**< Transmit only if channel si free */
|
||||
TONE = 2, /**< Transmit on matching tone */
|
||||
COLOR = 3 /**< Transmit only if color code is not used yet */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -52,8 +52,8 @@ enum admit_t
|
|||
enum bw_t
|
||||
{
|
||||
BW_12_5 = 0, /**< Bandwidth is 12.5kHz */
|
||||
BW_20, /**< Bandwidth is 20kHz */
|
||||
BW_25 /**< Bandwidth is 25kHz */
|
||||
BW_20 = 1, /**< Bandwidth is 20kHz */
|
||||
BW_25 = 2 /**< Bandwidth is 25kHz */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define RTX_H
|
||||
|
||||
#include <os.h>
|
||||
#include <cps.h>
|
||||
#include <stdint.h>
|
||||
#include <datatypes.h>
|
||||
|
||||
|
@ -44,18 +45,18 @@ typedef struct
|
|||
}
|
||||
rtxStatus_t;
|
||||
|
||||
enum bandwidth
|
||||
{
|
||||
BW_12_5 = 0, /**< 12.5kHz bandwidth */
|
||||
BW_20 = 1, /**< 20kHz bandwidth */
|
||||
BW_25 = 2 /**< 25kHz bandwidth */
|
||||
};
|
||||
|
||||
enum opmode
|
||||
{
|
||||
FM = 0, /**< Analog FM */
|
||||
DMR = 1 /**< DMR */
|
||||
};
|
||||
// enum bandwidth
|
||||
// {
|
||||
// BW_12_5 = 0, /**< 12.5kHz bandwidth */
|
||||
// BW_20 = 1, /**< 20kHz bandwidth */
|
||||
// BW_25 = 2 /**< 25kHz bandwidth */
|
||||
// };
|
||||
//
|
||||
// enum opmode
|
||||
// {
|
||||
// FM = 0, /**< Analog FM */
|
||||
// DMR = 1 /**< DMR */
|
||||
// };
|
||||
|
||||
enum opstatus
|
||||
{
|
||||
|
|
|
@ -27,8 +27,7 @@
|
|||
#include <platform.h>
|
||||
#include <hwconfig.h>
|
||||
#include <event.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <rtx.h>
|
||||
|
||||
/* Mutex for concurrent access to state variable */
|
||||
static OS_MUTEX state_mutex;
|
||||
|
@ -36,6 +35,9 @@ static OS_MUTEX state_mutex;
|
|||
/* Queue for sending and receiving ui update requests */
|
||||
static OS_Q ui_queue;
|
||||
|
||||
/* Mutex for concurrent access to RTX state variable */
|
||||
static OS_MUTEX rtx_mutex;
|
||||
|
||||
/**************************** IMPORTANT NOTE ***********************************
|
||||
* *
|
||||
* Rationale for "xx_TASK_STKSIZE/sizeof(CPU_STK)": uC/OS-III manages task *
|
||||
|
@ -65,11 +67,6 @@ static CPU_STK dev_stk[DEV_TASK_STKSIZE/sizeof(CPU_STK)];
|
|||
static OS_TCB rtx_tcb;
|
||||
static CPU_STK rtx_stk[RTX_TASK_STKSIZE/sizeof(CPU_STK)];
|
||||
|
||||
/* DMR task control block and stack */
|
||||
static OS_TCB dmr_tcb;
|
||||
static CPU_STK dmr_stk[DMR_TASK_STKSIZE/sizeof(CPU_STK)];
|
||||
|
||||
|
||||
/**
|
||||
* \internal Task function in charge of updating the UI.
|
||||
*/
|
||||
|
@ -189,28 +186,11 @@ static void rtx_task(void *arg)
|
|||
(void) arg;
|
||||
OS_ERR os_err;
|
||||
|
||||
while(1)
|
||||
{
|
||||
// Execute rtx radio thread every 30ms to match DMR task
|
||||
//TODO: uncomment after rtx.h merge
|
||||
//rtx_main();
|
||||
OSTimeDlyHMSM(0u, 0u, 0u, 30u, OS_OPT_TIME_HMSM_STRICT, &os_err);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \internal Task function for DMR management.
|
||||
*/
|
||||
static void dmr_task(void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
OS_ERR os_err;
|
||||
rtx_init(&rtx_mutex);
|
||||
|
||||
while(1)
|
||||
{
|
||||
// Execute dmr radio thread every 30ms to match DMR timeslot
|
||||
//TODO: uncomment after dmr.h merge
|
||||
//dmr_main();
|
||||
rtx_taskFunc();
|
||||
OSTimeDlyHMSM(0u, 0u, 0u, 30u, OS_OPT_TIME_HMSM_STRICT, &os_err);
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +212,12 @@ void create_threads()
|
|||
(CPU_CHAR *) "UI event queue",
|
||||
(OS_MSG_QTY ) 10,
|
||||
(OS_ERR *) &os_err);
|
||||
|
||||
|
||||
// Create RTX state mutex
|
||||
OSMutexCreate((OS_MUTEX *) &rtx_mutex,
|
||||
(CPU_CHAR *) "RTX Mutex",
|
||||
(OS_ERR *) &os_err);
|
||||
|
||||
// State initialization, execute before starting all tasks
|
||||
state_init();
|
||||
|
||||
|
@ -265,7 +250,7 @@ void create_threads()
|
|||
(void *) 0,
|
||||
(OS_OPT ) (OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
|
||||
(OS_ERR *) &os_err);
|
||||
|
||||
|
||||
// Create state thread
|
||||
OSTaskCreate((OS_TCB *) &dev_tcb,
|
||||
(CPU_CHAR *) "Device Task",
|
||||
|
@ -295,19 +280,4 @@ void create_threads()
|
|||
(void *) 0,
|
||||
(OS_OPT ) (OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
|
||||
(OS_ERR *) &os_err);
|
||||
|
||||
// Create dmr radio thread
|
||||
OSTaskCreate((OS_TCB *) &dmr_tcb,
|
||||
(CPU_CHAR *) "DMR Task",
|
||||
(OS_TASK_PTR ) dmr_task,
|
||||
(void *) 0,
|
||||
(OS_PRIO ) 3,
|
||||
(CPU_STK *) &dmr_stk[0],
|
||||
(CPU_STK ) 0,
|
||||
(CPU_STK_SIZE) DMR_TASK_STKSIZE/sizeof(CPU_STK),
|
||||
(OS_MSG_QTY ) 0,
|
||||
(OS_TICK ) 0,
|
||||
(void *) 0,
|
||||
(OS_OPT ) (OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
|
||||
(OS_ERR *) &os_err);
|
||||
}
|
||||
|
|
|
@ -17,12 +17,13 @@
|
|||
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
||||
***************************************************************************/
|
||||
|
||||
#include <platform.h>
|
||||
#include <gpio.h>
|
||||
#include <nvmem.h>
|
||||
#include <platform.h>
|
||||
#include <hwconfig.h>
|
||||
#include <ADC1_MDx.h>
|
||||
#include <calibInfo_MDx.h>
|
||||
#include <nvmem.h>
|
||||
#include <toneGenerator_MDx.h>
|
||||
|
||||
md3x0Calib_t calibration;
|
||||
|
||||
|
@ -77,6 +78,11 @@ void platform_init()
|
|||
*/
|
||||
nvm_init();
|
||||
nvm_readCalibData(&calibration);
|
||||
|
||||
/*
|
||||
* Initialise tone generator
|
||||
*/
|
||||
toneGen_init();
|
||||
}
|
||||
|
||||
void platform_terminate()
|
||||
|
|
|
@ -17,12 +17,13 @@
|
|||
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
||||
***************************************************************************/
|
||||
|
||||
#include <platform.h>
|
||||
#include <gpio.h>
|
||||
#include <nvmem.h>
|
||||
#include <platform.h>
|
||||
#include <hwconfig.h>
|
||||
#include <ADC1_MDx.h>
|
||||
#include <calibInfo_MDx.h>
|
||||
#include <nvmem.h>
|
||||
#include <toneGenerator_MDx.h>
|
||||
|
||||
md3x0Calib_t calibration;
|
||||
|
||||
|
@ -77,6 +78,11 @@ void platform_init()
|
|||
*/
|
||||
nvm_init();
|
||||
nvm_readCalibData(&calibration);
|
||||
|
||||
/*
|
||||
* Initialise tone generator
|
||||
*/
|
||||
toneGen_init();
|
||||
}
|
||||
|
||||
void platform_terminate()
|
||||
|
|
Ładowanie…
Reference in New Issue