USB device stack

Dependents:   mbed-mX-USB-TEST1 USBMSD_SD_HID_HelloWorld HidTest MIDI_usb_bridge ... 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:14:04 2017 +0100
Revision:
71:53949e6131f6
Update libraries

Fixes the previous commmit, as some devices were not copied. USBDevice contains
now targets directory with all targets implementations

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 71:53949e6131f6 1 /*******************************************************************************
Kojto 71:53949e6131f6 2 * DISCLAIMER
Kojto 71:53949e6131f6 3 * This software is supplied by Renesas Electronics Corporation and is only
Kojto 71:53949e6131f6 4 * intended for use with Renesas products. No other uses are authorized. This
Kojto 71:53949e6131f6 5 * software is owned by Renesas Electronics Corporation and is protected under
Kojto 71:53949e6131f6 6 * all applicable laws, including copyright laws.
Kojto 71:53949e6131f6 7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
Kojto 71:53949e6131f6 8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
Kojto 71:53949e6131f6 9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
Kojto 71:53949e6131f6 10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
Kojto 71:53949e6131f6 11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
Kojto 71:53949e6131f6 12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
Kojto 71:53949e6131f6 13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
Kojto 71:53949e6131f6 14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
Kojto 71:53949e6131f6 15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Kojto 71:53949e6131f6 16 * Renesas reserves the right, without notice, to make changes to this software
Kojto 71:53949e6131f6 17 * and to discontinue the availability of this software. By using this software,
Kojto 71:53949e6131f6 18 * you agree to the additional terms and conditions found by accessing the
Kojto 71:53949e6131f6 19 * following link:
Kojto 71:53949e6131f6 20 * http://www.renesas.com/disclaimer
Kojto 71:53949e6131f6 21 * Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
Kojto 71:53949e6131f6 22 *******************************************************************************/
Kojto 71:53949e6131f6 23 /*******************************************************************************
Kojto 71:53949e6131f6 24 * File Name : usb0_function_global.c
Kojto 71:53949e6131f6 25 * $Rev: 1116 $
Kojto 71:53949e6131f6 26 * $Date:: 2014-07-09 16:29:19 +0900#$
Kojto 71:53949e6131f6 27 * Device(s) : RZ/A1H
Kojto 71:53949e6131f6 28 * Tool-Chain :
Kojto 71:53949e6131f6 29 * OS : None
Kojto 71:53949e6131f6 30 * H/W Platform :
Kojto 71:53949e6131f6 31 * Description : RZ/A1H R7S72100 USB Sample Program
Kojto 71:53949e6131f6 32 * Operation :
Kojto 71:53949e6131f6 33 * Limitations :
Kojto 71:53949e6131f6 34 *******************************************************************************/
Kojto 71:53949e6131f6 35
Kojto 71:53949e6131f6 36
Kojto 71:53949e6131f6 37 /*******************************************************************************
Kojto 71:53949e6131f6 38 Includes <System Includes> , "Project Includes"
Kojto 71:53949e6131f6 39 *******************************************************************************/
Kojto 71:53949e6131f6 40 #include "usb0_function.h"
Kojto 71:53949e6131f6 41
Kojto 71:53949e6131f6 42
Kojto 71:53949e6131f6 43 /*******************************************************************************
Kojto 71:53949e6131f6 44 Typedef definitions
Kojto 71:53949e6131f6 45 *******************************************************************************/
Kojto 71:53949e6131f6 46
Kojto 71:53949e6131f6 47
Kojto 71:53949e6131f6 48 /*******************************************************************************
Kojto 71:53949e6131f6 49 Macro definitions
Kojto 71:53949e6131f6 50 *******************************************************************************/
Kojto 71:53949e6131f6 51
Kojto 71:53949e6131f6 52
Kojto 71:53949e6131f6 53 /*******************************************************************************
Kojto 71:53949e6131f6 54 Imported global variables and functions (from other files)
Kojto 71:53949e6131f6 55 *******************************************************************************/
Kojto 71:53949e6131f6 56
Kojto 71:53949e6131f6 57
Kojto 71:53949e6131f6 58 /*******************************************************************************
Kojto 71:53949e6131f6 59 Exported global variables and functions (to be accessed by other files)
Kojto 71:53949e6131f6 60 *******************************************************************************/
Kojto 71:53949e6131f6 61
Kojto 71:53949e6131f6 62
Kojto 71:53949e6131f6 63 /*******************************************************************************
Kojto 71:53949e6131f6 64 Private global variables and functions
Kojto 71:53949e6131f6 65 *******************************************************************************/
Kojto 71:53949e6131f6 66 const uint16_t g_usb0_function_bit_set[16] =
Kojto 71:53949e6131f6 67 {
Kojto 71:53949e6131f6 68 0x0001, 0x0002, 0x0004, 0x0008,
Kojto 71:53949e6131f6 69 0x0010, 0x0020, 0x0040, 0x0080,
Kojto 71:53949e6131f6 70 0x0100, 0x0200, 0x0400, 0x0800,
Kojto 71:53949e6131f6 71 0x1000, 0x2000, 0x4000, 0x8000
Kojto 71:53949e6131f6 72 };
Kojto 71:53949e6131f6 73
Kojto 71:53949e6131f6 74 uint32_t g_usb0_function_data_count[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 75 uint8_t * g_usb0_function_data_pointer[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 76
Kojto 71:53949e6131f6 77 uint16_t g_usb0_function_PipeIgnore[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 78 uint16_t g_usb0_function_PipeTbl[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 79 uint16_t g_usb0_function_pipe_status[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 80 uint32_t g_usb0_function_PipeDataSize[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 81
Kojto 71:53949e6131f6 82 USB_FUNCTION_DMA_t g_usb0_function_DmaInfo[2];
Kojto 71:53949e6131f6 83 uint16_t g_usb0_function_DmaPipe[2];
Kojto 71:53949e6131f6 84 uint16_t g_usb0_function_DmaBval[2];
Kojto 71:53949e6131f6 85 uint16_t g_usb0_function_DmaStatus[2];
Kojto 71:53949e6131f6 86
Kojto 71:53949e6131f6 87 uint16_t g_usb0_function_CtrZeroLengthFlag;
Kojto 71:53949e6131f6 88
Kojto 71:53949e6131f6 89 //uint16_t g_usb0_function_ConfigNum;
Kojto 71:53949e6131f6 90 //uint16_t g_usb0_function_Alternate[USB_FUNCTION_ALT_NO];
Kojto 71:53949e6131f6 91 //uint16_t g_usb0_function_RemoteWakeupFlag;
Kojto 71:53949e6131f6 92 uint16_t g_usb0_function_TestModeFlag;
Kojto 71:53949e6131f6 93 uint16_t g_usb0_function_TestModeSelectors;
Kojto 71:53949e6131f6 94
Kojto 71:53949e6131f6 95 //uint16_t g_usb0_function_ReqType;
Kojto 71:53949e6131f6 96 //uint16_t g_usb0_function_ReqTypeType;
Kojto 71:53949e6131f6 97 //uint16_t g_usb0_function_ReqTypeRecip;
Kojto 71:53949e6131f6 98 //uint16_t g_usb0_function_ReqRequest;
Kojto 71:53949e6131f6 99 //uint16_t g_usb0_function_ReqValue;
Kojto 71:53949e6131f6 100 //uint16_t g_usb0_function_ReqIndex;
Kojto 71:53949e6131f6 101 //uint16_t g_usb0_function_ReqLength;
Kojto 71:53949e6131f6 102
Kojto 71:53949e6131f6 103 //uint16_t g_usb0_function_EPTableIndex[USB_FUNCTION_MAX_EP_NO + 1];
Kojto 71:53949e6131f6 104
Kojto 71:53949e6131f6 105 uint16_t g_usb0_function_pipecfg[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 106 uint16_t g_usb0_function_pipebuf[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 107 uint16_t g_usb0_function_pipemaxp[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 108 uint16_t g_usb0_function_pipeperi[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 109
Kojto 71:53949e6131f6 110
Kojto 71:53949e6131f6 111 /*******************************************************************************
Kojto 71:53949e6131f6 112 * Function Name: usb0_function_init_status
Kojto 71:53949e6131f6 113 * Description : Initialization USB Sample Driver Variable.
Kojto 71:53949e6131f6 114 * Arguments : none
Kojto 71:53949e6131f6 115 * Return Value : none
Kojto 71:53949e6131f6 116 *******************************************************************************/
Kojto 71:53949e6131f6 117 void usb0_function_init_status (void)
Kojto 71:53949e6131f6 118 {
Kojto 71:53949e6131f6 119 uint16_t pipe;
Kojto 71:53949e6131f6 120
Kojto 71:53949e6131f6 121 //g_usb0_function_ConfigNum = 0;
Kojto 71:53949e6131f6 122 //g_usb0_function_RemoteWakeupFlag = DEVDRV_USBF_OFF;
Kojto 71:53949e6131f6 123 g_usb0_function_TestModeFlag = DEVDRV_USBF_OFF;
Kojto 71:53949e6131f6 124 g_usb0_function_CtrZeroLengthFlag = 0;
Kojto 71:53949e6131f6 125
Kojto 71:53949e6131f6 126 #if 0
Kojto 71:53949e6131f6 127 usb0_function_clear_alt();
Kojto 71:53949e6131f6 128 #endif
Kojto 71:53949e6131f6 129
Kojto 71:53949e6131f6 130 for (pipe = 0; pipe < (USB_FUNCTION_MAX_PIPE_NO + 1); ++pipe)
Kojto 71:53949e6131f6 131 {
Kojto 71:53949e6131f6 132 g_usb0_function_pipe_status[pipe] = DEVDRV_USBF_PIPE_IDLE;
Kojto 71:53949e6131f6 133 g_usb0_function_PipeDataSize[pipe] = 0;
Kojto 71:53949e6131f6 134 g_usb0_function_data_count[pipe] = 0;
Kojto 71:53949e6131f6 135
Kojto 71:53949e6131f6 136 /* pipe configuration in usb0_function_ResetEP() */
Kojto 71:53949e6131f6 137 g_usb0_function_pipecfg[pipe] = 0;
Kojto 71:53949e6131f6 138 g_usb0_function_pipebuf[pipe] = 0;
Kojto 71:53949e6131f6 139 g_usb0_function_pipemaxp[pipe] = 0;
Kojto 71:53949e6131f6 140 g_usb0_function_pipeperi[pipe] = 0;
Kojto 71:53949e6131f6 141 }
Kojto 71:53949e6131f6 142 }
Kojto 71:53949e6131f6 143
Kojto 71:53949e6131f6 144 /* End of File */