Skip to content

Proposal for common 802.15.4 radio driver API definition.#925

Merged
rousselk merged 1 commit intoRIOT-OS:masterfrom
rousselk:radio-driver-api-proposal
Apr 28, 2014
Merged

Proposal for common 802.15.4 radio driver API definition.#925
rousselk merged 1 commit intoRIOT-OS:masterfrom
rousselk:radio-driver-api-proposal

Conversation

@rousselk
Copy link
Copy Markdown
Contributor

A possible common API for all 802.15.4 radio drivers.

Let me know what you think about it. If this is deemed worthy, I shall begin to adapt drivers to comply with the API (especially the CC2420 drivers).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to add a state for transmission in progress, maybe RADIO_TX_SENDING or something?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I envision the send() function not to return until the final outcome of the transmission is known: a blocking function for the calling thread.

As Oleg noticed hereafter, this API will be mainly used by the MAC layer and/or low-level apps on limited devices. Higher-level systems shall probably continue to use the 'transceiver' and 'net_if' modules and their message passing system.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see. Sounds sensible.

@OlegHahm
Copy link
Copy Markdown
Member

Actually this PR reminds me a bit of what we once had in FeuerWare/µkleos and is for historical reasons still defined here: https://github.com/RIOT-OS/RIOT/blob/master/sys/include/radio/radio.h

I'm not a fan of function pointers though. However, I see that for MAC protocols that might be more sensible than using IPC.

@rousselk
Copy link
Copy Markdown
Contributor Author

Yes, as a MAC protocol developer, it would tremendously simplify my life. I can't really use the FeuerWare API since it doesn't separate the MAC and physical layers...
And as I told you, using function pointers (that is: code, stored in Flash memory) instead of IPC should -- I hope -- also prove useful to limit RAM usage. I must say that on my tiny little MSP430 devices and their 8 KB RAM, I always fear to run out of memory...

Moreover, implementing this API doesn't prevent (unless I missed something) the ability to continue using the IPC mechanism, for people who prefer elegant solutions -- and have higher-end devices ;)

@LudwigKnuepfer
Copy link
Copy Markdown
Member

@thomaseichinger et al:
Would it make sense to streamline this for the requirements of openwsn?
That is: split load and and send functions if I remember it correctly.

@rousselk
Copy link
Copy Markdown
Contributor Author

@LudwigOrtmann
By "splitting load and send", do you mean having something like this:

void (* load)(void *buf, unsigned len); // load transceiver TX buffer
radio_tx_status_t (* send)(void); // send what's inside transceiver TX buffer

instead of the current send() function?

@rousselk
Copy link
Copy Markdown
Contributor Author

Rebased on master

@LudwigKnuepfer
Copy link
Copy Markdown
Member

@rousselk
Almost - the send function could/should still exist, but just call those two.
Maybe a return value for the loading wouldn't hurt either, but that's not for me to say ;-)

@rousselk
Copy link
Copy Markdown
Contributor Author

rousselk commented Apr 1, 2014

Here you go. Also corrected a couple of mistakes.

@LudwigKnuepfer
Copy link
Copy Markdown
Member

@thomaseichinger is this what you need?

@thomaseichinger
Copy link
Copy Markdown
Member

Yes, this would meet my requirements on a radio driver regarding OpenWSN.

@rousselk
Copy link
Copy Markdown
Contributor Author

rousselk commented Apr 2, 2014

Rebased on master.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand the docs \c or @c only effect the word after and don't open a block like @code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it seems so, corrected.

@rousselk
Copy link
Copy Markdown
Contributor Author

rousselk commented Apr 2, 2014

Corrected documentation, and completed the send() and load_tx() prototypes---using a new ieee802154_node_addr_t type.
The API specification should be complete now...

@rousselk
Copy link
Copy Markdown
Contributor Author

Rebased on master (again).

@rousselk
Copy link
Copy Markdown
Contributor Author

Is this PR ready to be merged?

@LudwigKnuepfer
Copy link
Copy Markdown
Member

I can't really judge the content, but as comments have been addresssed, you could squash the commits already.

@authmillenon do you have any opinion on this?

@rousselk
Copy link
Copy Markdown
Contributor Author

Squashed commits together. Ready to be merged if everyone agrees.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Apr 26, 2014

There might be some corner cases, where this driver model might not be useful (e. g. multiple receive threads), but this can be easily circumvent with some kind of multiplexing layer (which might be needed at some point anyways, if we get more network stacks ;-)), maybe some adaption of net_if would suffice for that.

@miri64
Copy link
Copy Markdown
Member

miri64 commented Apr 26, 2014

in any way: ACK.

@rousselk
Copy link
Copy Markdown
Contributor Author

Well, it seems this PR is ready. @OlegHahm @thomaseichinger no objections?

@thomaseichinger
Copy link
Copy Markdown
Member

looks good to me, ACK

@LudwigKnuepfer LudwigKnuepfer assigned OlegHahm and unassigned miri64 Apr 28, 2014
@rousselk
Copy link
Copy Markdown
Contributor Author

Let's move on, then!

rousselk added a commit that referenced this pull request Apr 28, 2014
Proposal for common 802.15.4 radio driver API definition.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants