VSF Documented
vsf_usbh_uac.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __VSF_USBH_UAC_H__
19#define __VSF_USBH_UAC_H__
20
21
22/*============================ INCLUDES ======================================*/
23
25
26#if VSF_USE_USB_HOST == ENABLED && VSF_USBH_USE_UAC == ENABLED
27
29
30#undef PUBLIC_CONST
31#if defined(__VSF_USBH_UAC_CLASS_IMPLEMENT)
32# undef __VSF_USBH_UAC_CLASS_IMPLEMENT
33# define __VSF_CLASS_IMPLEMENT__
34# define PUBLIC_CONST
35#else
36# define PUBLIC_CONST const
37#endif
38#include "utilities/ooc_class.h"
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44/*============================ MACROS ========================================*/
45
46// for some hcd, one urb will take 2ms(eg. ohci), so need 2 urbs to implement 1ms interval transaction
47#ifndef VSF_USBH_UAC_CFG_URB_NUM_PER_STREAM
48# define VSF_USBH_UAC_CFG_URB_NUM_PER_STREAM 1
49#endif
50#if VSF_USBH_UAC_CFG_URB_NUM_PER_STREAM > 8
51# error VSF_USBH_UAC_CFG_URB_NUM_PER_STREAM MUST be <= 8
52#endif
53
54#if VSF_USE_SIMPLE_STREAM != ENABLED
55# error VSF_USE_SIMPLE_STREAM is needed for USBH UAC driver
56#endif
57
58/*============================ MACROFIED FUNCTIONS ===========================*/
59/*============================ TYPES =========================================*/
60
62 public_member(
63 PUBLIC_CONST uint8_t is_in : 1;
64 PUBLIC_CONST uint8_t sample_size : 3;
65 PUBLIC_CONST uint8_t channel_num;
67 PUBLIC_CONST uint32_t sample_rate;
68 )
69
70 private_member(
71 uint8_t idx : 6;
72 uint8_t is_connected : 1;
73 uint8_t is_to_disconnect : 1;
74 uint8_t urb_mask;
75 uint16_t next_frame;
76
78 vsf_stream_t *stream;
79 void *param;
80 )
81};
82
83/*============================ GLOBAL VARIABLES ==============================*/
84
86
87/*============================ PROTOTYPES ====================================*/
88
89extern vk_usbh_uac_stream_t * vsf_usbh_uac_get_stream_info(void *param, uint_fast8_t stream_idx);
90extern vsf_err_t vsf_usbh_uac_connect_stream(void *param, uint_fast8_t stream_idx, vsf_stream_t *stream);
91extern void vsf_usbh_uac_disconnect_stream(void *param, uint_fast8_t stream_idx);
92extern vsf_err_t __vsf_usbh_uac_submit_req(void *uac_ptr, void *data, struct usb_ctrlrequest_t *req);
93
94#ifdef __cplusplus
95}
96#endif
97
98#endif
99#endif
vsf_err_t
Definition __type.h:42
Definition vsf_usbh.h:268
Definition vsf_usbh_uac.h:61
Definition vsf_usbh.h:450
Definition vsf_simple_stream.h:254
struct ieee80211_ext_chansw_ie data
Definition ieee80211.h:80
#define vsf_class(__name)
Definition ooc_class.h:48
unsigned short uint16_t
Definition stdint.h:7
unsigned char uint_fast8_t
Definition stdint.h:23
unsigned uint32_t
Definition stdint.h:9
unsigned char uint8_t
Definition stdint.h:5
Definition usb.h:152
Definition usb_common.h:85
SDL_PixelFormat format
Definition vsf_sdl2_pixelformat.c:32
vk_usbh_uac_stream_t * vsf_usbh_uac_get_stream_info(void *param, uint_fast8_t stream_idx)
Definition vsf_usbh_uac.c:139
void vsf_usbh_uac_disconnect_stream(void *param, uint_fast8_t stream_idx)
Definition vsf_usbh_uac.c:177
vsf_err_t __vsf_usbh_uac_submit_req(void *uac_ptr, void *data, struct usb_ctrlrequest_t *req)
Definition vsf_usbh_uac.c:146
const vk_usbh_class_drv_t vk_usbh_uac_drv
Definition vsf_usbh_uac.c:129
#define VSF_USBH_UAC_CFG_URB_NUM_PER_STREAM
Definition vsf_usbh_uac.h:48
#define PUBLIC_CONST
Definition vsf_usbh_uac.h:36
vsf_err_t vsf_usbh_uac_connect_stream(void *param, uint_fast8_t stream_idx, vsf_stream_t *stream)
Definition vsf_usbh_uac.c:161