USBHost library. NOTE: This library is only officially supported on the LPC1768 platform. For more information, please see the handbook page.

Dependencies:   FATFileSystem mbed-rtos

Dependents:   BTstack WallbotWii SD to Flash Data Transfer USBHost-MSD_HelloWorld ... more

Legacy Warning

This is an mbed 2 library. To learn more about mbed OS 5, visit the docs.

Pull requests against this repository are no longer supported. Please raise against mbed OS 5 as documented above.

Committer:
Kojto
Date:
Thu Jul 27 12:24:30 2017 +0100
Revision:
39:d96aa62afc5b
Update USBHost - add targets directory

This corresponds to mbed-os/master commit 9207365

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 39:d96aa62afc5b 1 /*******************************************************************************
Kojto 39:d96aa62afc5b 2 * DISCLAIMER
Kojto 39:d96aa62afc5b 3 * This software is supplied by Renesas Electronics Corporation and is only
Kojto 39:d96aa62afc5b 4 * intended for use with Renesas products. No other uses are authorized. This
Kojto 39:d96aa62afc5b 5 * software is owned by Renesas Electronics Corporation and is protected under
Kojto 39:d96aa62afc5b 6 * all applicable laws, including copyright laws.
Kojto 39:d96aa62afc5b 7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
Kojto 39:d96aa62afc5b 8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
Kojto 39:d96aa62afc5b 9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
Kojto 39:d96aa62afc5b 10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
Kojto 39:d96aa62afc5b 11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
Kojto 39:d96aa62afc5b 12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
Kojto 39:d96aa62afc5b 13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
Kojto 39:d96aa62afc5b 14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
Kojto 39:d96aa62afc5b 15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Kojto 39:d96aa62afc5b 16 * Renesas reserves the right, without notice, to make changes to this software
Kojto 39:d96aa62afc5b 17 * and to discontinue the availability of this software. By using this software,
Kojto 39:d96aa62afc5b 18 * you agree to the additional terms and conditions found by accessing the
Kojto 39:d96aa62afc5b 19 * following link:
Kojto 39:d96aa62afc5b 20 * http://www.renesas.com/disclaimer
Kojto 39:d96aa62afc5b 21 * Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
Kojto 39:d96aa62afc5b 22 *******************************************************************************/
Kojto 39:d96aa62afc5b 23 /*******************************************************************************
Kojto 39:d96aa62afc5b 24 * File Name : usb1_host_usbsig.c
Kojto 39:d96aa62afc5b 25 * $Rev: 1116 $
Kojto 39:d96aa62afc5b 26 * $Date:: 2014-07-09 16:29:19 +0900#$
Kojto 39:d96aa62afc5b 27 * Device(s) : RZ/A1H
Kojto 39:d96aa62afc5b 28 * Tool-Chain :
Kojto 39:d96aa62afc5b 29 * OS : None
Kojto 39:d96aa62afc5b 30 * H/W Platform :
Kojto 39:d96aa62afc5b 31 * Description : RZ/A1H R7S72100 USB Sample Program
Kojto 39:d96aa62afc5b 32 * Operation :
Kojto 39:d96aa62afc5b 33 * Limitations :
Kojto 39:d96aa62afc5b 34 *******************************************************************************/
Kojto 39:d96aa62afc5b 35
Kojto 39:d96aa62afc5b 36
Kojto 39:d96aa62afc5b 37 /*******************************************************************************
Kojto 39:d96aa62afc5b 38 Includes <System Includes> , "Project Includes"
Kojto 39:d96aa62afc5b 39 *******************************************************************************/
Kojto 39:d96aa62afc5b 40 #include "usb1_host.h"
Kojto 39:d96aa62afc5b 41 #include "dev_drv.h"
Kojto 39:d96aa62afc5b 42
Kojto 39:d96aa62afc5b 43
Kojto 39:d96aa62afc5b 44 /*******************************************************************************
Kojto 39:d96aa62afc5b 45 Typedef definitions
Kojto 39:d96aa62afc5b 46 *******************************************************************************/
Kojto 39:d96aa62afc5b 47
Kojto 39:d96aa62afc5b 48
Kojto 39:d96aa62afc5b 49 /*******************************************************************************
Kojto 39:d96aa62afc5b 50 Macro definitions
Kojto 39:d96aa62afc5b 51 *******************************************************************************/
Kojto 39:d96aa62afc5b 52
Kojto 39:d96aa62afc5b 53
Kojto 39:d96aa62afc5b 54 /*******************************************************************************
Kojto 39:d96aa62afc5b 55 Imported global variables and functions (from other files)
Kojto 39:d96aa62afc5b 56 *******************************************************************************/
Kojto 39:d96aa62afc5b 57
Kojto 39:d96aa62afc5b 58
Kojto 39:d96aa62afc5b 59 /*******************************************************************************
Kojto 39:d96aa62afc5b 60 Exported global variables and functions (to be accessed by other files)
Kojto 39:d96aa62afc5b 61 *******************************************************************************/
Kojto 39:d96aa62afc5b 62 static void usb1_host_EnableINT_Module(void);
Kojto 39:d96aa62afc5b 63 static void usb1_host_Enable_AttachINT(void);
Kojto 39:d96aa62afc5b 64 static void usb1_host_Disable_AttachINT(void);
Kojto 39:d96aa62afc5b 65 static void usb1_host_Disable_BchgINT(void);
Kojto 39:d96aa62afc5b 66
Kojto 39:d96aa62afc5b 67
Kojto 39:d96aa62afc5b 68 /*******************************************************************************
Kojto 39:d96aa62afc5b 69 Private global variables and functions
Kojto 39:d96aa62afc5b 70 *******************************************************************************/
Kojto 39:d96aa62afc5b 71
Kojto 39:d96aa62afc5b 72
Kojto 39:d96aa62afc5b 73 /*******************************************************************************
Kojto 39:d96aa62afc5b 74 * Function Name: usb1_host_InitModule
Kojto 39:d96aa62afc5b 75 * Description : Initializes the USB module in USB host module.
Kojto 39:d96aa62afc5b 76 * Arguments : none
Kojto 39:d96aa62afc5b 77 * Return Value : none
Kojto 39:d96aa62afc5b 78 *******************************************************************************/
Kojto 39:d96aa62afc5b 79 void usb1_host_InitModule (void)
Kojto 39:d96aa62afc5b 80 {
Kojto 39:d96aa62afc5b 81 uint16_t buf1;
Kojto 39:d96aa62afc5b 82 uint16_t buf2;
Kojto 39:d96aa62afc5b 83 uint16_t buf3;
Kojto 39:d96aa62afc5b 84
Kojto 39:d96aa62afc5b 85 usb1_host_init_pipe_status();
Kojto 39:d96aa62afc5b 86
Kojto 39:d96aa62afc5b 87 RZA_IO_RegWrite_16(&USB201.SYSCFG0,
Kojto 39:d96aa62afc5b 88 1,
Kojto 39:d96aa62afc5b 89 USB_SYSCFG_DCFM_SHIFT,
Kojto 39:d96aa62afc5b 90 USB_SYSCFG_DCFM); /* HOST mode */
Kojto 39:d96aa62afc5b 91 RZA_IO_RegWrite_16(&USB201.SYSCFG0,
Kojto 39:d96aa62afc5b 92 1,
Kojto 39:d96aa62afc5b 93 USB_SYSCFG_DRPD_SHIFT,
Kojto 39:d96aa62afc5b 94 USB_SYSCFG_DRPD); /* PORT0 D+, D- setting */
Kojto 39:d96aa62afc5b 95
Kojto 39:d96aa62afc5b 96 do
Kojto 39:d96aa62afc5b 97 {
Kojto 39:d96aa62afc5b 98 buf1 = RZA_IO_RegRead_16(&USB201.SYSSTS0,
Kojto 39:d96aa62afc5b 99 USB_SYSSTS0_LNST_SHIFT,
Kojto 39:d96aa62afc5b 100 USB_SYSSTS0_LNST);
Kojto 39:d96aa62afc5b 101 Userdef_USB_usb1_host_delay_xms(50);
Kojto 39:d96aa62afc5b 102 buf2 = RZA_IO_RegRead_16(&USB201.SYSSTS0,
Kojto 39:d96aa62afc5b 103 USB_SYSSTS0_LNST_SHIFT,
Kojto 39:d96aa62afc5b 104 USB_SYSSTS0_LNST);
Kojto 39:d96aa62afc5b 105 Userdef_USB_usb1_host_delay_xms(50);
Kojto 39:d96aa62afc5b 106 buf3 = RZA_IO_RegRead_16(&USB201.SYSSTS0,
Kojto 39:d96aa62afc5b 107 USB_SYSSTS0_LNST_SHIFT,
Kojto 39:d96aa62afc5b 108 USB_SYSSTS0_LNST);
Kojto 39:d96aa62afc5b 109
Kojto 39:d96aa62afc5b 110 } while ((buf1 != buf2) || (buf1 != buf3));
Kojto 39:d96aa62afc5b 111
Kojto 39:d96aa62afc5b 112 RZA_IO_RegWrite_16(&USB201.SYSCFG0,
Kojto 39:d96aa62afc5b 113 1,
Kojto 39:d96aa62afc5b 114 USB_SYSCFG_USBE_SHIFT,
Kojto 39:d96aa62afc5b 115 USB_SYSCFG_USBE);
Kojto 39:d96aa62afc5b 116
Kojto 39:d96aa62afc5b 117 USB201.CFIFOSEL = (uint16_t)(USB_HOST_BITRCNT | USB_HOST_BITMBW_8 | USB_HOST_BITBYTE_LITTLE);
Kojto 39:d96aa62afc5b 118 USB201.D0FIFOSEL = (uint16_t)( USB_HOST_BITMBW_8 | USB_HOST_BITBYTE_LITTLE);
Kojto 39:d96aa62afc5b 119 USB201.D1FIFOSEL = (uint16_t)( USB_HOST_BITMBW_8 | USB_HOST_BITBYTE_LITTLE);
Kojto 39:d96aa62afc5b 120 }
Kojto 39:d96aa62afc5b 121
Kojto 39:d96aa62afc5b 122 /*******************************************************************************
Kojto 39:d96aa62afc5b 123 * Function Name: usb1_host_CheckAttach
Kojto 39:d96aa62afc5b 124 * Description : Returns the USB device connection state.
Kojto 39:d96aa62afc5b 125 * Arguments : none
Kojto 39:d96aa62afc5b 126 * Return Value : uint16_t ; USB_HOST_ATTACH : Attached
Kojto 39:d96aa62afc5b 127 * : ; USB_HOST_DETACH : not Attached
Kojto 39:d96aa62afc5b 128 *******************************************************************************/
Kojto 39:d96aa62afc5b 129 uint16_t usb1_host_CheckAttach (void)
Kojto 39:d96aa62afc5b 130 {
Kojto 39:d96aa62afc5b 131 uint16_t buf1;
Kojto 39:d96aa62afc5b 132 uint16_t buf2;
Kojto 39:d96aa62afc5b 133 uint16_t buf3;
Kojto 39:d96aa62afc5b 134 uint16_t rhst;
Kojto 39:d96aa62afc5b 135
Kojto 39:d96aa62afc5b 136 do
Kojto 39:d96aa62afc5b 137 {
Kojto 39:d96aa62afc5b 138 buf1 = RZA_IO_RegRead_16(&USB201.SYSSTS0,
Kojto 39:d96aa62afc5b 139 USB_SYSSTS0_LNST_SHIFT,
Kojto 39:d96aa62afc5b 140 USB_SYSSTS0_LNST);
Kojto 39:d96aa62afc5b 141 Userdef_USB_usb1_host_delay_xms(50);
Kojto 39:d96aa62afc5b 142 buf2 = RZA_IO_RegRead_16(&USB201.SYSSTS0,
Kojto 39:d96aa62afc5b 143 USB_SYSSTS0_LNST_SHIFT,
Kojto 39:d96aa62afc5b 144 USB_SYSSTS0_LNST);
Kojto 39:d96aa62afc5b 145 Userdef_USB_usb1_host_delay_xms(50);
Kojto 39:d96aa62afc5b 146 buf3 = RZA_IO_RegRead_16(&USB201.SYSSTS0,
Kojto 39:d96aa62afc5b 147 USB_SYSSTS0_LNST_SHIFT,
Kojto 39:d96aa62afc5b 148 USB_SYSSTS0_LNST);
Kojto 39:d96aa62afc5b 149
Kojto 39:d96aa62afc5b 150 } while ((buf1 != buf2) || (buf1 != buf3));
Kojto 39:d96aa62afc5b 151
Kojto 39:d96aa62afc5b 152 rhst = RZA_IO_RegRead_16(&USB201.DVSTCTR0,
Kojto 39:d96aa62afc5b 153 USB_DVSTCTR0_RHST_SHIFT,
Kojto 39:d96aa62afc5b 154 USB_DVSTCTR0_RHST);
Kojto 39:d96aa62afc5b 155 if (rhst == USB_HOST_UNDECID)
Kojto 39:d96aa62afc5b 156 {
Kojto 39:d96aa62afc5b 157 if (buf1 == USB_HOST_FS_JSTS)
Kojto 39:d96aa62afc5b 158 {
Kojto 39:d96aa62afc5b 159 if (g_usb1_host_SupportUsbDeviceSpeed == USB_HOST_HIGH_SPEED)
Kojto 39:d96aa62afc5b 160 {
Kojto 39:d96aa62afc5b 161 RZA_IO_RegWrite_16(&USB201.SYSCFG0,
Kojto 39:d96aa62afc5b 162 1,
Kojto 39:d96aa62afc5b 163 USB_SYSCFG_HSE_SHIFT,
Kojto 39:d96aa62afc5b 164 USB_SYSCFG_HSE);
Kojto 39:d96aa62afc5b 165 }
Kojto 39:d96aa62afc5b 166 else
Kojto 39:d96aa62afc5b 167 {
Kojto 39:d96aa62afc5b 168 RZA_IO_RegWrite_16(&USB201.SYSCFG0,
Kojto 39:d96aa62afc5b 169 0,
Kojto 39:d96aa62afc5b 170 USB_SYSCFG_HSE_SHIFT,
Kojto 39:d96aa62afc5b 171 USB_SYSCFG_HSE);
Kojto 39:d96aa62afc5b 172 }
Kojto 39:d96aa62afc5b 173 return USB_HOST_ATTACH;
Kojto 39:d96aa62afc5b 174 }
Kojto 39:d96aa62afc5b 175 else if (buf1 == USB_HOST_LS_JSTS)
Kojto 39:d96aa62afc5b 176 {
Kojto 39:d96aa62afc5b 177 /* Low Speed Device */
Kojto 39:d96aa62afc5b 178 RZA_IO_RegWrite_16(&USB201.SYSCFG0,
Kojto 39:d96aa62afc5b 179 0,
Kojto 39:d96aa62afc5b 180 USB_SYSCFG_HSE_SHIFT,
Kojto 39:d96aa62afc5b 181 USB_SYSCFG_HSE);
Kojto 39:d96aa62afc5b 182 return USB_HOST_ATTACH;
Kojto 39:d96aa62afc5b 183 }
Kojto 39:d96aa62afc5b 184 else
Kojto 39:d96aa62afc5b 185 {
Kojto 39:d96aa62afc5b 186 /* Do Nothing */
Kojto 39:d96aa62afc5b 187 }
Kojto 39:d96aa62afc5b 188 }
Kojto 39:d96aa62afc5b 189 else if ((rhst == USB_HOST_HSMODE) || (rhst == USB_HOST_FSMODE))
Kojto 39:d96aa62afc5b 190 {
Kojto 39:d96aa62afc5b 191 return USB_HOST_ATTACH;
Kojto 39:d96aa62afc5b 192 }
Kojto 39:d96aa62afc5b 193 else if (rhst == USB_HOST_LSMODE)
Kojto 39:d96aa62afc5b 194 {
Kojto 39:d96aa62afc5b 195 return USB_HOST_ATTACH;
Kojto 39:d96aa62afc5b 196 }
Kojto 39:d96aa62afc5b 197 else
Kojto 39:d96aa62afc5b 198 {
Kojto 39:d96aa62afc5b 199 /* Do Nothing */
Kojto 39:d96aa62afc5b 200 }
Kojto 39:d96aa62afc5b 201
Kojto 39:d96aa62afc5b 202 return USB_HOST_DETACH;
Kojto 39:d96aa62afc5b 203 }
Kojto 39:d96aa62afc5b 204
Kojto 39:d96aa62afc5b 205 /*******************************************************************************
Kojto 39:d96aa62afc5b 206 * Function Name: usb1_host_UsbAttach
Kojto 39:d96aa62afc5b 207 * Description : Connects the USB device.
Kojto 39:d96aa62afc5b 208 * Arguments : none
Kojto 39:d96aa62afc5b 209 * Return Value : none
Kojto 39:d96aa62afc5b 210 *******************************************************************************/
Kojto 39:d96aa62afc5b 211 void usb1_host_UsbAttach (void)
Kojto 39:d96aa62afc5b 212 {
Kojto 39:d96aa62afc5b 213 usb1_host_EnableINT_Module();
Kojto 39:d96aa62afc5b 214 usb1_host_Disable_BchgINT();
Kojto 39:d96aa62afc5b 215 usb1_host_Disable_AttachINT();
Kojto 39:d96aa62afc5b 216 usb1_host_Enable_DetachINT();
Kojto 39:d96aa62afc5b 217 }
Kojto 39:d96aa62afc5b 218
Kojto 39:d96aa62afc5b 219 /*******************************************************************************
Kojto 39:d96aa62afc5b 220 * Function Name: usb1_host_UsbDetach
Kojto 39:d96aa62afc5b 221 * Description : Disconnects the USB device.
Kojto 39:d96aa62afc5b 222 * Arguments : none
Kojto 39:d96aa62afc5b 223 * Return Value : none
Kojto 39:d96aa62afc5b 224 *******************************************************************************/
Kojto 39:d96aa62afc5b 225 void usb1_host_UsbDetach (void)
Kojto 39:d96aa62afc5b 226 {
Kojto 39:d96aa62afc5b 227 uint16_t pipe;
Kojto 39:d96aa62afc5b 228 uint16_t devadr;
Kojto 39:d96aa62afc5b 229
Kojto 39:d96aa62afc5b 230 g_usb1_host_driver_state = USB_HOST_DRV_DETACHED;
Kojto 39:d96aa62afc5b 231
Kojto 39:d96aa62afc5b 232 /* Terminate all the pipes in which communications on port */
Kojto 39:d96aa62afc5b 233 /* are currently carried out */
Kojto 39:d96aa62afc5b 234 for (pipe = 0; pipe < (USB_HOST_MAX_PIPE_NO + 1); ++pipe)
Kojto 39:d96aa62afc5b 235 {
Kojto 39:d96aa62afc5b 236 if (g_usb1_host_pipe_status[pipe] != USB_HOST_PIPE_IDLE)
Kojto 39:d96aa62afc5b 237 {
Kojto 39:d96aa62afc5b 238 if (pipe == USB_HOST_PIPE0)
Kojto 39:d96aa62afc5b 239 {
Kojto 39:d96aa62afc5b 240 devadr = RZA_IO_RegRead_16(&USB201.DCPMAXP,
Kojto 39:d96aa62afc5b 241 USB_DCPMAXP_DEVSEL_SHIFT,
Kojto 39:d96aa62afc5b 242 USB_DCPMAXP_DEVSEL);
Kojto 39:d96aa62afc5b 243 }
Kojto 39:d96aa62afc5b 244 else
Kojto 39:d96aa62afc5b 245 {
Kojto 39:d96aa62afc5b 246 devadr = RZA_IO_RegRead_16(&g_usb1_host_pipemaxp[pipe], USB_PIPEMAXP_DEVSEL_SHIFT, USB_PIPEMAXP_DEVSEL);
Kojto 39:d96aa62afc5b 247 }
Kojto 39:d96aa62afc5b 248
Kojto 39:d96aa62afc5b 249 if (devadr == g_usb1_host_UsbAddress)
Kojto 39:d96aa62afc5b 250 {
Kojto 39:d96aa62afc5b 251 usb1_host_stop_transfer(pipe);
Kojto 39:d96aa62afc5b 252 }
Kojto 39:d96aa62afc5b 253
Kojto 39:d96aa62afc5b 254 g_usb1_host_pipe_status[pipe] = USB_HOST_PIPE_IDLE;
Kojto 39:d96aa62afc5b 255 }
Kojto 39:d96aa62afc5b 256 }
Kojto 39:d96aa62afc5b 257
Kojto 39:d96aa62afc5b 258 g_usb1_host_ConfigNum = 0;
Kojto 39:d96aa62afc5b 259 g_usb1_host_UsbAddress = 0;
Kojto 39:d96aa62afc5b 260 g_usb1_host_default_max_packet[USB_HOST_DEVICE_0] = 64;
Kojto 39:d96aa62afc5b 261
Kojto 39:d96aa62afc5b 262 usb1_host_UsbDetach2();
Kojto 39:d96aa62afc5b 263 }
Kojto 39:d96aa62afc5b 264
Kojto 39:d96aa62afc5b 265 /*******************************************************************************
Kojto 39:d96aa62afc5b 266 * Function Name: usb1_host_UsbDetach2
Kojto 39:d96aa62afc5b 267 * Description : Disconnects the USB device.
Kojto 39:d96aa62afc5b 268 * Arguments : none
Kojto 39:d96aa62afc5b 269 * Return Value : none
Kojto 39:d96aa62afc5b 270 *******************************************************************************/
Kojto 39:d96aa62afc5b 271 void usb1_host_UsbDetach2 (void)
Kojto 39:d96aa62afc5b 272 {
Kojto 39:d96aa62afc5b 273 usb1_host_Disable_DetachINT();
Kojto 39:d96aa62afc5b 274 usb1_host_Disable_BchgINT();
Kojto 39:d96aa62afc5b 275 usb1_host_Enable_AttachINT();
Kojto 39:d96aa62afc5b 276 }
Kojto 39:d96aa62afc5b 277
Kojto 39:d96aa62afc5b 278 /*******************************************************************************
Kojto 39:d96aa62afc5b 279 * Function Name: usb1_host_UsbBusReset
Kojto 39:d96aa62afc5b 280 * Description : Issues the USB bus reset signal.
Kojto 39:d96aa62afc5b 281 * Arguments : none
Kojto 39:d96aa62afc5b 282 * Return Value : uint16_t ; RHST
Kojto 39:d96aa62afc5b 283 *******************************************************************************/
Kojto 39:d96aa62afc5b 284 uint16_t usb1_host_UsbBusReset (void)
Kojto 39:d96aa62afc5b 285 {
Kojto 39:d96aa62afc5b 286 uint16_t buffer;
Kojto 39:d96aa62afc5b 287 uint16_t loop;
Kojto 39:d96aa62afc5b 288
Kojto 39:d96aa62afc5b 289 RZA_IO_RegWrite_16(&USB201.DVSTCTR0,
Kojto 39:d96aa62afc5b 290 1,
Kojto 39:d96aa62afc5b 291 USB_DVSTCTR0_USBRST_SHIFT,
Kojto 39:d96aa62afc5b 292 USB_DVSTCTR0_USBRST);
Kojto 39:d96aa62afc5b 293 RZA_IO_RegWrite_16(&USB201.DVSTCTR0,
Kojto 39:d96aa62afc5b 294 0,
Kojto 39:d96aa62afc5b 295 USB_DVSTCTR0_UACT_SHIFT,
Kojto 39:d96aa62afc5b 296 USB_DVSTCTR0_UACT);
Kojto 39:d96aa62afc5b 297
Kojto 39:d96aa62afc5b 298 Userdef_USB_usb1_host_delay_xms(50);
Kojto 39:d96aa62afc5b 299
Kojto 39:d96aa62afc5b 300 buffer = USB201.DVSTCTR0;
Kojto 39:d96aa62afc5b 301 buffer &= (uint16_t)(~(USB_HOST_BITRST));
Kojto 39:d96aa62afc5b 302 buffer |= USB_HOST_BITUACT;
Kojto 39:d96aa62afc5b 303 USB201.DVSTCTR0 = buffer;
Kojto 39:d96aa62afc5b 304
Kojto 39:d96aa62afc5b 305 Userdef_USB_usb1_host_delay_xms(20);
Kojto 39:d96aa62afc5b 306
Kojto 39:d96aa62afc5b 307 for (loop = 0, buffer = USB_HOST_HSPROC; loop < 3; ++loop)
Kojto 39:d96aa62afc5b 308 {
Kojto 39:d96aa62afc5b 309 buffer = RZA_IO_RegRead_16(&USB201.DVSTCTR0,
Kojto 39:d96aa62afc5b 310 USB_DVSTCTR0_RHST_SHIFT,
Kojto 39:d96aa62afc5b 311 USB_DVSTCTR0_RHST);
Kojto 39:d96aa62afc5b 312 if (buffer == USB_HOST_HSPROC)
Kojto 39:d96aa62afc5b 313 {
Kojto 39:d96aa62afc5b 314 Userdef_USB_usb1_host_delay_xms(10);
Kojto 39:d96aa62afc5b 315 }
Kojto 39:d96aa62afc5b 316 else
Kojto 39:d96aa62afc5b 317 {
Kojto 39:d96aa62afc5b 318 break;
Kojto 39:d96aa62afc5b 319 }
Kojto 39:d96aa62afc5b 320 }
Kojto 39:d96aa62afc5b 321
Kojto 39:d96aa62afc5b 322 return buffer;
Kojto 39:d96aa62afc5b 323 }
Kojto 39:d96aa62afc5b 324
Kojto 39:d96aa62afc5b 325 /*******************************************************************************
Kojto 39:d96aa62afc5b 326 * Function Name: usb1_host_UsbResume
Kojto 39:d96aa62afc5b 327 * Description : Issues the USB resume signal.
Kojto 39:d96aa62afc5b 328 * Arguments : none
Kojto 39:d96aa62afc5b 329 * Return Value : int32_t ; DEVDRV_SUCCESS
Kojto 39:d96aa62afc5b 330 * : ; DEVDRV_ERROR
Kojto 39:d96aa62afc5b 331 *******************************************************************************/
Kojto 39:d96aa62afc5b 332 int32_t usb1_host_UsbResume (void)
Kojto 39:d96aa62afc5b 333 {
Kojto 39:d96aa62afc5b 334 uint16_t buf;
Kojto 39:d96aa62afc5b 335
Kojto 39:d96aa62afc5b 336 if ((g_usb1_host_driver_state & USB_HOST_DRV_SUSPEND) == 0)
Kojto 39:d96aa62afc5b 337 {
Kojto 39:d96aa62afc5b 338 /* not SUSPEND */
Kojto 39:d96aa62afc5b 339 return DEVDRV_ERROR;
Kojto 39:d96aa62afc5b 340 }
Kojto 39:d96aa62afc5b 341
Kojto 39:d96aa62afc5b 342 RZA_IO_RegWrite_16(&USB201.INTENB1,
Kojto 39:d96aa62afc5b 343 0,
Kojto 39:d96aa62afc5b 344 USB_INTENB1_BCHGE_SHIFT,
Kojto 39:d96aa62afc5b 345 USB_INTENB1_BCHGE);
Kojto 39:d96aa62afc5b 346 RZA_IO_RegWrite_16(&USB201.DVSTCTR0,
Kojto 39:d96aa62afc5b 347 1,
Kojto 39:d96aa62afc5b 348 USB_DVSTCTR0_RESUME_SHIFT,
Kojto 39:d96aa62afc5b 349 USB_DVSTCTR0_RESUME);
Kojto 39:d96aa62afc5b 350 Userdef_USB_usb1_host_delay_xms(20);
Kojto 39:d96aa62afc5b 351
Kojto 39:d96aa62afc5b 352 buf = USB201.DVSTCTR0;
Kojto 39:d96aa62afc5b 353 buf &= (uint16_t)(~(USB_HOST_BITRESUME));
Kojto 39:d96aa62afc5b 354 buf |= USB_HOST_BITUACT;
Kojto 39:d96aa62afc5b 355 USB201.DVSTCTR0 = buf;
Kojto 39:d96aa62afc5b 356
Kojto 39:d96aa62afc5b 357 g_usb1_host_driver_state &= (uint16_t)~USB_HOST_DRV_SUSPEND;
Kojto 39:d96aa62afc5b 358
Kojto 39:d96aa62afc5b 359 return DEVDRV_SUCCESS;
Kojto 39:d96aa62afc5b 360 }
Kojto 39:d96aa62afc5b 361
Kojto 39:d96aa62afc5b 362 /*******************************************************************************
Kojto 39:d96aa62afc5b 363 * Function Name: usb1_host_UsbSuspend
Kojto 39:d96aa62afc5b 364 * Description : Issues the USB suspend signal.
Kojto 39:d96aa62afc5b 365 * Arguments : none
Kojto 39:d96aa62afc5b 366 * Return Value : int32_t ; DEVDRV_SUCCESS :not SUSPEND
Kojto 39:d96aa62afc5b 367 * : ; DEVDRV_ERROR :SUSPEND
Kojto 39:d96aa62afc5b 368 *******************************************************************************/
Kojto 39:d96aa62afc5b 369 int32_t usb1_host_UsbSuspend (void)
Kojto 39:d96aa62afc5b 370 {
Kojto 39:d96aa62afc5b 371 uint16_t buf;
Kojto 39:d96aa62afc5b 372
Kojto 39:d96aa62afc5b 373 if ((g_usb1_host_driver_state & USB_HOST_DRV_SUSPEND) != 0)
Kojto 39:d96aa62afc5b 374 {
Kojto 39:d96aa62afc5b 375 /* SUSPEND */
Kojto 39:d96aa62afc5b 376 return DEVDRV_ERROR;
Kojto 39:d96aa62afc5b 377 }
Kojto 39:d96aa62afc5b 378
Kojto 39:d96aa62afc5b 379 RZA_IO_RegWrite_16(&USB201.DVSTCTR0,
Kojto 39:d96aa62afc5b 380 0,
Kojto 39:d96aa62afc5b 381 USB_DVSTCTR0_UACT_SHIFT,
Kojto 39:d96aa62afc5b 382 USB_DVSTCTR0_UACT);
Kojto 39:d96aa62afc5b 383
Kojto 39:d96aa62afc5b 384 Userdef_USB_usb1_host_delay_xms(5);
Kojto 39:d96aa62afc5b 385
Kojto 39:d96aa62afc5b 386 buf = RZA_IO_RegRead_16(&USB201.SYSSTS0,
Kojto 39:d96aa62afc5b 387 USB_SYSSTS0_LNST_SHIFT,
Kojto 39:d96aa62afc5b 388 USB_SYSSTS0_LNST);
Kojto 39:d96aa62afc5b 389 if ((buf != USB_HOST_FS_JSTS) && (buf != USB_HOST_LS_JSTS))
Kojto 39:d96aa62afc5b 390 {
Kojto 39:d96aa62afc5b 391 usb1_host_UsbDetach();
Kojto 39:d96aa62afc5b 392 }
Kojto 39:d96aa62afc5b 393 else
Kojto 39:d96aa62afc5b 394 {
Kojto 39:d96aa62afc5b 395 g_usb1_host_driver_state |= USB_HOST_DRV_SUSPEND;
Kojto 39:d96aa62afc5b 396 }
Kojto 39:d96aa62afc5b 397
Kojto 39:d96aa62afc5b 398 return DEVDRV_SUCCESS;
Kojto 39:d96aa62afc5b 399 }
Kojto 39:d96aa62afc5b 400
Kojto 39:d96aa62afc5b 401 /*******************************************************************************
Kojto 39:d96aa62afc5b 402 * Function Name: usb1_host_Enable_DetachINT
Kojto 39:d96aa62afc5b 403 * Description : Enables the USB disconnection interrupt.
Kojto 39:d96aa62afc5b 404 * Arguments : none
Kojto 39:d96aa62afc5b 405 * Return Value : none
Kojto 39:d96aa62afc5b 406 *******************************************************************************/
Kojto 39:d96aa62afc5b 407 void usb1_host_Enable_DetachINT (void)
Kojto 39:d96aa62afc5b 408 {
Kojto 39:d96aa62afc5b 409 USB201.INTSTS1 = (uint16_t)(~(USB_HOST_BITDTCH));
Kojto 39:d96aa62afc5b 410 RZA_IO_RegWrite_16(&USB201.INTENB1,
Kojto 39:d96aa62afc5b 411 1,
Kojto 39:d96aa62afc5b 412 USB_INTENB1_DTCHE_SHIFT,
Kojto 39:d96aa62afc5b 413 USB_INTENB1_DTCHE);
Kojto 39:d96aa62afc5b 414 }
Kojto 39:d96aa62afc5b 415
Kojto 39:d96aa62afc5b 416 /*******************************************************************************
Kojto 39:d96aa62afc5b 417 * Function Name: usb1_host_Disable_DetachINT
Kojto 39:d96aa62afc5b 418 * Description : Disables the USB disconnection interrupt.
Kojto 39:d96aa62afc5b 419 * Arguments : none
Kojto 39:d96aa62afc5b 420 * Return Value : none
Kojto 39:d96aa62afc5b 421 *******************************************************************************/
Kojto 39:d96aa62afc5b 422 void usb1_host_Disable_DetachINT (void)
Kojto 39:d96aa62afc5b 423 {
Kojto 39:d96aa62afc5b 424 USB201.INTSTS1 = (uint16_t)(~(USB_HOST_BITDTCH));
Kojto 39:d96aa62afc5b 425 RZA_IO_RegWrite_16(&USB201.INTENB1,
Kojto 39:d96aa62afc5b 426 0,
Kojto 39:d96aa62afc5b 427 USB_INTENB1_DTCHE_SHIFT,
Kojto 39:d96aa62afc5b 428 USB_INTENB1_DTCHE);
Kojto 39:d96aa62afc5b 429 }
Kojto 39:d96aa62afc5b 430
Kojto 39:d96aa62afc5b 431 /*******************************************************************************
Kojto 39:d96aa62afc5b 432 * Function Name: usb1_host_Enable_AttachINT
Kojto 39:d96aa62afc5b 433 * Description : Enables the USB connection detection interrupt.
Kojto 39:d96aa62afc5b 434 * Arguments : none
Kojto 39:d96aa62afc5b 435 * Return Value : none
Kojto 39:d96aa62afc5b 436 *******************************************************************************/
Kojto 39:d96aa62afc5b 437 void usb1_host_Enable_AttachINT (void)
Kojto 39:d96aa62afc5b 438 {
Kojto 39:d96aa62afc5b 439 USB201.INTSTS1 = (uint16_t)(~(USB_HOST_BITATTCH));
Kojto 39:d96aa62afc5b 440 RZA_IO_RegWrite_16(&USB201.INTENB1,
Kojto 39:d96aa62afc5b 441 1,
Kojto 39:d96aa62afc5b 442 USB_INTENB1_ATTCHE_SHIFT,
Kojto 39:d96aa62afc5b 443 USB_INTENB1_ATTCHE);
Kojto 39:d96aa62afc5b 444 }
Kojto 39:d96aa62afc5b 445
Kojto 39:d96aa62afc5b 446 /*******************************************************************************
Kojto 39:d96aa62afc5b 447 * Function Name: usb1_host_Disable_AttachINT
Kojto 39:d96aa62afc5b 448 * Description : Disables the USB connection detection interrupt.
Kojto 39:d96aa62afc5b 449 * Arguments : none
Kojto 39:d96aa62afc5b 450 * Return Value : none
Kojto 39:d96aa62afc5b 451 *******************************************************************************/
Kojto 39:d96aa62afc5b 452 void usb1_host_Disable_AttachINT (void)
Kojto 39:d96aa62afc5b 453 {
Kojto 39:d96aa62afc5b 454 USB201.INTSTS1 = (uint16_t)(~(USB_HOST_BITATTCH));
Kojto 39:d96aa62afc5b 455 RZA_IO_RegWrite_16(&USB201.INTENB1,
Kojto 39:d96aa62afc5b 456 0,
Kojto 39:d96aa62afc5b 457 USB_INTENB1_ATTCHE_SHIFT,
Kojto 39:d96aa62afc5b 458 USB_INTENB1_ATTCHE);
Kojto 39:d96aa62afc5b 459 }
Kojto 39:d96aa62afc5b 460
Kojto 39:d96aa62afc5b 461 /*******************************************************************************
Kojto 39:d96aa62afc5b 462 * Function Name: usb1_host_Disable_BchgINT
Kojto 39:d96aa62afc5b 463 * Description : Disables the USB bus change detection interrupt.
Kojto 39:d96aa62afc5b 464 * Arguments : none
Kojto 39:d96aa62afc5b 465 * Return Value : none
Kojto 39:d96aa62afc5b 466 *******************************************************************************/
Kojto 39:d96aa62afc5b 467 void usb1_host_Disable_BchgINT (void)
Kojto 39:d96aa62afc5b 468 {
Kojto 39:d96aa62afc5b 469 USB201.INTSTS1 = (uint16_t)(~(USB_HOST_BITBCHG));
Kojto 39:d96aa62afc5b 470 RZA_IO_RegWrite_16(&USB201.INTENB1,
Kojto 39:d96aa62afc5b 471 0,
Kojto 39:d96aa62afc5b 472 USB_INTENB1_BCHGE_SHIFT,
Kojto 39:d96aa62afc5b 473 USB_INTENB1_BCHGE);
Kojto 39:d96aa62afc5b 474 }
Kojto 39:d96aa62afc5b 475
Kojto 39:d96aa62afc5b 476 /*******************************************************************************
Kojto 39:d96aa62afc5b 477 * Function Name: usb1_host_set_devadd
Kojto 39:d96aa62afc5b 478 * Description : DEVADDn register is set by specified value
Kojto 39:d96aa62afc5b 479 * Arguments : uint16_t addr : Device address
Kojto 39:d96aa62afc5b 480 * : uint16_t *devadd : Set value
Kojto 39:d96aa62afc5b 481 * Return Value : none
Kojto 39:d96aa62afc5b 482 *******************************************************************************/
Kojto 39:d96aa62afc5b 483 void usb1_host_set_devadd (uint16_t addr, uint16_t * devadd)
Kojto 39:d96aa62afc5b 484 {
Kojto 39:d96aa62afc5b 485 uint16_t * ptr;
Kojto 39:d96aa62afc5b 486 uint16_t ret_flag = DEVDRV_FLAG_ON; // avoid warning.
Kojto 39:d96aa62afc5b 487
Kojto 39:d96aa62afc5b 488 switch (addr)
Kojto 39:d96aa62afc5b 489 {
Kojto 39:d96aa62afc5b 490 case USB_HOST_DEVICE_0:
Kojto 39:d96aa62afc5b 491 ptr = (uint16_t *)&USB201.DEVADD0;
Kojto 39:d96aa62afc5b 492 break;
Kojto 39:d96aa62afc5b 493
Kojto 39:d96aa62afc5b 494 case USB_HOST_DEVICE_1:
Kojto 39:d96aa62afc5b 495 ptr = (uint16_t *)&USB201.DEVADD1;
Kojto 39:d96aa62afc5b 496 break;
Kojto 39:d96aa62afc5b 497
Kojto 39:d96aa62afc5b 498 case USB_HOST_DEVICE_2:
Kojto 39:d96aa62afc5b 499 ptr = (uint16_t *)&USB201.DEVADD2;
Kojto 39:d96aa62afc5b 500 break;
Kojto 39:d96aa62afc5b 501
Kojto 39:d96aa62afc5b 502 case USB_HOST_DEVICE_3:
Kojto 39:d96aa62afc5b 503 ptr = (uint16_t *)&USB201.DEVADD3;
Kojto 39:d96aa62afc5b 504 break;
Kojto 39:d96aa62afc5b 505
Kojto 39:d96aa62afc5b 506 case USB_HOST_DEVICE_4:
Kojto 39:d96aa62afc5b 507 ptr = (uint16_t *)&USB201.DEVADD4;
Kojto 39:d96aa62afc5b 508 break;
Kojto 39:d96aa62afc5b 509
Kojto 39:d96aa62afc5b 510 case USB_HOST_DEVICE_5:
Kojto 39:d96aa62afc5b 511 ptr = (uint16_t *)&USB201.DEVADD5;
Kojto 39:d96aa62afc5b 512 break;
Kojto 39:d96aa62afc5b 513
Kojto 39:d96aa62afc5b 514 case USB_HOST_DEVICE_6:
Kojto 39:d96aa62afc5b 515 ptr = (uint16_t *)&USB201.DEVADD6;
Kojto 39:d96aa62afc5b 516 break;
Kojto 39:d96aa62afc5b 517
Kojto 39:d96aa62afc5b 518 case USB_HOST_DEVICE_7:
Kojto 39:d96aa62afc5b 519 ptr = (uint16_t *)&USB201.DEVADD7;
Kojto 39:d96aa62afc5b 520 break;
Kojto 39:d96aa62afc5b 521
Kojto 39:d96aa62afc5b 522 case USB_HOST_DEVICE_8:
Kojto 39:d96aa62afc5b 523 ptr = (uint16_t *)&USB201.DEVADD8;
Kojto 39:d96aa62afc5b 524 break;
Kojto 39:d96aa62afc5b 525
Kojto 39:d96aa62afc5b 526 case USB_HOST_DEVICE_9:
Kojto 39:d96aa62afc5b 527 ptr = (uint16_t *)&USB201.DEVADD9;
Kojto 39:d96aa62afc5b 528 break;
Kojto 39:d96aa62afc5b 529
Kojto 39:d96aa62afc5b 530 case USB_HOST_DEVICE_10:
Kojto 39:d96aa62afc5b 531 ptr = (uint16_t *)&USB201.DEVADDA;
Kojto 39:d96aa62afc5b 532 break;
Kojto 39:d96aa62afc5b 533
Kojto 39:d96aa62afc5b 534 default:
Kojto 39:d96aa62afc5b 535 ret_flag = DEVDRV_FLAG_OFF;
Kojto 39:d96aa62afc5b 536 break;
Kojto 39:d96aa62afc5b 537 }
Kojto 39:d96aa62afc5b 538
Kojto 39:d96aa62afc5b 539 if (ret_flag == DEVDRV_FLAG_ON)
Kojto 39:d96aa62afc5b 540 {
Kojto 39:d96aa62afc5b 541 *ptr = (uint16_t)(*devadd & USB_HOST_DEVADD_MASK);
Kojto 39:d96aa62afc5b 542 }
Kojto 39:d96aa62afc5b 543 }
Kojto 39:d96aa62afc5b 544
Kojto 39:d96aa62afc5b 545 /*******************************************************************************
Kojto 39:d96aa62afc5b 546 * Function Name: usb1_host_get_devadd
Kojto 39:d96aa62afc5b 547 * Description : DEVADDn register is obtained
Kojto 39:d96aa62afc5b 548 * Arguments : uint16_t addr : Device address
Kojto 39:d96aa62afc5b 549 * : uint16_t *devadd : USB_HOST_DEVADD register value
Kojto 39:d96aa62afc5b 550 * Return Value : none
Kojto 39:d96aa62afc5b 551 *******************************************************************************/
Kojto 39:d96aa62afc5b 552 void usb1_host_get_devadd (uint16_t addr, uint16_t * devadd)
Kojto 39:d96aa62afc5b 553 {
Kojto 39:d96aa62afc5b 554 uint16_t * ptr;
Kojto 39:d96aa62afc5b 555 uint16_t ret_flag = DEVDRV_FLAG_ON; // avoid warning.
Kojto 39:d96aa62afc5b 556
Kojto 39:d96aa62afc5b 557 switch (addr)
Kojto 39:d96aa62afc5b 558 {
Kojto 39:d96aa62afc5b 559 case USB_HOST_DEVICE_0:
Kojto 39:d96aa62afc5b 560 ptr = (uint16_t *)&USB201.DEVADD0;
Kojto 39:d96aa62afc5b 561 break;
Kojto 39:d96aa62afc5b 562
Kojto 39:d96aa62afc5b 563 case USB_HOST_DEVICE_1:
Kojto 39:d96aa62afc5b 564 ptr = (uint16_t *)&USB201.DEVADD1;
Kojto 39:d96aa62afc5b 565 break;
Kojto 39:d96aa62afc5b 566
Kojto 39:d96aa62afc5b 567 case USB_HOST_DEVICE_2:
Kojto 39:d96aa62afc5b 568 ptr = (uint16_t *)&USB201.DEVADD2;
Kojto 39:d96aa62afc5b 569 break;
Kojto 39:d96aa62afc5b 570
Kojto 39:d96aa62afc5b 571 case USB_HOST_DEVICE_3:
Kojto 39:d96aa62afc5b 572 ptr = (uint16_t *)&USB201.DEVADD3;
Kojto 39:d96aa62afc5b 573 break;
Kojto 39:d96aa62afc5b 574
Kojto 39:d96aa62afc5b 575 case USB_HOST_DEVICE_4:
Kojto 39:d96aa62afc5b 576 ptr = (uint16_t *)&USB201.DEVADD4;
Kojto 39:d96aa62afc5b 577 break;
Kojto 39:d96aa62afc5b 578
Kojto 39:d96aa62afc5b 579 case USB_HOST_DEVICE_5:
Kojto 39:d96aa62afc5b 580 ptr = (uint16_t *)&USB201.DEVADD5;
Kojto 39:d96aa62afc5b 581 break;
Kojto 39:d96aa62afc5b 582
Kojto 39:d96aa62afc5b 583 case USB_HOST_DEVICE_6:
Kojto 39:d96aa62afc5b 584 ptr = (uint16_t *)&USB201.DEVADD6;
Kojto 39:d96aa62afc5b 585 break;
Kojto 39:d96aa62afc5b 586
Kojto 39:d96aa62afc5b 587 case USB_HOST_DEVICE_7:
Kojto 39:d96aa62afc5b 588 ptr = (uint16_t *)&USB201.DEVADD7;
Kojto 39:d96aa62afc5b 589 break;
Kojto 39:d96aa62afc5b 590
Kojto 39:d96aa62afc5b 591 case USB_HOST_DEVICE_8:
Kojto 39:d96aa62afc5b 592 ptr = (uint16_t *)&USB201.DEVADD8;
Kojto 39:d96aa62afc5b 593 break;
Kojto 39:d96aa62afc5b 594
Kojto 39:d96aa62afc5b 595 case USB_HOST_DEVICE_9:
Kojto 39:d96aa62afc5b 596 ptr = (uint16_t *)&USB201.DEVADD9;
Kojto 39:d96aa62afc5b 597 break;
Kojto 39:d96aa62afc5b 598
Kojto 39:d96aa62afc5b 599 case USB_HOST_DEVICE_10:
Kojto 39:d96aa62afc5b 600 ptr = (uint16_t *)&USB201.DEVADDA;
Kojto 39:d96aa62afc5b 601 break;
Kojto 39:d96aa62afc5b 602
Kojto 39:d96aa62afc5b 603 default:
Kojto 39:d96aa62afc5b 604 ret_flag = DEVDRV_FLAG_OFF;
Kojto 39:d96aa62afc5b 605 break;
Kojto 39:d96aa62afc5b 606 }
Kojto 39:d96aa62afc5b 607
Kojto 39:d96aa62afc5b 608 if (ret_flag == DEVDRV_FLAG_ON)
Kojto 39:d96aa62afc5b 609 {
Kojto 39:d96aa62afc5b 610 *devadd = *ptr;
Kojto 39:d96aa62afc5b 611 }
Kojto 39:d96aa62afc5b 612 }
Kojto 39:d96aa62afc5b 613
Kojto 39:d96aa62afc5b 614 /*******************************************************************************
Kojto 39:d96aa62afc5b 615 * Function Name: usb1_host_EnableINT_Module
Kojto 39:d96aa62afc5b 616 * Description : Enables BEMP/NRDY/BRDY interrupt and SIGN/SACK interrupt.
Kojto 39:d96aa62afc5b 617 * : Enables NRDY/BEMP interrupt in the pipe0.
Kojto 39:d96aa62afc5b 618 * Arguments : none
Kojto 39:d96aa62afc5b 619 * Return Value : none
Kojto 39:d96aa62afc5b 620 *******************************************************************************/
Kojto 39:d96aa62afc5b 621 void usb1_host_EnableINT_Module (void)
Kojto 39:d96aa62afc5b 622 {
Kojto 39:d96aa62afc5b 623 uint16_t buf;
Kojto 39:d96aa62afc5b 624
Kojto 39:d96aa62afc5b 625 buf = USB201.INTENB0;
Kojto 39:d96aa62afc5b 626 buf |= (USB_HOST_BITBEMPE | USB_HOST_BITNRDYE | USB_HOST_BITBRDYE);
Kojto 39:d96aa62afc5b 627 USB201.INTENB0 = buf;
Kojto 39:d96aa62afc5b 628
Kojto 39:d96aa62afc5b 629 buf = USB201.INTENB1;
Kojto 39:d96aa62afc5b 630 buf |= (USB_HOST_BITSIGNE | USB_HOST_BITSACKE);
Kojto 39:d96aa62afc5b 631 USB201.INTENB1 = buf;
Kojto 39:d96aa62afc5b 632
Kojto 39:d96aa62afc5b 633 usb1_host_enable_nrdy_int(USB_HOST_PIPE0);
Kojto 39:d96aa62afc5b 634 usb1_host_enable_bemp_int(USB_HOST_PIPE0);
Kojto 39:d96aa62afc5b 635 }
Kojto 39:d96aa62afc5b 636
Kojto 39:d96aa62afc5b 637 /* End of File */