USBHost library. NOTE: This library is only officially supported on the LPC1768 platform. For more information, please see the handbook page.

Dependencies:   FATFileSystem mbed-rtos

Dependents:   BTstack WallbotWii SD to Flash Data Transfer USBHost-MSD_HelloWorld ... 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:24:30 2017 +0100
Revision:
39:d96aa62afc5b
Update USBHost - add targets directory

This corresponds to mbed-os/master commit 9207365

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 39:d96aa62afc5b 1 /*******************************************************************************
Kojto 39:d96aa62afc5b 2 * DISCLAIMER
Kojto 39:d96aa62afc5b 3 * This software is supplied by Renesas Electronics Corporation and is only
Kojto 39:d96aa62afc5b 4 * intended for use with Renesas products. No other uses are authorized. This
Kojto 39:d96aa62afc5b 5 * software is owned by Renesas Electronics Corporation and is protected under
Kojto 39:d96aa62afc5b 6 * all applicable laws, including copyright laws.
Kojto 39:d96aa62afc5b 7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
Kojto 39:d96aa62afc5b 8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
Kojto 39:d96aa62afc5b 9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
Kojto 39:d96aa62afc5b 10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
Kojto 39:d96aa62afc5b 11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
Kojto 39:d96aa62afc5b 12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
Kojto 39:d96aa62afc5b 13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
Kojto 39:d96aa62afc5b 14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
Kojto 39:d96aa62afc5b 15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Kojto 39:d96aa62afc5b 16 * Renesas reserves the right, without notice, to make changes to this software
Kojto 39:d96aa62afc5b 17 * and to discontinue the availability of this software. By using this software,
Kojto 39:d96aa62afc5b 18 * you agree to the additional terms and conditions found by accessing the
Kojto 39:d96aa62afc5b 19 * following link:
Kojto 39:d96aa62afc5b 20 * http://www.renesas.com/disclaimer
Kojto 39:d96aa62afc5b 21 * Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
Kojto 39:d96aa62afc5b 22 *******************************************************************************/
Kojto 39:d96aa62afc5b 23 /*******************************************************************************
Kojto 39:d96aa62afc5b 24 * File Name : usb0_host.h
Kojto 39:d96aa62afc5b 25 * $Rev: 1116 $
Kojto 39:d96aa62afc5b 26 * $Date:: 2014-07-09 16:29:19 +0900#$
Kojto 39:d96aa62afc5b 27 * Description : RZ/A1H R7S72100 USB Sample Program
Kojto 39:d96aa62afc5b 28 *******************************************************************************/
Kojto 39:d96aa62afc5b 29 #ifndef USB0_HOST_H
Kojto 39:d96aa62afc5b 30 #define USB0_HOST_H
Kojto 39:d96aa62afc5b 31
Kojto 39:d96aa62afc5b 32 /*******************************************************************************
Kojto 39:d96aa62afc5b 33 Includes <System Includes> , "Project Includes"
Kojto 39:d96aa62afc5b 34 *******************************************************************************/
Kojto 39:d96aa62afc5b 35 #include "devdrv_usb_host_api.h"
Kojto 39:d96aa62afc5b 36 #include "usb_host.h"
Kojto 39:d96aa62afc5b 37
Kojto 39:d96aa62afc5b 38 /*******************************************************************************
Kojto 39:d96aa62afc5b 39 Imported global variables and functions (from other files)
Kojto 39:d96aa62afc5b 40 *******************************************************************************/
Kojto 39:d96aa62afc5b 41 extern const uint16_t g_usb0_host_bit_set[];
Kojto 39:d96aa62afc5b 42 extern uint32_t g_usb0_host_data_count[USB_HOST_MAX_PIPE_NO + 1];
Kojto 39:d96aa62afc5b 43 extern uint8_t *g_usb0_host_data_pointer[USB_HOST_MAX_PIPE_NO + 1];
Kojto 39:d96aa62afc5b 44
Kojto 39:d96aa62afc5b 45 extern uint16_t g_usb0_host_PipeIgnore[];
Kojto 39:d96aa62afc5b 46 extern uint16_t g_usb0_host_PipeTbl[];
Kojto 39:d96aa62afc5b 47 extern uint16_t g_usb0_host_pipe_status[];
Kojto 39:d96aa62afc5b 48 extern uint32_t g_usb0_host_PipeDataSize[];
Kojto 39:d96aa62afc5b 49
Kojto 39:d96aa62afc5b 50 extern USB_HOST_DMA_t g_usb0_host_DmaInfo[];
Kojto 39:d96aa62afc5b 51 extern uint16_t g_usb0_host_DmaPipe[];
Kojto 39:d96aa62afc5b 52 extern uint16_t g_usb0_host_DmaBval[];
Kojto 39:d96aa62afc5b 53 extern uint16_t g_usb0_host_DmaStatus[];
Kojto 39:d96aa62afc5b 54
Kojto 39:d96aa62afc5b 55 extern uint16_t g_usb0_host_driver_state;
Kojto 39:d96aa62afc5b 56 extern uint16_t g_usb0_host_ConfigNum;
Kojto 39:d96aa62afc5b 57 extern uint16_t g_usb0_host_CmdStage;
Kojto 39:d96aa62afc5b 58 extern uint16_t g_usb0_host_bchg_flag;
Kojto 39:d96aa62afc5b 59 extern uint16_t g_usb0_host_detach_flag;
Kojto 39:d96aa62afc5b 60 extern uint16_t g_usb0_host_attach_flag;
Kojto 39:d96aa62afc5b 61
Kojto 39:d96aa62afc5b 62 extern uint16_t g_usb0_host_UsbAddress;
Kojto 39:d96aa62afc5b 63 extern uint16_t g_usb0_host_setUsbAddress;
Kojto 39:d96aa62afc5b 64 extern uint16_t g_usb0_host_default_max_packet[USB_HOST_MAX_DEVICE + 1];
Kojto 39:d96aa62afc5b 65 extern uint16_t g_usb0_host_UsbDeviceSpeed;
Kojto 39:d96aa62afc5b 66 extern uint16_t g_usb0_host_SupportUsbDeviceSpeed;
Kojto 39:d96aa62afc5b 67
Kojto 39:d96aa62afc5b 68 extern uint16_t g_usb0_host_SavReq;
Kojto 39:d96aa62afc5b 69 extern uint16_t g_usb0_host_SavVal;
Kojto 39:d96aa62afc5b 70 extern uint16_t g_usb0_host_SavIndx;
Kojto 39:d96aa62afc5b 71 extern uint16_t g_usb0_host_SavLen;
Kojto 39:d96aa62afc5b 72
Kojto 39:d96aa62afc5b 73 extern uint16_t g_usb0_host_pipecfg[USB_HOST_MAX_PIPE_NO + 1];
Kojto 39:d96aa62afc5b 74 extern uint16_t g_usb0_host_pipebuf[USB_HOST_MAX_PIPE_NO + 1];
Kojto 39:d96aa62afc5b 75 extern uint16_t g_usb0_host_pipemaxp[USB_HOST_MAX_PIPE_NO + 1];
Kojto 39:d96aa62afc5b 76 extern uint16_t g_usb0_host_pipeperi[USB_HOST_MAX_PIPE_NO + 1];
Kojto 39:d96aa62afc5b 77
Kojto 39:d96aa62afc5b 78 /*******************************************************************************
Kojto 39:d96aa62afc5b 79 Functions Prototypes
Kojto 39:d96aa62afc5b 80 *******************************************************************************/
Kojto 39:d96aa62afc5b 81 /* ==== common ==== */
Kojto 39:d96aa62afc5b 82 void usb0_host_dma_stop_d0(uint16_t pipe, uint32_t remain);
Kojto 39:d96aa62afc5b 83 void usb0_host_dma_stop_d1(uint16_t pipe, uint32_t remain);
Kojto 39:d96aa62afc5b 84 uint16_t usb0_host_is_hispeed(void);
Kojto 39:d96aa62afc5b 85 uint16_t usb0_host_is_hispeed_enable(void);
Kojto 39:d96aa62afc5b 86 uint16_t usb0_host_start_send_transfer(uint16_t pipe, uint32_t size, uint8_t *data);
Kojto 39:d96aa62afc5b 87 uint16_t usb0_host_write_buffer(uint16_t pipe);
Kojto 39:d96aa62afc5b 88 uint16_t usb0_host_write_buffer_c(uint16_t pipe);
Kojto 39:d96aa62afc5b 89 uint16_t usb0_host_write_buffer_d0(uint16_t pipe);
Kojto 39:d96aa62afc5b 90 uint16_t usb0_host_write_buffer_d1(uint16_t pipe);
Kojto 39:d96aa62afc5b 91 void usb0_host_start_receive_transfer(uint16_t pipe, uint32_t size, uint8_t *data);
Kojto 39:d96aa62afc5b 92 uint16_t usb0_host_read_buffer(uint16_t pipe);
Kojto 39:d96aa62afc5b 93 uint16_t usb0_host_read_buffer_c(uint16_t pipe);
Kojto 39:d96aa62afc5b 94 uint16_t usb0_host_read_buffer_d0(uint16_t pipe);
Kojto 39:d96aa62afc5b 95 uint16_t usb0_host_read_buffer_d1(uint16_t pipe);
Kojto 39:d96aa62afc5b 96 uint16_t usb0_host_change_fifo_port(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw);
Kojto 39:d96aa62afc5b 97 void usb0_host_set_curpipe(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw);
Kojto 39:d96aa62afc5b 98 void usb0_host_set_curpipe2(uint16_t pipe, uint16_t fifosel, uint16_t isel, uint16_t mbw, uint16_t dfacc);
Kojto 39:d96aa62afc5b 99 uint16_t usb0_host_get_mbw(uint32_t trncount, uint32_t dtptr);
Kojto 39:d96aa62afc5b 100 uint16_t usb0_host_read_dma(uint16_t pipe);
Kojto 39:d96aa62afc5b 101 void usb0_host_stop_transfer(uint16_t pipe);
Kojto 39:d96aa62afc5b 102 void usb0_host_brdy_int(uint16_t status, uint16_t int_enb);
Kojto 39:d96aa62afc5b 103 void usb0_host_nrdy_int(uint16_t status, uint16_t int_enb);
Kojto 39:d96aa62afc5b 104 void usb0_host_bemp_int(uint16_t status, uint16_t int_enb);
Kojto 39:d96aa62afc5b 105 void usb0_host_setting_interrupt(uint8_t level);
Kojto 39:d96aa62afc5b 106 void usb0_host_reset_module(uint16_t clockmode);
Kojto 39:d96aa62afc5b 107 uint16_t usb0_host_get_buf_size(uint16_t pipe);
Kojto 39:d96aa62afc5b 108 uint16_t usb0_host_get_mxps(uint16_t pipe);
Kojto 39:d96aa62afc5b 109 void usb0_host_enable_brdy_int(uint16_t pipe);
Kojto 39:d96aa62afc5b 110 void usb0_host_disable_brdy_int(uint16_t pipe);
Kojto 39:d96aa62afc5b 111 void usb0_host_clear_brdy_sts(uint16_t pipe);
Kojto 39:d96aa62afc5b 112 void usb0_host_enable_bemp_int(uint16_t pipe);
Kojto 39:d96aa62afc5b 113 void usb0_host_disable_bemp_int(uint16_t pipe);
Kojto 39:d96aa62afc5b 114 void usb0_host_clear_bemp_sts(uint16_t pipe);
Kojto 39:d96aa62afc5b 115 void usb0_host_enable_nrdy_int(uint16_t pipe);
Kojto 39:d96aa62afc5b 116 void usb0_host_disable_nrdy_int(uint16_t pipe);
Kojto 39:d96aa62afc5b 117 void usb0_host_clear_nrdy_sts(uint16_t pipe);
Kojto 39:d96aa62afc5b 118 void usb0_host_set_pid_buf(uint16_t pipe);
Kojto 39:d96aa62afc5b 119 void usb0_host_set_pid_nak(uint16_t pipe);
Kojto 39:d96aa62afc5b 120 void usb0_host_set_pid_stall(uint16_t pipe);
Kojto 39:d96aa62afc5b 121 void usb0_host_clear_pid_stall(uint16_t pipe);
Kojto 39:d96aa62afc5b 122 uint16_t usb0_host_get_pid(uint16_t pipe);
Kojto 39:d96aa62afc5b 123 void usb0_host_set_sqclr(uint16_t pipe);
Kojto 39:d96aa62afc5b 124 void usb0_host_set_sqset(uint16_t pipe);
Kojto 39:d96aa62afc5b 125 void usb0_host_set_csclr(uint16_t pipe);
Kojto 39:d96aa62afc5b 126 void usb0_host_aclrm(uint16_t pipe);
Kojto 39:d96aa62afc5b 127 void usb0_host_set_aclrm(uint16_t pipe);
Kojto 39:d96aa62afc5b 128 void usb0_host_clr_aclrm(uint16_t pipe);
Kojto 39:d96aa62afc5b 129 uint16_t usb0_host_get_sqmon(uint16_t pipe);
Kojto 39:d96aa62afc5b 130 uint16_t usb0_host_get_inbuf(uint16_t pipe);
Kojto 39:d96aa62afc5b 131
Kojto 39:d96aa62afc5b 132 /* ==== host ==== */
Kojto 39:d96aa62afc5b 133 void usb0_host_init_pipe_status(void);
Kojto 39:d96aa62afc5b 134 int32_t usb0_host_CtrlTransStart(uint16_t devadr, uint16_t Req, uint16_t Val, uint16_t Indx, uint16_t Len, uint8_t *Buf);
Kojto 39:d96aa62afc5b 135 void usb0_host_SetupStage(uint16_t Req, uint16_t Val, uint16_t Indx, uint16_t Len);
Kojto 39:d96aa62afc5b 136 void usb0_host_CtrlReadStart(uint32_t Bsize, uint8_t *Table);
Kojto 39:d96aa62afc5b 137 uint16_t usb0_host_CtrlWriteStart(uint32_t Bsize, uint8_t *Table);
Kojto 39:d96aa62afc5b 138 void usb0_host_StatusStage(void);
Kojto 39:d96aa62afc5b 139 void usb0_host_get_devadd(uint16_t addr, uint16_t *devadd);
Kojto 39:d96aa62afc5b 140 void usb0_host_set_devadd(uint16_t addr, uint16_t *devadd);
Kojto 39:d96aa62afc5b 141 void usb0_host_InitModule(void);
Kojto 39:d96aa62afc5b 142 uint16_t usb0_host_CheckAttach(void);
Kojto 39:d96aa62afc5b 143 void usb0_host_UsbDetach(void);
Kojto 39:d96aa62afc5b 144 void usb0_host_UsbDetach2(void);
Kojto 39:d96aa62afc5b 145 void usb0_host_UsbAttach(void);
Kojto 39:d96aa62afc5b 146 uint16_t usb0_host_UsbBusReset(void);
Kojto 39:d96aa62afc5b 147 int32_t usb0_host_UsbResume(void);
Kojto 39:d96aa62afc5b 148 int32_t usb0_host_UsbSuspend(void);
Kojto 39:d96aa62afc5b 149 void usb0_host_Enable_DetachINT(void);
Kojto 39:d96aa62afc5b 150 void usb0_host_Disable_DetachINT(void);
Kojto 39:d96aa62afc5b 151 void usb0_host_UsbStateManager(void);
Kojto 39:d96aa62afc5b 152
Kojto 39:d96aa62afc5b 153
Kojto 39:d96aa62afc5b 154 #endif /* USB0_HOST_H */
Kojto 39:d96aa62afc5b 155
Kojto 39:d96aa62afc5b 156 /* End of File */