summaryrefslogtreecommitdiff
path: root/tool/mbed/mbed-sdk/libraries/USBDevice/USBDevice/TARGET_RENESAS/TARGET_RZ_A1H/usb0/inc/usb0_function.h
blob: 02855eb13e0ccf54dd27c73302c6d2386e369cea (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*******************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only
* intended for use with Renesas products. No other uses are authorized. This
* software is owned by Renesas Electronics Corporation and is protected under
* all applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software
* and to discontinue the availability of this software. By using this software,
* you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
* Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
*******************************************************************************/
/*******************************************************************************
* File Name    : usb0_function.h
* $Rev: 1116 $
* $Date:: 2014-07-09 16:29:19 +0900#$
* Description  : RZ/A1H R7S72100 USB Sample Program
*******************************************************************************/
#ifndef USB0_FUNCTION_H
#define USB0_FUNCTION_H


/*******************************************************************************
Includes   <System Includes> , "Project Includes"
*******************************************************************************/
#include "devdrv_usb_function_api.h"
#include "usb_function.h"


#ifdef __cplusplus
extern "C" {
#endif

/*******************************************************************************
Typedef definitions
*******************************************************************************/


/*******************************************************************************
Macro definitions
*******************************************************************************/


/*******************************************************************************
Imported global variables and functions (from other files)
*******************************************************************************/
extern const uint16_t       g_usb0_function_bit_set[];
extern uint32_t             g_usb0_function_data_count[USB_FUNCTION_MAX_PIPE_NO + 1];
extern uint8_t              *g_usb0_function_data_pointer[USB_FUNCTION_MAX_PIPE_NO + 1];

extern uint16_t             g_usb0_function_PipeIgnore[];
extern uint16_t             g_usb0_function_PipeTbl[];
extern uint16_t             g_usb0_function_pipe_status[];
extern uint32_t             g_usb0_function_PipeDataSize[];

extern USB_FUNCTION_DMA_t   g_usb0_function_DmaInfo[];
extern uint16_t             g_usb0_function_DmaPipe[];
extern uint16_t             g_usb0_function_DmaBval[];
extern uint16_t             g_usb0_function_DmaStatus[];

extern uint16_t             g_usb0_function_CtrZeroLengthFlag;

extern uint16_t             g_usb0_function_ConfigNum;
extern uint16_t             g_usb0_function_Alternate[USB_FUNCTION_ALT_NO];
extern uint16_t             g_usb0_function_RemoteWakeupFlag;
extern uint16_t             g_usb0_function_TestModeFlag;
extern uint16_t             g_usb0_function_TestModeSelectors;

extern uint16_t             g_usb0_function_ReqType;
extern uint16_t             g_usb0_function_ReqTypeType;
extern uint16_t             g_usb0_function_ReqTypeRecip;
extern uint16_t             g_usb0_function_ReqRequest;
extern uint16_t             g_usb0_function_ReqValue;
extern uint16_t             g_usb0_function_ReqIndex;
extern uint16_t             g_usb0_function_ReqLength;

extern uint16_t             g_usb0_function_EPTableIndex[USB_FUNCTION_MAX_EP_NO + 1];

extern uint16_t             g_usb0_function_pipecfg[USB_FUNCTION_MAX_PIPE_NO + 1];
extern uint16_t             g_usb0_function_pipebuf[USB_FUNCTION_MAX_PIPE_NO + 1];
extern uint16_t             g_usb0_function_pipemaxp[USB_FUNCTION_MAX_PIPE_NO + 1];
extern uint16_t             g_usb0_function_pipeperi[USB_FUNCTION_MAX_PIPE_NO + 1];


/*******************************************************************************
Exported global variables and functions (to be accessed by other files)
*******************************************************************************/
/* ==== common ==== */
void     usb0_function_dma_stop_d0(uint16_t pipe, uint32_t remain);
void     usb0_function_dma_stop_d1(uint16_t pipe, uint32_t remain);
uint16_t usb0_function_is_hispeed(void);
uint16_t usb0_function_is_hispeed_enable(void);
uint16_t usb0_function_start_send_transfer(uint16_t pipe, uint32_t size, uint8_t *data);
uint16_t usb0_function_write_buffer(uint16_t pipe);
uint16_t usb0_function_write_buffer_c(uint16_t pipe);
uint16_t usb0_function_write_buffer_d0(uint16_t pipe);
uint16_t usb0_function_write_buffer_d1(uint16_t pipe);
void     usb0_function_start_receive_transfer(uint16_t pipe, uint32_t size, uint8_t *data);
uint16_t usb0_function_read_buffer(uint16_t pipe);
uint16_t usb0_function_read_buffer_c(uint16_t pipe);
uint16_t usb0_function_read_buffer_d0(uint16_t pipe);
uint16_t usb0_function_read_buffer_d1(uint16_t pipe);
uint16_t usb0_function_change_fifo_port(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw);
void     usb0_function_set_curpipe(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw);
void     usb0_function_set_curpipe2(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw, uint16_t dfacc);
uint16_t usb0_function_get_mbw(uint32_t trncount, uint32_t dtptr);
uint16_t usb0_function_read_dma(uint16_t pipe);
void     usb0_function_brdy_int(uint16_t status, uint16_t int_enb);
void     usb0_function_nrdy_int(uint16_t status, uint16_t int_enb);
void     usb0_function_bemp_int(uint16_t status, uint16_t int_enb);
void     usb0_function_setting_interrupt(uint8_t level);
void     usb0_function_reset_module(uint16_t clockmode);
uint16_t usb0_function_get_buf_size(uint16_t pipe);
uint16_t usb0_function_get_mxps(uint16_t pipe);
void     usb0_function_clear_brdy_sts(uint16_t pipe);
void     usb0_function_clear_bemp_sts(uint16_t pipe);
void     usb0_function_clear_nrdy_sts(uint16_t pipe);
void     usb0_function_set_pid_buf(uint16_t pipe);
void     usb0_function_set_pid_nak(uint16_t pipe);
void     usb0_function_set_pid_stall(uint16_t pipe);
void     usb0_function_clear_pid_stall(uint16_t pipe);
uint16_t usb0_function_get_pid(uint16_t pipe);
void     usb0_function_set_sqclr(uint16_t pipe);
void     usb0_function_set_sqset(uint16_t pipe);
void     usb0_function_set_csclr(uint16_t pipe);
void     usb0_function_aclrm(uint16_t pipe);
void     usb0_function_set_aclrm(uint16_t pipe);
void     usb0_function_clr_aclrm(uint16_t pipe);
uint16_t usb0_function_get_sqmon(uint16_t pipe);
uint16_t usb0_function_get_inbuf(uint16_t pipe);

/* ==== function ==== */
void     usb0_function_init_status(void);
void     usb0_function_InitModule(uint16_t mode);
uint16_t usb0_function_CheckVBUStaus(void);
void     usb0_function_USB_FUNCTION_Attach(void);
void     usb0_function_USB_FUNCTION_Detach(void);
void     usb0_function_USB_FUNCTION_BusReset(void);
void     usb0_function_USB_FUNCTION_Resume(void);
void     usb0_function_USB_FUNCTION_Suspend(void);
void     usb0_function_USB_FUNCTION_TestMode(void);
void     usb0_function_ResetDCP(void);
void     usb0_function_ResetEP(uint16_t num);
uint16_t usb0_function_EpToPipe(uint16_t ep);
void     usb0_function_InitEPTable(uint16_t Con_Num, uint16_t Int_Num, uint16_t Alt_Num);
uint16_t usb0_function_GetConfigNum(void);
uint16_t usb0_function_GetAltNum(uint16_t Con_Num, uint16_t Int_Num);
uint16_t usb0_function_CheckRemoteWakeup(void);
void     usb0_function_clear_alt(void);
void     usb0_function_clear_pipe_tbl(void);
void     usb0_function_clear_ep_table_index(void);
uint16_t usb0_function_GetInterfaceNum(uint16_t num);

#ifdef __cplusplus
}
#endif


#endif /* USB0_FUNCTION_H */

/* End of File */