]> git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/USBDevice/USBDevice/TARGET_RENESAS/TARGET_RZ_A1H/usb0/inc/usb0_function_dmacdrv.h
Merge commit '1fe4406f374291ab2e86e95a97341fd9c475fcb8'
[tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / libraries / USBDevice / USBDevice / TARGET_RENESAS / TARGET_RZ_A1H / usb0 / inc / usb0_function_dmacdrv.h
1 /*******************************************************************************
2 * DISCLAIMER
3 * This software is supplied by Renesas Electronics Corporation and is only
4 * intended for use with Renesas products. No other uses are authorized. This
5 * software is owned by Renesas Electronics Corporation and is protected under
6 * all applicable laws, including copyright laws.
7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
16 * Renesas reserves the right, without notice, to make changes to this software
17 * and to discontinue the availability of this software. By using this software,
18 * you agree to the additional terms and conditions found by accessing the
19 * following link:
20 * http://www.renesas.com/disclaimer
21 * Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
22 *******************************************************************************/
23 /*******************************************************************************
24 * File Name : usb0_function_dmacdrv.h
25 * $Rev: 1116 $
26 * $Date:: 2014-07-09 16:29:19 +0900#$
27 * Description : RZ/A1H R7S72100 USB Sample Program
28 *******************************************************************************/
29 #ifndef USB0_FUNCTION_DMACDRV_H
30 #define USB0_FUNCTION_DMACDRV_H
31
32
33 /*******************************************************************************
34 Includes <System Includes> , "Project Includes"
35 *******************************************************************************/
36
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 /*******************************************************************************
43 Typedef definitions
44 *******************************************************************************/
45 typedef struct dmac_transinfo
46 {
47 uint32_t src_addr; /* Transfer source address */
48 uint32_t dst_addr; /* Transfer destination address */
49 uint32_t count; /* Transfer byte count */
50 uint32_t src_size; /* Transfer source data size */
51 uint32_t dst_size; /* Transfer destination data size */
52 uint32_t saddr_dir; /* Transfer source address direction */
53 uint32_t daddr_dir; /* Transfer destination address direction */
54 } dmac_transinfo_t;
55
56
57 /*******************************************************************************
58 Macro definitions
59 *******************************************************************************/
60 /* ==== Transfer specification of the sample program ==== */
61 #define DMAC_SAMPLE_SINGLE (0) /* Single transfer */
62 #define DMAC_SAMPLE_CONTINUATION (1) /* Continuous transfer (use REN bit) */
63
64 /* ==== DMA modes ==== */
65 #define DMAC_MODE_REGISTER (0) /* Register mode */
66 #define DMAC_MODE_LINK (1) /* Link mode */
67
68 /* ==== Transfer requests ==== */
69 #define DMAC_REQ_MODE_EXT (0) /* External request */
70 #define DMAC_REQ_MODE_PERI (1) /* On-chip peripheral module request */
71 #define DMAC_REQ_MODE_SOFT (2) /* Auto-request (request by software) */
72
73 /* ==== DMAC transfer sizes ==== */
74 #define DMAC_TRANS_SIZE_8 (0) /* 8 bits */
75 #define DMAC_TRANS_SIZE_16 (1) /* 16 bits */
76 #define DMAC_TRANS_SIZE_32 (2) /* 32 bits */
77 #define DMAC_TRANS_SIZE_64 (3) /* 64 bits */
78 #define DMAC_TRANS_SIZE_128 (4) /* 128 bits */
79 #define DMAC_TRANS_SIZE_256 (5) /* 256 bits */
80 #define DMAC_TRANS_SIZE_512 (6) /* 512 bits */
81 #define DMAC_TRANS_SIZE_1024 (7) /* 1024 bits */
82
83 /* ==== Address increment for transferring ==== */
84 #define DMAC_TRANS_ADR_NO_INC (1) /* Not increment */
85 #define DMAC_TRANS_ADR_INC (0) /* Increment */
86
87 /* ==== Method for detecting DMA request ==== */
88 #define DMAC_REQ_DET_FALL (0) /* Falling edge detection */
89 #define DMAC_REQ_DET_RISE (1) /* Rising edge detection */
90 #define DMAC_REQ_DET_LOW (2) /* Low level detection */
91 #define DMAC_REQ_DET_HIGH (3) /* High level detection */
92
93 /* ==== Request Direction ==== */
94 #define DMAC_REQ_DIR_SRC (0) /* DMAREQ is the source/ DMAACK is active when reading */
95 #define DMAC_REQ_DIR_DST (1) /* DMAREQ is the destination/ DMAACK is active when writing */
96
97 /* ==== Descriptors ==== */
98 #define DMAC_DESC_HEADER (0) /* Header */
99 #define DMAC_DESC_SRC_ADDR (1) /* Source Address */
100 #define DMAC_DESC_DST_ADDR (2) /* Destination Address */
101 #define DMAC_DESC_COUNT (3) /* Transaction Byte */
102 #define DMAC_DESC_CHCFG (4) /* Channel Confg */
103 #define DMAC_DESC_CHITVL (5) /* Channel Interval */
104 #define DMAC_DESC_CHEXT (6) /* Channel Extension */
105 #define DMAC_DESC_LINK_ADDR (7) /* Link Address */
106
107 /* ==== On-chip peripheral module requests ===== */
108 typedef enum dmac_request_factor
109 {
110 DMAC_REQ_USB0_DMA0_TX, /* USB_0 channel 0 transmit FIFO empty */
111 DMAC_REQ_USB0_DMA0_RX, /* USB_0 channel 0 receive FIFO full */
112 DMAC_REQ_USB0_DMA1_TX, /* USB_0 channel 1 transmit FIFO empty */
113 DMAC_REQ_USB0_DMA1_RX, /* USB_0 channel 1 receive FIFO full */
114 DMAC_REQ_USB1_DMA0_TX, /* USB_1 channel 0 transmit FIFO empty */
115 DMAC_REQ_USB1_DMA0_RX, /* USB_1 channel 0 receive FIFO full */
116 DMAC_REQ_USB1_DMA1_TX, /* USB_1 channel 1 transmit FIFO empty */
117 DMAC_REQ_USB1_DMA1_RX, /* USB_1 channel 1 receive FIFO full */
118 } dmac_request_factor_t;
119
120
121 /*******************************************************************************
122 Exported global variables and functions (to be accessed by other files)
123 *******************************************************************************/
124 void usb0_function_DMAC1_PeriReqInit(const dmac_transinfo_t *trans_info, uint32_t dmamode, uint32_t continuation,
125 uint32_t request_factor, uint32_t req_direction);
126 int32_t usb0_function_DMAC1_Open(uint32_t req);
127 void usb0_function_DMAC1_Close(uint32_t *remain);
128 void usb0_function_DMAC1_Load_Set(uint32_t src_addr, uint32_t dst_addr, uint32_t count);
129
130 void usb0_function_DMAC2_PeriReqInit(const dmac_transinfo_t *trans_info, uint32_t dmamode, uint32_t continuation,
131 uint32_t request_factor, uint32_t req_direction);
132 int32_t usb0_function_DMAC2_Open(uint32_t req);
133 void usb0_function_DMAC2_Close(uint32_t *remain);
134 void usb0_function_DMAC2_Load_Set(uint32_t src_addr, uint32_t dst_addr, uint32_t count);
135
136 #ifdef __cplusplus
137 }
138 #endif
139
140 #endif /* USB0_FUNCTION_DMACDRV_H */
141
142 /* End of File */
Imprint / Impressum