summaryrefslogtreecommitdiff
path: root/bsp/phytium/libraries/standalone/drivers/usb/fxhci/fxhci.h
blob: b23ebd05a185f78721f7f88bfd6ac65019233622 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
 * Copyright : (C) 2022 Phytium Information Technology, Inc.
 * All Rights Reserved.
 *
 * This program is OPEN SOURCE software: you can redistribute it and/or modify it
 * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
 * either version 1.0 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the Phytium Public License for more details.
 *
 *
 * FilePath: fxhci.h
 * Date: 2022-02-11 13:33:12
 * LastEditTime: 2022-02-18 09:17:44
 * Description:  This files is for definition of XHCI user function
 *
 * Modify History:
 *  Ver   Who        Date         Changes
 * ----- ------     --------    --------------------------------------
 * 1.0   Zhugengyu  2022/2/7    init commit
 */

#ifndef  DRIVERS_USB_FXHCI_H
#define  DRIVERS_USB_FXHCI_H

#ifdef __cplusplus
extern "C"
{
#endif

/***************************** Include Files *********************************/
#include "fusb.h"

/************************** Constant Definitions *****************************/
#define FXHCI_EVENT_RING_SIZE    64
#define FXHCI_TRANSFER_RING_SIZE 32 /* Never raise this above 256 to prevent transfer event length overflow! */
#define FXHCI_COMMAND_RING_SIZE  4
#define FXHCI_NUM_EPS            32

#define FXHCI_HC_VERSION_MIN     0x96 /* supported XHCI version from v0.96 to v1.2 */
#define FXHCI_HC_VERSION_MAX     0x120

/* completion code for xhci */
enum
{
    /* Make these high enough to not collide with negative FUSB_HC_XHCI CCs */
    FXHCI_CC_TIMEOUT                =   -65,
    FXHCI_CC_CONTROLLER_ERROR       =   -66,
    FXHCI_CC_COMMUNICATION_ERROR    =   -67,
    FXHCI_CC_OUT_OF_MEMORY          =   -68,
    FXHCI_CC_DRIVER_ERROR           =   -69,
    FXHCI_CC_GENERAL_ERROR          =   -1,

    FXHCI_CC_ZERO_BYTES             =   FUSB_CC_ZERO_BYTES,

    /* defined according to Table 130: TRB Completion Code Definitions in spec */
    FXHCI_CC_SUCCESS                =   FUSB_CC_SUCCESS,

    /* Use as -FXHCI_CC_TRB_ERROR when return as error */
    FXHCI_CC_TRB_ERROR              =   5,
    FXHCI_CC_STALL_ERROR            =   6,
    FXHCI_CC_RESOURCE_ERROR         =   7,
    FXHCI_CC_BANDWIDTH_ERROR        =   8,
    FXHCI_CC_NO_SLOTS_AVAILABLE     =   9,
    FXHCI_CC_SLOT_NOT_ENABLED       =   11,
    FXHCI_CC_SHORT_PACKET           =   13,
    FXHCI_CC_EVENT_RING_FULL_ERROR  =   21,
    FXHCI_CC_COMMAND_RING_STOPPED   =   24,
    FXHCI_CC_COMMAND_ABORTED        =   25,
    FXHCI_CC_STOPPED                =   26,
    FXHCI_CC_STOPPED_LENGTH_INVALID =   27
};

typedef FUsbTransCode FXhciTransCode;
/**************************** Type Definitions *******************************/

/************************** Variable Definitions *****************************/

/***************** Macros (Inline Functions) Definitions *********************/

/************************** Function Prototypes ******************************/
/* 创建XHCI USB 控制器实例,完成初始化 */
FUsbHc *FXhciHcInit(FUsb *instance, uintptr base_addr);

#ifdef __cplusplus
}
#endif


#endif