TI E2E Community
Passing parameters to a Clock function in SYS/BIOS
I am trying to build a program that uses SYS/BIOS (aka BIOS 6) with CCS 4.2. The BIOS "Clock" module can be set up to run a function either periodically or only once ("one-shot"). In my case, I need to run it only once. Setting up and initializing the clock is not a problem:
Clock_Params_init(&clkParams);clkParams.period = 0;
clkParams.startFlag = FALSE;
clk = Clock_create(myFunc, 1, &clkParams, NULL);
In Clock_create, I am setting up the clock to execute "myFunc". What I don't know how to do is pass parameters into myFunc. From BIOS documentation, the only way I saw is to define the optional clock argument:
clkParams.arg = (UArg)0x1234; /* set up a flag for the clock */
However, that's just a single 32-bit value. What I need is to pass arbitrary parameters, which might include different primitive types, pointers, and structures, into myFunc. Suppose myFunc is defined as:
void myFunc(int* x, size_t x_len);
Is there a way to do it? It seems that not being able to pass parameters to functions, either periodic or one-shot, would be a significant restriction. I am sure it can be done, I just lack knowledge on SYS/BIOS.
I have this same question. Can anyone solve it?
Define a structure that contains all the info you want to pass to the Clock function.
Create one of those structures and initialize it accordingly.
Pass a pointer to that structure as the clkParams.arg parameter.
In your Clock function, cast the arg as a ptr to your structure, then de-reference the struct ptr to access the info.
Thank you Alan!
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.