M471M/R1/S BSP V3.01.000
The Board Support Package for M4521
usbh_uac.h
Go to the documentation of this file.
1/**************************************************************************/
8#ifndef _USBH_UAC_H_
9#define _USBH_UAC_H_
10
11#include "NuMicro.h"
12
13#include "usb.h"
14#include "usbh_lib.h"
15#include "../src_uac/uac.h"
16
30#define CONFIG_UAC_MAX_DEV 3
31#define NUM_UTR 2
32#define UAC_REQ_TIMEOUT 50
34#define UAC_SPEAKER 1
35#define UAC_MICROPHONE 2
37/*
38 * Audio Class-Specific Request Codes
39 */
40#define UAC_SET_CUR 0x01
41#define UAC_GET_CUR 0x81
42#define UAC_SET_MIN 0x02
43#define UAC_GET_MIN 0x82
44#define UAC_SET_MAX 0x03
45#define UAC_GET_MAX 0x83
46#define UAC_SET_RES 0x04
47#define UAC_GET_RES 0x84
48#define UAC_GET_STAT 0xFF
50/*
51 * Audio Class-Specific Channel selection
52 */
53#define UAC_CH_MASTER 0
54#define UAC_CH_LEFT_FRONT 1
55#define UAC_CH_RIGHT_FRONT 2
56#define UAC_CH_CENTER_FRONT 3
57#define UAC_CH_LOW_FREQ_EN 4
58#define UAC_CH_LEFT_SRN 5
59#define UAC_CH_RIGHT_SRN 6
60#define UAC_CH_LEFT_OF_CENTER 7
61#define UAC_CH_RIGHT_OF_CENTER 8
62#define UAC_CH_SURROUND 9
63#define UAC_CH_SIDE_LEFT 10
64#define UAC_CH_SIDE_RIGHT 11
65#define UAC_CH_TOP 12 /* end of group USBH_EXPORTED_CONSTANTS */
68
69
70
76/*----------------------------------------------------------------------------------------*/
77/* Audio Control Interface */
78/*----------------------------------------------------------------------------------------*/
79typedef struct ac_if_t {
80 IFACE_T *iface;
81 uint8_t mic_id;
82 uint8_t mic_fuid;
83 uint8_t speaker_id;
84 uint8_t speaker_fuid;
86
87/*----------------------------------------------------------------------------------------*/
88/* Audio Streaming Interface */
89/*----------------------------------------------------------------------------------------*/
90typedef struct as_if_t {
91 IFACE_T *iface;
92 EP_INFO_T *ep;
93 UTR_T *utr[NUM_UTR];
94 AS_GEN_T *as_gen;
95 AC_IT_T *it;
96 AC_OT_T *ot;
97 AS_FT1_T *ft;
98 CS_EP_T *cs_epd;
101
102
103/*----------------------------------------------------------------------------------------*/
104/* Audio Class device */
105/*----------------------------------------------------------------------------------------*/
106typedef struct uac_dev_t {
107 UDEV_T *udev;
113 uint32_t uid;
114 UAC_STATE_E state;
115 struct uac_dev_t *next;
116} UAC_DEV_T; /* end of group USBH_EXPORTED_STRUCTURES */
120
121
123
124extern int uac_parse_control_interface(UAC_DEV_T *uac, IFACE_T *iface);
125extern int uac_parse_streaming_interface(UAC_DEV_T *uac, IFACE_T *iface, uint8_t bAlternateSetting);
126extern int usbh_uac_find_best_alt(IFACE_T *iface, uint8_t dir, uint8_t attr, int pkt_sz, uint8_t *bAlternateSetting);
127extern int usbh_uac_find_max_alt(IFACE_T *iface, uint8_t dir, uint8_t attr, uint8_t *bAlternateSetting);
128
130
131
132#ifdef __cplusplus
133extern "C" {
134#endif
135 /* end of group USBH_Library */
137 /* end of group LIBRARY */
139
140
141#ifdef __cplusplus
142}
143#endif
144
145#endif /* _USBH_UAC_H_ */
146
147
148/*** (C) COPYRIGHT 2020 Nuvoton Technology Corp. ***/
149
NuMicro peripheral access layer header file.
#define NUM_UTR
Definition: usbh_uac.h:31
struct ac_if_t AC_IF_T
UAC_CB_FUNC * func_au_out
Definition: usbh_uac.h:112
struct uac_dev_t UAC_DEV_T
EP_INFO_T * ep
Definition: usbh_uac.h:92
uint8_t speaker_id
Definition: usbh_uac.h:83
AC_OT_T * ot
Definition: usbh_uac.h:96
CS_EP_T * cs_epd
Definition: usbh_uac.h:98
UTR_T * utr[NUM_UTR]
Definition: usbh_uac.h:93
uint8_t mic_id
Definition: usbh_uac.h:81
uint8_t mic_fuid
Definition: usbh_uac.h:82
struct as_if_t AS_IF_T
UAC_STATE_E state
Definition: usbh_uac.h:114
IFACE_T * iface
Definition: usbh_uac.h:80
struct uac_dev_t * next
Definition: usbh_uac.h:115
AC_IF_T acif
Definition: usbh_uac.h:108
IFACE_T * iface
Definition: usbh_uac.h:91
AS_IF_T asif_in
Definition: usbh_uac.h:109
uint8_t speaker_fuid
Definition: usbh_uac.h:84
uint32_t uid
Definition: usbh_uac.h:113
uint8_t flag_streaming
Definition: usbh_uac.h:99
UAC_CB_FUNC * func_au_in
Definition: usbh_uac.h:111
AS_GEN_T * as_gen
Definition: usbh_uac.h:94
UDEV_T * udev
Definition: usbh_uac.h:107
AS_FT1_T * ft
Definition: usbh_uac.h:97
AC_IT_T * it
Definition: usbh_uac.h:95
AS_IF_T asif_out
Definition: usbh_uac.h:110
int() UAC_CB_FUNC(struct uac_dev_t *dev, uint8_t *data, int len)
Definition: usbh_lib.h:126
USB Host library header file.
USB Host library exported header file.