| M480 BSP V3.05.001 The Board Support Package for M480 Series

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