Some cams are dual-core. I've worked out how to start tasks on the second core. Cores can communicate using at least semaphores, so we can do cooperative multi-tasking. This should be quite useful for splitting work, especially anything that can be easily pipelined or batched. E.g., expensive operations on a sequence of frames or images - these can alternate between cores or be picked up from a queue by whichever core becomes ready first. For CPU bound tasks this may be a large improvement.
I seem to recall CHDK / srsa already knew this, from some other thread, but I couldn't find it and there were no details.
On 200D, 1.0.1, df008f0a is task_create_ex(), which is like task_create() but with an extra arg that selects CPU to use. I've tested 0 and 1, I believe -1 means "run on either/all CPU(s)", but this is untested.
Small code example:
static struct semaphore *mp_sem; // for multi-process cooperation
static void cpu0_test()
{
while(1)
{
DryosDebugMsg(0, 15, "Hello from CPU0");
take_semaphore(mp_sem, 0);
msleep(1000);
give_semaphore(mp_sem);
}
}
static void cpu1_test()
{
while(1)
{
DryosDebugMsg(0, 15, "Hello from CPU1");
take_semaphore(mp_sem, 0);
msleep(1000);
give_semaphore(mp_sem);
}
}
static void run_test()
{
mp_sem = create_named_semaphore("mp_sem", 1);
task_create_ex("cpu1_test", 0x1e, 0, cpu1_test, 0, 1);
task_create_ex("cpu0_test", 0x1e, 0, cpu0_test, 0, 0);
return;
}
This leads to the CPUs taking turns to print, once per second.