Thanks, a while(1) {..... msleep(10);} fixed it.
So, how often does the task scheduler service this task, is it related to the msleep(10) time ?
Yes. What exactly happens depends on the details of the scheduler, task priority and what other tasks are doing.
msleep yields the task so the next one in the schedulers list will be run. Your task shouldn't be scheduled again for at least 10ms, but the delay could be longer.
msleep isn't the only thing that could cause your task to yield.
- Preemptive schedulers (which the cameras have) will interrupt running tasks to let others run, subject to priority and the details of the implementation. However, this probably won't happen if interrupts are disabled, which may be relevant when you are modifying canon tasks.
- Other system calls can implicitly yield. For example, on many systems IO will cause a task to yield, so something else can run while the hardware is busy. Tasks will also yield waiting for a synchronized resource.
As the beep interval is measured in seconds, could I use msleep(500), for example ?
If you want whole seconds, you might as well use 1000 .
A stack size of 0x2000 is obviously not needed, is there a lower limit ?
I'm not sure if there's a lower limit, but you need enough for whatever functions your task calls. A good rule of thumb would be to use what the simpler canon tasks use. I came up with 0x200 for init_chdk_ptp_task using this approach.
It should be divisible by 4. It looks like dryos will refuse to create a stack that's less than about 32 bytes.
Also, why is task priority 0x19 ?
Because I blindly copy pasted/from something else and it worked
Note that in vxworks (and presumably dryos) lower numbers are higher priority. What exactly priority means depends a lot on the scheduler implementation.
Can the movie task be paused and restarted using the appropriate firmware commands ?
You can wait on synchronization objects like
semaphores or message queues. If you look at the canon tasks, you can see that most of them sit in a loop waiting on a message queue. How long the canon task could be stalled like this before causing problems is open to question. There are also functions to suspend and resume tasks externally (taskSuspend and taskResume in vxworks)
FWIW, you can find the vxworks documentation online with a little googling. This will give you a lot of information on the task and task synchronization functions.