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 : usb1_host_dmacdrv.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 USB1_HOST_DMACDRV_H
Kojto 39:d96aa62afc5b 30 #define USB1_HOST_DMACDRV_H
Kojto 39:d96aa62afc5b 31
Kojto 39:d96aa62afc5b 32
Kojto 39:d96aa62afc5b 33 /*******************************************************************************
Kojto 39:d96aa62afc5b 34 Includes <System Includes> , "Project Includes"
Kojto 39:d96aa62afc5b 35 *******************************************************************************/
Kojto 39:d96aa62afc5b 36
Kojto 39:d96aa62afc5b 37
Kojto 39:d96aa62afc5b 38 /*******************************************************************************
Kojto 39:d96aa62afc5b 39 Typedef definitions
Kojto 39:d96aa62afc5b 40 *******************************************************************************/
Kojto 39:d96aa62afc5b 41 typedef struct dmac_transinfo
Kojto 39:d96aa62afc5b 42 {
Kojto 39:d96aa62afc5b 43 uint32_t src_addr; /* Transfer source address */
Kojto 39:d96aa62afc5b 44 uint32_t dst_addr; /* Transfer destination address */
Kojto 39:d96aa62afc5b 45 uint32_t count; /* Transfer byte count */
Kojto 39:d96aa62afc5b 46 uint32_t src_size; /* Transfer source data size */
Kojto 39:d96aa62afc5b 47 uint32_t dst_size; /* Transfer destination data size */
Kojto 39:d96aa62afc5b 48 uint32_t saddr_dir; /* Transfer source address direction */
Kojto 39:d96aa62afc5b 49 uint32_t daddr_dir; /* Transfer destination address direction */
Kojto 39:d96aa62afc5b 50 } dmac_transinfo_t;
Kojto 39:d96aa62afc5b 51
Kojto 39:d96aa62afc5b 52
Kojto 39:d96aa62afc5b 53 /*******************************************************************************
Kojto 39:d96aa62afc5b 54 Macro definitions
Kojto 39:d96aa62afc5b 55 *******************************************************************************/
Kojto 39:d96aa62afc5b 56 /* ==== Transfer specification of the sample program ==== */
Kojto 39:d96aa62afc5b 57 #define DMAC_SAMPLE_SINGLE (0) /* Single transfer */
Kojto 39:d96aa62afc5b 58 #define DMAC_SAMPLE_CONTINUATION (1) /* Continuous transfer (use REN bit) */
Kojto 39:d96aa62afc5b 59
Kojto 39:d96aa62afc5b 60 /* ==== DMA modes ==== */
Kojto 39:d96aa62afc5b 61 #define DMAC_MODE_REGISTER (0) /* Register mode */
Kojto 39:d96aa62afc5b 62 #define DMAC_MODE_LINK (1) /* Link mode */
Kojto 39:d96aa62afc5b 63
Kojto 39:d96aa62afc5b 64 /* ==== Transfer requests ==== */
Kojto 39:d96aa62afc5b 65 #define DMAC_REQ_MODE_EXT (0) /* External request */
Kojto 39:d96aa62afc5b 66 #define DMAC_REQ_MODE_PERI (1) /* On-chip peripheral module request */
Kojto 39:d96aa62afc5b 67 #define DMAC_REQ_MODE_SOFT (2) /* Auto-request (request by software) */
Kojto 39:d96aa62afc5b 68
Kojto 39:d96aa62afc5b 69 /* ==== DMAC transfer sizes ==== */
Kojto 39:d96aa62afc5b 70 #define DMAC_TRANS_SIZE_8 (0) /* 8 bits */
Kojto 39:d96aa62afc5b 71 #define DMAC_TRANS_SIZE_16 (1) /* 16 bits */
Kojto 39:d96aa62afc5b 72 #define DMAC_TRANS_SIZE_32 (2) /* 32 bits */
Kojto 39:d96aa62afc5b 73 #define DMAC_TRANS_SIZE_64 (3) /* 64 bits */
Kojto 39:d96aa62afc5b 74 #define DMAC_TRANS_SIZE_128 (4) /* 128 bits */
Kojto 39:d96aa62afc5b 75 #define DMAC_TRANS_SIZE_256 (5) /* 256 bits */
Kojto 39:d96aa62afc5b 76 #define DMAC_TRANS_SIZE_512 (6) /* 512 bits */
Kojto 39:d96aa62afc5b 77 #define DMAC_TRANS_SIZE_1024 (7) /* 1024 bits */
Kojto 39:d96aa62afc5b 78
Kojto 39:d96aa62afc5b 79 /* ==== Address increment for transferring ==== */
Kojto 39:d96aa62afc5b 80 #define DMAC_TRANS_ADR_NO_INC (1) /* Not increment */
Kojto 39:d96aa62afc5b 81 #define DMAC_TRANS_ADR_INC (0) /* Increment */
Kojto 39:d96aa62afc5b 82
Kojto 39:d96aa62afc5b 83 /* ==== Method for detecting DMA request ==== */
Kojto 39:d96aa62afc5b 84 #define DMAC_REQ_DET_FALL (0) /* Falling edge detection */
Kojto 39:d96aa62afc5b 85 #define DMAC_REQ_DET_RISE (1) /* Rising edge detection */
Kojto 39:d96aa62afc5b 86 #define DMAC_REQ_DET_LOW (2) /* Low level detection */
Kojto 39:d96aa62afc5b 87 #define DMAC_REQ_DET_HIGH (3) /* High level detection */
Kojto 39:d96aa62afc5b 88
Kojto 39:d96aa62afc5b 89 /* ==== Request Direction ==== */
Kojto 39:d96aa62afc5b 90 #define DMAC_REQ_DIR_SRC (0) /* DMAREQ is the source/ DMAACK is active when reading */
Kojto 39:d96aa62afc5b 91 #define DMAC_REQ_DIR_DST (1) /* DMAREQ is the destination/ DMAACK is active when writing */
Kojto 39:d96aa62afc5b 92
Kojto 39:d96aa62afc5b 93 /* ==== Descriptors ==== */
Kojto 39:d96aa62afc5b 94 #define DMAC_DESC_HEADER (0) /* Header */
Kojto 39:d96aa62afc5b 95 #define DMAC_DESC_SRC_ADDR (1) /* Source Address */
Kojto 39:d96aa62afc5b 96 #define DMAC_DESC_DST_ADDR (2) /* Destination Address */
Kojto 39:d96aa62afc5b 97 #define DMAC_DESC_COUNT (3) /* Transaction Byte */
Kojto 39:d96aa62afc5b 98 #define DMAC_DESC_CHCFG (4) /* Channel Confg */
Kojto 39:d96aa62afc5b 99 #define DMAC_DESC_CHITVL (5) /* Channel Interval */
Kojto 39:d96aa62afc5b 100 #define DMAC_DESC_CHEXT (6) /* Channel Extension */
Kojto 39:d96aa62afc5b 101 #define DMAC_DESC_LINK_ADDR (7) /* Link Address */
Kojto 39:d96aa62afc5b 102
Kojto 39:d96aa62afc5b 103 /* ==== On-chip peripheral module requests ===== */
Kojto 39:d96aa62afc5b 104 typedef enum dmac_request_factor
Kojto 39:d96aa62afc5b 105 {
Kojto 39:d96aa62afc5b 106 DMAC_REQ_USB0_DMA0_TX, /* USB_0 channel 0 transmit FIFO empty */
Kojto 39:d96aa62afc5b 107 DMAC_REQ_USB0_DMA0_RX, /* USB_0 channel 0 receive FIFO full */
Kojto 39:d96aa62afc5b 108 DMAC_REQ_USB0_DMA1_TX, /* USB_0 channel 1 transmit FIFO empty */
Kojto 39:d96aa62afc5b 109 DMAC_REQ_USB0_DMA1_RX, /* USB_0 channel 1 receive FIFO full */
Kojto 39:d96aa62afc5b 110 DMAC_REQ_USB1_DMA0_TX, /* USB_1 channel 0 transmit FIFO empty */
Kojto 39:d96aa62afc5b 111 DMAC_REQ_USB1_DMA0_RX, /* USB_1 channel 0 receive FIFO full */
Kojto 39:d96aa62afc5b 112 DMAC_REQ_USB1_DMA1_TX, /* USB_1 channel 1 transmit FIFO empty */
Kojto 39:d96aa62afc5b 113 DMAC_REQ_USB1_DMA1_RX, /* USB_1 channel 1 receive FIFO full */
Kojto 39:d96aa62afc5b 114 } dmac_request_factor_t;
Kojto 39:d96aa62afc5b 115
Kojto 39:d96aa62afc5b 116
Kojto 39:d96aa62afc5b 117 /*******************************************************************************
Kojto 39:d96aa62afc5b 118 Variable Externs
Kojto 39:d96aa62afc5b 119 *******************************************************************************/
Kojto 39:d96aa62afc5b 120
Kojto 39:d96aa62afc5b 121
Kojto 39:d96aa62afc5b 122 /*******************************************************************************
Kojto 39:d96aa62afc5b 123 Functions Prototypes
Kojto 39:d96aa62afc5b 124 *******************************************************************************/
Kojto 39:d96aa62afc5b 125 void usb1_host_DMAC3_PeriReqInit(const dmac_transinfo_t *trans_info, uint32_t dmamode, uint32_t continuation,
Kojto 39:d96aa62afc5b 126 uint32_t request_factor, uint32_t req_direction);
Kojto 39:d96aa62afc5b 127 int32_t usb1_host_DMAC3_Open(uint32_t req);
Kojto 39:d96aa62afc5b 128 void usb1_host_DMAC3_Close(uint32_t *remain);
Kojto 39:d96aa62afc5b 129 void usb1_host_DMAC3_Load_Set(uint32_t src_addr, uint32_t dst_addr, uint32_t count);
Kojto 39:d96aa62afc5b 130
Kojto 39:d96aa62afc5b 131 void usb1_host_DMAC4_PeriReqInit(const dmac_transinfo_t *trans_info, uint32_t dmamode, uint32_t continuation,
Kojto 39:d96aa62afc5b 132 uint32_t request_factor, uint32_t req_direction);
Kojto 39:d96aa62afc5b 133 int32_t usb1_host_DMAC4_Open(uint32_t req);
Kojto 39:d96aa62afc5b 134 void usb1_host_DMAC4_Close(uint32_t *remain);
Kojto 39:d96aa62afc5b 135 void usb1_host_DMAC4_Load_Set(uint32_t src_addr, uint32_t dst_addr, uint32_t count);
Kojto 39:d96aa62afc5b 136
Kojto 39:d96aa62afc5b 137 #endif /* USB1_HOST_DMACDRV_H */
Kojto 39:d96aa62afc5b 138
Kojto 39:d96aa62afc5b 139 /* End of File */