SDG+USBHost(Mouse) Sample

Dependencies:   Sound_Generator USBHost_custom

Fork of SDG_Mouse_Sample by GR-PEACH_producer_meeting

Information

Japanese version is available in lower part of this page.
このページの後半に日本語版が用意されています.

What is this?

This program is a demonstration that sounds the sound by mouse operation by using USBHost(Mouse) and Sound Generator.

Settings

Close JP3 of GR-PEACH.
/media/uploads/RyoheiHagimoto/sdg-mouse.jpg

Operation

operationeffect
Right clickSounds
Left clickReset to base tone (C)
Moves the mouse to the rightLower the sound
Moves the mouse to the leftHigher the sound
Center cursorAdjust the sensitivity.
Reset the reference value in the click.

Others

The default setting of serial communication (baud rate etc.) in mbed is shown the following link.
Please refer to the link and change the settings of your PC terminal software.
The default value of baud rate in mbed is 9600, and this application uses baud rate 9600.
https://developer.mbed.org/teams/Renesas/wiki/GR-PEACH-Getting-Started#install-the-usb-serial-communication


概要

このプログラムは、USBHost(Mouse) + Sound Generatorで、マウス操作による擬似笛デモです。

設定

GR-PEACHのJP3をショートする必要があります。
/media/uploads/RyoheiHagimoto/sdg-mouse.jpg

操作方法

操作内容
右クリック音出力開始
左クリック基準音(ド)にリセット
マウス右移動高音になります
マウス左移動低音になります
センターカーソル音高低の変化量調整(クリックで基準値にリセット)

Others

mbedのシリアル通信(ボーレート等)のデフォルト設定は以下のリンクに示しています。
リンクを参考に、お使いのPCターミナルソフトの設定を変更して下さい。
mbedでのボーレートのデフォルト値は9600で、このサンプルではボーレート9600を使います。
https://developer.mbed.org/teams/Renesas/wiki/GR-PEACH-Getting-Started#install-the-usb-serial-communication

Committer:
mbed_official
Date:
Mon Jan 19 14:30:37 2015 +0000
Revision:
27:4206883f4cb7
Synchronized with git revision 0ab8d2e6b3d884137dcb5c62d29a07abe132bac7

Full URL: https://github.com/mbedmicro/mbed/commit/0ab8d2e6b3d884137dcb5c62d29a07abe132bac7/

RZ_A1H - Implement some USB functions and fix some bugs about USBHost common codes.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 27:4206883f4cb7 1 /*******************************************************************************
mbed_official 27:4206883f4cb7 2 * DISCLAIMER
mbed_official 27:4206883f4cb7 3 * This software is supplied by Renesas Electronics Corporation and is only
mbed_official 27:4206883f4cb7 4 * intended for use with Renesas products. No other uses are authorized. This
mbed_official 27:4206883f4cb7 5 * software is owned by Renesas Electronics Corporation and is protected under
mbed_official 27:4206883f4cb7 6 * all applicable laws, including copyright laws.
mbed_official 27:4206883f4cb7 7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
mbed_official 27:4206883f4cb7 8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
mbed_official 27:4206883f4cb7 9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
mbed_official 27:4206883f4cb7 10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
mbed_official 27:4206883f4cb7 11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
mbed_official 27:4206883f4cb7 12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
mbed_official 27:4206883f4cb7 13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
mbed_official 27:4206883f4cb7 14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
mbed_official 27:4206883f4cb7 15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
mbed_official 27:4206883f4cb7 16 * Renesas reserves the right, without notice, to make changes to this software
mbed_official 27:4206883f4cb7 17 * and to discontinue the availability of this software. By using this software,
mbed_official 27:4206883f4cb7 18 * you agree to the additional terms and conditions found by accessing the
mbed_official 27:4206883f4cb7 19 * following link:
mbed_official 27:4206883f4cb7 20 * http://www.renesas.com/disclaimer
mbed_official 27:4206883f4cb7 21 * Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
mbed_official 27:4206883f4cb7 22 *******************************************************************************/
mbed_official 27:4206883f4cb7 23 /*******************************************************************************
mbed_official 27:4206883f4cb7 24 * File Name : usb0_host_dma.c
mbed_official 27:4206883f4cb7 25 * $Rev: 1116 $
mbed_official 27:4206883f4cb7 26 * $Date:: 2014-07-09 16:29:19 +0900#$
mbed_official 27:4206883f4cb7 27 * Device(s) : RZ/A1H
mbed_official 27:4206883f4cb7 28 * Tool-Chain :
mbed_official 27:4206883f4cb7 29 * OS : None
mbed_official 27:4206883f4cb7 30 * H/W Platform :
mbed_official 27:4206883f4cb7 31 * Description : RZ/A1H R7S72100 USB Sample Program
mbed_official 27:4206883f4cb7 32 * Operation :
mbed_official 27:4206883f4cb7 33 * Limitations :
mbed_official 27:4206883f4cb7 34 *******************************************************************************/
mbed_official 27:4206883f4cb7 35
mbed_official 27:4206883f4cb7 36
mbed_official 27:4206883f4cb7 37 /*******************************************************************************
mbed_official 27:4206883f4cb7 38 Includes <System Includes> , "Project Includes"
mbed_official 27:4206883f4cb7 39 *******************************************************************************/
mbed_official 27:4206883f4cb7 40 #include "usb0_host.h"
mbed_official 27:4206883f4cb7 41 /* #include "usb0_host_dmacdrv.h" */
mbed_official 27:4206883f4cb7 42
mbed_official 27:4206883f4cb7 43
mbed_official 27:4206883f4cb7 44 /*******************************************************************************
mbed_official 27:4206883f4cb7 45 Typedef definitions
mbed_official 27:4206883f4cb7 46 *******************************************************************************/
mbed_official 27:4206883f4cb7 47
mbed_official 27:4206883f4cb7 48
mbed_official 27:4206883f4cb7 49 /*******************************************************************************
mbed_official 27:4206883f4cb7 50 Macro definitions
mbed_official 27:4206883f4cb7 51 *******************************************************************************/
mbed_official 27:4206883f4cb7 52
mbed_official 27:4206883f4cb7 53
mbed_official 27:4206883f4cb7 54 /*******************************************************************************
mbed_official 27:4206883f4cb7 55 Imported global variables and functions (from other files)
mbed_official 27:4206883f4cb7 56 *******************************************************************************/
mbed_official 27:4206883f4cb7 57
mbed_official 27:4206883f4cb7 58
mbed_official 27:4206883f4cb7 59 /*******************************************************************************
mbed_official 27:4206883f4cb7 60 Exported global variables and functions (to be accessed by other files)
mbed_official 27:4206883f4cb7 61 *******************************************************************************/
mbed_official 27:4206883f4cb7 62
mbed_official 27:4206883f4cb7 63
mbed_official 27:4206883f4cb7 64 /*******************************************************************************
mbed_official 27:4206883f4cb7 65 Private global variables and functions
mbed_official 27:4206883f4cb7 66 *******************************************************************************/
mbed_official 27:4206883f4cb7 67 static void usb0_host_dmaint(uint16_t fifo);
mbed_official 27:4206883f4cb7 68 static void usb0_host_dmaint_buf2fifo(uint16_t pipe);
mbed_official 27:4206883f4cb7 69 static void usb0_host_dmaint_fifo2buf(uint16_t pipe);
mbed_official 27:4206883f4cb7 70
mbed_official 27:4206883f4cb7 71
mbed_official 27:4206883f4cb7 72 /*******************************************************************************
mbed_official 27:4206883f4cb7 73 * Function Name: usb0_host_dma_stop_d0
mbed_official 27:4206883f4cb7 74 * Description : D0FIFO DMA stop
mbed_official 27:4206883f4cb7 75 * Arguments : uint16_t pipe : pipe number
mbed_official 27:4206883f4cb7 76 * : uint32_t remain : transfer byte
mbed_official 27:4206883f4cb7 77 * Return Value : none
mbed_official 27:4206883f4cb7 78 *******************************************************************************/
mbed_official 27:4206883f4cb7 79 void usb0_host_dma_stop_d0 (uint16_t pipe, uint32_t remain)
mbed_official 27:4206883f4cb7 80 {
mbed_official 27:4206883f4cb7 81 uint16_t dtln;
mbed_official 27:4206883f4cb7 82 uint16_t dfacc;
mbed_official 27:4206883f4cb7 83 uint16_t buffer;
mbed_official 27:4206883f4cb7 84 uint16_t sds_b = 1;
mbed_official 27:4206883f4cb7 85
mbed_official 27:4206883f4cb7 86 dfacc = RZA_IO_RegRead_16(&USB200.D0FBCFG,
mbed_official 27:4206883f4cb7 87 USB_DnFBCFG_DFACC_SHIFT,
mbed_official 27:4206883f4cb7 88 USB_DnFBCFG_DFACC);
mbed_official 27:4206883f4cb7 89 if (dfacc == 2)
mbed_official 27:4206883f4cb7 90 {
mbed_official 27:4206883f4cb7 91 sds_b = 32;
mbed_official 27:4206883f4cb7 92 }
mbed_official 27:4206883f4cb7 93 else if (dfacc == 1)
mbed_official 27:4206883f4cb7 94 {
mbed_official 27:4206883f4cb7 95 sds_b = 16;
mbed_official 27:4206883f4cb7 96 }
mbed_official 27:4206883f4cb7 97 else
mbed_official 27:4206883f4cb7 98 {
mbed_official 27:4206883f4cb7 99 if (g_usb0_host_DmaInfo[USB_HOST_D0FIFO].size == 2)
mbed_official 27:4206883f4cb7 100 {
mbed_official 27:4206883f4cb7 101 sds_b = 4;
mbed_official 27:4206883f4cb7 102 }
mbed_official 27:4206883f4cb7 103 else if (g_usb0_host_DmaInfo[USB_HOST_D0FIFO].size == 1)
mbed_official 27:4206883f4cb7 104 {
mbed_official 27:4206883f4cb7 105 sds_b = 2;
mbed_official 27:4206883f4cb7 106 }
mbed_official 27:4206883f4cb7 107 else
mbed_official 27:4206883f4cb7 108 {
mbed_official 27:4206883f4cb7 109 sds_b = 1;
mbed_official 27:4206883f4cb7 110 }
mbed_official 27:4206883f4cb7 111 }
mbed_official 27:4206883f4cb7 112
mbed_official 27:4206883f4cb7 113 if (RZA_IO_RegRead_16(&g_usb0_host_pipecfg[pipe], USB_PIPECFG_BFRE_SHIFT, USB_PIPECFG_BFRE) == 1)
mbed_official 27:4206883f4cb7 114 {
mbed_official 27:4206883f4cb7 115 if (g_usb0_host_pipe_status[pipe] != USB_HOST_PIPE_DONE)
mbed_official 27:4206883f4cb7 116 {
mbed_official 27:4206883f4cb7 117 buffer = USB200.D0FIFOCTR;
mbed_official 27:4206883f4cb7 118 dtln = (buffer & USB_HOST_BITDTLN);
mbed_official 27:4206883f4cb7 119
mbed_official 27:4206883f4cb7 120 if ((dtln % sds_b) != 0)
mbed_official 27:4206883f4cb7 121 {
mbed_official 27:4206883f4cb7 122 remain += (sds_b - (dtln % sds_b));
mbed_official 27:4206883f4cb7 123 }
mbed_official 27:4206883f4cb7 124 g_usb0_host_PipeDataSize[pipe] = (g_usb0_host_data_count[pipe] - remain);
mbed_official 27:4206883f4cb7 125 g_usb0_host_data_count[pipe] = remain;
mbed_official 27:4206883f4cb7 126 }
mbed_official 27:4206883f4cb7 127 }
mbed_official 27:4206883f4cb7 128
mbed_official 27:4206883f4cb7 129 RZA_IO_RegWrite_16(&USB200.D0FIFOSEL,
mbed_official 27:4206883f4cb7 130 0,
mbed_official 27:4206883f4cb7 131 USB_DnFIFOSEL_DREQE_SHIFT,
mbed_official 27:4206883f4cb7 132 USB_DnFIFOSEL_DREQE);
mbed_official 27:4206883f4cb7 133 }
mbed_official 27:4206883f4cb7 134
mbed_official 27:4206883f4cb7 135 /*******************************************************************************
mbed_official 27:4206883f4cb7 136 * Function Name: usb0_host_dma_stop_d1
mbed_official 27:4206883f4cb7 137 * Description : D1FIFO DMA stop
mbed_official 27:4206883f4cb7 138 * Arguments : uint16_t pipe : pipe number
mbed_official 27:4206883f4cb7 139 * : uint32_t remain : transfer byte
mbed_official 27:4206883f4cb7 140 * Return Value : none
mbed_official 27:4206883f4cb7 141 *******************************************************************************/
mbed_official 27:4206883f4cb7 142 void usb0_host_dma_stop_d1 (uint16_t pipe, uint32_t remain)
mbed_official 27:4206883f4cb7 143 {
mbed_official 27:4206883f4cb7 144 uint16_t dtln;
mbed_official 27:4206883f4cb7 145 uint16_t dfacc;
mbed_official 27:4206883f4cb7 146 uint16_t buffer;
mbed_official 27:4206883f4cb7 147 uint16_t sds_b = 1;
mbed_official 27:4206883f4cb7 148
mbed_official 27:4206883f4cb7 149 dfacc = RZA_IO_RegRead_16(&USB200.D1FBCFG,
mbed_official 27:4206883f4cb7 150 USB_DnFBCFG_DFACC_SHIFT,
mbed_official 27:4206883f4cb7 151 USB_DnFBCFG_DFACC);
mbed_official 27:4206883f4cb7 152 if (dfacc == 2)
mbed_official 27:4206883f4cb7 153 {
mbed_official 27:4206883f4cb7 154 sds_b = 32;
mbed_official 27:4206883f4cb7 155 }
mbed_official 27:4206883f4cb7 156 else if (dfacc == 1)
mbed_official 27:4206883f4cb7 157 {
mbed_official 27:4206883f4cb7 158 sds_b = 16;
mbed_official 27:4206883f4cb7 159 }
mbed_official 27:4206883f4cb7 160 else
mbed_official 27:4206883f4cb7 161 {
mbed_official 27:4206883f4cb7 162 if (g_usb0_host_DmaInfo[USB_HOST_D1FIFO].size == 2)
mbed_official 27:4206883f4cb7 163 {
mbed_official 27:4206883f4cb7 164 sds_b = 4;
mbed_official 27:4206883f4cb7 165 }
mbed_official 27:4206883f4cb7 166 else if (g_usb0_host_DmaInfo[USB_HOST_D1FIFO].size == 1)
mbed_official 27:4206883f4cb7 167 {
mbed_official 27:4206883f4cb7 168 sds_b = 2;
mbed_official 27:4206883f4cb7 169 }
mbed_official 27:4206883f4cb7 170 else
mbed_official 27:4206883f4cb7 171 {
mbed_official 27:4206883f4cb7 172 sds_b = 1;
mbed_official 27:4206883f4cb7 173 }
mbed_official 27:4206883f4cb7 174 }
mbed_official 27:4206883f4cb7 175
mbed_official 27:4206883f4cb7 176 if (RZA_IO_RegRead_16(&g_usb0_host_pipecfg[pipe], USB_PIPECFG_BFRE_SHIFT, USB_PIPECFG_BFRE) == 1)
mbed_official 27:4206883f4cb7 177 {
mbed_official 27:4206883f4cb7 178 if (g_usb0_host_pipe_status[pipe] != USB_HOST_PIPE_DONE)
mbed_official 27:4206883f4cb7 179 {
mbed_official 27:4206883f4cb7 180 buffer = USB200.D1FIFOCTR;
mbed_official 27:4206883f4cb7 181 dtln = (buffer & USB_HOST_BITDTLN);
mbed_official 27:4206883f4cb7 182
mbed_official 27:4206883f4cb7 183 if ((dtln % sds_b) != 0)
mbed_official 27:4206883f4cb7 184 {
mbed_official 27:4206883f4cb7 185 remain += (sds_b - (dtln % sds_b));
mbed_official 27:4206883f4cb7 186 }
mbed_official 27:4206883f4cb7 187 g_usb0_host_PipeDataSize[pipe] = (g_usb0_host_data_count[pipe] - remain);
mbed_official 27:4206883f4cb7 188 g_usb0_host_data_count[pipe] = remain;
mbed_official 27:4206883f4cb7 189 }
mbed_official 27:4206883f4cb7 190 }
mbed_official 27:4206883f4cb7 191
mbed_official 27:4206883f4cb7 192 RZA_IO_RegWrite_16(&USB200.D1FIFOSEL,
mbed_official 27:4206883f4cb7 193 0,
mbed_official 27:4206883f4cb7 194 USB_DnFIFOSEL_DREQE_SHIFT,
mbed_official 27:4206883f4cb7 195 USB_DnFIFOSEL_DREQE);
mbed_official 27:4206883f4cb7 196 }
mbed_official 27:4206883f4cb7 197
mbed_official 27:4206883f4cb7 198 /*******************************************************************************
mbed_official 27:4206883f4cb7 199 * Function Name: usb0_host_dma_interrupt_d0fifo
mbed_official 27:4206883f4cb7 200 * Description : This function is DMA interrupt handler entry.
mbed_official 27:4206883f4cb7 201 * : Execute usb1_host_dmaint() after disabling DMA interrupt in this function.
mbed_official 27:4206883f4cb7 202 * : Disable DMA interrupt to DMAC executed when USB_HOST_D0FIFO_DMA is
mbed_official 27:4206883f4cb7 203 * : specified by dma->fifo.
mbed_official 27:4206883f4cb7 204 * : Register this function as DMA complete interrupt.
mbed_official 27:4206883f4cb7 205 * Arguments : uint32_t int_sense ; Interrupts detection mode
mbed_official 27:4206883f4cb7 206 * : ; INTC_LEVEL_SENSITIVE : Level sense
mbed_official 27:4206883f4cb7 207 * : ; INTC_EDGE_TRIGGER : Edge trigger
mbed_official 27:4206883f4cb7 208 * Return Value : none
mbed_official 27:4206883f4cb7 209 *******************************************************************************/
mbed_official 27:4206883f4cb7 210 void usb0_host_dma_interrupt_d0fifo (uint32_t int_sense)
mbed_official 27:4206883f4cb7 211 {
mbed_official 27:4206883f4cb7 212 usb0_host_dmaint(USB_HOST_D0FIFO);
mbed_official 27:4206883f4cb7 213 g_usb0_host_DmaStatus[USB_HOST_D0FIFO] = USB_HOST_DMA_READY;
mbed_official 27:4206883f4cb7 214 }
mbed_official 27:4206883f4cb7 215
mbed_official 27:4206883f4cb7 216 /*******************************************************************************
mbed_official 27:4206883f4cb7 217 * Function Name: usb0_host_dma_interrupt_d1fifo
mbed_official 27:4206883f4cb7 218 * Description : This function is DMA interrupt handler entry.
mbed_official 27:4206883f4cb7 219 * : Execute usb0_host_dmaint() after disabling DMA interrupt in this function.
mbed_official 27:4206883f4cb7 220 * : Disable DMA interrupt to DMAC executed when USB_HOST_D1FIFO_DMA is
mbed_official 27:4206883f4cb7 221 * : specified by dma->fifo.
mbed_official 27:4206883f4cb7 222 * : Register this function as DMA complete interrupt.
mbed_official 27:4206883f4cb7 223 * Arguments : uint32_t int_sense ; Interrupts detection mode
mbed_official 27:4206883f4cb7 224 * : ; INTC_LEVEL_SENSITIVE : Level sense
mbed_official 27:4206883f4cb7 225 * : ; INTC_EDGE_TRIGGER : Edge trigger
mbed_official 27:4206883f4cb7 226 * Return Value : none
mbed_official 27:4206883f4cb7 227 *******************************************************************************/
mbed_official 27:4206883f4cb7 228 void usb0_host_dma_interrupt_d1fifo (uint32_t int_sense)
mbed_official 27:4206883f4cb7 229 {
mbed_official 27:4206883f4cb7 230 usb0_host_dmaint(USB_HOST_D1FIFO);
mbed_official 27:4206883f4cb7 231 g_usb0_host_DmaStatus[USB_HOST_D1FIFO] = USB_HOST_DMA_READY;
mbed_official 27:4206883f4cb7 232 }
mbed_official 27:4206883f4cb7 233
mbed_official 27:4206883f4cb7 234 /*******************************************************************************
mbed_official 27:4206883f4cb7 235 * Function Name: usb0_host_dmaint
mbed_official 27:4206883f4cb7 236 * Description : This function is DMA transfer end interrupt
mbed_official 27:4206883f4cb7 237 * Arguments : uint16_t fifo ; fifo number
mbed_official 27:4206883f4cb7 238 * : ; USB_HOST_D0FIFO
mbed_official 27:4206883f4cb7 239 * : ; USB_HOST_D1FIFO
mbed_official 27:4206883f4cb7 240 * Return Value : none
mbed_official 27:4206883f4cb7 241 *******************************************************************************/
mbed_official 27:4206883f4cb7 242 static void usb0_host_dmaint (uint16_t fifo)
mbed_official 27:4206883f4cb7 243 {
mbed_official 27:4206883f4cb7 244 uint16_t pipe;
mbed_official 27:4206883f4cb7 245
mbed_official 27:4206883f4cb7 246 pipe = g_usb0_host_DmaPipe[fifo];
mbed_official 27:4206883f4cb7 247
mbed_official 27:4206883f4cb7 248 if (g_usb0_host_DmaInfo[fifo].dir == USB_HOST_BUF2FIFO)
mbed_official 27:4206883f4cb7 249 {
mbed_official 27:4206883f4cb7 250 usb0_host_dmaint_buf2fifo(pipe);
mbed_official 27:4206883f4cb7 251 }
mbed_official 27:4206883f4cb7 252 else
mbed_official 27:4206883f4cb7 253 {
mbed_official 27:4206883f4cb7 254 usb0_host_dmaint_fifo2buf(pipe);
mbed_official 27:4206883f4cb7 255 }
mbed_official 27:4206883f4cb7 256 }
mbed_official 27:4206883f4cb7 257
mbed_official 27:4206883f4cb7 258 /*******************************************************************************
mbed_official 27:4206883f4cb7 259 * Function Name: usb0_host_dmaint_fifo2buf
mbed_official 27:4206883f4cb7 260 * Description : Executes read completion from FIFO by DMAC.
mbed_official 27:4206883f4cb7 261 * Arguments : uint16_t pipe : pipe number
mbed_official 27:4206883f4cb7 262 * Return Value : none
mbed_official 27:4206883f4cb7 263 *******************************************************************************/
mbed_official 27:4206883f4cb7 264 static void usb0_host_dmaint_fifo2buf (uint16_t pipe)
mbed_official 27:4206883f4cb7 265 {
mbed_official 27:4206883f4cb7 266 uint32_t remain;
mbed_official 27:4206883f4cb7 267 uint16_t useport;
mbed_official 27:4206883f4cb7 268
mbed_official 27:4206883f4cb7 269 if (g_usb0_host_pipe_status[pipe] != USB_HOST_PIPE_DONE)
mbed_official 27:4206883f4cb7 270 {
mbed_official 27:4206883f4cb7 271 useport = (uint16_t)(g_usb0_host_PipeTbl[pipe] & USB_HOST_FIFO_USE);
mbed_official 27:4206883f4cb7 272
mbed_official 27:4206883f4cb7 273 if (useport == USB_HOST_D0FIFO_DMA)
mbed_official 27:4206883f4cb7 274 {
mbed_official 27:4206883f4cb7 275 remain = Userdef_USB_usb0_host_stop_dma0();
mbed_official 27:4206883f4cb7 276 usb0_host_dma_stop_d0(pipe, remain);
mbed_official 27:4206883f4cb7 277
mbed_official 27:4206883f4cb7 278 if (RZA_IO_RegRead_16(&g_usb0_host_pipecfg[pipe], USB_PIPECFG_BFRE_SHIFT, USB_PIPECFG_BFRE) == 0)
mbed_official 27:4206883f4cb7 279 {
mbed_official 27:4206883f4cb7 280 if (g_usb0_host_DmaStatus[USB_HOST_D0FIFO] == USB_HOST_DMA_BUSYEND)
mbed_official 27:4206883f4cb7 281 {
mbed_official 27:4206883f4cb7 282 USB200.D0FIFOCTR = USB_HOST_BITBCLR;
mbed_official 27:4206883f4cb7 283 g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_DONE;
mbed_official 27:4206883f4cb7 284 }
mbed_official 27:4206883f4cb7 285 else
mbed_official 27:4206883f4cb7 286 {
mbed_official 27:4206883f4cb7 287 usb0_host_enable_brdy_int(pipe);
mbed_official 27:4206883f4cb7 288 }
mbed_official 27:4206883f4cb7 289 }
mbed_official 27:4206883f4cb7 290 }
mbed_official 27:4206883f4cb7 291 else
mbed_official 27:4206883f4cb7 292 {
mbed_official 27:4206883f4cb7 293 remain = Userdef_USB_usb0_host_stop_dma1();
mbed_official 27:4206883f4cb7 294 usb0_host_dma_stop_d1(pipe, remain);
mbed_official 27:4206883f4cb7 295
mbed_official 27:4206883f4cb7 296 if (RZA_IO_RegRead_16(&g_usb0_host_pipecfg[pipe], USB_PIPECFG_BFRE_SHIFT, USB_PIPECFG_BFRE) == 0)
mbed_official 27:4206883f4cb7 297 {
mbed_official 27:4206883f4cb7 298 if (g_usb0_host_DmaStatus[USB_HOST_D1FIFO] == USB_HOST_DMA_BUSYEND)
mbed_official 27:4206883f4cb7 299 {
mbed_official 27:4206883f4cb7 300 USB200.D1FIFOCTR = USB_HOST_BITBCLR;
mbed_official 27:4206883f4cb7 301 g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_DONE;
mbed_official 27:4206883f4cb7 302 }
mbed_official 27:4206883f4cb7 303 else
mbed_official 27:4206883f4cb7 304 {
mbed_official 27:4206883f4cb7 305 usb0_host_enable_brdy_int(pipe);
mbed_official 27:4206883f4cb7 306 }
mbed_official 27:4206883f4cb7 307 }
mbed_official 27:4206883f4cb7 308 }
mbed_official 27:4206883f4cb7 309 }
mbed_official 27:4206883f4cb7 310 }
mbed_official 27:4206883f4cb7 311
mbed_official 27:4206883f4cb7 312 /*******************************************************************************
mbed_official 27:4206883f4cb7 313 * Function Name: usb0_host_dmaint_buf2fifo
mbed_official 27:4206883f4cb7 314 * Description : Executes write completion in FIFO by DMAC.
mbed_official 27:4206883f4cb7 315 * Arguments : uint16_t pipe : pipe number
mbed_official 27:4206883f4cb7 316 * Return Value : none
mbed_official 27:4206883f4cb7 317 *******************************************************************************/
mbed_official 27:4206883f4cb7 318 static void usb0_host_dmaint_buf2fifo (uint16_t pipe)
mbed_official 27:4206883f4cb7 319 {
mbed_official 27:4206883f4cb7 320 uint16_t useport;
mbed_official 27:4206883f4cb7 321 uint32_t remain;
mbed_official 27:4206883f4cb7 322
mbed_official 27:4206883f4cb7 323 useport = (uint16_t)(g_usb0_host_PipeTbl[pipe] & USB_HOST_FIFO_USE);
mbed_official 27:4206883f4cb7 324
mbed_official 27:4206883f4cb7 325 if (useport == USB_HOST_D0FIFO_DMA)
mbed_official 27:4206883f4cb7 326 {
mbed_official 27:4206883f4cb7 327 remain = Userdef_USB_usb0_host_stop_dma0();
mbed_official 27:4206883f4cb7 328 usb0_host_dma_stop_d0(pipe, remain);
mbed_official 27:4206883f4cb7 329
mbed_official 27:4206883f4cb7 330 if (g_usb0_host_DmaBval[USB_HOST_D0FIFO] != 0)
mbed_official 27:4206883f4cb7 331 {
mbed_official 27:4206883f4cb7 332 RZA_IO_RegWrite_16(&USB200.D0FIFOCTR,
mbed_official 27:4206883f4cb7 333 1,
mbed_official 27:4206883f4cb7 334 USB_DnFIFOCTR_BVAL_SHIFT,
mbed_official 27:4206883f4cb7 335 USB_DnFIFOCTR_BVAL);
mbed_official 27:4206883f4cb7 336 }
mbed_official 27:4206883f4cb7 337 }
mbed_official 27:4206883f4cb7 338 else
mbed_official 27:4206883f4cb7 339 {
mbed_official 27:4206883f4cb7 340 remain = Userdef_USB_usb0_host_stop_dma1();
mbed_official 27:4206883f4cb7 341 usb0_host_dma_stop_d1(pipe, remain);
mbed_official 27:4206883f4cb7 342
mbed_official 27:4206883f4cb7 343 if (g_usb0_host_DmaBval[USB_HOST_D1FIFO] != 0)
mbed_official 27:4206883f4cb7 344 {
mbed_official 27:4206883f4cb7 345 RZA_IO_RegWrite_16(&USB200.D1FIFOCTR,
mbed_official 27:4206883f4cb7 346 1,
mbed_official 27:4206883f4cb7 347 USB_DnFIFOCTR_BVAL_SHIFT,
mbed_official 27:4206883f4cb7 348 USB_DnFIFOCTR_BVAL);
mbed_official 27:4206883f4cb7 349 }
mbed_official 27:4206883f4cb7 350 }
mbed_official 27:4206883f4cb7 351
mbed_official 27:4206883f4cb7 352 usb0_host_enable_bemp_int(pipe);
mbed_official 27:4206883f4cb7 353 }
mbed_official 27:4206883f4cb7 354
mbed_official 27:4206883f4cb7 355 /* End of File */