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.

porting Linux setitimer and gettimeofday function to DSP/BIOS

Our project is coded in Linux OS. Now, I need port it on C64x+. many functions supported by Linux cannot be used any more. But I need implement the same functionality. two of them are setitimer() and gettimeofday(), which finish operation related to time. How should I port them on DSP/BIOS OS. Where can I find library support for those function? Thank you for your help.

  • I am not familiar with these two functions, but judging from the function names I am sure I do not need to be familiar with them to know what you are trying to do. Note that on a typical Linux workstation (as opposed to embedded system) that there is a real-time clock implemented into the motherboard which keeps track of the time. Unless you have added such a device into your custom hardware this is not something you can easily code. To put it another way:

    - You will need to add an RTC to your system which can keep track of time once set. These are usually independently battery-powered because they consume little power and so they can keep track of time even when the board is powered down.

    - It seems setitimer() is what configures the RTC with the actual time. Depending on how the RTC is connected to your DSP this function will differ; however, as an example if you connected it to an I2C port you would simply need to write to a specific slave address via I2C and program all the necessary registers.

    - Once the RTC is added and programmed with the correct time you will need to implement gettimeofday() to read from this RTC. Similar to the example above the I2C port would then read all the necessary registers from the RTC's slave address.

    I am sorry I cannot be more specific, but much of the discussion relies on the specifics of your RTC implementation. I hope that this at least steers you in the right direction.

  • As a side thought, if your device was never powered off you could potentially create a calendar using one of the DSP's timers interrupting at a 1ms interval. Every time the timer interrupted it would increment a variable by '1' which would denote a single second. Unfortunately this would require you to reinvent the wheel, so to speak, of a software-defined calendar which a high-level Operating System already includes as this is not a feature of the DSP/BIOS scheduler.