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.h
Kojto 71:53949e6131f6 25 * $Rev: 1116 $
Kojto 71:53949e6131f6 26 * $Date:: 2014-07-09 16:29:19 +0900#$
Kojto 71:53949e6131f6 27 * Description : RZ/A1H R7S72100 USB Sample Program
Kojto 71:53949e6131f6 28 *******************************************************************************/
Kojto 71:53949e6131f6 29 #ifndef USB0_FUNCTION_H
Kojto 71:53949e6131f6 30 #define USB0_FUNCTION_H
Kojto 71:53949e6131f6 31
Kojto 71:53949e6131f6 32
Kojto 71:53949e6131f6 33 /*******************************************************************************
Kojto 71:53949e6131f6 34 Includes <System Includes> , "Project Includes"
Kojto 71:53949e6131f6 35 *******************************************************************************/
Kojto 71:53949e6131f6 36 #include "devdrv_usb_function_api.h"
Kojto 71:53949e6131f6 37 #include "usb_function.h"
Kojto 71:53949e6131f6 38
Kojto 71:53949e6131f6 39
Kojto 71:53949e6131f6 40 #ifdef __cplusplus
Kojto 71:53949e6131f6 41 extern "C" {
Kojto 71:53949e6131f6 42 #endif
Kojto 71:53949e6131f6 43
Kojto 71:53949e6131f6 44 /*******************************************************************************
Kojto 71:53949e6131f6 45 Typedef definitions
Kojto 71:53949e6131f6 46 *******************************************************************************/
Kojto 71:53949e6131f6 47
Kojto 71:53949e6131f6 48
Kojto 71:53949e6131f6 49 /*******************************************************************************
Kojto 71:53949e6131f6 50 Macro definitions
Kojto 71:53949e6131f6 51 *******************************************************************************/
Kojto 71:53949e6131f6 52
Kojto 71:53949e6131f6 53
Kojto 71:53949e6131f6 54 /*******************************************************************************
Kojto 71:53949e6131f6 55 Imported global variables and functions (from other files)
Kojto 71:53949e6131f6 56 *******************************************************************************/
Kojto 71:53949e6131f6 57 extern const uint16_t g_usb0_function_bit_set[];
Kojto 71:53949e6131f6 58 extern uint32_t g_usb0_function_data_count[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 59 extern uint8_t *g_usb0_function_data_pointer[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 60
Kojto 71:53949e6131f6 61 extern uint16_t g_usb0_function_PipeIgnore[];
Kojto 71:53949e6131f6 62 extern uint16_t g_usb0_function_PipeTbl[];
Kojto 71:53949e6131f6 63 extern uint16_t g_usb0_function_pipe_status[];
Kojto 71:53949e6131f6 64 extern uint32_t g_usb0_function_PipeDataSize[];
Kojto 71:53949e6131f6 65
Kojto 71:53949e6131f6 66 extern USB_FUNCTION_DMA_t g_usb0_function_DmaInfo[];
Kojto 71:53949e6131f6 67 extern uint16_t g_usb0_function_DmaPipe[];
Kojto 71:53949e6131f6 68 extern uint16_t g_usb0_function_DmaBval[];
Kojto 71:53949e6131f6 69 extern uint16_t g_usb0_function_DmaStatus[];
Kojto 71:53949e6131f6 70
Kojto 71:53949e6131f6 71 extern uint16_t g_usb0_function_CtrZeroLengthFlag;
Kojto 71:53949e6131f6 72
Kojto 71:53949e6131f6 73 extern uint16_t g_usb0_function_ConfigNum;
Kojto 71:53949e6131f6 74 extern uint16_t g_usb0_function_Alternate[USB_FUNCTION_ALT_NO];
Kojto 71:53949e6131f6 75 extern uint16_t g_usb0_function_RemoteWakeupFlag;
Kojto 71:53949e6131f6 76 extern uint16_t g_usb0_function_TestModeFlag;
Kojto 71:53949e6131f6 77 extern uint16_t g_usb0_function_TestModeSelectors;
Kojto 71:53949e6131f6 78
Kojto 71:53949e6131f6 79 extern uint16_t g_usb0_function_ReqType;
Kojto 71:53949e6131f6 80 extern uint16_t g_usb0_function_ReqTypeType;
Kojto 71:53949e6131f6 81 extern uint16_t g_usb0_function_ReqTypeRecip;
Kojto 71:53949e6131f6 82 extern uint16_t g_usb0_function_ReqRequest;
Kojto 71:53949e6131f6 83 extern uint16_t g_usb0_function_ReqValue;
Kojto 71:53949e6131f6 84 extern uint16_t g_usb0_function_ReqIndex;
Kojto 71:53949e6131f6 85 extern uint16_t g_usb0_function_ReqLength;
Kojto 71:53949e6131f6 86
Kojto 71:53949e6131f6 87 extern uint16_t g_usb0_function_EPTableIndex[USB_FUNCTION_MAX_EP_NO + 1];
Kojto 71:53949e6131f6 88
Kojto 71:53949e6131f6 89 extern uint16_t g_usb0_function_pipecfg[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 90 extern uint16_t g_usb0_function_pipebuf[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 91 extern uint16_t g_usb0_function_pipemaxp[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 92 extern uint16_t g_usb0_function_pipeperi[USB_FUNCTION_MAX_PIPE_NO + 1];
Kojto 71:53949e6131f6 93
Kojto 71:53949e6131f6 94
Kojto 71:53949e6131f6 95 /*******************************************************************************
Kojto 71:53949e6131f6 96 Exported global variables and functions (to be accessed by other files)
Kojto 71:53949e6131f6 97 *******************************************************************************/
Kojto 71:53949e6131f6 98 /* ==== common ==== */
Kojto 71:53949e6131f6 99 void usb0_function_dma_stop_d0(uint16_t pipe, uint32_t remain);
Kojto 71:53949e6131f6 100 void usb0_function_dma_stop_d1(uint16_t pipe, uint32_t remain);
Kojto 71:53949e6131f6 101 uint16_t usb0_function_is_hispeed(void);
Kojto 71:53949e6131f6 102 uint16_t usb0_function_is_hispeed_enable(void);
Kojto 71:53949e6131f6 103 uint16_t usb0_function_start_send_transfer(uint16_t pipe, uint32_t size, uint8_t *data);
Kojto 71:53949e6131f6 104 uint16_t usb0_function_write_buffer(uint16_t pipe);
Kojto 71:53949e6131f6 105 uint16_t usb0_function_write_buffer_c(uint16_t pipe);
Kojto 71:53949e6131f6 106 uint16_t usb0_function_write_buffer_d0(uint16_t pipe);
Kojto 71:53949e6131f6 107 uint16_t usb0_function_write_buffer_d1(uint16_t pipe);
Kojto 71:53949e6131f6 108 void usb0_function_start_receive_transfer(uint16_t pipe, uint32_t size, uint8_t *data);
Kojto 71:53949e6131f6 109 uint16_t usb0_function_read_buffer(uint16_t pipe);
Kojto 71:53949e6131f6 110 uint16_t usb0_function_read_buffer_c(uint16_t pipe);
Kojto 71:53949e6131f6 111 uint16_t usb0_function_read_buffer_d0(uint16_t pipe);
Kojto 71:53949e6131f6 112 uint16_t usb0_function_read_buffer_d1(uint16_t pipe);
Kojto 71:53949e6131f6 113 uint16_t usb0_function_change_fifo_port(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw);
Kojto 71:53949e6131f6 114 void usb0_function_set_curpipe(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw);
Kojto 71:53949e6131f6 115 void usb0_function_set_curpipe2(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw, uint16_t dfacc);
Kojto 71:53949e6131f6 116 uint16_t usb0_function_get_mbw(uint32_t trncount, uint32_t dtptr);
Kojto 71:53949e6131f6 117 uint16_t usb0_function_read_dma(uint16_t pipe);
Kojto 71:53949e6131f6 118 void usb0_function_brdy_int(uint16_t status, uint16_t int_enb);
Kojto 71:53949e6131f6 119 void usb0_function_nrdy_int(uint16_t status, uint16_t int_enb);
Kojto 71:53949e6131f6 120 void usb0_function_bemp_int(uint16_t status, uint16_t int_enb);
Kojto 71:53949e6131f6 121 void usb0_function_setting_interrupt(uint8_t level);
Kojto 71:53949e6131f6 122 void usb0_function_reset_module(uint16_t clockmode);
Kojto 71:53949e6131f6 123 uint16_t usb0_function_get_buf_size(uint16_t pipe);
Kojto 71:53949e6131f6 124 uint16_t usb0_function_get_mxps(uint16_t pipe);
Kojto 71:53949e6131f6 125 void usb0_function_clear_brdy_sts(uint16_t pipe);
Kojto 71:53949e6131f6 126 void usb0_function_clear_bemp_sts(uint16_t pipe);
Kojto 71:53949e6131f6 127 void usb0_function_clear_nrdy_sts(uint16_t pipe);
Kojto 71:53949e6131f6 128 void usb0_function_set_pid_buf(uint16_t pipe);
Kojto 71:53949e6131f6 129 void usb0_function_set_pid_nak(uint16_t pipe);
Kojto 71:53949e6131f6 130 void usb0_function_set_pid_stall(uint16_t pipe);
Kojto 71:53949e6131f6 131 void usb0_function_clear_pid_stall(uint16_t pipe);
Kojto 71:53949e6131f6 132 uint16_t usb0_function_get_pid(uint16_t pipe);
Kojto 71:53949e6131f6 133 void usb0_function_set_sqclr(uint16_t pipe);
Kojto 71:53949e6131f6 134 void usb0_function_set_sqset(uint16_t pipe);
Kojto 71:53949e6131f6 135 void usb0_function_set_csclr(uint16_t pipe);
Kojto 71:53949e6131f6 136 void usb0_function_aclrm(uint16_t pipe);
Kojto 71:53949e6131f6 137 void usb0_function_set_aclrm(uint16_t pipe);
Kojto 71:53949e6131f6 138 void usb0_function_clr_aclrm(uint16_t pipe);
Kojto 71:53949e6131f6 139 uint16_t usb0_function_get_sqmon(uint16_t pipe);
Kojto 71:53949e6131f6 140 uint16_t usb0_function_get_inbuf(uint16_t pipe);
Kojto 71:53949e6131f6 141
Kojto 71:53949e6131f6 142 /* ==== function ==== */
Kojto 71:53949e6131f6 143 void usb0_function_init_status(void);
Kojto 71:53949e6131f6 144 void usb0_function_InitModule(uint16_t mode);
Kojto 71:53949e6131f6 145 uint16_t usb0_function_CheckVBUStaus(void);
Kojto 71:53949e6131f6 146 void usb0_function_USB_FUNCTION_Attach(void);
Kojto 71:53949e6131f6 147 void usb0_function_USB_FUNCTION_Detach(void);
Kojto 71:53949e6131f6 148 void usb0_function_USB_FUNCTION_BusReset(void);
Kojto 71:53949e6131f6 149 void usb0_function_USB_FUNCTION_Resume(void);
Kojto 71:53949e6131f6 150 void usb0_function_USB_FUNCTION_Suspend(void);
Kojto 71:53949e6131f6 151 void usb0_function_USB_FUNCTION_TestMode(void);
Kojto 71:53949e6131f6 152 void usb0_function_ResetDCP(void);
Kojto 71:53949e6131f6 153 void usb0_function_ResetEP(uint16_t num);
Kojto 71:53949e6131f6 154 uint16_t usb0_function_EpToPipe(uint16_t ep);
Kojto 71:53949e6131f6 155 void usb0_function_InitEPTable(uint16_t Con_Num, uint16_t Int_Num, uint16_t Alt_Num);
Kojto 71:53949e6131f6 156 uint16_t usb0_function_GetConfigNum(void);
Kojto 71:53949e6131f6 157 uint16_t usb0_function_GetAltNum(uint16_t Con_Num, uint16_t Int_Num);
Kojto 71:53949e6131f6 158 uint16_t usb0_function_CheckRemoteWakeup(void);
Kojto 71:53949e6131f6 159 void usb0_function_clear_alt(void);
Kojto 71:53949e6131f6 160 void usb0_function_clear_pipe_tbl(void);
Kojto 71:53949e6131f6 161 void usb0_function_clear_ep_table_index(void);
Kojto 71:53949e6131f6 162 uint16_t usb0_function_GetInterfaceNum(uint16_t num);
Kojto 71:53949e6131f6 163
Kojto 71:53949e6131f6 164 #ifdef __cplusplus
Kojto 71:53949e6131f6 165 }
Kojto 71:53949e6131f6 166 #endif
Kojto 71:53949e6131f6 167
Kojto 71:53949e6131f6 168
Kojto 71:53949e6131f6 169 #endif /* USB0_FUNCTION_H */
Kojto 71:53949e6131f6 170
Kojto 71:53949e6131f6 171 /* End of File */