Hi,
I want to add a Task that interval every 100 ms operate 1'st. My code are as follows:
#include <string.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/knl/Event.h>
#include <ti/sysbios/knl/Queue.h>
#include "hci_tl.h"
#include "gatt.h"
#include "linkdb.h"
#include "gapgattserver.h"
#include "gattservapp.h"
#include "devinfoservice.h"
#if defined(FEATURE_OAD) || defined(IMAGE_INVALIDATE)
#include "oad_target.h"
#include "oad.h"
#endif //FEATURE_OAD || IMAGE_INVALIDATE
#include "peripheral.h"
#include "gapbondmgr.h"
#include "osal_snv.h"
#include "icall_apimsg.h"
#include "util.h"
#ifdef USE_RCOSC
#include "rcosc_calibration.h"
#endif //USE_RCOSC
#ifdef USE_CORE_SDK
#include <ti/display/Display.h>
#else // !USE_CORE_SDK
#include <ti/mw/display/Display.h>
#endif // USE_CORE_SDK
#include "board_key.h"
#include "board.h"
#include "serial_port_service.h"
#include "spp_ble_server.h"
#include "inc/sdi_task.h"
#include "inc/sdi_tl_uart.h"
#if defined( DEBUG_SW_TRACE )
#include <driverlib/ioc.h>
#endif // USE_FPGA | DEBUG_SW_TRACE
#include "icall_api.h"
#define CTT_ICALL_EVT ICALL_MSG_EVENT_ID // Event_Id_31
#define CTT_QUEUE_EVT UTIL_QUEUE_EVENT_ID // Event_Id_30
#define CTT_PERIODIC_EVT Event_Id_07
#define CTT_ALL_EVENTS (CTT_ICALL_EVT | \
CTT_QUEUE_EVT | \
CTT_PERIODIC_EVT)
#define CTTTASK_STACK_SIZE 800
#define CTTTASK_PRIORITY 2
// How often to perform periodic event (in msec)
#define CTT_PERIODIC_EVT_PERIOD 100
static void CTT_init(void);
static void CTTTask_Fxn(UArg a0, UArg a1);
static void CTTTask_clockHandler(UArg a11);
static ICall_EntityID selfEntity;
static ICall_SyncHandle syncEvent;
static Clock_Struct periodicClock;
Char cttTaskStack[CTTTASK_STACK_SIZE];
Task_Struct cttTaskStruct;
int Don_test1;
long Don_test2;
uint32_t Don_test3;
void CTTTask_createTask(void)
{
Task_Params ctttaskParams;
// Configure and create the SDI task.
Task_Params_init(&ctttaskParams);
ctttaskParams.stack = cttTaskStack;
ctttaskParams.stackSize = CTTTASK_STACK_SIZE;
ctttaskParams.priority = CTTTASK_PRIORITY;
Task_construct(&cttTaskStruct, CTTTask_Fxn, &ctttaskParams, NULL);
}
void CTTTask_Fxn(UArg a0, UArg a1)
{
Don_test1 = 0;
Don_test2 = 1;
CTT_init();
for(;;)
{
uint32_t events;
// Wait for an event to be posted
events = Event_pend(syncEvent, Event_Id_NONE, CTT_ALL_EVENTS,
ICALL_TIMEOUT_FOREVER);
Don_test3 = events;
if(events)
{
// ICall_EntityID dest;
// ICall_ServiceEnum src;
// ICall_HciExtEvt *pMsg = NULL;
Don_test1++;
Don_test2 = Don_test2 + Don_test1;
}
}
}
static void CTT_init(void)
{
ICall_registerApp(&selfEntity, &syncEvent);
Util_constructClock(&periodicClock, CTTTask_clockHandler,
CTT_PERIODIC_EVT_PERIOD, 0, false, CTT_PERIODIC_EVT);
}
static void CTTTask_clockHandler(UArg a11)
{
// Wake up the application.
Event_post(syncEvent, a11);
}
My questions are as follows:
1, My code jest run CTTTask_Fxn(UArg a0, UArg a1) program 1'st, not interval every 100 ms operate 1'st.
2, How to modify my program, let it interval every 100 ms operate 1'st.
Any idea how can I solve the problem? Every help would be really appreciated!
Thanks in advance.
Don