This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C28X Timer module callback function and HWI

Other Parts Discussed in Thread: SYSBIOS

Hi,Sir!

This is a demo code from CCS5.X.

/*
* 28x specific Task example.
*
* This example:
*
* 1) prints "Hello world" in main().
*
* 2) increments a counter within a timer interrupt.
*
* 3) every 10 timer interrupts, the timer interrupt handler
* posts a semaphore to awaken a task to perform additional
* work.
*
* 4) prints "10 ticks" from within the task function awakened
* each time 10 interrupts have been serviced.
*
* All output is routed to a log buffer which can be viewed
* using the RTA "Raw Logs" viewer. After loading and running
* the application, launch the Tools->RTA->Raw Logs tool to
* view the logs.
*/
#include <xdc/std.h>
#include <xdc/runtime/Log.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Semaphore.h>

/* Semaphore handle defined in task.cfg */
extern const Semaphore_Handle mySem;

/* Counter incremented by timer interrupt */
volatile UInt tickCount = 0;
volatile UInt tickCount1 = 0;
volatile UInt Clock0Count = 0;
volatile UInt Clock1Count = 0;
/*
* ======== main ========
*/
Void main()
{
/*
* Print "Hello world" to a log buffer.
*/
Log_info0("Hello world\n");

/*
* Start BIOS.
* Begins task scheduling.
*/
BIOS_start(); /* does not return */
}

/*
* ======== myTickFxn ========
* Timer ISR function that posts a Swi to perform
* the non-realtime service functions.
*/

Void clock0Fn(UArg arg)
{
Clock0Count++;
}
Void clock1Fn(UArg arg)
{
Clock1Count++;
}

Void myTickFxn(UArg arg)
{
tickCount += 1; /* increment the counter */

/* every 10 timer interrupts post the semaphore */
if ((tickCount % 10) == 0) {
Semaphore_post(mySem);
}
}
Void Timer1Fn(UArg arg)
{

tickCount1 += 1; /* increment the counter */

}
/*
* ======== myTaskFxn ========
* Task function that pends on a semaphore until 10 ticks have
* expired.
*/
Void myTaskFxn(Void)
{
/*
* Do this forever
*/
while (TRUE) {
/*
* Pend on "mySemaphore" until the timer ISR says
* its time to do something.
*/
Semaphore_pend(mySem, BIOS_WAIT_FOREVER);

/*
* Print the current value of tickCount to a log buffer.
*/
Log_info1("10 ticks. Tick Count = %d\n", tickCount);
}
}

It seems timer callback function is just like HWI task. you can call Semaphore_post() in its function.

Is Timer module  a special HWI task? how about its interrupt latency?

Can I set the period is 10 us?