Hi
I have added this to an empty RTOS project. Why is the task not running?
Kind regards
/*
* ======== empty.c ========
*/
/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/runtime/System.h>
/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/knl/Task.h>
/* TI-RTOS Header files */
// #include <ti/drivers/I2C.h>
#include <ti/drivers/PIN.h>
// #include <ti/drivers/SPI.h>
// #include <ti/drivers/UART.h>
// #include <ti/drivers/Watchdog.h>
/* Board Header files */
#include "Board.h"
#define TASKSTACKSIZE 512
Task_Struct task0Struct;
Char task0Stack[TASKSTACKSIZE];
Task_Struct task1Struct;
Char task1Stack[TASKSTACKSIZE];
/* Pin driver handle */
static PIN_Handle ledPinHandle;
static PIN_State ledPinState;
uint8_t g_configPinStatus=0;
uint8_t g_currentState=0;
/*
* Application LED pin configuration table:
* - All LEDs board LEDs are off.
*/
PIN_Config ledPinTable[] = {
Board_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
Board_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
Board_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
Board_LED3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
PIN_TERMINATE
};
/*
* ======== heartBeatFxn ========
* Toggle the Board_LED0. The Task_sleep is determined by arg0 which
* is configured for the heartBeat Task instance.
*/
Void heartBeatFxn(UArg arg0, UArg arg1)
{
while (1) {
Task_sleep((UInt)arg0);
PIN_setOutputValue(ledPinHandle, Board_LED0,
!PIN_getOutputValue(Board_LED0));
System_printf("Now In hearBeat");
}
}
/*
* ======== CheckCfgPin ========
* Check Cfg Pin
*/
Void checkCFGPin(UArg arg0, UArg arg1)
{
while (1)
{
Task_sleep((UInt)arg0);
g_configPinStatus = PIN_getInputValue(EnableConfig);
System_printf("Now in checkCfg");
if(g_configPinStatus&1 == 1)
{
PIN_setOutputValue(ledPinHandle, Board_LED2,
!PIN_getOutputValue(Board_LED2));
}
}
}
/*
* ======== main ========
*/
int main(void)
{
Task_Params taskParams;
Task_Params cfgChkTsk;
/* Call board init functions */
Board_initGeneral();
// Board_initI2C();
// Board_initSPI();
// Board_initUART();
// Board_initWatchdog();
/* Construct heartBeat Task thread */
Task_Params_init(&taskParams);
taskParams.arg0 = 1000000 / Clock_tickPeriod;
taskParams.stackSize = TASKSTACKSIZE;
taskParams.stack = &task0Stack;
Task_construct(&task0Struct, (Task_FuncPtr)heartBeatFxn, &taskParams, NULL);
Task_Params_init(&cfgChkTsk);
cfgChkTsk.arg0 = 5000000 / Clock_tickPeriod;
cfgChkTsk.stackSize = TASKSTACKSIZE;
cfgChkTsk.stack = &task0Stack;
Task_construct(&task1Struct, (Task_FuncPtr)checkCFGPin, &cfgChkTsk, NULL);
/* Open LED pins */
ledPinHandle = PIN_open(&ledPinState, ledPinTable);
if(!ledPinHandle) {
System_abort("Error initializing board LED pins\n");
}
//PIN_setOutputValue(ledPinHandle, Board_LED1, 1);
System_printf("Starting the example\nSystem provider is set to SysMin. "
"Halt the target to view any SysMin contents in ROV.\n");
/* SysMin will only print to the console when you call flush or exit */
System_flush();
/* Start BIOS */
BIOS_start();
return (0);
}
Ben