USB device stack

Dependents:   USBMSD_step1 USBMSD_step1_5 picossd_step1_2cs

Committer:
muraguchi
Date:
Tue Feb 09 12:00:34 2021 +0000
Revision:
72:c80da04112fd
Parent:
71:53949e6131f6
Initial release

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