Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
uaol.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
11
12#ifndef ZEPHYR_INCLUDE_DRIVERS_UAOL_H_
13#define ZEPHYR_INCLUDE_DRIVERS_UAOL_H_
14
15#include <stdint.h>
16#include <zephyr/device.h>
17
26
32
38
60
67
73typedef int (*uaol_api_config)(const struct device *dev, int stream, struct uaol_config *config);
74
75typedef int (*uaol_api_start)(const struct device *dev, int stream);
76
77typedef int (*uaol_api_stop)(const struct device *dev, int stream);
78
79typedef int (*uaol_api_program_ep_table)(const struct device *dev, int stream,
80 struct uaol_ep_table_entry entry, bool valid);
81
82typedef int (*uaol_api_get_capabilities)(const struct device *dev, struct uaol_capabilities *caps);
83
84typedef int (*uaol_api_adjust_rate)(const struct device *dev, int stream, bool increase);
85
86typedef int (*uaol_api_interpret_feedback_value)(const struct device *dev, int stream,
87 uint32_t feedback_value);
88
89__subsystem struct uaol_driver_api {
90 uaol_api_config config;
91 uaol_api_start start;
92 uaol_api_stop stop;
93 uaol_api_program_ep_table program_ep_table;
94 uaol_api_get_capabilities get_capabilities;
95 uaol_api_adjust_rate adjust_rate;
96 uaol_api_interpret_feedback_value interpret_feedback_value;
97};
101
111static inline int uaol_config(const struct device *dev, int stream, struct uaol_config *cfg)
112{
113 return DEVICE_API_GET(uaol, dev)->config(dev, stream, cfg);
114}
115
124static inline int uaol_start(const struct device *dev, int stream)
125{
126 return DEVICE_API_GET(uaol, dev)->start(dev, stream);
127}
128
137static inline int uaol_stop(const struct device *dev, int stream)
138{
139 return DEVICE_API_GET(uaol, dev)->stop(dev, stream);
140}
141
152static inline int uaol_program_ep_table(const struct device *dev, int stream,
153 struct uaol_ep_table_entry entry, bool valid)
154{
155 return DEVICE_API_GET(uaol, dev)->program_ep_table(dev, stream, entry, valid);
156}
157
166static inline int uaol_get_capabilities(const struct device *dev, struct uaol_capabilities *caps)
167{
168 return DEVICE_API_GET(uaol, dev)->get_capabilities(dev, caps);
169}
170
183__syscall int uaol_adjust_rate(const struct device *dev, int stream, bool increase);
184
185static inline int z_impl_uaol_adjust_rate(const struct device *dev, int stream, bool increase)
186{
187 return DEVICE_API_GET(uaol, dev)->adjust_rate(dev, stream, increase);
188}
189
201__syscall int uaol_interpret_feedback_value(const struct device *dev, int stream,
202 uint32_t feedback_value);
203
204static inline int z_impl_uaol_interpret_feedback_value(const struct device *dev, int stream,
205 uint32_t feedback_value)
206{
207 return DEVICE_API_GET(uaol, dev)->interpret_feedback_value(dev, stream, feedback_value);
208}
209
220int uaol_get_mapped_hda_link_stream_id(const struct device *dev, int uaol_stream_id);
221
222#include <zephyr/syscalls/uaol.h>
223
224#endif /* ZEPHYR_INCLUDE_DRIVERS_UAOL_H_ */
APIs and macros for the Zephyr device model.
#define DEVICE_API_GET(_class, _dev)
Expands to the pointer of a device's API for a given class.
Definition device.h:1505
#define bool
Definition stdbool.h:13
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:543
UAOL hardware capabilities.
Definition uaol.h:19
uint32_t max_rx_fifo_size
Max RX FIFO size.
Definition uaol.h:24
uint32_t input_streams
Number of supported input streams.
Definition uaol.h:20
uint32_t bidirectional_streams
Number of supported bidir streams.
Definition uaol.h:22
uint32_t max_tx_fifo_size
Max TX FIFO size.
Definition uaol.h:23
uint32_t output_streams
Number of supported output streams.
Definition uaol.h:21
UAOL stream configuration data.
Definition uaol.h:40
uint32_t feedback_service_interval
Feedback service interval in us.
Definition uaol.h:55
uint16_t art_divider_m
USB ART divider multiplication value.
Definition uaol.h:44
uint32_t feedback_packet_size
Feedback endpoint packet size in bytes.
Definition uaol.h:56
enum uaol_direction direction
USB stream/endpoint direction.
Definition uaol.h:53
uint32_t sample_rate
Audio sample rate (frames per second ).
Definition uaol.h:46
uint16_t hda_link_map
HDA link stream and channels bound to the stream.
Definition uaol.h:52
uint16_t fifo_start_offset
UAOL FIFO start address offset.
Definition uaol.h:51
uint32_t sio_credit_size
SIO credit packet size in bytes.
Definition uaol.h:50
uint32_t channels
Number of audio channels.
Definition uaol.h:47
uint32_t feedback_stream
UAOL feedback stream index, 0 if none.
Definition uaol.h:54
uint8_t xhci_function
xHCI controller function
Definition uaol.h:43
uint8_t xhci_bus
xHCI controller bus
Definition uaol.h:41
uint16_t art_divider_n
USB ART divider division value.
Definition uaol.h:45
uint8_t xhci_device
xHCI controller device
Definition uaol.h:42
uint16_t feedback_hda_link_map
HDA link stream bound to the feedback stream.
Definition uaol.h:57
uint32_t sample_bits
Audio sample (container) size in bits.
Definition uaol.h:48
uint32_t service_interval
Service interval for PCM stream operation in us.
Definition uaol.h:49
enum uaol_device_speed device_speed
Full- or High-speed device.
Definition uaol.h:58
UAOL stream endpoint table entry.
Definition uaol.h:62
uint32_t split_ep
Split endpoint flag.
Definition uaol.h:65
uint32_t usb_ep_address
USB endpoint number.
Definition uaol.h:63
uint32_t device_slot_number
Slot number.
Definition uaol.h:64
static int uaol_program_ep_table(const struct device *dev, int stream, struct uaol_ep_table_entry entry, bool valid)
Program an endpoint table entry for UAOL individual stream.
Definition uaol.h:152
int uaol_get_mapped_hda_link_stream_id(const struct device *dev, int uaol_stream_id)
Get the HDA link stream ID mapped in HW to the UAOL stream ID.
static int uaol_get_capabilities(const struct device *dev, struct uaol_capabilities *caps)
Query UAOL hardware capabilities.
Definition uaol.h:166
static int uaol_config(const struct device *dev, int stream, struct uaol_config *cfg)
Set UAOL individual stream configuration.
Definition uaol.h:111
static int uaol_stop(const struct device *dev, int stream)
Stop UAOL individual stream operation.
Definition uaol.h:137
int uaol_interpret_feedback_value(const struct device *dev, int stream, uint32_t feedback_value)
Convert a raw feedback endpoint value to a frequency.
static int uaol_start(const struct device *dev, int stream)
Start UAOL individual stream operation.
Definition uaol.h:124
int uaol_adjust_rate(const struct device *dev, int stream, bool increase)
Perform a one-time rate adjustment for UAOL stream.
uaol_device_speed
UAOL device speed.
Definition uaol.h:34
@ UAOL_DEVICE_SPEED_FULL
Full-speed USB device.
Definition uaol.h:35
@ UAOL_DEVICE_SPEED_HIGH
High-speed USB device.
Definition uaol.h:36
uaol_direction
UAOL stream/endpoint direction.
Definition uaol.h:28
@ UAOL_DIR_PLAYBACK
Host-to-device USB endpoint.
Definition uaol.h:29
@ UAOL_DIR_CAPTURE
Device-to-host USB endpoint.
Definition uaol.h:30