VSF Documented
vsf_linux_functionfs.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_LINUX_FUNCTIONFS_INTERNAL_H__
19#define __VSF_LINUX_FUNCTIONFS_INTERNAL_H__
20
21/*============================ INCLUDES ======================================*/
22
24
25#if VSF_USE_LINUX == ENABLED && VSF_LINUX_USE_DEVFS == ENABLED \
26 && VSF_USE_USB_DEVICE == ENABLED && VSF_USBD_CFG_RAW_MODE != ENABLED
27
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/*============================ MACROS ========================================*/
35/*============================ MACROFIED FUNCTIONS ===========================*/
36/*============================ TYPES =========================================*/
37
38typedef struct vsf_linux_usbd_ifs_t vsf_linux_usbd_ifs_t;
39typedef struct vsf_linux_usbd_ep_t {
40 // ep_no/zlp/mts and mts MUST be initialized by user
41 uint8_t ep_no;
42 bool zlp;
43 uint32_t mts;
44 uint8_t *buffer;
45
46 // private member, don't touch
47 uint32_t cur_pos;
48 vsf_linux_usbd_ifs_t *ifs;
49} vsf_linux_usbd_ep_t;
50
51typedef struct vsf_linux_usbd_ifs_t {
52 vk_usbd_dev_t *dev;
53 vk_usbd_ifs_t *ifs;
54
55 vk_usbd_desc_t * (*get_desc)(vk_usbd_dev_t *dev, vsf_linux_usbd_ifs_t *ifs,
57 vsf_err_t (*request_prepare)(vk_usbd_dev_t *dev, vsf_linux_usbd_ifs_t *ifs, struct usb_ctrlrequest_t *request);
58 vsf_err_t (*request_process)(vk_usbd_dev_t *dev, vsf_linux_usbd_ifs_t *ifs, struct usb_ctrlrequest_t *request);
59} vsf_linux_usbd_ifs_t;
60
61/*============================ GLOBAL VARIABLES ==============================*/
62/*============================ LOCAL VARIABLES ===============================*/
63/*============================ PROTOTYPES ====================================*/
64
65// ep0 will be binded under ifs_path if success
66extern int vsf_linux_fs_bind_usbd_ifs(char *ifs_path, vsf_linux_usbd_ifs_t *ifs);
67
68// for IN ep, msb of ep_no is 1
69// for OUT ep, msb of ep_no is 0
70// ep 0 is bi-directional
71// no need to bind ep0, it will be binded in vsf_linux_fs_bind_usbd_ifs
72extern int vsf_linux_fs_bind_usbd_ep(char *ifs_path, vsf_linux_usbd_ep_t *ep);
73
74#ifdef __cplusplus
75}
76#endif
77
78/*============================ INCLUDES ======================================*/
79
80#endif // VSF_USE_LINUX && VSF_LINUX_USE_DEVFS && VSF_USE_USB_DEVICE && !VSF_USBD_CFG_RAW_MODE
81#endif // __VSF_LINUX_FUNCTIONFS_INTERNAL_H__
82/* EOF */
vsf_err_t
Definition __type.h:42
unsigned int uint32_t
Definition lvgl.h:43
unsigned char uint8_t
Definition lvgl.h:40
unsigned char uint_fast8_t
Definition stdint.h:23
unsigned short uint_fast16_t
Definition stdint.h:25
Definition usb_common.h:85
Definition vsf_usbd.h:379
vk_av_control_type_t type
Definition vsf_audio.h:170