Skip to content

Commit 1fdf21f

Browse files
committed
Merge pull request #1 from mbedmicro/master
Update
2 parents fbd914c + 8c14c06 commit 1fdf21f

File tree

51 files changed

+13719
-341
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+13719
-341
lines changed

libraries/USBDevice/USBDevice/USBHAL_RZ_A1H.cpp

Lines changed: 512 additions & 245 deletions
Large diffs are not rendered by default.

libraries/USBHost/USBHost/TARGET_RENESAS/TARGET_RZ_A1H/inc/devdrv_usb_host_api.h

Lines changed: 332 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
/*******************************************************************************
2+
* DISCLAIMER
3+
* This software is supplied by Renesas Electronics Corporation and is only
4+
* intended for use with Renesas products. No other uses are authorized. This
5+
* software is owned by Renesas Electronics Corporation and is protected under
6+
* all applicable laws, including copyright laws.
7+
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
8+
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
9+
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
10+
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
11+
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
12+
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
13+
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
14+
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
15+
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
16+
* Renesas reserves the right, without notice, to make changes to this software
17+
* and to discontinue the availability of this software. By using this software,
18+
* you agree to the additional terms and conditions found by accessing the
19+
* following link:
20+
* http://www.renesas.com/disclaimer
21+
* Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
22+
*******************************************************************************/
23+
/*******************************************************************************
24+
* File Name : usb0_host.h
25+
* $Rev: 1116 $
26+
* $Date:: 2014-07-09 16:29:19 +0900#$
27+
* Description : RZ/A1H R7S72100 USB Sample Program
28+
*******************************************************************************/
29+
#ifndef USB0_HOST_H
30+
#define USB0_HOST_H
31+
32+
/*******************************************************************************
33+
Includes <System Includes> , "Project Includes"
34+
*******************************************************************************/
35+
#include "devdrv_usb_host_api.h"
36+
#include "usb_host.h"
37+
38+
/*******************************************************************************
39+
Imported global variables and functions (from other files)
40+
*******************************************************************************/
41+
extern const uint16_t g_usb0_host_bit_set[];
42+
extern uint32_t g_usb0_host_data_count[USB_HOST_MAX_PIPE_NO + 1];
43+
extern uint8_t *g_usb0_host_data_pointer[USB_HOST_MAX_PIPE_NO + 1];
44+
45+
extern uint16_t g_usb0_host_PipeIgnore[];
46+
extern uint16_t g_usb0_host_PipeTbl[];
47+
extern uint16_t g_usb0_host_pipe_status[];
48+
extern uint32_t g_usb0_host_PipeDataSize[];
49+
50+
extern USB_HOST_DMA_t g_usb0_host_DmaInfo[];
51+
extern uint16_t g_usb0_host_DmaPipe[];
52+
extern uint16_t g_usb0_host_DmaBval[];
53+
extern uint16_t g_usb0_host_DmaStatus[];
54+
55+
extern uint16_t g_usb0_host_driver_state;
56+
extern uint16_t g_usb0_host_ConfigNum;
57+
extern uint16_t g_usb0_host_CmdStage;
58+
extern uint16_t g_usb0_host_bchg_flag;
59+
extern uint16_t g_usb0_host_detach_flag;
60+
extern uint16_t g_usb0_host_attach_flag;
61+
62+
extern uint16_t g_usb0_host_UsbAddress;
63+
extern uint16_t g_usb0_host_setUsbAddress;
64+
extern uint16_t g_usb0_host_default_max_packet[USB_HOST_MAX_DEVICE + 1];
65+
extern uint16_t g_usb0_host_UsbDeviceSpeed;
66+
extern uint16_t g_usb0_host_SupportUsbDeviceSpeed;
67+
68+
extern uint16_t g_usb0_host_SavReq;
69+
extern uint16_t g_usb0_host_SavVal;
70+
extern uint16_t g_usb0_host_SavIndx;
71+
extern uint16_t g_usb0_host_SavLen;
72+
73+
extern uint16_t g_usb0_host_pipecfg[USB_HOST_MAX_PIPE_NO + 1];
74+
extern uint16_t g_usb0_host_pipebuf[USB_HOST_MAX_PIPE_NO + 1];
75+
extern uint16_t g_usb0_host_pipemaxp[USB_HOST_MAX_PIPE_NO + 1];
76+
extern uint16_t g_usb0_host_pipeperi[USB_HOST_MAX_PIPE_NO + 1];
77+
78+
/*******************************************************************************
79+
Functions Prototypes
80+
*******************************************************************************/
81+
/* ==== common ==== */
82+
void usb0_host_dma_stop_d0(uint16_t pipe, uint32_t remain);
83+
void usb0_host_dma_stop_d1(uint16_t pipe, uint32_t remain);
84+
uint16_t usb0_host_is_hispeed(void);
85+
uint16_t usb0_host_is_hispeed_enable(void);
86+
uint16_t usb0_host_start_send_transfer(uint16_t pipe, uint32_t size, uint8_t *data);
87+
uint16_t usb0_host_write_buffer(uint16_t pipe);
88+
uint16_t usb0_host_write_buffer_c(uint16_t pipe);
89+
uint16_t usb0_host_write_buffer_d0(uint16_t pipe);
90+
uint16_t usb0_host_write_buffer_d1(uint16_t pipe);
91+
void usb0_host_start_receive_transfer(uint16_t pipe, uint32_t size, uint8_t *data);
92+
uint16_t usb0_host_read_buffer(uint16_t pipe);
93+
uint16_t usb0_host_read_buffer_c(uint16_t pipe);
94+
uint16_t usb0_host_read_buffer_d0(uint16_t pipe);
95+
uint16_t usb0_host_read_buffer_d1(uint16_t pipe);
96+
uint16_t usb0_host_change_fifo_port(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw);
97+
void usb0_host_set_curpipe(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw);
98+
void usb0_host_set_curpipe2(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw, uint16_t dfacc);
99+
uint16_t usb0_host_get_mbw(uint32_t trncount, uint32_t dtptr);
100+
uint16_t usb0_host_read_dma(uint16_t pipe);
101+
void usb0_host_stop_transfer(uint16_t pipe);
102+
void usb0_host_brdy_int(uint16_t status, uint16_t int_enb);
103+
void usb0_host_nrdy_int(uint16_t status, uint16_t int_enb);
104+
void usb0_host_bemp_int(uint16_t status, uint16_t int_enb);
105+
void usb0_host_setting_interrupt(uint8_t level);
106+
void usb0_host_reset_module(uint16_t clockmode);
107+
uint16_t usb0_host_get_buf_size(uint16_t pipe);
108+
uint16_t usb0_host_get_mxps(uint16_t pipe);
109+
void usb0_host_enable_brdy_int(uint16_t pipe);
110+
void usb0_host_disable_brdy_int(uint16_t pipe);
111+
void usb0_host_clear_brdy_sts(uint16_t pipe);
112+
void usb0_host_enable_bemp_int(uint16_t pipe);
113+
void usb0_host_disable_bemp_int(uint16_t pipe);
114+
void usb0_host_clear_bemp_sts(uint16_t pipe);
115+
void usb0_host_enable_nrdy_int(uint16_t pipe);
116+
void usb0_host_disable_nrdy_int(uint16_t pipe);
117+
void usb0_host_clear_nrdy_sts(uint16_t pipe);
118+
void usb0_host_set_pid_buf(uint16_t pipe);
119+
void usb0_host_set_pid_nak(uint16_t pipe);
120+
void usb0_host_set_pid_stall(uint16_t pipe);
121+
void usb0_host_clear_pid_stall(uint16_t pipe);
122+
uint16_t usb0_host_get_pid(uint16_t pipe);
123+
void usb0_host_set_sqclr(uint16_t pipe);
124+
void usb0_host_set_sqset(uint16_t pipe);
125+
void usb0_host_set_csclr(uint16_t pipe);
126+
void usb0_host_aclrm(uint16_t pipe);
127+
void usb0_host_set_aclrm(uint16_t pipe);
128+
void usb0_host_clr_aclrm(uint16_t pipe);
129+
uint16_t usb0_host_get_sqmon(uint16_t pipe);
130+
uint16_t usb0_host_get_inbuf(uint16_t pipe);
131+
132+
/* ==== host ==== */
133+
void usb0_host_init_pipe_status(void);
134+
int32_t usb0_host_CtrlTransStart(uint16_t devadr, uint16_t Req, uint16_t Val, uint16_t Indx, uint16_t Len, uint8_t *Buf);
135+
void usb0_host_SetupStage(uint16_t Req, uint16_t Val, uint16_t Indx, uint16_t Len);
136+
void usb0_host_CtrlReadStart(uint32_t Bsize, uint8_t *Table);
137+
uint16_t usb0_host_CtrlWriteStart(uint32_t Bsize, uint8_t *Table);
138+
void usb0_host_StatusStage(void);
139+
void usb0_host_get_devadd(uint16_t addr, uint16_t *devadd);
140+
void usb0_host_set_devadd(uint16_t addr, uint16_t *devadd);
141+
void usb0_host_InitModule(void);
142+
uint16_t usb0_host_CheckAttach(void);
143+
void usb0_host_UsbDetach(void);
144+
void usb0_host_UsbDetach2(void);
145+
void usb0_host_UsbAttach(void);
146+
uint16_t usb0_host_UsbBusReset(void);
147+
int32_t usb0_host_UsbResume(void);
148+
int32_t usb0_host_UsbSuspend(void);
149+
void usb0_host_Enable_DetachINT(void);
150+
void usb0_host_Disable_DetachINT(void);
151+
void usb0_host_UsbStateManager(void);
152+
153+
154+
#endif /* USB0_HOST_H */
155+
156+
/* End of File */
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/*******************************************************************************
2+
* DISCLAIMER
3+
* This software is supplied by Renesas Electronics Corporation and is only
4+
* intended for use with Renesas products. No other uses are authorized. This
5+
* software is owned by Renesas Electronics Corporation and is protected under
6+
* all applicable laws, including copyright laws.
7+
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
8+
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
9+
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
10+
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
11+
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
12+
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
13+
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
14+
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
15+
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
16+
* Renesas reserves the right, without notice, to make changes to this software
17+
* and to discontinue the availability of this software. By using this software,
18+
* you agree to the additional terms and conditions found by accessing the
19+
* following link:
20+
* http://www.renesas.com/disclaimer
21+
* Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
22+
*******************************************************************************/
23+
/*******************************************************************************
24+
* File Name : usb0_host_api.h
25+
* $Rev: 1116 $
26+
* $Date:: 2014-07-09 16:29:19 +0900#$
27+
* Description : RZ/A1H R7S72100 USB Sample Program
28+
*******************************************************************************/
29+
#ifndef USB0_HOST_API_H
30+
#define USB0_HOST_API_H
31+
32+
33+
/*******************************************************************************
34+
Typedef definitions
35+
*******************************************************************************/
36+
37+
38+
/*******************************************************************************
39+
Macro definitions
40+
*******************************************************************************/
41+
42+
43+
/*******************************************************************************
44+
Variable Externs
45+
*******************************************************************************/
46+
47+
48+
/*******************************************************************************
49+
Functions Prototypes
50+
*******************************************************************************/
51+
void usb0_host_interrupt(uint32_t int_sense);
52+
void usb0_host_dma_interrupt_d0fifo(uint32_t int_sense);
53+
void usb0_host_dma_interrupt_d1fifo(uint32_t int_sense);
54+
55+
uint16_t usb0_api_host_init(uint8_t int_level, uint16_t mode, uint16_t clockmode);
56+
int32_t usb0_api_host_enumeration(uint16_t devadr);
57+
int32_t usb0_api_host_detach(void);
58+
int32_t usb0_api_host_data_in(uint16_t devadr, uint16_t Pipe, uint32_t Size, uint8_t *data_buf);
59+
int32_t usb0_api_host_data_out(uint16_t devadr, uint16_t Pipe, uint32_t Size, uint8_t *data_buf);
60+
int32_t usb0_api_host_control_transfer(uint16_t devadr, uint16_t Req, uint16_t Val, uint16_t Indx, uint16_t Len, uint8_t *Buf);
61+
int32_t usb0_api_host_set_endpoint(uint16_t devadr, USB_HOST_CFG_PIPETBL_t *user_table, uint8_t *configdescriptor);
62+
int32_t usb0_api_host_clear_endpoint(USB_HOST_CFG_PIPETBL_t *user_table);
63+
int32_t usb0_api_host_clear_endpoint_pipe(uint16_t pipe_sel, USB_HOST_CFG_PIPETBL_t *user_table);
64+
uint16_t usb0_api_host_SetEndpointTable(uint16_t devadr, USB_HOST_CFG_PIPETBL_t *user_table, uint8_t* Table);
65+
int32_t usb0_api_host_data_count(uint16_t pipe, uint32_t *data_count);
66+
67+
int32_t usb0_api_host_GetDeviceDescriptor(uint16_t devadr, uint16_t size, uint8_t *buf);
68+
int32_t usb0_api_host_GetConfigDescriptor(uint16_t devadr, uint16_t size, uint8_t *buf);
69+
int32_t usb0_api_host_SetConfig(uint16_t devadr, uint16_t confignum);
70+
int32_t usb0_api_host_SetInterface(uint16_t devadr, uint16_t interface_alt, uint16_t interface_index);
71+
int32_t usb0_api_host_ClearStall(uint16_t devadr, uint16_t ep_dir);
72+
uint16_t usb0_api_host_GetUsbDeviceState(void);
73+
74+
void usb0_api_host_elt_4_4(void);
75+
void usb0_api_host_elt_4_5(void);
76+
void usb0_api_host_elt_4_6(void);
77+
void usb0_api_host_elt_4_7(void);
78+
void usb0_api_host_elt_4_8(void);
79+
void usb0_api_host_elt_4_9(void);
80+
void usb0_api_host_elt_get_desc(void);
81+
82+
void usb0_host_EL_ModeInit(void);
83+
void usb0_host_EL_SetUACT(void);
84+
void usb0_host_EL_ClearUACT(void);
85+
void usb0_host_EL_SetTESTMODE(uint16_t mode);
86+
void usb0_host_EL_ClearNRDYSTS(uint16_t pipe);
87+
uint16_t usb0_host_EL_GetINTSTS1(void);
88+
void usb0_host_EL_UsbBusReset(void);
89+
void usb0_host_EL_UsbAttach(void);
90+
void usb0_host_EL_SetupStage(uint16_t Req, uint16_t Val, uint16_t Indx, uint16_t Len);
91+
void usb0_host_EL_StatusStage(void);
92+
void usb0_host_EL_CtrlReadStart(uint32_t Bsize, uint8_t *Table);
93+
int32_t usb0_host_EL_UsbSuspend(void);
94+
int32_t usb0_host_EL_UsbResume(void);
95+
96+
#if 0 /* prototype in devdrv_usb_host_api.h */
97+
uint16_t Userdef_USB_usb0_host_d0fifo_dmaintid(void);
98+
uint16_t Userdef_USB_usb0_host_d1fifo_dmaintid(void);
99+
void Userdef_USB_usb0_host_attach(void);
100+
void Userdef_USB_usb0_host_detach(void);
101+
void Userdef_USB_usb0_host_delay_1ms(void);
102+
void Userdef_USB_usb0_host_delay_xms(uint32_t msec);
103+
void Userdef_USB_usb0_host_delay_10us(uint32_t usec);
104+
void Userdef_USB_usb0_host_delay_500ns(void);
105+
void Userdef_USB_usb0_host_start_dma(USB_HOST_DMA_t *dma, uint16_t dfacc);
106+
uint32_t Userdef_USB_usb0_host_stop_dma0(void);
107+
uint32_t Userdef_USB_usb0_host_stop_dma1(void);
108+
#endif
109+
110+
#endif /* USB0_HOST_API_H */
111+
112+
/* End of File */

0 commit comments

Comments
 (0)