I changed one line of code in the file with path name: USBDeviceHT/targets/TARGET_Maxim
Fork of USBDeviceHT by
targets/TARGET_RENESAS/TARGET_RZ_A1H/usb0/src/function/usb0_function_sig.c@6:c1f162fd7777, 2018-06-01 (annotated)
- Committer:
- dev_alexander
- Date:
- Fri Jun 01 21:43:55 2018 +0000
- Revision:
- 6:c1f162fd7777
- Parent:
- 0:a3ea811f80f2
Fixed Error with code not compiling due to an issue with there not being a (uint32_t) cast of a (void) pointer. Maxim was the only mbed vendor to not have this one (uint32_t) cast in the spot it was added to. Look into public repos for similar cases.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Helmut64 | 0:a3ea811f80f2 | 1 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 2 | * DISCLAIMER |
Helmut64 | 0:a3ea811f80f2 | 3 | * This software is supplied by Renesas Electronics Corporation and is only |
Helmut64 | 0:a3ea811f80f2 | 4 | * intended for use with Renesas products. No other uses are authorized. This |
Helmut64 | 0:a3ea811f80f2 | 5 | * software is owned by Renesas Electronics Corporation and is protected under |
Helmut64 | 0:a3ea811f80f2 | 6 | * all applicable laws, including copyright laws. |
Helmut64 | 0:a3ea811f80f2 | 7 | * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING |
Helmut64 | 0:a3ea811f80f2 | 8 | * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT |
Helmut64 | 0:a3ea811f80f2 | 9 | * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE |
Helmut64 | 0:a3ea811f80f2 | 10 | * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. |
Helmut64 | 0:a3ea811f80f2 | 11 | * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS |
Helmut64 | 0:a3ea811f80f2 | 12 | * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE |
Helmut64 | 0:a3ea811f80f2 | 13 | * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR |
Helmut64 | 0:a3ea811f80f2 | 14 | * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE |
Helmut64 | 0:a3ea811f80f2 | 15 | * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
Helmut64 | 0:a3ea811f80f2 | 16 | * Renesas reserves the right, without notice, to make changes to this software |
Helmut64 | 0:a3ea811f80f2 | 17 | * and to discontinue the availability of this software. By using this software, |
Helmut64 | 0:a3ea811f80f2 | 18 | * you agree to the additional terms and conditions found by accessing the |
Helmut64 | 0:a3ea811f80f2 | 19 | * following link: |
Helmut64 | 0:a3ea811f80f2 | 20 | * http://www.renesas.com/disclaimer |
Helmut64 | 0:a3ea811f80f2 | 21 | * Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved. |
Helmut64 | 0:a3ea811f80f2 | 22 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 23 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 24 | * File Name : usb0_function_sig.c |
Helmut64 | 0:a3ea811f80f2 | 25 | * $Rev: 1116 $ |
Helmut64 | 0:a3ea811f80f2 | 26 | * $Date:: 2014-07-09 16:29:19 +0900#$ |
Helmut64 | 0:a3ea811f80f2 | 27 | * Device(s) : RZ/A1H |
Helmut64 | 0:a3ea811f80f2 | 28 | * Tool-Chain : |
Helmut64 | 0:a3ea811f80f2 | 29 | * OS : None |
Helmut64 | 0:a3ea811f80f2 | 30 | * H/W Platform : |
Helmut64 | 0:a3ea811f80f2 | 31 | * Description : RZ/A1H R7S72100 USB Sample Program |
Helmut64 | 0:a3ea811f80f2 | 32 | * Operation : |
Helmut64 | 0:a3ea811f80f2 | 33 | * Limitations : |
Helmut64 | 0:a3ea811f80f2 | 34 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 35 | |
Helmut64 | 0:a3ea811f80f2 | 36 | |
Helmut64 | 0:a3ea811f80f2 | 37 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 38 | Includes <System Includes> , "Project Includes" |
Helmut64 | 0:a3ea811f80f2 | 39 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 40 | #include "usb0_function.h" |
Helmut64 | 0:a3ea811f80f2 | 41 | |
Helmut64 | 0:a3ea811f80f2 | 42 | |
Helmut64 | 0:a3ea811f80f2 | 43 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 44 | Typedef definitions |
Helmut64 | 0:a3ea811f80f2 | 45 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 46 | |
Helmut64 | 0:a3ea811f80f2 | 47 | |
Helmut64 | 0:a3ea811f80f2 | 48 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 49 | Macro definitions |
Helmut64 | 0:a3ea811f80f2 | 50 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 51 | |
Helmut64 | 0:a3ea811f80f2 | 52 | |
Helmut64 | 0:a3ea811f80f2 | 53 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 54 | Imported global variables and functions (from other files) |
Helmut64 | 0:a3ea811f80f2 | 55 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 56 | |
Helmut64 | 0:a3ea811f80f2 | 57 | |
Helmut64 | 0:a3ea811f80f2 | 58 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 59 | Exported global variables and functions (to be accessed by other files) |
Helmut64 | 0:a3ea811f80f2 | 60 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 61 | static void usb0_function_EnableINTModule(void); |
Helmut64 | 0:a3ea811f80f2 | 62 | |
Helmut64 | 0:a3ea811f80f2 | 63 | |
Helmut64 | 0:a3ea811f80f2 | 64 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 65 | Private global variables and functions |
Helmut64 | 0:a3ea811f80f2 | 66 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 67 | |
Helmut64 | 0:a3ea811f80f2 | 68 | |
Helmut64 | 0:a3ea811f80f2 | 69 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 70 | * Function Name: usb0_function_InitModule |
Helmut64 | 0:a3ea811f80f2 | 71 | * Description : Initializes the USB module in the USB function mode. |
Helmut64 | 0:a3ea811f80f2 | 72 | * Arguments : uint16_t mode ; USB_FUNCTION_HIGH_SPEED ; Hi-Speed Mode |
Helmut64 | 0:a3ea811f80f2 | 73 | * : ; other ; Full-speed Mode |
Helmut64 | 0:a3ea811f80f2 | 74 | * Return Value : none |
Helmut64 | 0:a3ea811f80f2 | 75 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 76 | void usb0_function_InitModule (uint16_t mode) |
Helmut64 | 0:a3ea811f80f2 | 77 | { |
Helmut64 | 0:a3ea811f80f2 | 78 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
Helmut64 | 0:a3ea811f80f2 | 79 | 0, |
Helmut64 | 0:a3ea811f80f2 | 80 | USB_SYSCFG_DCFM_SHIFT, |
Helmut64 | 0:a3ea811f80f2 | 81 | USB_SYSCFG_DCFM); /* USB function */ |
Helmut64 | 0:a3ea811f80f2 | 82 | |
Helmut64 | 0:a3ea811f80f2 | 83 | /* USB module operation enabled */ |
Helmut64 | 0:a3ea811f80f2 | 84 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
Helmut64 | 0:a3ea811f80f2 | 85 | 1, |
Helmut64 | 0:a3ea811f80f2 | 86 | USB_SYSCFG_USBE_SHIFT, |
Helmut64 | 0:a3ea811f80f2 | 87 | USB_SYSCFG_USBE); |
Helmut64 | 0:a3ea811f80f2 | 88 | |
Helmut64 | 0:a3ea811f80f2 | 89 | if (mode == USB_FUNCTION_HIGH_SPEED) |
Helmut64 | 0:a3ea811f80f2 | 90 | { |
Helmut64 | 0:a3ea811f80f2 | 91 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
Helmut64 | 0:a3ea811f80f2 | 92 | 1, |
Helmut64 | 0:a3ea811f80f2 | 93 | USB_SYSCFG_HSE_SHIFT, |
Helmut64 | 0:a3ea811f80f2 | 94 | USB_SYSCFG_HSE); /* Hi-Speed Mode */ |
Helmut64 | 0:a3ea811f80f2 | 95 | } |
Helmut64 | 0:a3ea811f80f2 | 96 | else |
Helmut64 | 0:a3ea811f80f2 | 97 | { |
Helmut64 | 0:a3ea811f80f2 | 98 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
Helmut64 | 0:a3ea811f80f2 | 99 | 0, |
Helmut64 | 0:a3ea811f80f2 | 100 | USB_SYSCFG_HSE_SHIFT, |
Helmut64 | 0:a3ea811f80f2 | 101 | USB_SYSCFG_HSE); |
Helmut64 | 0:a3ea811f80f2 | 102 | } |
Helmut64 | 0:a3ea811f80f2 | 103 | |
Helmut64 | 0:a3ea811f80f2 | 104 | /* for power-on */ |
Helmut64 | 0:a3ea811f80f2 | 105 | if (usb0_function_CheckVBUStaus() == DEVDRV_USBF_ON) |
Helmut64 | 0:a3ea811f80f2 | 106 | { |
Helmut64 | 0:a3ea811f80f2 | 107 | usb0_function_EnableINTModule(); /* Interrupt Enable */ |
Helmut64 | 0:a3ea811f80f2 | 108 | usb0_function_USB_FUNCTION_Attach(); /* pull-up D+ and open D- */ |
Helmut64 | 0:a3ea811f80f2 | 109 | } |
Helmut64 | 0:a3ea811f80f2 | 110 | else |
Helmut64 | 0:a3ea811f80f2 | 111 | { |
Helmut64 | 0:a3ea811f80f2 | 112 | usb0_function_USB_FUNCTION_Detach(); /* USB Detach */ |
Helmut64 | 0:a3ea811f80f2 | 113 | /* with Interrupt Enable */ |
Helmut64 | 0:a3ea811f80f2 | 114 | } |
Helmut64 | 0:a3ea811f80f2 | 115 | } |
Helmut64 | 0:a3ea811f80f2 | 116 | |
Helmut64 | 0:a3ea811f80f2 | 117 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 118 | * Function Name: usb0_function_CheckVBUStaus |
Helmut64 | 0:a3ea811f80f2 | 119 | * Description : Checks the USB-VBUS state to returns the connection state to |
Helmut64 | 0:a3ea811f80f2 | 120 | * : the USB host. |
Helmut64 | 0:a3ea811f80f2 | 121 | * Arguments : none |
Helmut64 | 0:a3ea811f80f2 | 122 | * Return Value : DEVDRV_USBF_ON : VBUS ON |
Helmut64 | 0:a3ea811f80f2 | 123 | * : DEVDRV_USBF_OFF : VBUS OFF |
Helmut64 | 0:a3ea811f80f2 | 124 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 125 | uint16_t usb0_function_CheckVBUStaus (void) |
Helmut64 | 0:a3ea811f80f2 | 126 | { |
Helmut64 | 0:a3ea811f80f2 | 127 | uint16_t buf1; |
Helmut64 | 0:a3ea811f80f2 | 128 | uint16_t buf2; |
Helmut64 | 0:a3ea811f80f2 | 129 | uint16_t buf3; |
Helmut64 | 0:a3ea811f80f2 | 130 | |
Helmut64 | 0:a3ea811f80f2 | 131 | /* monitor VBUS pins */ |
Helmut64 | 0:a3ea811f80f2 | 132 | do |
Helmut64 | 0:a3ea811f80f2 | 133 | { |
Helmut64 | 0:a3ea811f80f2 | 134 | buf1 = RZA_IO_RegRead_16(&USB200.INTSTS0, |
Helmut64 | 0:a3ea811f80f2 | 135 | USB_INTSTS0_VBSTS_SHIFT, |
Helmut64 | 0:a3ea811f80f2 | 136 | USB_INTSTS0_VBSTS); |
Helmut64 | 0:a3ea811f80f2 | 137 | Userdef_USB_usb0_function_delay_10us(1); |
Helmut64 | 0:a3ea811f80f2 | 138 | buf2 = RZA_IO_RegRead_16(&USB200.INTSTS0, |
Helmut64 | 0:a3ea811f80f2 | 139 | USB_INTSTS0_VBSTS_SHIFT, |
Helmut64 | 0:a3ea811f80f2 | 140 | USB_INTSTS0_VBSTS); |
Helmut64 | 0:a3ea811f80f2 | 141 | Userdef_USB_usb0_function_delay_10us(1); |
Helmut64 | 0:a3ea811f80f2 | 142 | buf3 = RZA_IO_RegRead_16(&USB200.INTSTS0, |
Helmut64 | 0:a3ea811f80f2 | 143 | USB_INTSTS0_VBSTS_SHIFT, |
Helmut64 | 0:a3ea811f80f2 | 144 | USB_INTSTS0_VBSTS); |
Helmut64 | 0:a3ea811f80f2 | 145 | } while ((buf1 != buf2) || (buf2 != buf3)); |
Helmut64 | 0:a3ea811f80f2 | 146 | |
Helmut64 | 0:a3ea811f80f2 | 147 | if (buf1 == DEVDRV_USBF_OFF) |
Helmut64 | 0:a3ea811f80f2 | 148 | { |
Helmut64 | 0:a3ea811f80f2 | 149 | return DEVDRV_USBF_OFF; /* detach */ |
Helmut64 | 0:a3ea811f80f2 | 150 | } |
Helmut64 | 0:a3ea811f80f2 | 151 | |
Helmut64 | 0:a3ea811f80f2 | 152 | return DEVDRV_USBF_ON; /* attach */ |
Helmut64 | 0:a3ea811f80f2 | 153 | } |
Helmut64 | 0:a3ea811f80f2 | 154 | |
Helmut64 | 0:a3ea811f80f2 | 155 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 156 | * Function Name: usb0_function_USB_FUNCTION_Attach |
Helmut64 | 0:a3ea811f80f2 | 157 | * Description : Connects to the USB host controller. |
Helmut64 | 0:a3ea811f80f2 | 158 | * : This function pulls up D+. |
Helmut64 | 0:a3ea811f80f2 | 159 | * Arguments : none |
Helmut64 | 0:a3ea811f80f2 | 160 | * Return Value : none |
Helmut64 | 0:a3ea811f80f2 | 161 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 162 | void usb0_function_USB_FUNCTION_Attach (void) |
Helmut64 | 0:a3ea811f80f2 | 163 | { |
Helmut64 | 0:a3ea811f80f2 | 164 | Userdef_USB_usb0_function_attach(); |
Helmut64 | 0:a3ea811f80f2 | 165 | |
Helmut64 | 0:a3ea811f80f2 | 166 | Userdef_USB_usb0_function_delay_xms(10); |
Helmut64 | 0:a3ea811f80f2 | 167 | |
Helmut64 | 0:a3ea811f80f2 | 168 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
Helmut64 | 0:a3ea811f80f2 | 169 | 1, |
Helmut64 | 0:a3ea811f80f2 | 170 | USB_SYSCFG_DPRPU_SHIFT, |
Helmut64 | 0:a3ea811f80f2 | 171 | USB_SYSCFG_DPRPU); /* Pull-up D+ and open D- */ |
Helmut64 | 0:a3ea811f80f2 | 172 | } |
Helmut64 | 0:a3ea811f80f2 | 173 | |
Helmut64 | 0:a3ea811f80f2 | 174 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 175 | * Function Name: usb0_function_USB_FUNCTION_Detach |
Helmut64 | 0:a3ea811f80f2 | 176 | * Description : Disconnects from the USB host controller. |
Helmut64 | 0:a3ea811f80f2 | 177 | * : This function opens D+/D-. |
Helmut64 | 0:a3ea811f80f2 | 178 | * Arguments : none |
Helmut64 | 0:a3ea811f80f2 | 179 | * Return Value : none |
Helmut64 | 0:a3ea811f80f2 | 180 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 181 | void usb0_function_USB_FUNCTION_Detach (void) |
Helmut64 | 0:a3ea811f80f2 | 182 | { |
Helmut64 | 0:a3ea811f80f2 | 183 | uint16_t pipe; |
Helmut64 | 0:a3ea811f80f2 | 184 | |
Helmut64 | 0:a3ea811f80f2 | 185 | Userdef_USB_usb0_function_detach(); |
Helmut64 | 0:a3ea811f80f2 | 186 | |
Helmut64 | 0:a3ea811f80f2 | 187 | for (pipe = 0; pipe < (USB_FUNCTION_MAX_PIPE_NO + 1); ++pipe) |
Helmut64 | 0:a3ea811f80f2 | 188 | { |
Helmut64 | 0:a3ea811f80f2 | 189 | if (g_usb0_function_pipe_status[pipe] != DEVDRV_USBF_PIPE_IDLE) |
Helmut64 | 0:a3ea811f80f2 | 190 | { |
Helmut64 | 0:a3ea811f80f2 | 191 | usb0_function_stop_transfer(pipe); |
Helmut64 | 0:a3ea811f80f2 | 192 | } |
Helmut64 | 0:a3ea811f80f2 | 193 | } |
Helmut64 | 0:a3ea811f80f2 | 194 | |
Helmut64 | 0:a3ea811f80f2 | 195 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
Helmut64 | 0:a3ea811f80f2 | 196 | 0, |
Helmut64 | 0:a3ea811f80f2 | 197 | USB_SYSCFG_DPRPU_SHIFT, |
Helmut64 | 0:a3ea811f80f2 | 198 | USB_SYSCFG_DPRPU); /* open D+ and D- */ |
Helmut64 | 0:a3ea811f80f2 | 199 | |
Helmut64 | 0:a3ea811f80f2 | 200 | /* Detach Recovery */ |
Helmut64 | 0:a3ea811f80f2 | 201 | Userdef_USB_usb0_function_delay_500ns(); /* need 1us=500ns * 2 wait */ |
Helmut64 | 0:a3ea811f80f2 | 202 | Userdef_USB_usb0_function_delay_500ns(); |
Helmut64 | 0:a3ea811f80f2 | 203 | |
Helmut64 | 0:a3ea811f80f2 | 204 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
Helmut64 | 0:a3ea811f80f2 | 205 | 1, |
Helmut64 | 0:a3ea811f80f2 | 206 | USB_SYSCFG_DCFM_SHIFT, |
Helmut64 | 0:a3ea811f80f2 | 207 | USB_SYSCFG_DCFM); |
Helmut64 | 0:a3ea811f80f2 | 208 | Userdef_USB_usb0_function_delay_500ns(); /* need 100ns wait but 500ns S/W wait */ |
Helmut64 | 0:a3ea811f80f2 | 209 | |
Helmut64 | 0:a3ea811f80f2 | 210 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
Helmut64 | 0:a3ea811f80f2 | 211 | 0, |
Helmut64 | 0:a3ea811f80f2 | 212 | USB_SYSCFG_DCFM_SHIFT, |
Helmut64 | 0:a3ea811f80f2 | 213 | USB_SYSCFG_DCFM); |
Helmut64 | 0:a3ea811f80f2 | 214 | |
Helmut64 | 0:a3ea811f80f2 | 215 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
Helmut64 | 0:a3ea811f80f2 | 216 | 0, |
Helmut64 | 0:a3ea811f80f2 | 217 | USB_SYSCFG_USBE_SHIFT, |
Helmut64 | 0:a3ea811f80f2 | 218 | USB_SYSCFG_USBE); /* soft reset module */ |
Helmut64 | 0:a3ea811f80f2 | 219 | Userdef_USB_usb0_function_delay_500ns(); |
Helmut64 | 0:a3ea811f80f2 | 220 | |
Helmut64 | 0:a3ea811f80f2 | 221 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
Helmut64 | 0:a3ea811f80f2 | 222 | 1, |
Helmut64 | 0:a3ea811f80f2 | 223 | USB_SYSCFG_USBE_SHIFT, |
Helmut64 | 0:a3ea811f80f2 | 224 | USB_SYSCFG_USBE); |
Helmut64 | 0:a3ea811f80f2 | 225 | |
Helmut64 | 0:a3ea811f80f2 | 226 | usb0_function_EnableINTModule(); /* Interrupt Enable */ |
Helmut64 | 0:a3ea811f80f2 | 227 | } |
Helmut64 | 0:a3ea811f80f2 | 228 | |
Helmut64 | 0:a3ea811f80f2 | 229 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 230 | * Function Name: usb0_function_USB_FUNCTION_BusReset |
Helmut64 | 0:a3ea811f80f2 | 231 | * Description : This function is executed when the USB device is transitioned |
Helmut64 | 0:a3ea811f80f2 | 232 | * : to POWERD_STATE. Sets the device descriptor according to the |
Helmut64 | 0:a3ea811f80f2 | 233 | * : connection speed determined by the USB reset hand shake. |
Helmut64 | 0:a3ea811f80f2 | 234 | * Arguments : none |
Helmut64 | 0:a3ea811f80f2 | 235 | * Return Value : none |
Helmut64 | 0:a3ea811f80f2 | 236 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 237 | #if 0 /*The USBHAL in mbed does not need this function*/ |
Helmut64 | 0:a3ea811f80f2 | 238 | void usb0_function_USB_FUNCTION_BusReset (void) |
Helmut64 | 0:a3ea811f80f2 | 239 | { |
Helmut64 | 0:a3ea811f80f2 | 240 | usb0_function_init_status(); /* memory clear */ |
Helmut64 | 0:a3ea811f80f2 | 241 | |
Helmut64 | 0:a3ea811f80f2 | 242 | if (usb0_function_is_hispeed() == USB_FUNCTION_HIGH_SPEED) |
Helmut64 | 0:a3ea811f80f2 | 243 | { |
Helmut64 | 0:a3ea811f80f2 | 244 | usb0_function_ResetDescriptor(USB_FUNCTION_HIGH_SPEED); /* Device Descriptor reset */ |
Helmut64 | 0:a3ea811f80f2 | 245 | } |
Helmut64 | 0:a3ea811f80f2 | 246 | else |
Helmut64 | 0:a3ea811f80f2 | 247 | { |
Helmut64 | 0:a3ea811f80f2 | 248 | usb0_function_ResetDescriptor(USB_FUNCTION_FULL_SPEED); /* Device Descriptor reset */ |
Helmut64 | 0:a3ea811f80f2 | 249 | } |
Helmut64 | 0:a3ea811f80f2 | 250 | |
Helmut64 | 0:a3ea811f80f2 | 251 | usb0_function_ResetDCP(); /* Default Control PIPE reset */ |
Helmut64 | 0:a3ea811f80f2 | 252 | } |
Helmut64 | 0:a3ea811f80f2 | 253 | #endif |
Helmut64 | 0:a3ea811f80f2 | 254 | |
Helmut64 | 0:a3ea811f80f2 | 255 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 256 | * Function Name: usb0_function_USB_FUNCTION_Resume |
Helmut64 | 0:a3ea811f80f2 | 257 | * Description : This function is executed when the USB device detects a resume |
Helmut64 | 0:a3ea811f80f2 | 258 | * : signal. |
Helmut64 | 0:a3ea811f80f2 | 259 | * : The USB sample driver does not operate for this function. |
Helmut64 | 0:a3ea811f80f2 | 260 | * Arguments : none |
Helmut64 | 0:a3ea811f80f2 | 261 | * Return Value : none |
Helmut64 | 0:a3ea811f80f2 | 262 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 263 | #if 0 /*The USBHAL in mbed does not need this function*/ |
Helmut64 | 0:a3ea811f80f2 | 264 | void usb0_function_USB_FUNCTION_Resume (void) |
Helmut64 | 0:a3ea811f80f2 | 265 | { |
Helmut64 | 0:a3ea811f80f2 | 266 | /* NOP */ |
Helmut64 | 0:a3ea811f80f2 | 267 | } |
Helmut64 | 0:a3ea811f80f2 | 268 | #endif |
Helmut64 | 0:a3ea811f80f2 | 269 | |
Helmut64 | 0:a3ea811f80f2 | 270 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 271 | * Function Name: usb0_function_USB_FUNCTION_Suspend |
Helmut64 | 0:a3ea811f80f2 | 272 | * Description : This function is executed when the USB device detects a suspend |
Helmut64 | 0:a3ea811f80f2 | 273 | * : signal. |
Helmut64 | 0:a3ea811f80f2 | 274 | * : The USB sample driver does not operate for this function. |
Helmut64 | 0:a3ea811f80f2 | 275 | * Arguments : none |
Helmut64 | 0:a3ea811f80f2 | 276 | * Return Value : none |
Helmut64 | 0:a3ea811f80f2 | 277 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 278 | #if 0 /*The USBHAL in mbed does not need this function*/ |
Helmut64 | 0:a3ea811f80f2 | 279 | void usb0_function_USB_FUNCTION_Suspend (void) |
Helmut64 | 0:a3ea811f80f2 | 280 | { |
Helmut64 | 0:a3ea811f80f2 | 281 | /* NOP */ |
Helmut64 | 0:a3ea811f80f2 | 282 | } |
Helmut64 | 0:a3ea811f80f2 | 283 | #endif |
Helmut64 | 0:a3ea811f80f2 | 284 | |
Helmut64 | 0:a3ea811f80f2 | 285 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 286 | * Function Name: usb0_function_USB_FUNCTION_TestMode |
Helmut64 | 0:a3ea811f80f2 | 287 | * Description : This function is executed when the USB device is transitioned U |
Helmut64 | 0:a3ea811f80f2 | 288 | * : to TEST_MODE by the USB standard request. |
Helmut64 | 0:a3ea811f80f2 | 289 | * Arguments : none |
Helmut64 | 0:a3ea811f80f2 | 290 | * Return Value : none |
Helmut64 | 0:a3ea811f80f2 | 291 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 292 | void usb0_function_USB_FUNCTION_TestMode (void) |
Helmut64 | 0:a3ea811f80f2 | 293 | { |
Helmut64 | 0:a3ea811f80f2 | 294 | switch (g_usb0_function_TestModeSelectors & USB_FUNCTION_FUNCTION_TEST_SELECT) |
Helmut64 | 0:a3ea811f80f2 | 295 | { |
Helmut64 | 0:a3ea811f80f2 | 296 | case USB_FUNCTION_FUNCTION_TEST_J: |
Helmut64 | 0:a3ea811f80f2 | 297 | case USB_FUNCTION_FUNCTION_TEST_K: |
Helmut64 | 0:a3ea811f80f2 | 298 | case USB_FUNCTION_FUNCTION_TEST_SE0_NAK: |
Helmut64 | 0:a3ea811f80f2 | 299 | case USB_FUNCTION_FUNCTION_TEST_PACKET: |
Helmut64 | 0:a3ea811f80f2 | 300 | RZA_IO_RegWrite_16(&USB200.TESTMODE, |
Helmut64 | 0:a3ea811f80f2 | 301 | (g_usb0_function_TestModeSelectors >> 8), |
Helmut64 | 0:a3ea811f80f2 | 302 | USB_TESTMODE_UTST_SHIFT, |
Helmut64 | 0:a3ea811f80f2 | 303 | USB_TESTMODE_UTST); |
Helmut64 | 0:a3ea811f80f2 | 304 | break; |
Helmut64 | 0:a3ea811f80f2 | 305 | |
Helmut64 | 0:a3ea811f80f2 | 306 | case USB_FUNCTION_FUNCTION_TEST_FORCE_ENABLE: |
Helmut64 | 0:a3ea811f80f2 | 307 | default: |
Helmut64 | 0:a3ea811f80f2 | 308 | break; |
Helmut64 | 0:a3ea811f80f2 | 309 | } |
Helmut64 | 0:a3ea811f80f2 | 310 | } |
Helmut64 | 0:a3ea811f80f2 | 311 | |
Helmut64 | 0:a3ea811f80f2 | 312 | /******************************************************************************* |
Helmut64 | 0:a3ea811f80f2 | 313 | * Function Name: usb0_function_EnableINTModule |
Helmut64 | 0:a3ea811f80f2 | 314 | * Description : Enables USB interrupt. |
Helmut64 | 0:a3ea811f80f2 | 315 | * Arguments : none |
Helmut64 | 0:a3ea811f80f2 | 316 | * Return Value : none |
Helmut64 | 0:a3ea811f80f2 | 317 | *******************************************************************************/ |
Helmut64 | 0:a3ea811f80f2 | 318 | static void usb0_function_EnableINTModule (void) |
Helmut64 | 0:a3ea811f80f2 | 319 | { |
Helmut64 | 0:a3ea811f80f2 | 320 | uint16_t buf; |
Helmut64 | 0:a3ea811f80f2 | 321 | |
Helmut64 | 0:a3ea811f80f2 | 322 | buf = USB200.INTENB0; |
Helmut64 | 0:a3ea811f80f2 | 323 | buf |= (USB_FUNCTION_BITVBSE | USB_FUNCTION_BITDVSE | USB_FUNCTION_BITCTRE | |
Helmut64 | 0:a3ea811f80f2 | 324 | USB_FUNCTION_BITBEMPE | USB_FUNCTION_BITNRDYE | USB_FUNCTION_BITBRDYE); |
Helmut64 | 0:a3ea811f80f2 | 325 | USB200.INTENB0 = buf; |
Helmut64 | 0:a3ea811f80f2 | 326 | |
Helmut64 | 0:a3ea811f80f2 | 327 | usb0_function_enable_bemp_int(USB_FUNCTION_PIPE0); |
Helmut64 | 0:a3ea811f80f2 | 328 | } |
Helmut64 | 0:a3ea811f80f2 | 329 | |
Helmut64 | 0:a3ea811f80f2 | 330 | /* End of File */ |