USB device stack - Added support for the logo/windows key to USB keyboard.

Dependents:   randomSearch

Fork of USBDevice by mbed official

Committer:
mbed_official
Date:
Tue Mar 31 16:15:39 2015 +0100
Revision:
46:378357d7e90d
Synchronized with git revision 251f3f8b55a4dc98b831c80e032464ed45cce309

Full URL: https://github.com/mbedmicro/mbed/commit/251f3f8b55a4dc98b831c80e032464ed45cce309/

[RZ/A1H]Add some function(USB 2port, NVIC wrapper) and modify some settings(OS, Terminal).

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 46:378357d7e90d 1 /*******************************************************************************
mbed_official 46:378357d7e90d 2 * DISCLAIMER
mbed_official 46:378357d7e90d 3 * This software is supplied by Renesas Electronics Corporation and is only
mbed_official 46:378357d7e90d 4 * intended for use with Renesas products. No other uses are authorized. This
mbed_official 46:378357d7e90d 5 * software is owned by Renesas Electronics Corporation and is protected under
mbed_official 46:378357d7e90d 6 * all applicable laws, including copyright laws.
mbed_official 46:378357d7e90d 7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
mbed_official 46:378357d7e90d 8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
mbed_official 46:378357d7e90d 9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
mbed_official 46:378357d7e90d 10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
mbed_official 46:378357d7e90d 11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
mbed_official 46:378357d7e90d 12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
mbed_official 46:378357d7e90d 13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
mbed_official 46:378357d7e90d 14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
mbed_official 46:378357d7e90d 15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
mbed_official 46:378357d7e90d 16 * Renesas reserves the right, without notice, to make changes to this software
mbed_official 46:378357d7e90d 17 * and to discontinue the availability of this software. By using this software,
mbed_official 46:378357d7e90d 18 * you agree to the additional terms and conditions found by accessing the
mbed_official 46:378357d7e90d 19 * following link:
mbed_official 46:378357d7e90d 20 * http://www.renesas.com/disclaimer
mbed_official 46:378357d7e90d 21 * Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
mbed_official 46:378357d7e90d 22 *******************************************************************************/
mbed_official 46:378357d7e90d 23 /*******************************************************************************
mbed_official 46:378357d7e90d 24 * File Name : usb1_function_api.c
mbed_official 46:378357d7e90d 25 * $Rev: 1116 $
mbed_official 46:378357d7e90d 26 * $Date:: 2014-07-09 16:29:19 +0900#$
mbed_official 46:378357d7e90d 27 * Device(s) : RZ/A1H
mbed_official 46:378357d7e90d 28 * Tool-Chain :
mbed_official 46:378357d7e90d 29 * OS : None
mbed_official 46:378357d7e90d 30 * H/W Platform :
mbed_official 46:378357d7e90d 31 * Description : RZ/A1H R7S72100 USB Sample Program
mbed_official 46:378357d7e90d 32 * Operation :
mbed_official 46:378357d7e90d 33 * Limitations :
mbed_official 46:378357d7e90d 34 *******************************************************************************/
mbed_official 46:378357d7e90d 35
mbed_official 46:378357d7e90d 36
mbed_official 46:378357d7e90d 37 /*******************************************************************************
mbed_official 46:378357d7e90d 38 Includes <System Includes> , "Project Includes"
mbed_official 46:378357d7e90d 39 *******************************************************************************/
mbed_official 46:378357d7e90d 40 #include "usb1_function.h"
mbed_official 46:378357d7e90d 41 #include "dev_drv.h"
mbed_official 46:378357d7e90d 42
mbed_official 46:378357d7e90d 43
mbed_official 46:378357d7e90d 44 /*******************************************************************************
mbed_official 46:378357d7e90d 45 Typedef definitions
mbed_official 46:378357d7e90d 46 *******************************************************************************/
mbed_official 46:378357d7e90d 47
mbed_official 46:378357d7e90d 48
mbed_official 46:378357d7e90d 49 /*******************************************************************************
mbed_official 46:378357d7e90d 50 Macro definitions
mbed_official 46:378357d7e90d 51 *******************************************************************************/
mbed_official 46:378357d7e90d 52
mbed_official 46:378357d7e90d 53
mbed_official 46:378357d7e90d 54 /*******************************************************************************
mbed_official 46:378357d7e90d 55 Imported global variables and functions (from other files)
mbed_official 46:378357d7e90d 56 *******************************************************************************/
mbed_official 46:378357d7e90d 57
mbed_official 46:378357d7e90d 58
mbed_official 46:378357d7e90d 59 /*******************************************************************************
mbed_official 46:378357d7e90d 60 Exported global variables and functions (to be accessed by other files)
mbed_official 46:378357d7e90d 61 *******************************************************************************/
mbed_official 46:378357d7e90d 62
mbed_official 46:378357d7e90d 63
mbed_official 46:378357d7e90d 64 /*******************************************************************************
mbed_official 46:378357d7e90d 65 Private global variables and functions
mbed_official 46:378357d7e90d 66 *******************************************************************************/
mbed_official 46:378357d7e90d 67
mbed_official 46:378357d7e90d 68
mbed_official 46:378357d7e90d 69 /*******************************************************************************
mbed_official 46:378357d7e90d 70 * Function Name: usb1_api_function_init
mbed_official 46:378357d7e90d 71 * Description : Initializes the USB module in the USB function mode.
mbed_official 46:378357d7e90d 72 * Arguments : uint8_t int_level ; interruput level
mbed_official 46:378357d7e90d 73 * : uint16_t mode : Speed modes
mbed_official 46:378357d7e90d 74 * : : USB_FUCNTION_HIGH_SPEED: High-speed device
mbed_official 46:378357d7e90d 75 * : : USB_FUCNTION_FULL_SPEED: Full-speed device
mbed_official 46:378357d7e90d 76 * : uint16_t clockmode ; 48MHz ; USBFCLOCK_X1_48MHZ
mbed_official 46:378357d7e90d 77 * : ; 12MHz ; USBFCLOCK_EXTAL_12MHZ
mbed_official 46:378357d7e90d 78 * Return Value : none
mbed_official 46:378357d7e90d 79 *******************************************************************************/
mbed_official 46:378357d7e90d 80 #if 0
mbed_official 46:378357d7e90d 81 void usb1_api_function_init (uint8_t int_level, uint16_t mode, uint16_t clockmode)
mbed_official 46:378357d7e90d 82 {
mbed_official 46:378357d7e90d 83 volatile uint8_t dummy_buf;
mbed_official 46:378357d7e90d 84
mbed_official 46:378357d7e90d 85 CPG.STBCR7 &= 0xfc; /*The clock of USB0/1 modules is permitted */
mbed_official 46:378357d7e90d 86 dummy_buf = CPG.STBCR7; /* (Dummy read) */
mbed_official 46:378357d7e90d 87
mbed_official 46:378357d7e90d 88 usb1_function_setting_interrupt(int_level);
mbed_official 46:378357d7e90d 89
mbed_official 46:378357d7e90d 90 usb1_function_reset_module(clockmode); /* reset USB module with setting tranciever */
mbed_official 46:378357d7e90d 91 /* and HSE=1 */
mbed_official 46:378357d7e90d 92
mbed_official 46:378357d7e90d 93 usb1_function_init_status(); /* clear variables */
mbed_official 46:378357d7e90d 94
mbed_official 46:378357d7e90d 95 usb1_function_InitModule(mode); /* select USB Function and Interrupt Enable */
mbed_official 46:378357d7e90d 96 /* Detect USB Device to attach or detach */
mbed_official 46:378357d7e90d 97 }
mbed_official 46:378357d7e90d 98 #endif
mbed_official 46:378357d7e90d 99
mbed_official 46:378357d7e90d 100 /*******************************************************************************
mbed_official 46:378357d7e90d 101 * Function Name: usb1_api_function_IsConfigured
mbed_official 46:378357d7e90d 102 * Description : Checks if the USB device is configured to return the result as
mbed_official 46:378357d7e90d 103 * : the return value.
mbed_official 46:378357d7e90d 104 * Arguments : none
mbed_official 46:378357d7e90d 105 * Return Value : DEVDRV_USBF_YES : Configured & Configured Suspend
mbed_official 46:378357d7e90d 106 * : DEVDRV_USBF_NO : not Configured
mbed_official 46:378357d7e90d 107 *******************************************************************************/
mbed_official 46:378357d7e90d 108 uint16_t usb1_api_function_IsConfigured (void)
mbed_official 46:378357d7e90d 109 {
mbed_official 46:378357d7e90d 110 uint16_t dvst;
mbed_official 46:378357d7e90d 111
mbed_official 46:378357d7e90d 112 dvst = usb1_function_GetDeviceState();
mbed_official 46:378357d7e90d 113
mbed_official 46:378357d7e90d 114 if ((dvst == USB_FUNCTION_DVST_CONFIGURED) ||
mbed_official 46:378357d7e90d 115 (dvst == USB_FUNCTION_DVST_CONFIGURED_SUSPEND))
mbed_official 46:378357d7e90d 116 {
mbed_official 46:378357d7e90d 117 return DEVDRV_USBF_YES;
mbed_official 46:378357d7e90d 118 }
mbed_official 46:378357d7e90d 119
mbed_official 46:378357d7e90d 120 return DEVDRV_USBF_NO;
mbed_official 46:378357d7e90d 121 }
mbed_official 46:378357d7e90d 122
mbed_official 46:378357d7e90d 123 /*******************************************************************************
mbed_official 46:378357d7e90d 124 * Function Name: usb1_function_GetDeviceState
mbed_official 46:378357d7e90d 125 * Description : Returns the state of USB device.
mbed_official 46:378357d7e90d 126 * Arguments : none
mbed_official 46:378357d7e90d 127 * Return Value : Device States
mbed_official 46:378357d7e90d 128 *******************************************************************************/
mbed_official 46:378357d7e90d 129 uint16_t usb1_function_GetDeviceState (void)
mbed_official 46:378357d7e90d 130 {
mbed_official 46:378357d7e90d 131 uint16_t dvsq;
mbed_official 46:378357d7e90d 132 uint16_t dvst;
mbed_official 46:378357d7e90d 133
mbed_official 46:378357d7e90d 134 dvsq = USB201.INTSTS0;
mbed_official 46:378357d7e90d 135 switch (dvsq & USB_FUNCTION_BITDVSQ)
mbed_official 46:378357d7e90d 136 {
mbed_official 46:378357d7e90d 137 case USB_FUNCTION_DS_POWR: /* Power state *//* power-on */
mbed_official 46:378357d7e90d 138 dvst = USB_FUNCTION_DVST_POWERED;
mbed_official 46:378357d7e90d 139 break;
mbed_official 46:378357d7e90d 140
mbed_official 46:378357d7e90d 141 case USB_FUNCTION_DS_DFLT: /* Default state *//* bus-reset */
mbed_official 46:378357d7e90d 142 dvst = USB_FUNCTION_DVST_DEFAULT;
mbed_official 46:378357d7e90d 143 break;
mbed_official 46:378357d7e90d 144
mbed_official 46:378357d7e90d 145 case USB_FUNCTION_DS_ADDS: /* Address state */
mbed_official 46:378357d7e90d 146 dvst = USB_FUNCTION_DVST_ADDRESS;
mbed_official 46:378357d7e90d 147 break;
mbed_official 46:378357d7e90d 148
mbed_official 46:378357d7e90d 149 case USB_FUNCTION_DS_CNFG: /* Configured state */
mbed_official 46:378357d7e90d 150 dvst = USB_FUNCTION_DVST_CONFIGURED;
mbed_official 46:378357d7e90d 151 break;
mbed_official 46:378357d7e90d 152
mbed_official 46:378357d7e90d 153 case USB_FUNCTION_DS_SPD_CNFG: /* Configured Suspend state */
mbed_official 46:378357d7e90d 154 dvst = USB_FUNCTION_DVST_CONFIGURED_SUSPEND;
mbed_official 46:378357d7e90d 155 break;
mbed_official 46:378357d7e90d 156
mbed_official 46:378357d7e90d 157 case USB_FUNCTION_DS_SPD_POWR: /* Power Suspend state */
mbed_official 46:378357d7e90d 158 case USB_FUNCTION_DS_SPD_DFLT: /* Default Suspend state */
mbed_official 46:378357d7e90d 159 case USB_FUNCTION_DS_SPD_ADDR: /* Address Suspend state */
mbed_official 46:378357d7e90d 160 dvst = USB_FUNCTION_DVST_SUSPEND;
mbed_official 46:378357d7e90d 161 break;
mbed_official 46:378357d7e90d 162
mbed_official 46:378357d7e90d 163 default: /* error */
mbed_official 46:378357d7e90d 164 dvst = USB_FUNCTION_DVST_SUSPEND;
mbed_official 46:378357d7e90d 165 break;
mbed_official 46:378357d7e90d 166 }
mbed_official 46:378357d7e90d 167
mbed_official 46:378357d7e90d 168 return dvst;
mbed_official 46:378357d7e90d 169 }
mbed_official 46:378357d7e90d 170
mbed_official 46:378357d7e90d 171 /*******************************************************************************
mbed_official 46:378357d7e90d 172 * Function Name: usb1_api_function_start_receive_transfer
mbed_official 46:378357d7e90d 173 * Description : Starts USB data reception using the pipe specified in the argument.
mbed_official 46:378357d7e90d 174 * : The FIFO for using is set in the pipe definition table.
mbed_official 46:378357d7e90d 175 * Arguments : uint16_t pipe ; Pipe Number
mbed_official 46:378357d7e90d 176 * : uint32_t size ; Data Size
mbed_official 46:378357d7e90d 177 * : uint8_t *data ; Data data Address
mbed_official 46:378357d7e90d 178 * Return Value : none
mbed_official 46:378357d7e90d 179 *******************************************************************************/
mbed_official 46:378357d7e90d 180 void usb1_api_function_start_receive_transfer (uint16_t pipe, uint32_t size, uint8_t * data)
mbed_official 46:378357d7e90d 181 {
mbed_official 46:378357d7e90d 182 usb1_function_start_receive_transfer(pipe, size, data);
mbed_official 46:378357d7e90d 183 }
mbed_official 46:378357d7e90d 184
mbed_official 46:378357d7e90d 185 /*******************************************************************************
mbed_official 46:378357d7e90d 186 * Function Name: usb1_api_function_start_send_transfer
mbed_official 46:378357d7e90d 187 * Description : Starts the USB data communication using pipe specified by the argument.
mbed_official 46:378357d7e90d 188 * Arguments : uint16_t pipe ; Pipe Number
mbed_official 46:378357d7e90d 189 * : uint32_t size ; Data Size
mbed_official 46:378357d7e90d 190 * : uint8_t *data ; Data data Address
mbed_official 46:378357d7e90d 191 * Return Value : DEVDRV_USBF_WRITEEND ; Write end
mbed_official 46:378357d7e90d 192 * : DEVDRV_USBF_WRITESHRT ; short data
mbed_official 46:378357d7e90d 193 * : DEVDRV_USBF_WRITING ; Continue of data write
mbed_official 46:378357d7e90d 194 * : DEVDRV_USBF_WRITEDMA ; Write DMA
mbed_official 46:378357d7e90d 195 * : DEVDRV_USBF_FIFOERROR ; FIFO status
mbed_official 46:378357d7e90d 196 *******************************************************************************/
mbed_official 46:378357d7e90d 197 uint16_t usb1_api_function_start_send_transfer (uint16_t pipe, uint32_t size, uint8_t * data)
mbed_official 46:378357d7e90d 198 {
mbed_official 46:378357d7e90d 199 uint16_t status;
mbed_official 46:378357d7e90d 200
mbed_official 46:378357d7e90d 201 status = usb1_function_start_send_transfer(pipe, size, data);
mbed_official 46:378357d7e90d 202
mbed_official 46:378357d7e90d 203 return status;
mbed_official 46:378357d7e90d 204 }
mbed_official 46:378357d7e90d 205
mbed_official 46:378357d7e90d 206 /*******************************************************************************
mbed_official 46:378357d7e90d 207 * Function Name: usb1_api_function_check_pipe_status
mbed_official 46:378357d7e90d 208 * Description : Starts USB data reception using the pipe specified in the argument.
mbed_official 46:378357d7e90d 209 * : The FIFO for using is set in the pipe definition table.
mbed_official 46:378357d7e90d 210 * Arguments : uint16_t pipe ; Pipe Number
mbed_official 46:378357d7e90d 211 * : uint32_t *size ; Data Size
mbed_official 46:378357d7e90d 212 * Return Value : Pipe Status
mbed_official 46:378357d7e90d 213 *******************************************************************************/
mbed_official 46:378357d7e90d 214 uint16_t usb1_api_function_check_pipe_status (uint16_t pipe, uint32_t * size)
mbed_official 46:378357d7e90d 215 {
mbed_official 46:378357d7e90d 216 if (g_usb1_function_pipe_status[pipe] == DEVDRV_USBF_PIPE_DONE)
mbed_official 46:378357d7e90d 217 {
mbed_official 46:378357d7e90d 218 *size = g_usb1_function_PipeDataSize[pipe];
mbed_official 46:378357d7e90d 219 g_usb1_function_pipe_status[pipe] = DEVDRV_USBF_PIPE_IDLE;
mbed_official 46:378357d7e90d 220
mbed_official 46:378357d7e90d 221 return DEVDRV_USBF_PIPE_DONE;
mbed_official 46:378357d7e90d 222 }
mbed_official 46:378357d7e90d 223 else if (g_usb1_function_pipe_status[pipe] == DEVDRV_USBF_PIPE_NORES)
mbed_official 46:378357d7e90d 224 {
mbed_official 46:378357d7e90d 225 *size = 0;
mbed_official 46:378357d7e90d 226 g_usb1_function_pipe_status[pipe] = DEVDRV_USBF_PIPE_IDLE;
mbed_official 46:378357d7e90d 227
mbed_official 46:378357d7e90d 228 return DEVDRV_USBF_PIPE_NORES;
mbed_official 46:378357d7e90d 229 }
mbed_official 46:378357d7e90d 230 else if (g_usb1_function_pipe_status[pipe] == DEVDRV_USBF_PIPE_STALL)
mbed_official 46:378357d7e90d 231 {
mbed_official 46:378357d7e90d 232 *size = 0;
mbed_official 46:378357d7e90d 233 g_usb1_function_pipe_status[pipe] = DEVDRV_USBF_PIPE_IDLE;
mbed_official 46:378357d7e90d 234
mbed_official 46:378357d7e90d 235 return DEVDRV_USBF_PIPE_STALL;
mbed_official 46:378357d7e90d 236 }
mbed_official 46:378357d7e90d 237 else if (g_usb1_function_pipe_status[pipe] == DEVDRV_USBF_FIFOERROR)
mbed_official 46:378357d7e90d 238 {
mbed_official 46:378357d7e90d 239 *size = 0;
mbed_official 46:378357d7e90d 240 g_usb1_function_pipe_status[pipe] = DEVDRV_USBF_PIPE_IDLE;
mbed_official 46:378357d7e90d 241
mbed_official 46:378357d7e90d 242 return DEVDRV_USBF_FIFOERROR;
mbed_official 46:378357d7e90d 243 }
mbed_official 46:378357d7e90d 244 else
mbed_official 46:378357d7e90d 245 {
mbed_official 46:378357d7e90d 246 /* Do Nothing */
mbed_official 46:378357d7e90d 247 }
mbed_official 46:378357d7e90d 248
mbed_official 46:378357d7e90d 249 return g_usb1_function_pipe_status[pipe];
mbed_official 46:378357d7e90d 250 }
mbed_official 46:378357d7e90d 251
mbed_official 46:378357d7e90d 252 /*******************************************************************************
mbed_official 46:378357d7e90d 253 * Function Name: usb1_api_function_clear_pipe_status
mbed_official 46:378357d7e90d 254 * Description : Starts USB data reception using the pipe specified in the argument.
mbed_official 46:378357d7e90d 255 * : The FIFO for using is set in the pipe definition table.
mbed_official 46:378357d7e90d 256 * Arguments : uint16_t pipe ; Pipe Number
mbed_official 46:378357d7e90d 257 * Return Value : Pipe Status
mbed_official 46:378357d7e90d 258 *******************************************************************************/
mbed_official 46:378357d7e90d 259 void usb1_api_function_clear_pipe_status (uint16_t pipe)
mbed_official 46:378357d7e90d 260 {
mbed_official 46:378357d7e90d 261 g_usb1_function_pipe_status[pipe] = DEVDRV_USBF_PIPE_IDLE;
mbed_official 46:378357d7e90d 262 g_usb1_function_PipeDataSize[pipe] = 0;
mbed_official 46:378357d7e90d 263 }
mbed_official 46:378357d7e90d 264
mbed_official 46:378357d7e90d 265 /*******************************************************************************
mbed_official 46:378357d7e90d 266 * Function Name: usb1_api_function_set_pid_buf
mbed_official 46:378357d7e90d 267 * Description : Enables communicaqtion in the pipe specified by the argument
mbed_official 46:378357d7e90d 268 * : (BUF).
mbed_official 46:378357d7e90d 269 * Arguments : uint16_t pipe ; pipe Number
mbed_official 46:378357d7e90d 270 * Return Value : none
mbed_official 46:378357d7e90d 271 *******************************************************************************/
mbed_official 46:378357d7e90d 272 void usb1_api_function_set_pid_buf (uint16_t pipe)
mbed_official 46:378357d7e90d 273 {
mbed_official 46:378357d7e90d 274 usb1_function_set_pid_buf(pipe);
mbed_official 46:378357d7e90d 275 }
mbed_official 46:378357d7e90d 276
mbed_official 46:378357d7e90d 277 /*******************************************************************************
mbed_official 46:378357d7e90d 278 * Function Name: usb1_api_function_set_pid_nak
mbed_official 46:378357d7e90d 279 * Description : Disables communication (NAK) in the pipe specified by the argument.
mbed_official 46:378357d7e90d 280 * : When the pipe status was enabling communication (BUF) before
mbed_official 46:378357d7e90d 281 * : executing before executing this function, waits in the software
mbed_official 46:378357d7e90d 282 * : until the pipe becomes ready after setting disabled.
mbed_official 46:378357d7e90d 283 * Arguments : uint16_t pipe ; pipe Number
mbed_official 46:378357d7e90d 284 * Return Value : none
mbed_official 46:378357d7e90d 285 *******************************************************************************/
mbed_official 46:378357d7e90d 286 void usb1_api_function_set_pid_nak (uint16_t pipe)
mbed_official 46:378357d7e90d 287 {
mbed_official 46:378357d7e90d 288 usb1_function_set_pid_nak(pipe);
mbed_official 46:378357d7e90d 289 }
mbed_official 46:378357d7e90d 290
mbed_official 46:378357d7e90d 291 /*******************************************************************************
mbed_official 46:378357d7e90d 292 * Function Name: usb1_api_function_set_pid_stall
mbed_official 46:378357d7e90d 293 * Description : Disables communication (STALL) in the pipe specified by the
mbed_official 46:378357d7e90d 294 * : argument.
mbed_official 46:378357d7e90d 295 * Arguments : uint16_t pipe ; pipe Number
mbed_official 46:378357d7e90d 296 * Return Value : none
mbed_official 46:378357d7e90d 297 *******************************************************************************/
mbed_official 46:378357d7e90d 298 void usb1_api_function_set_pid_stall (uint16_t pipe)
mbed_official 46:378357d7e90d 299 {
mbed_official 46:378357d7e90d 300 usb1_function_set_pid_stall(pipe);
mbed_official 46:378357d7e90d 301 }
mbed_official 46:378357d7e90d 302
mbed_official 46:378357d7e90d 303 /*******************************************************************************
mbed_official 46:378357d7e90d 304 * Function Name: usb1_api_function_clear_pid_stall
mbed_official 46:378357d7e90d 305 * Description : Disables communication (NAK) in the pipe specified by the argument.
mbed_official 46:378357d7e90d 306 * Arguments : uint16_t pipe ; pipe Number
mbed_official 46:378357d7e90d 307 * Return Value : none
mbed_official 46:378357d7e90d 308 *******************************************************************************/
mbed_official 46:378357d7e90d 309 void usb1_api_function_clear_pid_stall (uint16_t pipe)
mbed_official 46:378357d7e90d 310 {
mbed_official 46:378357d7e90d 311 usb1_function_clear_pid_stall(pipe);
mbed_official 46:378357d7e90d 312 }
mbed_official 46:378357d7e90d 313
mbed_official 46:378357d7e90d 314 /*******************************************************************************
mbed_official 46:378357d7e90d 315 * Function Name: usb1_api_function_get_pid
mbed_official 46:378357d7e90d 316 * Description : Returns the pipe state specified by the argument.
mbed_official 46:378357d7e90d 317 * Arguments : uint16_t pipe ; Pipe Number
mbed_official 46:378357d7e90d 318 * Return Value : PID
mbed_official 46:378357d7e90d 319 *******************************************************************************/
mbed_official 46:378357d7e90d 320 uint16_t usb1_api_function_get_pid (uint16_t pipe)
mbed_official 46:378357d7e90d 321 {
mbed_official 46:378357d7e90d 322 uint16_t pid;
mbed_official 46:378357d7e90d 323
mbed_official 46:378357d7e90d 324 pid = usb1_function_get_pid(pipe);
mbed_official 46:378357d7e90d 325
mbed_official 46:378357d7e90d 326 return pid;
mbed_official 46:378357d7e90d 327 }
mbed_official 46:378357d7e90d 328
mbed_official 46:378357d7e90d 329 /*******************************************************************************
mbed_official 46:378357d7e90d 330 * Function Name: usb1_api_function_check_stall
mbed_official 46:378357d7e90d 331 * Description :
mbed_official 46:378357d7e90d 332 * Arguments : uint16_t pipe ; Pipe Number
mbed_official 46:378357d7e90d 333 * Return Value : PID
mbed_official 46:378357d7e90d 334 *******************************************************************************/
mbed_official 46:378357d7e90d 335 int32_t usb1_api_function_check_stall (uint16_t pipe)
mbed_official 46:378357d7e90d 336 {
mbed_official 46:378357d7e90d 337 uint16_t pid;
mbed_official 46:378357d7e90d 338
mbed_official 46:378357d7e90d 339 pid = usb1_function_get_pid(pipe);
mbed_official 46:378357d7e90d 340
mbed_official 46:378357d7e90d 341 if ((pid & DEVDRV_USBF_PID_STALL) == DEVDRV_USBF_PID_STALL)
mbed_official 46:378357d7e90d 342 {
mbed_official 46:378357d7e90d 343 return DEVDRV_USBF_STALL;
mbed_official 46:378357d7e90d 344 }
mbed_official 46:378357d7e90d 345
mbed_official 46:378357d7e90d 346 return DEVDRV_SUCCESS;
mbed_official 46:378357d7e90d 347 }
mbed_official 46:378357d7e90d 348
mbed_official 46:378357d7e90d 349 /*******************************************************************************
mbed_official 46:378357d7e90d 350 * Function Name: usb1_api_function_set_sqclr
mbed_official 46:378357d7e90d 351 * Description : Sets the sequence bit of the pipe specified by the argument to
mbed_official 46:378357d7e90d 352 * : DATA0.
mbed_official 46:378357d7e90d 353 * Arguments : uint16_t pipe ; Pipe Number
mbed_official 46:378357d7e90d 354 * Return Value : none
mbed_official 46:378357d7e90d 355 *******************************************************************************/
mbed_official 46:378357d7e90d 356 void usb1_api_function_set_sqclr (uint16_t pipe)
mbed_official 46:378357d7e90d 357 {
mbed_official 46:378357d7e90d 358 usb1_function_set_sqclr(pipe);
mbed_official 46:378357d7e90d 359 }
mbed_official 46:378357d7e90d 360
mbed_official 46:378357d7e90d 361 /*******************************************************************************
mbed_official 46:378357d7e90d 362 * Function Name: usb1_api_function_set_sqset
mbed_official 46:378357d7e90d 363 * Description : Sets the sequence bit of the pipe specified by the argument to
mbed_official 46:378357d7e90d 364 * : DATA1.
mbed_official 46:378357d7e90d 365 * Arguments : uint16_t pipe ; Pipe number
mbed_official 46:378357d7e90d 366 * Return Value : none
mbed_official 46:378357d7e90d 367 *******************************************************************************/
mbed_official 46:378357d7e90d 368 void usb1_api_function_set_sqset (uint16_t pipe)
mbed_official 46:378357d7e90d 369 {
mbed_official 46:378357d7e90d 370 usb1_function_set_sqset(pipe);
mbed_official 46:378357d7e90d 371 }
mbed_official 46:378357d7e90d 372
mbed_official 46:378357d7e90d 373 /*******************************************************************************
mbed_official 46:378357d7e90d 374 * Function Name: usb1_api_function_set_csclr
mbed_official 46:378357d7e90d 375 * Description : CSPLIT status clear setting of sprit transaction in specified
mbed_official 46:378357d7e90d 376 * : pipe is performed.
mbed_official 46:378357d7e90d 377 * : When SQSET bit or SQCLR bit, and SQSET bit or SQCLR bit
mbed_official 46:378357d7e90d 378 * : in DCPCTR register are continuously changed (when the sequence
mbed_official 46:378357d7e90d 379 * : toggle bit of data PID is continuously changed over two or more pipes),
mbed_official 46:378357d7e90d 380 * : the access cycle with 120 ns and more than 5 cycle bus clock is necessary.
mbed_official 46:378357d7e90d 381 * : Do not set both SQCLR bit and SQSET bit to 1 at the same time.
mbed_official 46:378357d7e90d 382 * : In addition, both bits should be operated after PID is set to NAK.
mbed_official 46:378357d7e90d 383 * : However, when it is set to the isochronous transfer as the transfer type
mbed_official 46:378357d7e90d 384 * : (TYPE=11), writing in SQSET bit is disabled.
mbed_official 46:378357d7e90d 385 * Arguments : uint16_t pipe ; Pipe number
mbed_official 46:378357d7e90d 386 * Return Value : none
mbed_official 46:378357d7e90d 387 *******************************************************************************/
mbed_official 46:378357d7e90d 388 void usb1_api_function_set_csclr (uint16_t pipe)
mbed_official 46:378357d7e90d 389 {
mbed_official 46:378357d7e90d 390 usb1_function_set_csclr(pipe);
mbed_official 46:378357d7e90d 391 }
mbed_official 46:378357d7e90d 392
mbed_official 46:378357d7e90d 393 /*******************************************************************************
mbed_official 46:378357d7e90d 394 * Function Name: usb1_api_function_set_curpipe
mbed_official 46:378357d7e90d 395 * Description : Allocates FIF0 specifed by the argument in the pipe assigned
mbed_official 46:378357d7e90d 396 * : by the argument.
mbed_official 46:378357d7e90d 397 * Arguments : uint16_t pipe ; Pipe Number
mbed_official 46:378357d7e90d 398 * : uint16_t fifosel ; Select FIFO
mbed_official 46:378357d7e90d 399 * : uint16_t isel ; FIFO Access Direction
mbed_official 46:378357d7e90d 400 * : uint16_t mbw ; FIFO Port Access Bit Width
mbed_official 46:378357d7e90d 401 * Return Value : none
mbed_official 46:378357d7e90d 402 *******************************************************************************/
mbed_official 46:378357d7e90d 403 void usb1_api_function_set_curpipe (uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw)
mbed_official 46:378357d7e90d 404 {
mbed_official 46:378357d7e90d 405 usb1_function_set_curpipe(pipe, fifosel, isel, mbw);
mbed_official 46:378357d7e90d 406 }
mbed_official 46:378357d7e90d 407
mbed_official 46:378357d7e90d 408 /*******************************************************************************
mbed_official 46:378357d7e90d 409 * Function Name: usb1_api_function_clear_brdy_sts
mbed_official 46:378357d7e90d 410 * Description : Clear BRDY interrupt status in the pipe spceified by the argument.
mbed_official 46:378357d7e90d 411 * Arguments : uint16_t pipe ; pipe Number
mbed_official 46:378357d7e90d 412 * Return Value : none
mbed_official 46:378357d7e90d 413 *******************************************************************************/
mbed_official 46:378357d7e90d 414 void usb1_api_function_clear_brdy_sts (uint16_t pipe)
mbed_official 46:378357d7e90d 415 {
mbed_official 46:378357d7e90d 416 usb1_function_clear_brdy_sts(pipe);
mbed_official 46:378357d7e90d 417 }
mbed_official 46:378357d7e90d 418
mbed_official 46:378357d7e90d 419 /*******************************************************************************
mbed_official 46:378357d7e90d 420 * Function Name: usb1_api_function_clear_bemp_sts
mbed_official 46:378357d7e90d 421 * Description : Clear BEMP interrupt status in the pipe spceified by the argument.
mbed_official 46:378357d7e90d 422 * Arguments : uint16_t pipe ; pipe Number
mbed_official 46:378357d7e90d 423 * Return Value : none
mbed_official 46:378357d7e90d 424 *******************************************************************************/
mbed_official 46:378357d7e90d 425 void usb1_api_function_clear_bemp_sts (uint16_t pipe)
mbed_official 46:378357d7e90d 426 {
mbed_official 46:378357d7e90d 427 usb1_function_clear_bemp_sts(pipe);
mbed_official 46:378357d7e90d 428 }
mbed_official 46:378357d7e90d 429
mbed_official 46:378357d7e90d 430 /*******************************************************************************
mbed_official 46:378357d7e90d 431 * Function Name: usb1_api_function_clear_nrdy_sts
mbed_official 46:378357d7e90d 432 * Description : Clear NRDY interrupt status in the pipe spceified by the argument.
mbed_official 46:378357d7e90d 433 * Arguments : uint16_t pipe ; pipe Number
mbed_official 46:378357d7e90d 434 * Return Value : none
mbed_official 46:378357d7e90d 435 *******************************************************************************/
mbed_official 46:378357d7e90d 436 void usb1_api_function_clear_nrdy_sts (uint16_t pipe)
mbed_official 46:378357d7e90d 437 {
mbed_official 46:378357d7e90d 438 usb1_function_clear_nrdy_sts(pipe);
mbed_official 46:378357d7e90d 439 }
mbed_official 46:378357d7e90d 440
mbed_official 46:378357d7e90d 441 /* End of File */