Page 1 of 1
HAL Event Sources / Listeners etc?
Posted: Sun Dec 29, 2013 5:05 pm
by avrhack
Apologies if I've missed this - I have looked in the documentation at length and the FAQ on this site - but I can't see anything that tells me what events the various HAL drivers can generate.
I've noticed they do indeed generate events, but at the moment I'm having to work through each drivers code and headers to figure out what can appear, combined with examining the testhal code which in some cases also uses events.
Is there any documentation on this as it doesn't seem to be part of the reference manual for each HAL module?
Thanks.
Re: HAL Event Sources / Listeners etc?
Posted: Sun Dec 29, 2013 5:18 pm
by Giovanni
Hi,
Probably the documentation could be better organized. Anyway, only few drivers generate events, most use direct callbacks.
Those using events are Serial, Serial_USB, CAN and (optionally) MAC:
http://chibios.sourceforge.net/html/gro ... n_e_l.htmlhttp://chibios.sourceforge.net/html/group___m_a_c.htmlhttp://chibios.sourceforge.net/html/group___c_a_n.htmlLook in the xxxDriver structure for the available event sources.
Giovanni
Re: HAL Event Sources / Listeners etc?
Posted: Sun Dec 29, 2013 5:33 pm
by avrhack
Great thanks Giovanni - and especially for the super-fast reply! Funnily enough CAN and Serial were the two I was experimenting with, so I hadn't realised that it was relatively few that used events; it seems like an excellent model so I'd be interested in the rationale for not using more widely?
Overall though, really impressed with your work on ChiBIOS. I've been programming AVRs for years and never use an OS; decided to move to ARM only a week ago and did some research and using ChiBIOS has made the learning curve much, much quicker than it would otherwise have been, as well as making the code much more structured and reliable because of the threading and other core kernel components.
Brilliant!
Re: HAL Event Sources / Listeners etc?
Posted: Sun Dec 29, 2013 5:50 pm
by Giovanni
Hi,
Events are used in those drivers meant to interact with threads directly (asynchronous communication usually), other drivers simply have callbacks. From a callback events can still be generated if the user wants to operate that way.
Note that a callback not necessarily triggers a context switch in order to do its operation, events always wake up another thread so are a little bit less efficient.
Giovanni
Re: HAL Event Sources / Listeners etc?
Posted: Sun Dec 29, 2013 6:35 pm
by avrhack
Makes perfect sense now thanks. You can tell I'm still getting to grips with ChiBIOS can't you?
