VSF Documented
vsf_dwcotg_common.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_COMMON_H__
19#define __VSF_DWCOTG_COMMON_H__
20
21/*============================ INCLUDES ======================================*/
22
24
25#if (VSF_USE_USB_DEVICE == ENABLED && VSF_USBD_USE_DCD_DWCOTG == ENABLED)\
26 || (VSF_USE_USB_HOST == ENABLED && VSF_USBH_USE_HCD_DWCOTG == ENABLED)
27
28#include "hal/vsf_hal.h"
29
30#include "./vsf_dwcotg_hw.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36/*============================ MACROS ========================================*/
37
38#ifndef VSF_DWCOTG_DCD_CFG_EP_NUM
39# ifdef USB_DWCOTG_MAX_EP_NUM
40# define VSF_DWCOTG_DCD_CFG_EP_NUM USB_DWCOTG_MAX_EP_NUM
41# else
42# define VSF_DWCOTG_DCD_CFG_EP_NUM 16
43# endif
44#endif
45
46/*============================ MACROFIED FUNCTIONS ===========================*/
47/*============================ TYPES =========================================*/
48
49typedef struct vk_dwcotg_param_t {
50 union {
51 struct {
57 };
59 };
61
62typedef struct vk_dwcotg_reg_t {
63 // Core Global registers starting at offset 000h
65 union {
66 struct {
67 // Host Global Registers starting at offset 400h.
69 // Host Port 0 Control and Status Register at offset 440h.
70 volatile uint32_t *hprt0;
71 // Host Channel Specific Registers at offsets 500h-5FCh.
73 } host;
74 struct {
75 // Device Global Registers starting at offset 800h
77 struct {
78 // Device Logical IN Endpoint-Specific Registers 900h-AFCh
80 // Device Logical OUT Endpoint-Specific Registers B00h-CFCh
82 } ep;
83 } dev;
84 };
87
88typedef struct vk_dwcotg_t {
92
93/*============================ GLOBAL VARIABLES ==============================*/
94/*============================ INCLUDES ======================================*/
95/*============================ PROTOTYPES ====================================*/
96
98 const vk_dwcotg_param_t *param,
99 vk_dwcotg_hw_info_t *hw_info);
100
101#ifdef __cplusplus
102}
103#endif
104
105#endif
106#endif
107/* EOF */
unsigned uint32_t
Definition stdint.h:9
unsigned char uint8_t
Definition stdint.h:5
Definition dwcotg_regs.h:43
Definition dwcotg_regs.h:353
Definition dwcotg_regs.h:766
Definition dwcotg_regs.h:846
Definition dwcotg_regs.h:635
Definition dwcotg_regs.h:543
Definition vsf_dwcotg_hw.h:38
Definition vsf_dwcotg_common.h:49
uint8_t dma_en
Definition vsf_dwcotg_common.h:56
uint8_t feature
Definition vsf_dwcotg_common.h:58
uint8_t ulpi_en
Definition vsf_dwcotg_common.h:53
uint8_t speed
Definition vsf_dwcotg_common.h:52
uint8_t vbus_en
Definition vsf_dwcotg_common.h:55
uint8_t utmi_en
Definition vsf_dwcotg_common.h:54
Definition vsf_dwcotg_common.h:62
struct dwcotg_dev_in_ep_regs_t * in_regs
Definition vsf_dwcotg_common.h:79
struct dwcotg_host_global_regs_t * global_regs
Definition vsf_dwcotg_common.h:68
volatile uint32_t * dfifo[VSF_DWCOTG_DCD_CFG_EP_NUM]
Definition vsf_dwcotg_common.h:85
struct dwcotg_dev_global_regs_t * global_regs
Definition vsf_dwcotg_common.h:76
volatile uint32_t * hprt0
Definition vsf_dwcotg_common.h:70
struct dwcotg_core_global_regs_t * global_regs
Definition vsf_dwcotg_common.h:64
struct dwcotg_hc_regs_t * hc_regs
Definition vsf_dwcotg_common.h:72
struct dwcotg_dev_out_ep_regs_t * out_regs
Definition vsf_dwcotg_common.h:81
Definition vsf_dwcotg_common.h:88
vk_dwcotg_reg_t reg
Definition vsf_dwcotg_common.h:89
uint8_t ep_num
Definition vsf_dwcotg_common.h:90
void vk_dwcotg_phy_init(vk_dwcotg_t *dwcotg, const vk_dwcotg_param_t *param, vk_dwcotg_hw_info_t *hw_info)
Definition vsf_dwcotg_common.c:42
#define VSF_DWCOTG_DCD_CFG_EP_NUM
Definition vsf_dwcotg_common.h:42