-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I2S support for 4b ports #3
Comments
Here's some additional details! In lib_i2s, there exists a set of functions Therefore, my proposed change to the API would be non-breaking - I propose simply adding An alternative approach would be to alter the existing API to include a An ideal implementation would be for this process to be invisible to the user, and for them to be able to supply either an array of 1b ports or a single 4b port and for the function to then decide which implemetation to use. However, this isn't (as far as I'm aware...) cleanly possible in C. If someone has a thought on how to achieve this, I'm all ears! Very happy to go with either - what are your thoughts @keithm-xmos and @mbanth? |
Realised I'd had a bit of a moment - putting a flag in the function declaration still presents the problem where the argument describing the I/O ports can't be both an array of ports and a single port simultaneously. I still think they require separate function definitions unless there's some nice trick I can use - any advice appreciated! |
Separate functions has my vote but I defer to @xmos-jmccarthy. |
Separate functions are okay with me too. |
Is the end goal for this to be available in the RTOS driver as well, or just as a hil library for use in bare metal? |
The goal is for it to be available in the RTOS driver as well. Integrating it there is a separate piece of work. |
Is it possible to implement this driver to have a single implementation which supports multiple port widths, similar to how the I2C hil was rewritten? We have tried to avoid multiple implementations and consolidated I2C and SPI from dozens of implementations into 1 each. This achieves 2 things. 1 the use in bare metal is always the same, just with function arg differences. 2 the use in the rtos can be simplified as we don't need to have layers of code to call 1b port version vs 4b vs 8b etc, which would ultimately end up as just wasted binary space 99% of the time. If it is not possible to consolidate the implementations then the question is where we want to add the bloat for selection. Either the i2s implementation or the rtos driver instantiation will contain the code to specify and ultimately call the 1b or 4b port version. If that decision is not to be made right now, I would propose the following: |
After consultation with @mbanth and @xmos-jmccarthy the above approach is what I'll go with. void i2s_master(
const i2s_callback_group_t *const i2s_cbg,
const size_t io_port_size,
const size_t num_data_bits, // The number of data bits in a channel word can only currently be 32, but this is not specification compliant; an implementation exists in lib_i2s to deal with non-32b data bit lengths in a 1b port. This may or may not be possible in a 4b port implementation.
const port_t p_dout[],
const size_t num_out_ports,
const size_t num_out,
const port_t p_din[],
const size_t num_in_ports,
const size_t num_in,
const port_t p_bclk,
const port_t p_lrclk,
const port_t p_mclk,
const xclock_t bclk); with a pseudocode definition along the lines of {
if (io_port_size is 4)
{ i2s_master_4b(*args, **kwargs) }
else if (io_port_size is 1)
{ i2s_master_1b(*args, **kwargs) }
else
{ assert something along the lines of "nope" }
} |
Thank you for submitting an SDK feature request. Please provide as much information you can.
Describe the feature
Currently, I2S communication occurs only over 1b ports. Some processors have a limited number of 1b ports, so a desire exists to enhance I2S to allow the use of 4b ports.
Will this change any current APIs? How?
The I2S API will change. (@ACascarino to supply details)
Who will benefit with this feature?
Any customer or XMOS engineer writing software for a package with a limited number of 1b ports.
Any Other info
This enhancement has been made to lib_i2s. See lib_i2s issue 98 and pull request 107 for details.
The text was updated successfully, but these errors were encountered: