Skip to content

usbdev: Add low level initialization to periph_init()#11213

Merged
dylad merged 2 commits intoRIOT-OS:masterfrom
bergzand:pr/usb/periph_init
Mar 25, 2019
Merged

usbdev: Add low level initialization to periph_init()#11213
dylad merged 2 commits intoRIOT-OS:masterfrom
bergzand:pr/usb/periph_init

Conversation

@bergzand
Copy link
Copy Markdown
Member

@bergzand bergzand commented Mar 20, 2019

Contribution description

This PR adds low level initialization functions for usbdev. A low level init function is added to be called in periph_init(). This should prepare any configured usbdev device available on the mcu for the real initialization call. Most of this is going to be hooking up the right driver struct with the right context.

The other function is added to allow for retrieving a usbdev context. this is similar to the already existing SPI_DEV() and I2C_DEV() macros.

Both of these functions must be implemented by the cpu-specific usbdev periph code.

Testing procedure

Must not impact anything normally as there is no board providing periph_usbdev yet. With periph_usbdev this should cause a linker error for a missing implementation of usbdev_init_lowlevel()

Issues/PRs references

image
fixes a chicken/egg issue with the current usb PR set.

@bergzand bergzand added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: USB Area: Universal Serial Bus labels Mar 20, 2019
@bergzand bergzand requested review from dylad and kaspar030 March 20, 2019 08:20
*
* @returns the usbdev context at index @p num
*/
usbdev_t *usbdev_get_ctx(unsigned num);
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.

uint8_t num ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'd rather keep this unsigned( or unsigned int). The size here doesn't really matter, I'd be suprised to see an mcu with more than 255 USB peripherals. With this in mind I'd like to leave it up to the platform to pick a decent size.

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.

+1

@dylad
Copy link
Copy Markdown
Member

dylad commented Mar 24, 2019

@bergzand Are you done here ? I'd like to merge it before feature freezes.

@bergzand
Copy link
Copy Markdown
Member Author

@bergzand Are you done here ? I'd like to merge it before feature freezes.

@dylad Sorry, wasn't aware that you were waiting for me here. Unless you consider your change request above unresolved I don't have anything to add here. What do you think?

Copy link
Copy Markdown
Contributor

@haukepetersen haukepetersen left a comment

Choose a reason for hiding this comment

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

looks good to me -> ACK

@miri64 miri64 added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 25, 2019
Copy link
Copy Markdown
Member

@dylad dylad left a comment

Choose a reason for hiding this comment

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

ACK.
Tested work on arduino-zero (with #10915 + #10916)
Good job @bergzand !

@dylad
Copy link
Copy Markdown
Member

dylad commented Mar 25, 2019

Here we go !

@dylad dylad merged commit 784af0a into RIOT-OS:master Mar 25, 2019
@bergzand
Copy link
Copy Markdown
Member Author

@dylad Thanks for testing!

@danpetry danpetry added this to the Release 2019.04 milestone Mar 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: USB Area: Universal Serial Bus CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR 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.

5 participants