[DONE]Atomic IO operations

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
kjellhar
Posts: 39
Joined: Sun Jul 08, 2012 10:44 pm

[DONE]Atomic IO operations

Post by kjellhar »

Hi,
I am a bit confused when reading the documentation on the PalWritePad (and the other Pad operations).
http://chibios.sourceforge.net/html/gro ... 34c5b42daa

In the Note, it says that the function is not guaranteed to be atomic, and it can be enclosed between chSysLock() and chSysUnlock() to ensure this. However, the Function Class is "Normal" which means it cannot be invoked within a lock zone.

So, which one is it?

I really need to make a small set of Pad write operations atomic in a PWM callback, but I'm not sure if it is allowed.

Best regards,
Kjell
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Atomic IO operations

Post by Giovanni »

It is allowed, it is a documentation error.

Giovanni
kjellhar
Posts: 39
Joined: Sun Jul 08, 2012 10:44 pm

Re: Atomic IO operations

Post by kjellhar »

Is it safe to assume that if using lock is mentioned in the comments, it is allowed even if the Function class says it's not?

Thanks,
Kjell
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Atomic IO operations

Post by Giovanni »

Yes, it is safe.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [TODO]Atomic IO operations

Post by Giovanni »

Fixed in repository, will be released in 2.6.1.

Giovanni
Post Reply