M480 BSP V3.05.006
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 /* end of group USBH_EXPORTED_CONSTANTS */
69
70
71
77/*----------------------------------------------------------------------------------------*/
78/* Audio Control Interface */
79/*----------------------------------------------------------------------------------------*/
80typedef 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;
88
89/*----------------------------------------------------------------------------------------*/
90/* Audio Streaming Interface */
91/*----------------------------------------------------------------------------------------*/
92typedef 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;
104
105
106/*----------------------------------------------------------------------------------------*/
107/* Audio Class device */
108/*----------------------------------------------------------------------------------------*/
109typedef struct uac_dev_t
110{
111 UDEV_T *udev;
117 uint32_t uid;
118 UAC_STATE_E state;
119 struct uac_dev_t *next;
120} UAC_DEV_T; /* end of group USBH_EXPORTED_STRUCTURES */
124
125
127
128extern int uac_parse_control_interface(UAC_DEV_T *uac, IFACE_T *iface);
129extern int uac_parse_streaming_interface(UAC_DEV_T *uac, IFACE_T *iface, uint8_t bAlternateSetting);
130extern int usbh_uac_find_best_alt(IFACE_T *iface, uint8_t dir, uint8_t attr, int pkt_sz, uint8_t *bAlternateSetting);
131extern int usbh_uac_find_max_alt(IFACE_T *iface, uint8_t dir, uint8_t attr, uint8_t *bAlternateSetting);
132
134
135
136#ifdef __cplusplus
137extern "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
NuMicro peripheral access layer header file.
#define NUM_UTR
Definition: usbh_uac.h:32
struct ac_if_t AC_IF_T
UAC_CB_FUNC * func_au_out
Definition: usbh_uac.h:116
struct uac_dev_t UAC_DEV_T
EP_INFO_T * ep
Definition: usbh_uac.h:95
uint8_t speaker_id
Definition: usbh_uac.h:85
AC_OT_T * ot
Definition: usbh_uac.h:99
CS_EP_T * cs_epd
Definition: usbh_uac.h:101
UTR_T * utr[NUM_UTR]
Definition: usbh_uac.h:96
uint8_t mic_id
Definition: usbh_uac.h:83
uint8_t mic_fuid
Definition: usbh_uac.h:84
struct as_if_t AS_IF_T
UAC_STATE_E state
Definition: usbh_uac.h:118
IFACE_T * iface
Definition: usbh_uac.h:82
struct uac_dev_t * next
Definition: usbh_uac.h:119
AC_IF_T acif
Definition: usbh_uac.h:112
IFACE_T * iface
Definition: usbh_uac.h:94
AS_IF_T asif_in
Definition: usbh_uac.h:113
uint8_t speaker_fuid
Definition: usbh_uac.h:86
uint32_t uid
Definition: usbh_uac.h:117
uint8_t flag_streaming
Definition: usbh_uac.h:102
UAC_CB_FUNC * func_au_in
Definition: usbh_uac.h:115
AS_GEN_T * as_gen
Definition: usbh_uac.h:97
UDEV_T * udev
Definition: usbh_uac.h:111
AS_FT1_T * ft
Definition: usbh_uac.h:100
AC_IT_T * it
Definition: usbh_uac.h:98
AS_IF_T asif_out
Definition: usbh_uac.h:114
int() UAC_CB_FUNC(struct uac_dev_t *dev, uint8_t *data, int len)
Definition: usbh_lib.h:127
USB Host library header file.
USB Host library exported header file.