1 /*******************************************************************************
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
20 * http://www.renesas.com/disclaimer
21 * Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
22 *******************************************************************************/
23 /*******************************************************************************
24 * File Name : usb1_host_global.c
26 * $Date:: 2014-07-09 16:29:19 +0900#$
31 * Description : RZ/A1H R7S72100 USB Sample Program
34 *******************************************************************************/
37 /*******************************************************************************
38 Includes <System Includes> , "Project Includes"
39 *******************************************************************************/
40 #include "usb1_host.h"
43 /*******************************************************************************
45 *******************************************************************************/
48 /*******************************************************************************
50 *******************************************************************************/
53 /*******************************************************************************
54 Imported global variables and functions (from other files)
55 *******************************************************************************/
58 /*******************************************************************************
59 Exported global variables and functions (to be accessed by other files)
60 *******************************************************************************/
61 const uint16_t g_usb1_host_bit_set
[16] =
63 0x0001, 0x0002, 0x0004, 0x0008,
64 0x0010, 0x0020, 0x0040, 0x0080,
65 0x0100, 0x0200, 0x0400, 0x0800,
66 0x1000, 0x2000, 0x4000, 0x8000
69 uint32_t g_usb1_host_data_count
[USB_HOST_MAX_PIPE_NO
+ 1];
70 uint8_t * g_usb1_host_data_pointer
[USB_HOST_MAX_PIPE_NO
+ 1];
72 uint16_t g_usb1_host_PipeIgnore
[USB_HOST_MAX_PIPE_NO
+ 1];
73 uint16_t g_usb1_host_PipeTbl
[USB_HOST_MAX_PIPE_NO
+ 1];
74 uint16_t g_usb1_host_pipe_status
[USB_HOST_MAX_PIPE_NO
+ 1];
75 uint32_t g_usb1_host_PipeDataSize
[USB_HOST_MAX_PIPE_NO
+ 1];
77 USB_HOST_DMA_t g_usb1_host_DmaInfo
[2];
79 uint16_t g_usb1_host_DmaPipe
[2];
80 uint16_t g_usb1_host_DmaBval
[2];
81 uint16_t g_usb1_host_DmaStatus
[2];
83 uint16_t g_usb1_host_driver_state
;
84 uint16_t g_usb1_host_ConfigNum
;
85 uint16_t g_usb1_host_CmdStage
;
86 uint16_t g_usb1_host_bchg_flag
;
87 uint16_t g_usb1_host_detach_flag
;
88 uint16_t g_usb1_host_attach_flag
;
90 uint16_t g_usb1_host_UsbAddress
;
91 uint16_t g_usb1_host_setUsbAddress
;
92 uint16_t g_usb1_host_default_max_packet
[USB_HOST_MAX_DEVICE
+ 1];
93 uint16_t g_usb1_host_UsbDeviceSpeed
;
94 uint16_t g_usb1_host_SupportUsbDeviceSpeed
;
96 uint16_t g_usb1_host_SavReq
;
97 uint16_t g_usb1_host_SavVal
;
98 uint16_t g_usb1_host_SavIndx
;
99 uint16_t g_usb1_host_SavLen
;
101 uint16_t g_usb1_host_pipecfg
[USB_HOST_MAX_PIPE_NO
+ 1];
102 uint16_t g_usb1_host_pipebuf
[USB_HOST_MAX_PIPE_NO
+ 1];
103 uint16_t g_usb1_host_pipemaxp
[USB_HOST_MAX_PIPE_NO
+ 1];
104 uint16_t g_usb1_host_pipeperi
[USB_HOST_MAX_PIPE_NO
+ 1];
107 /*******************************************************************************
108 Private global variables and functions
109 *******************************************************************************/
112 /*******************************************************************************
113 * Function Name: usb1_host_init_pipe_status
114 * Description : Initialize pipe status.
116 * Return Value : none
117 *******************************************************************************/
118 void usb1_host_init_pipe_status (void)
122 g_usb1_host_ConfigNum
= 0;
124 for (loop
= 0; loop
< (USB_HOST_MAX_PIPE_NO
+ 1); ++loop
)
126 g_usb1_host_pipe_status
[loop
] = USB_HOST_PIPE_IDLE
;
127 g_usb1_host_PipeDataSize
[loop
] = 0;
129 /* pipe configuration in usb1_host_resetEP() */
130 g_usb1_host_pipecfg
[loop
] = 0;
131 g_usb1_host_pipebuf
[loop
] = 0;
132 g_usb1_host_pipemaxp
[loop
] = 0;
133 g_usb1_host_pipeperi
[loop
] = 0;