Skip to content
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

Add 4b-port support to I2S #30

Closed
wants to merge 7 commits into from

Conversation

ACascarino
Copy link
Contributor

Resolves #3

@ACascarino ACascarino self-assigned this Jul 22, 2022
@ACascarino
Copy link
Contributor Author

@xmos-jmccarthy I've not finished implementing yet but can I just check you're happy with the layout and function API here?

@xmos-jmccarthy
Copy link
Contributor

So far it looks good.

When you get to updating the drivers, I2S does something interesting. At the API level there is only 1 I2S context, rtos_i2s_t instead of a master and slave, as only the init is different. The main difference in the drivers is master/slave port setup. Adding 4b variant should be done by replacing the port calls with a single port description object. This way we could potentially add 8b 16b, etc in the future without breaking the 4b port API.

typedef enum {
    rtos_i2s_port_config_none = -1,
    rtos_i2s_port_config_master_1b,
    rtos_i2s_port_config_master_1b,
    rtos_i2s_port_config_slave_4b,
    rtos_i2s_port_config_slave_4b,
   RTOS_I2S_TOTAL_PORT_CONFIGS_CNT
} rtos_i2s_port_type_t;

typedef struct rtos_i2s_port_config_struct rtos_i2s_port_config_t;

struct rtos_i2s_port_config_struct{
    rtos_i2s_port_type_t port_typeg;
    i2s_mode_t mode;
    port_t p_dout[I2S_MAX_DATALINES];
    size_t num_out;
    port_t p_din[I2S_MAX_DATALINES];
    size_t num_in;
    port_t p_bclk;
    port_t p_lrclk;
    port_t p_mclk;
    xclock_t bclk;
}

void rtos_i2s_init(
        rtos_i2s_t *i2s_ctx,
        uint32_t io_core_mask,
        rtos_i2s_port_config_t *config);

The above would be similar for the slave.

Feel free to ask any questions when you get here.

@ACascarino ACascarino removed the request for review from xmos-jmccarthy September 12, 2022 12:56
@keithm-xmos
Copy link
Contributor

Closing this PR as this feature was experimental.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I2S support for 4b ports
3 participants