VSF Documented
vsf_dwcotg_dcd.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_DWCOTG_DCD_H__
19#define __VSF_DWCOTG_DCD_H__
20
21/*============================ INCLUDES ======================================*/
22
24
25#if VSF_USE_USB_DEVICE == ENABLED && VSF_USBD_USE_DCD_DWCOTG == ENABLED
26
27#include "./vsf_dwcotg_common.h"
28
29#if defined(__VSF_DWCOTG_DCD_CLASS_IMPLEMENT)
30# undef __VSF_DWCOTG_DCD_CLASS_IMPLEMENT
31# define __VSF_CLASS_IMPLEMENT__
32#endif
33
34#include "utilities/ooc_class.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/*============================ MACROS ========================================*/
41/*============================ MACROFIED FUNCTIONS ===========================*/
42
43#define vsf_usb_dc_from_dwcotg_ip(__n, __obj, __drv_name) \
44 __USB_DC_FROM_IP(__n, (__obj), __drv_name, vk_dwcotg_dcd)
45
46/*============================ TYPES =========================================*/
47
48typedef struct vk_dwcotg_dcd_param_t {
49 const i_usb_dc_ip_t *op;
50 implement(vk_dwcotg_param_t)
52
53typedef struct vk_dwcotg_dc_ip_info_t {
54 implement(usb_dc_ip_info_t)
55 implement(vk_dwcotg_hw_info_t)
56
57 struct {
58 void *param;
59 void (*phy_init)(void *usb_param, vk_dwcotg_dcd_param_t *param);
62
64 private_member(
65 uint8_t *buffer;
66 uint32_t remain;
68 uint32_t zlp : 1;
69 uint32_t use_dma: 1;
70 )
71};
72
78
80
81 public_member(
82 vk_dwcotg_dcd_param_t const * const param;
83 )
84
85 private_member(
86 implement(vk_dwcotg_t)
87 struct {
88 usb_dc_evthandler_t evthandler;
89 void *param;
90 } callback;
91 uint8_t setup[8];
92 uint16_t buffer_word_pos;
93 bool dma_en;
94 ctrl_transfer_state_t ctrl_transfer_state;
96 )
97};
98
99/*============================ GLOBAL VARIABLES ==============================*/
100/*============================ INCLUDES ======================================*/
101/*============================ PROTOTYPES ====================================*/
102
104extern void vk_dwcotg_dcd_fini(vk_dwcotg_dcd_t *dwcotg_dcd);
105extern void vk_dwcotg_dcd_reset(vk_dwcotg_dcd_t *dwcotg_dcd, usb_dc_cfg_t *cfg);
106
107extern void vk_dwcotg_dcd_connect(vk_dwcotg_dcd_t *dwcotg_dcd);
108extern void vk_dwcotg_dcd_disconnect(vk_dwcotg_dcd_t *dwcotg_dcd);
109extern void vk_dwcotg_dcd_wakeup(vk_dwcotg_dcd_t *dwcotg_dcd);
110
111extern void vk_dwcotg_dcd_set_address(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t addr);
113
116
117extern void vk_dwcotg_dcd_get_setup(vk_dwcotg_dcd_t *dwcotg_dcd, uint8_t *buffer);
118extern void vk_dwcotg_dcd_status_stage(vk_dwcotg_dcd_t *dwcotg_dcd, bool is_in);
119
123
125extern bool vk_dwcotg_dcd_ep_is_stalled(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t ep);
127
129
134
137
138extern void vk_dwcotg_dcd_irq(vk_dwcotg_dcd_t *dwcotg_dcd);
139
140#ifdef __cplusplus
141}
142#endif
143
144#endif
145#endif
146/* EOF */
vsf_err_t
Definition __type.h:42
Definition vsf_dwcotg_dcd.h:79
Definition vsf_dwcotg_dcd.h:63
unsigned short uint16_t
Definition lvgl.h:41
unsigned int uint32_t
Definition lvgl.h:43
unsigned char uint8_t
Definition lvgl.h:40
#define vsf_class(__name)
Definition ooc_class.h:48
unsigned char uint_fast8_t
Definition stdint.h:23
unsigned int uint_fast32_t
Definition stdint.h:27
unsigned short uint_fast16_t
Definition stdint.h:25
Definition vsf_template_usb.h:316
Definition vsf_template_usb.h:408
Definition vsf_dwcotg_dcd.h:53
void(* phy_init)(void *usb_param, vk_dwcotg_dcd_param_t *param)
Definition vsf_dwcotg_dcd.h:59
void * param
Definition vsf_dwcotg_dcd.h:58
usb_dc_ip_info_t vk_dwcotg_hw_info_t struct vk_dwcotg_dc_ip_info_t::@238 vendor
Definition vsf_dwcotg_dcd.h:48
const i_usb_dc_ip_t * op
Definition vsf_dwcotg_dcd.h:49
Definition vsf_dwcotg_hw.h:38
Definition vsf_dwcotg_common.h:49
Definition vsf_dwcotg_common.h:88
vk_av_control_type_t type
Definition vsf_audio.h:170
#define VSF_DWCOTG_DCD_CFG_EP_NUM
Definition vsf_dwcotg_common.h:42
void vk_dwcotg_dcd_get_setup(vk_dwcotg_dcd_t *dwcotg_dcd, uint8_t *buffer)
Definition vsf_dwcotg_dcd.c:213
vsf_err_t vk_dwcotg_dcd_ep_add(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t ep, usb_ep_type_t type, uint_fast16_t size)
Definition vsf_dwcotg_dcd.c:247
vsf_err_t vk_dwcotg_dcd_ep_transfer_recv(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t ep, uint8_t *buffer, uint_fast32_t size)
Definition vsf_dwcotg_dcd.c:538
vsf_err_t vk_dwcotg_dcd_init(vk_dwcotg_dcd_t *dwcotg_dcd, usb_dc_cfg_t *cfg)
Definition vsf_dwcotg_dcd.c:73
vsf_err_t vk_dwcotg_dcd_ep_transaction_set_data_size(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t ep, uint_fast16_t size)
Definition vsf_dwcotg_dcd.c:396
void vk_dwcotg_dcd_irq(vk_dwcotg_dcd_t *dwcotg_dcd)
Definition vsf_dwcotg_dcd.c:655
vsf_err_t vk_dwcotg_dcd_ep_transaction_read_buffer(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t ep, uint8_t *buffer, uint_fast16_t size)
Definition vsf_dwcotg_dcd.c:384
vsf_err_t vk_dwcotg_dcd_ep_set_stall(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t ep)
Definition vsf_dwcotg_dcd.c:343
uint_fast16_t vk_dwcotg_dcd_get_frame_number(vk_dwcotg_dcd_t *dwcotg_dcd)
Definition vsf_dwcotg_dcd.c:203
vsf_err_t vk_dwcotg_dcd_ep_transaction_write_buffer(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t ep, uint8_t *buffer, uint_fast16_t size)
Definition vsf_dwcotg_dcd.c:402
uint_fast8_t vk_dwcotg_dcd_ep_get_feature(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t ep, uint_fast8_t feature)
Definition vsf_dwcotg_dcd.c:235
void vk_dwcotg_dcd_connect(vk_dwcotg_dcd_t *dwcotg_dcd)
Definition vsf_dwcotg_dcd.c:179
uint_fast8_t vk_dwcotg_dcd_get_mframe_number(vk_dwcotg_dcd_t *dwcotg_dcd)
Definition vsf_dwcotg_dcd.c:208
void vk_dwcotg_dcd_fini(vk_dwcotg_dcd_t *dwcotg_dcd)
Definition vsf_dwcotg_dcd.c:156
void vk_dwcotg_dcd_wakeup(vk_dwcotg_dcd_t *dwcotg_dcd)
Definition vsf_dwcotg_dcd.c:189
void vk_dwcotg_dcd_reset(vk_dwcotg_dcd_t *dwcotg_dcd, usb_dc_cfg_t *cfg)
Definition vsf_dwcotg_dcd.c:161
void vk_dwcotg_dcd_disconnect(vk_dwcotg_dcd_t *dwcotg_dcd)
Definition vsf_dwcotg_dcd.c:184
uint_fast32_t vk_dwcotg_dcd_ep_get_data_size(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t ep)
Definition vsf_dwcotg_dcd.c:482
uint_fast16_t vk_dwcotg_dcd_ep_get_size(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t ep)
Definition vsf_dwcotg_dcd.c:323
vsf_err_t vk_dwcotg_dcd_ep_clear_stall(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t ep)
Definition vsf_dwcotg_dcd.c:373
uint_fast8_t vk_dwcotg_dcd_get_address(vk_dwcotg_dcd_t *dwcotg_dcd)
Definition vsf_dwcotg_dcd.c:198
ctrl_transfer_state_t
Definition vsf_dwcotg_dcd.h:73
@ DWCOTG_SETUP_STAGE
Definition vsf_dwcotg_dcd.h:74
@ DWCOTG_DATA_STAGE
Definition vsf_dwcotg_dcd.h:75
@ DWCOTG_STATUS_STAGE
Definition vsf_dwcotg_dcd.h:76
bool vk_dwcotg_dcd_ep_is_stalled(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t ep)
Definition vsf_dwcotg_dcd.c:363
vsf_err_t vk_dwcotg_dcd_ep_transfer_send(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t ep, uint8_t *buffer, uint_fast32_t size, bool zlp)
Definition vsf_dwcotg_dcd.c:619
void vk_dwcotg_dcd_set_address(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t addr)
Definition vsf_dwcotg_dcd.c:193
void vk_dwcotg_dcd_status_stage(vk_dwcotg_dcd_t *dwcotg_dcd, bool is_in)
Definition vsf_dwcotg_dcd.c:218
vsf_err_t vk_dwcotg_dcd_ep_transaction_enable_out(vk_dwcotg_dcd_t *dwcotg_dcd, uint_fast8_t ep)
Definition vsf_dwcotg_dcd.c:390
uint32_t size
Definition vsf_memfs.h:50
usb_ep_type_t
Definition vsf_template_usb.h:277
void(* usb_dc_evthandler_t)(void *param, usb_evt_t evt, uint_fast8_t value)
Definition vsf_template_usb.h:309