I changed one line of code in the file with path name: USBDeviceHT/targets/TARGET_Maxim

Fork of USBDeviceHT by Helmut Tschemernjak

Committer:
Helmut64
Date:
Mon Feb 05 10:22:57 2018 +0000
Revision:
0:a3ea811f80f2
Inital checkin after copied from mbed.

Who changed what in which revision?

UserRevisionLine numberNew 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_api.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 #include "dev_drv.h"
Helmut64 0:a3ea811f80f2 42
Helmut64 0:a3ea811f80f2 43
Helmut64 0:a3ea811f80f2 44 /*******************************************************************************
Helmut64 0:a3ea811f80f2 45 Typedef definitions
Helmut64 0:a3ea811f80f2 46 *******************************************************************************/
Helmut64 0:a3ea811f80f2 47
Helmut64 0:a3ea811f80f2 48
Helmut64 0:a3ea811f80f2 49 /*******************************************************************************
Helmut64 0:a3ea811f80f2 50 Macro definitions
Helmut64 0:a3ea811f80f2 51 *******************************************************************************/
Helmut64 0:a3ea811f80f2 52
Helmut64 0:a3ea811f80f2 53
Helmut64 0:a3ea811f80f2 54 /*******************************************************************************
Helmut64 0:a3ea811f80f2 55 Imported global variables and functions (from other files)
Helmut64 0:a3ea811f80f2 56 *******************************************************************************/
Helmut64 0:a3ea811f80f2 57
Helmut64 0:a3ea811f80f2 58
Helmut64 0:a3ea811f80f2 59 /*******************************************************************************
Helmut64 0:a3ea811f80f2 60 Exported global variables and functions (to be accessed by other files)
Helmut64 0:a3ea811f80f2 61 *******************************************************************************/
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_api_function_init
Helmut64 0:a3ea811f80f2 71 * Description : Initializes the USB module in the USB function mode.
Helmut64 0:a3ea811f80f2 72 * Arguments : uint8_t int_level ; interruput level
Helmut64 0:a3ea811f80f2 73 * : uint16_t mode : Speed modes
Helmut64 0:a3ea811f80f2 74 * : : USB_FUCNTION_HIGH_SPEED: High-speed device
Helmut64 0:a3ea811f80f2 75 * : : USB_FUCNTION_FULL_SPEED: Full-speed device
Helmut64 0:a3ea811f80f2 76 * : uint16_t clockmode ; 48MHz ; USBFCLOCK_X1_48MHZ
Helmut64 0:a3ea811f80f2 77 * : ; 12MHz ; USBFCLOCK_EXTAL_12MHZ
Helmut64 0:a3ea811f80f2 78 * Return Value : none
Helmut64 0:a3ea811f80f2 79 *******************************************************************************/
Helmut64 0:a3ea811f80f2 80 #if 0
Helmut64 0:a3ea811f80f2 81 void usb0_api_function_init (uint8_t int_level, uint16_t mode, uint16_t clockmode)
Helmut64 0:a3ea811f80f2 82 {
Helmut64 0:a3ea811f80f2 83 volatile uint8_t dummy_buf;
Helmut64 0:a3ea811f80f2 84
Helmut64 0:a3ea811f80f2 85 CPG.STBCR7 &= 0xfd; /* The clock of USB0 modules is permitted */
Helmut64 0:a3ea811f80f2 86 dummy_buf = CPG.STBCR7; /* (Dummy read) */
Helmut64 0:a3ea811f80f2 87
Helmut64 0:a3ea811f80f2 88 usb0_function_setting_interrupt(int_level);
Helmut64 0:a3ea811f80f2 89
Helmut64 0:a3ea811f80f2 90 usb0_function_reset_module(clockmode); /* reset USB module with setting tranciever */
Helmut64 0:a3ea811f80f2 91 /* and HSE=1 */
Helmut64 0:a3ea811f80f2 92
Helmut64 0:a3ea811f80f2 93 usb0_function_init_status(); /* clear variables */
Helmut64 0:a3ea811f80f2 94
Helmut64 0:a3ea811f80f2 95 usb0_function_InitModule(mode); /* select USB Function and Interrupt Enable */
Helmut64 0:a3ea811f80f2 96 /* Detect USB Device to attach or detach */
Helmut64 0:a3ea811f80f2 97 }
Helmut64 0:a3ea811f80f2 98 #endif
Helmut64 0:a3ea811f80f2 99
Helmut64 0:a3ea811f80f2 100 /*******************************************************************************
Helmut64 0:a3ea811f80f2 101 * Function Name: usb0_api_function_IsConfigured
Helmut64 0:a3ea811f80f2 102 * Description : Checks if the USB device is configured to return the result as
Helmut64 0:a3ea811f80f2 103 * : the return value.
Helmut64 0:a3ea811f80f2 104 * Arguments : none
Helmut64 0:a3ea811f80f2 105 * Return Value : DEVDRV_USBF_YES : Configured & Configured Suspend
Helmut64 0:a3ea811f80f2 106 * : DEVDRV_USBF_NO : not Configured
Helmut64 0:a3ea811f80f2 107 *******************************************************************************/
Helmut64 0:a3ea811f80f2 108 uint16_t usb0_api_function_IsConfigured (void)
Helmut64 0:a3ea811f80f2 109 {
Helmut64 0:a3ea811f80f2 110 uint16_t dvst;
Helmut64 0:a3ea811f80f2 111
Helmut64 0:a3ea811f80f2 112 dvst = usb0_function_GetDeviceState();
Helmut64 0:a3ea811f80f2 113
Helmut64 0:a3ea811f80f2 114 if ((dvst == USB_FUNCTION_DVST_CONFIGURED) ||
Helmut64 0:a3ea811f80f2 115 (dvst == USB_FUNCTION_DVST_CONFIGURED_SUSPEND))
Helmut64 0:a3ea811f80f2 116 {
Helmut64 0:a3ea811f80f2 117 return DEVDRV_USBF_YES;
Helmut64 0:a3ea811f80f2 118 }
Helmut64 0:a3ea811f80f2 119
Helmut64 0:a3ea811f80f2 120 return DEVDRV_USBF_NO;
Helmut64 0:a3ea811f80f2 121 }
Helmut64 0:a3ea811f80f2 122
Helmut64 0:a3ea811f80f2 123 /*******************************************************************************
Helmut64 0:a3ea811f80f2 124 * Function Name: usb0_function_GetDeviceState
Helmut64 0:a3ea811f80f2 125 * Description : Returns the state of USB device.
Helmut64 0:a3ea811f80f2 126 * Arguments : none
Helmut64 0:a3ea811f80f2 127 * Return Value : Device States
Helmut64 0:a3ea811f80f2 128 *******************************************************************************/
Helmut64 0:a3ea811f80f2 129 uint16_t usb0_function_GetDeviceState (void)
Helmut64 0:a3ea811f80f2 130 {
Helmut64 0:a3ea811f80f2 131 uint16_t dvsq;
Helmut64 0:a3ea811f80f2 132 uint16_t dvst;
Helmut64 0:a3ea811f80f2 133
Helmut64 0:a3ea811f80f2 134 dvsq = USB200.INTSTS0;
Helmut64 0:a3ea811f80f2 135 switch(dvsq & USB_FUNCTION_BITDVSQ)
Helmut64 0:a3ea811f80f2 136 {
Helmut64 0:a3ea811f80f2 137 case USB_FUNCTION_DS_POWR: /* Power state *//* power-on */
Helmut64 0:a3ea811f80f2 138 dvst = USB_FUNCTION_DVST_POWERED;
Helmut64 0:a3ea811f80f2 139 break;
Helmut64 0:a3ea811f80f2 140
Helmut64 0:a3ea811f80f2 141 case USB_FUNCTION_DS_DFLT: /* Default state *//* bus-reset */
Helmut64 0:a3ea811f80f2 142 dvst = USB_FUNCTION_DVST_DEFAULT;
Helmut64 0:a3ea811f80f2 143 break;
Helmut64 0:a3ea811f80f2 144
Helmut64 0:a3ea811f80f2 145 case USB_FUNCTION_DS_ADDS: /* Address state */
Helmut64 0:a3ea811f80f2 146 dvst = USB_FUNCTION_DVST_ADDRESS;
Helmut64 0:a3ea811f80f2 147 break;
Helmut64 0:a3ea811f80f2 148
Helmut64 0:a3ea811f80f2 149 case USB_FUNCTION_DS_CNFG: /* Configured state */
Helmut64 0:a3ea811f80f2 150 dvst = USB_FUNCTION_DVST_CONFIGURED;
Helmut64 0:a3ea811f80f2 151 break;
Helmut64 0:a3ea811f80f2 152
Helmut64 0:a3ea811f80f2 153 case USB_FUNCTION_DS_SPD_CNFG: /* Configured Suspend state */
Helmut64 0:a3ea811f80f2 154 dvst = USB_FUNCTION_DVST_CONFIGURED_SUSPEND;
Helmut64 0:a3ea811f80f2 155 break;
Helmut64 0:a3ea811f80f2 156
Helmut64 0:a3ea811f80f2 157 case USB_FUNCTION_DS_SPD_POWR: /* Power Suspend state */
Helmut64 0:a3ea811f80f2 158 case USB_FUNCTION_DS_SPD_DFLT: /* Default Suspend state */
Helmut64 0:a3ea811f80f2 159 case USB_FUNCTION_DS_SPD_ADDR: /* Address Suspend state */
Helmut64 0:a3ea811f80f2 160 dvst = USB_FUNCTION_DVST_SUSPEND;
Helmut64 0:a3ea811f80f2 161 break;
Helmut64 0:a3ea811f80f2 162
Helmut64 0:a3ea811f80f2 163 default: /* error */
Helmut64 0:a3ea811f80f2 164 dvst = USB_FUNCTION_DVST_SUSPEND;
Helmut64 0:a3ea811f80f2 165 break;
Helmut64 0:a3ea811f80f2 166 }
Helmut64 0:a3ea811f80f2 167
Helmut64 0:a3ea811f80f2 168 return dvst;
Helmut64 0:a3ea811f80f2 169 }
Helmut64 0:a3ea811f80f2 170
Helmut64 0:a3ea811f80f2 171 /*******************************************************************************
Helmut64 0:a3ea811f80f2 172 * Function Name: usb0_api_function_start_receive_transfer
Helmut64 0:a3ea811f80f2 173 * Description : Starts USB data reception using the pipe specified in the argument.
Helmut64 0:a3ea811f80f2 174 * : The FIFO for using is set in the pipe definition table.
Helmut64 0:a3ea811f80f2 175 * Arguments : uint16_t pipe ; Pipe Number
Helmut64 0:a3ea811f80f2 176 * : uint32_t size ; Data Size
Helmut64 0:a3ea811f80f2 177 * : uint8_t *data ; Data data Address
Helmut64 0:a3ea811f80f2 178 * Return Value : none
Helmut64 0:a3ea811f80f2 179 *******************************************************************************/
Helmut64 0:a3ea811f80f2 180 void usb0_api_function_start_receive_transfer (uint16_t pipe, uint32_t size, uint8_t * data)
Helmut64 0:a3ea811f80f2 181 {
Helmut64 0:a3ea811f80f2 182 usb0_function_start_receive_transfer(pipe, size, data);
Helmut64 0:a3ea811f80f2 183 }
Helmut64 0:a3ea811f80f2 184
Helmut64 0:a3ea811f80f2 185 /*******************************************************************************
Helmut64 0:a3ea811f80f2 186 * Function Name: usb0_api_function_start_send_transfer
Helmut64 0:a3ea811f80f2 187 * Description : Starts the USB data communication using pipe specified by the argument.
Helmut64 0:a3ea811f80f2 188 * Arguments : uint16_t pipe ; Pipe Number
Helmut64 0:a3ea811f80f2 189 * : uint32_t size ; Data Size
Helmut64 0:a3ea811f80f2 190 * : uint8_t *data ; Data data Address
Helmut64 0:a3ea811f80f2 191 * Return Value : DEVDRV_USBF_WRITEEND ; Write end
Helmut64 0:a3ea811f80f2 192 * : DEVDRV_USBF_WRITESHRT ; short data
Helmut64 0:a3ea811f80f2 193 * : DEVDRV_USBF_WRITING ; Continue of data write
Helmut64 0:a3ea811f80f2 194 * : DEVDRV_USBF_WRITEDMA ; Write DMA
Helmut64 0:a3ea811f80f2 195 * : DEVDRV_USBF_FIFOERROR ; FIFO status
Helmut64 0:a3ea811f80f2 196 *******************************************************************************/
Helmut64 0:a3ea811f80f2 197 uint16_t usb0_api_function_start_send_transfer (uint16_t pipe, uint32_t size, uint8_t * data)
Helmut64 0:a3ea811f80f2 198 {
Helmut64 0:a3ea811f80f2 199 uint16_t status;
Helmut64 0:a3ea811f80f2 200
Helmut64 0:a3ea811f80f2 201 status = usb0_function_start_send_transfer(pipe, size, data);
Helmut64 0:a3ea811f80f2 202
Helmut64 0:a3ea811f80f2 203 return status;
Helmut64 0:a3ea811f80f2 204 }
Helmut64 0:a3ea811f80f2 205
Helmut64 0:a3ea811f80f2 206 /*******************************************************************************
Helmut64 0:a3ea811f80f2 207 * Function Name: usb0_api_function_check_pipe_status
Helmut64 0:a3ea811f80f2 208 * Description : Starts USB data reception using the pipe specified in the argument.
Helmut64 0:a3ea811f80f2 209 * : The FIFO for using is set in the pipe definition table.
Helmut64 0:a3ea811f80f2 210 * Arguments : uint16_t pipe ; Pipe Number
Helmut64 0:a3ea811f80f2 211 * : uint32_t *size ; Data Size
Helmut64 0:a3ea811f80f2 212 * Return Value : Pipe Status
Helmut64 0:a3ea811f80f2 213 *******************************************************************************/
Helmut64 0:a3ea811f80f2 214 uint16_t usb0_api_function_check_pipe_status (uint16_t pipe, uint32_t * size)
Helmut64 0:a3ea811f80f2 215 {
Helmut64 0:a3ea811f80f2 216 if (g_usb0_function_pipe_status[pipe] == DEVDRV_USBF_PIPE_DONE)
Helmut64 0:a3ea811f80f2 217 {
Helmut64 0:a3ea811f80f2 218 *size = g_usb0_function_PipeDataSize[pipe];
Helmut64 0:a3ea811f80f2 219 g_usb0_function_pipe_status[pipe] = DEVDRV_USBF_PIPE_IDLE;
Helmut64 0:a3ea811f80f2 220
Helmut64 0:a3ea811f80f2 221 return DEVDRV_USBF_PIPE_DONE;
Helmut64 0:a3ea811f80f2 222 }
Helmut64 0:a3ea811f80f2 223 else if (g_usb0_function_pipe_status[pipe] == DEVDRV_USBF_PIPE_NORES)
Helmut64 0:a3ea811f80f2 224 {
Helmut64 0:a3ea811f80f2 225 *size = 0;
Helmut64 0:a3ea811f80f2 226 g_usb0_function_pipe_status[pipe] = DEVDRV_USBF_PIPE_IDLE;
Helmut64 0:a3ea811f80f2 227
Helmut64 0:a3ea811f80f2 228 return DEVDRV_USBF_PIPE_NORES;
Helmut64 0:a3ea811f80f2 229 }
Helmut64 0:a3ea811f80f2 230 else if (g_usb0_function_pipe_status[pipe] == DEVDRV_USBF_PIPE_STALL)
Helmut64 0:a3ea811f80f2 231 {
Helmut64 0:a3ea811f80f2 232 *size = 0;
Helmut64 0:a3ea811f80f2 233 g_usb0_function_pipe_status[pipe] = DEVDRV_USBF_PIPE_IDLE;
Helmut64 0:a3ea811f80f2 234
Helmut64 0:a3ea811f80f2 235 return DEVDRV_USBF_PIPE_STALL;
Helmut64 0:a3ea811f80f2 236 }
Helmut64 0:a3ea811f80f2 237 else if (g_usb0_function_pipe_status[pipe] == DEVDRV_USBF_FIFOERROR)
Helmut64 0:a3ea811f80f2 238 {
Helmut64 0:a3ea811f80f2 239 *size = 0;
Helmut64 0:a3ea811f80f2 240 g_usb0_function_pipe_status[pipe] = DEVDRV_USBF_PIPE_IDLE;
Helmut64 0:a3ea811f80f2 241
Helmut64 0:a3ea811f80f2 242 return DEVDRV_USBF_FIFOERROR;
Helmut64 0:a3ea811f80f2 243 }
Helmut64 0:a3ea811f80f2 244 else
Helmut64 0:a3ea811f80f2 245 {
Helmut64 0:a3ea811f80f2 246 /* Do Nothing */
Helmut64 0:a3ea811f80f2 247 }
Helmut64 0:a3ea811f80f2 248
Helmut64 0:a3ea811f80f2 249 return g_usb0_function_pipe_status[pipe];
Helmut64 0:a3ea811f80f2 250 }
Helmut64 0:a3ea811f80f2 251
Helmut64 0:a3ea811f80f2 252 /*******************************************************************************
Helmut64 0:a3ea811f80f2 253 * Function Name: usb0_api_function_clear_pipe_status
Helmut64 0:a3ea811f80f2 254 * Description : Starts USB data reception using the pipe specified in the argument.
Helmut64 0:a3ea811f80f2 255 * : The FIFO for using is set in the pipe definition table.
Helmut64 0:a3ea811f80f2 256 * Arguments : uint16_t pipe ; Pipe Number
Helmut64 0:a3ea811f80f2 257 * Return Value : Pipe Status
Helmut64 0:a3ea811f80f2 258 *******************************************************************************/
Helmut64 0:a3ea811f80f2 259 void usb0_api_function_clear_pipe_status (uint16_t pipe)
Helmut64 0:a3ea811f80f2 260 {
Helmut64 0:a3ea811f80f2 261 g_usb0_function_pipe_status[pipe] = DEVDRV_USBF_PIPE_IDLE;
Helmut64 0:a3ea811f80f2 262 g_usb0_function_PipeDataSize[pipe] = 0;
Helmut64 0:a3ea811f80f2 263 }
Helmut64 0:a3ea811f80f2 264
Helmut64 0:a3ea811f80f2 265 /*******************************************************************************
Helmut64 0:a3ea811f80f2 266 * Function Name: usb0_api_function_set_pid_buf
Helmut64 0:a3ea811f80f2 267 * Description : Enables communicaqtion in the pipe specified by the argument
Helmut64 0:a3ea811f80f2 268 * : (BUF).
Helmut64 0:a3ea811f80f2 269 * Arguments : uint16_t pipe ; pipe Number
Helmut64 0:a3ea811f80f2 270 * Return Value : none
Helmut64 0:a3ea811f80f2 271 *******************************************************************************/
Helmut64 0:a3ea811f80f2 272 void usb0_api_function_set_pid_buf (uint16_t pipe)
Helmut64 0:a3ea811f80f2 273 {
Helmut64 0:a3ea811f80f2 274 usb0_function_set_pid_buf(pipe);
Helmut64 0:a3ea811f80f2 275 }
Helmut64 0:a3ea811f80f2 276
Helmut64 0:a3ea811f80f2 277 /*******************************************************************************
Helmut64 0:a3ea811f80f2 278 * Function Name: usb0_api_function_set_pid_nak
Helmut64 0:a3ea811f80f2 279 * Description : Disables communication (NAK) in the pipe specified by the argument.
Helmut64 0:a3ea811f80f2 280 * : When the pipe status was enabling communication (BUF) before
Helmut64 0:a3ea811f80f2 281 * : executing before executing this function, waits in the software
Helmut64 0:a3ea811f80f2 282 * : until the pipe becomes ready after setting disabled.
Helmut64 0:a3ea811f80f2 283 * Arguments : uint16_t pipe ; pipe Number
Helmut64 0:a3ea811f80f2 284 * Return Value : none
Helmut64 0:a3ea811f80f2 285 *******************************************************************************/
Helmut64 0:a3ea811f80f2 286 void usb0_api_function_set_pid_nak (uint16_t pipe)
Helmut64 0:a3ea811f80f2 287 {
Helmut64 0:a3ea811f80f2 288 usb0_function_set_pid_nak(pipe);
Helmut64 0:a3ea811f80f2 289 }
Helmut64 0:a3ea811f80f2 290
Helmut64 0:a3ea811f80f2 291 /*******************************************************************************
Helmut64 0:a3ea811f80f2 292 * Function Name: usb0_api_function_set_pid_stall
Helmut64 0:a3ea811f80f2 293 * Description : Disables communication (STALL) in the pipe specified by the
Helmut64 0:a3ea811f80f2 294 * : argument.
Helmut64 0:a3ea811f80f2 295 * Arguments : uint16_t pipe ; pipe Number
Helmut64 0:a3ea811f80f2 296 * Return Value : none
Helmut64 0:a3ea811f80f2 297 *******************************************************************************/
Helmut64 0:a3ea811f80f2 298 void usb0_api_function_set_pid_stall (uint16_t pipe)
Helmut64 0:a3ea811f80f2 299 {
Helmut64 0:a3ea811f80f2 300 usb0_function_set_pid_stall(pipe);
Helmut64 0:a3ea811f80f2 301 }
Helmut64 0:a3ea811f80f2 302
Helmut64 0:a3ea811f80f2 303 /*******************************************************************************
Helmut64 0:a3ea811f80f2 304 * Function Name: usb0_api_function_clear_pid_stall
Helmut64 0:a3ea811f80f2 305 * Description : Disables communication (NAK) in the pipe specified by the argument.
Helmut64 0:a3ea811f80f2 306 * Arguments : uint16_t pipe ; pipe Number
Helmut64 0:a3ea811f80f2 307 * Return Value : none
Helmut64 0:a3ea811f80f2 308 *******************************************************************************/
Helmut64 0:a3ea811f80f2 309 void usb0_api_function_clear_pid_stall (uint16_t pipe)
Helmut64 0:a3ea811f80f2 310 {
Helmut64 0:a3ea811f80f2 311 usb0_function_clear_pid_stall(pipe);
Helmut64 0:a3ea811f80f2 312 }
Helmut64 0:a3ea811f80f2 313
Helmut64 0:a3ea811f80f2 314 /*******************************************************************************
Helmut64 0:a3ea811f80f2 315 * Function Name: usb0_api_function_get_pid
Helmut64 0:a3ea811f80f2 316 * Description : Returns the pipe state specified by the argument.
Helmut64 0:a3ea811f80f2 317 * Arguments : uint16_t pipe ; Pipe Number
Helmut64 0:a3ea811f80f2 318 * Return Value : PID
Helmut64 0:a3ea811f80f2 319 *******************************************************************************/
Helmut64 0:a3ea811f80f2 320 uint16_t usb0_api_function_get_pid (uint16_t pipe)
Helmut64 0:a3ea811f80f2 321 {
Helmut64 0:a3ea811f80f2 322 uint16_t pid;
Helmut64 0:a3ea811f80f2 323
Helmut64 0:a3ea811f80f2 324 pid = usb0_function_get_pid(pipe);
Helmut64 0:a3ea811f80f2 325
Helmut64 0:a3ea811f80f2 326 return pid;
Helmut64 0:a3ea811f80f2 327 }
Helmut64 0:a3ea811f80f2 328
Helmut64 0:a3ea811f80f2 329 /*******************************************************************************
Helmut64 0:a3ea811f80f2 330 * Function Name: usb0_api_function_check_stall
Helmut64 0:a3ea811f80f2 331 * Description :
Helmut64 0:a3ea811f80f2 332 * Arguments : uint16_t pipe ; Pipe Number
Helmut64 0:a3ea811f80f2 333 * Return Value : PID
Helmut64 0:a3ea811f80f2 334 *******************************************************************************/
Helmut64 0:a3ea811f80f2 335 int32_t usb0_api_function_check_stall (uint16_t pipe)
Helmut64 0:a3ea811f80f2 336 {
Helmut64 0:a3ea811f80f2 337 uint16_t pid;
Helmut64 0:a3ea811f80f2 338
Helmut64 0:a3ea811f80f2 339 pid = usb0_function_get_pid(pipe);
Helmut64 0:a3ea811f80f2 340
Helmut64 0:a3ea811f80f2 341 if ((pid & DEVDRV_USBF_PID_STALL) == DEVDRV_USBF_PID_STALL)
Helmut64 0:a3ea811f80f2 342 {
Helmut64 0:a3ea811f80f2 343 return DEVDRV_USBF_STALL;
Helmut64 0:a3ea811f80f2 344 }
Helmut64 0:a3ea811f80f2 345
Helmut64 0:a3ea811f80f2 346 return DEVDRV_SUCCESS;
Helmut64 0:a3ea811f80f2 347 }
Helmut64 0:a3ea811f80f2 348
Helmut64 0:a3ea811f80f2 349 /*******************************************************************************
Helmut64 0:a3ea811f80f2 350 * Function Name: usb0_api_function_set_sqclr
Helmut64 0:a3ea811f80f2 351 * Description : Sets the sequence bit of the pipe specified by the argument to
Helmut64 0:a3ea811f80f2 352 * : DATA0.
Helmut64 0:a3ea811f80f2 353 * Arguments : uint16_t pipe ; Pipe Number
Helmut64 0:a3ea811f80f2 354 * Return Value : none
Helmut64 0:a3ea811f80f2 355 *******************************************************************************/
Helmut64 0:a3ea811f80f2 356 void usb0_api_function_set_sqclr (uint16_t pipe)
Helmut64 0:a3ea811f80f2 357 {
Helmut64 0:a3ea811f80f2 358 usb0_function_set_sqclr(pipe);
Helmut64 0:a3ea811f80f2 359 }
Helmut64 0:a3ea811f80f2 360
Helmut64 0:a3ea811f80f2 361 /*******************************************************************************
Helmut64 0:a3ea811f80f2 362 * Function Name: usb0_api_function_set_sqset
Helmut64 0:a3ea811f80f2 363 * Description : Sets the sequence bit of the pipe specified by the argument to
Helmut64 0:a3ea811f80f2 364 * : DATA1.
Helmut64 0:a3ea811f80f2 365 * Arguments : uint16_t pipe ; Pipe number
Helmut64 0:a3ea811f80f2 366 * Return Value : none
Helmut64 0:a3ea811f80f2 367 *******************************************************************************/
Helmut64 0:a3ea811f80f2 368 void usb0_api_function_set_sqset (uint16_t pipe)
Helmut64 0:a3ea811f80f2 369 {
Helmut64 0:a3ea811f80f2 370 usb0_function_set_sqset(pipe);
Helmut64 0:a3ea811f80f2 371 }
Helmut64 0:a3ea811f80f2 372
Helmut64 0:a3ea811f80f2 373 /*******************************************************************************
Helmut64 0:a3ea811f80f2 374 * Function Name: usb0_api_function_set_csclr
Helmut64 0:a3ea811f80f2 375 * Description : CSPLIT status clear setting of sprit transaction in specified
Helmut64 0:a3ea811f80f2 376 * : pipe is performed.
Helmut64 0:a3ea811f80f2 377 * : When SQSET bit or SQCLR bit, and SQSET bit or SQCLR bit
Helmut64 0:a3ea811f80f2 378 * : in DCPCTR register are continuously changed (when the sequence
Helmut64 0:a3ea811f80f2 379 * : toggle bit of data PID is continuously changed over two or more pipes),
Helmut64 0:a3ea811f80f2 380 * : the access cycle with 120 ns and more than 5 cycle bus clock is necessary.
Helmut64 0:a3ea811f80f2 381 * : Do not set both SQCLR bit and SQSET bit to 1 at the same time.
Helmut64 0:a3ea811f80f2 382 * : In addition, both bits should be operated after PID is set to NAK.
Helmut64 0:a3ea811f80f2 383 * : However, when it is set to the isochronous transfer as the transfer type
Helmut64 0:a3ea811f80f2 384 * : (TYPE=11), writing in SQSET bit is disabled.
Helmut64 0:a3ea811f80f2 385 * Arguments : uint16_t pipe ; Pipe number
Helmut64 0:a3ea811f80f2 386 * Return Value : none
Helmut64 0:a3ea811f80f2 387 *******************************************************************************/
Helmut64 0:a3ea811f80f2 388 void usb0_api_function_set_csclr (uint16_t pipe)
Helmut64 0:a3ea811f80f2 389 {
Helmut64 0:a3ea811f80f2 390 usb0_function_set_csclr(pipe);
Helmut64 0:a3ea811f80f2 391 }
Helmut64 0:a3ea811f80f2 392
Helmut64 0:a3ea811f80f2 393 /*******************************************************************************
Helmut64 0:a3ea811f80f2 394 * Function Name: usb0_api_function_set_curpipe
Helmut64 0:a3ea811f80f2 395 * Description : Allocates FIF0 specifed by the argument in the pipe assigned
Helmut64 0:a3ea811f80f2 396 * : by the argument.
Helmut64 0:a3ea811f80f2 397 * Arguments : uint16_t pipe ; Pipe Number
Helmut64 0:a3ea811f80f2 398 * : uint16_t fifosel ; Select FIFO
Helmut64 0:a3ea811f80f2 399 * : uint16_t isel ; FIFO Access Direction
Helmut64 0:a3ea811f80f2 400 * : uint16_t mbw ; FIFO Port Access Bit Width
Helmut64 0:a3ea811f80f2 401 * Return Value : none
Helmut64 0:a3ea811f80f2 402 *******************************************************************************/
Helmut64 0:a3ea811f80f2 403 void usb0_api_function_set_curpipe (uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw)
Helmut64 0:a3ea811f80f2 404 {
Helmut64 0:a3ea811f80f2 405 usb0_function_set_curpipe(pipe, fifosel, isel, mbw);
Helmut64 0:a3ea811f80f2 406 }
Helmut64 0:a3ea811f80f2 407
Helmut64 0:a3ea811f80f2 408 /*******************************************************************************
Helmut64 0:a3ea811f80f2 409 * Function Name: usb0_api_function_clear_brdy_sts
Helmut64 0:a3ea811f80f2 410 * Description : Clear BRDY interrupt status in the pipe spceified by the argument.
Helmut64 0:a3ea811f80f2 411 * Arguments : uint16_t pipe ; pipe Number
Helmut64 0:a3ea811f80f2 412 * Return Value : none
Helmut64 0:a3ea811f80f2 413 *******************************************************************************/
Helmut64 0:a3ea811f80f2 414 void usb0_api_function_clear_brdy_sts (uint16_t pipe)
Helmut64 0:a3ea811f80f2 415 {
Helmut64 0:a3ea811f80f2 416 usb0_function_clear_brdy_sts(pipe);
Helmut64 0:a3ea811f80f2 417 }
Helmut64 0:a3ea811f80f2 418
Helmut64 0:a3ea811f80f2 419 /*******************************************************************************
Helmut64 0:a3ea811f80f2 420 * Function Name: usb0_api_function_clear_bemp_sts
Helmut64 0:a3ea811f80f2 421 * Description : Clear BEMP interrupt status in the pipe spceified by the argument.
Helmut64 0:a3ea811f80f2 422 * Arguments : uint16_t pipe ; pipe Number
Helmut64 0:a3ea811f80f2 423 * Return Value : none
Helmut64 0:a3ea811f80f2 424 *******************************************************************************/
Helmut64 0:a3ea811f80f2 425 void usb0_api_function_clear_bemp_sts (uint16_t pipe)
Helmut64 0:a3ea811f80f2 426 {
Helmut64 0:a3ea811f80f2 427 usb0_function_clear_bemp_sts(pipe);
Helmut64 0:a3ea811f80f2 428 }
Helmut64 0:a3ea811f80f2 429
Helmut64 0:a3ea811f80f2 430 /*******************************************************************************
Helmut64 0:a3ea811f80f2 431 * Function Name: usb0_api_function_clear_nrdy_sts
Helmut64 0:a3ea811f80f2 432 * Description : Clear NRDY interrupt status in the pipe spceified by the argument.
Helmut64 0:a3ea811f80f2 433 * Arguments : uint16_t pipe ; pipe Number
Helmut64 0:a3ea811f80f2 434 * Return Value : none
Helmut64 0:a3ea811f80f2 435 *******************************************************************************/
Helmut64 0:a3ea811f80f2 436 void usb0_api_function_clear_nrdy_sts (uint16_t pipe)
Helmut64 0:a3ea811f80f2 437 {
Helmut64 0:a3ea811f80f2 438 usb0_function_clear_nrdy_sts(pipe);
Helmut64 0:a3ea811f80f2 439 }
Helmut64 0:a3ea811f80f2 440
Helmut64 0:a3ea811f80f2 441 /* End of File */