diff options
| author | Bernard Xiong <[email protected]> | 2019-03-27 09:54:24 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-03-27 09:54:24 +0800 |
| commit | edcf8dacda386cc3494e348ae0ebde7077a097fd (patch) | |
| tree | ddf420e34c1a7189dc580c71b5f74432ebfae2ab | |
| parent | c9bcfcc63c52eab5974c90012c38fe794a1c78e6 (diff) | |
| parent | 0622b5a0df3cd1035ef1cd4fc2cf819b8ab40e09 (diff) | |
Merge pull request #2512 from BernardXiong/fix_drv_audio
[BSP] Add device ops for audio driver in qemu-vexpress-a9
| -rw-r--r-- | bsp/qemu-vexpress-a9/drivers/audio/drv_audio.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bsp/qemu-vexpress-a9/drivers/audio/drv_audio.c b/bsp/qemu-vexpress-a9/drivers/audio/drv_audio.c index eb3cc82ea2..53161ef22b 100644 --- a/bsp/qemu-vexpress-a9/drivers/audio/drv_audio.c +++ b/bsp/qemu-vexpress-a9/drivers/audio/drv_audio.c @@ -274,6 +274,18 @@ static rt_err_t codec_control(rt_device_t dev, int cmd, void *args) return result; } +#ifdef RT_USING_DEVICE_OPS +const static struct rt_device_ops codec_ops = +{ + codec_init, + codec_open, + codec_close, + codec_read, + codec_write, + codec_control +}; +#endif + int audio_hw_init(void) { struct audio_device *codec = &audio_device_drive; @@ -282,12 +294,16 @@ int audio_hw_init(void) codec->parent.rx_indicate = RT_NULL; codec->parent.tx_complete = RT_NULL; +#ifdef RT_USING_DEVICE_OPS + codec->parent.ops = &codec_ops; +#else codec->parent.init = codec_init; codec->parent.open = codec_open; codec->parent.close = codec_close; codec->parent.read = codec_read; codec->parent.write = codec_write; codec->parent.control = codec_control; +#endif codec->parent.user_data = RT_NULL; |
