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.

Why does this hook function runs at boot time?

Other Parts Discussed in Thread: SYSBIOS

Hi,

I read hook function on TI wiki. I don't understand why it said:

 * This function is called at boot time.

Here is the link:

processors.wiki.ti.com/.../BIOS_FAQs

Could you explain it to me? Thanks,

Task.addHookSet({
    registerFxn: '&myRegisterFxn',
    createFxn: '&myCreateFxn',
    deleteFxn: '&myDeleteFxn',
    switchFxn: '&mySwitchFxn'
});
And these sample implementations to your .c file:

#include <xdc/std.h>
 
#include <xdc/runtime/Memory.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>
 
#include <ti/sysbios/knl/Task.h>
 
/*
 * Task Hook Functions
 */
#define TLSSIZE 32
 
Int hookId;
 
/*
 * ======== myRegisterFxn ========
 * This function is called at boot time.
 */
Void myRegisterFxn(Int id)
{
     hookId = id;
}
 
/*
 * ======== myCreateFxn ========
 */
Void myCreateFxn(Task_Handle task, Error_Block *eb)
{
    Ptr tls;
     System_printf("myCreateFxn: task = 0x%x\n", task);
     Error_init(eb);
     tls = Memory_alloc(NULL, TLSSIZE, 0, eb);
 
     Task_setHookContext(task, hookId, tls);
}