forked for unsupported target
Dependents: stm32-disco-example DISCO-F469NI_BD_SD_Card_Control
Fork of USBHOST by
USBHost/TARGET_RENESAS/TARGET_VK_RZ_A1H/usb0/src/common/usb0_host_intrn.c@7:75f3e275934b, 2017-08-08 (annotated)
- Committer:
- bcjun@aname.co.kr
- Date:
- Tue Aug 08 16:20:39 2017 +0900
- Revision:
- 7:75f3e275934b
- Parent:
- 1:ab240722d7ef
change usbhost library that forked in my account
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 1 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 2 | * DISCLAIMER |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 3 | * This software is supplied by Renesas Electronics Corporation and is only |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 4 | * intended for use with Renesas products. No other uses are authorized. This |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 5 | * software is owned by Renesas Electronics Corporation and is protected under |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 6 | * all applicable laws, including copyright laws. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 7 | * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 8 | * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 9 | * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 10 | * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 11 | * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 12 | * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 13 | * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 14 | * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 15 | * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 16 | * Renesas reserves the right, without notice, to make changes to this software |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 17 | * and to discontinue the availability of this software. By using this software, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 18 | * you agree to the additional terms and conditions found by accessing the |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 19 | * following link: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 20 | * http://www.renesas.com/disclaimer |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 21 | * Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 22 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 23 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 24 | * File Name : usb0_host_intrn.c |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 25 | * $Rev: 1116 $ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 26 | * $Date:: 2014-07-09 16:29:19 +0900#$ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 27 | * Device(s) : RZ/A1H |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 28 | * Tool-Chain : |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 29 | * OS : None |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 30 | * H/W Platform : |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 31 | * Description : RZ/A1H R7S72100 USB Sample Program |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 32 | * Operation : |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 33 | * Limitations : |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 34 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 35 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 36 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 37 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 38 | Includes <System Includes> , "Project Includes" |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 39 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 40 | #include "usb0_host.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 41 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 42 | #include "ohci_wrapp_RZ_A1_local.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 43 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 44 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 45 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 46 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 47 | Typedef definitions |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 48 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 49 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 50 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 51 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 52 | Macro definitions |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 53 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 54 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 55 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 56 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 57 | Imported global variables and functions (from other files) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 58 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 59 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 60 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 61 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 62 | Exported global variables and functions (to be accessed by other files) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 63 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 64 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 65 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 66 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 67 | Private global variables and functions |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 68 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 69 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 70 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 71 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 72 | * Function Name: usb0_host_brdy_int |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 73 | * Description : Executes BRDY interrupt(USB_HOST_PIPE1-9). |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 74 | * : According to the pipe that interrupt is generated in, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 75 | * : reads/writes buffer allocated in the pipe. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 76 | * : This function is executed in the BRDY interrupt handler. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 77 | * : This function clears BRDY interrupt status and BEMP interrupt |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 78 | * : status. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 79 | * Arguments : uint16_t status ; BRDYSTS Register Value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 80 | * : uint16_t int_enb ; BRDYENB Register Value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 81 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 82 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 83 | void usb0_host_brdy_int (uint16_t status, uint16_t int_enb) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 84 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 85 | uint32_t int_sense = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 86 | uint16_t pipe; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 87 | uint16_t pipebit; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 88 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 89 | for (pipe = USB_HOST_PIPE1; pipe <= USB_HOST_MAX_PIPE_NO; pipe++) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 90 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 91 | pipebit = g_usb0_host_bit_set[pipe]; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 92 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 93 | if ((status & pipebit) && (int_enb & pipebit)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 94 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 95 | USB200.BRDYSTS = (uint16_t)~pipebit; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 96 | USB200.BEMPSTS = (uint16_t)~pipebit; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 97 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 98 | if ((g_usb0_host_PipeTbl[pipe] & USB_HOST_FIFO_USE) == USB_HOST_D0FIFO_DMA) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 99 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 100 | if (g_usb0_host_DmaStatus[USB_HOST_D0FIFO] != USB_HOST_DMA_READY) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 101 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 102 | usb0_host_dma_interrupt_d0fifo(int_sense); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 103 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 104 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 105 | if (RZA_IO_RegRead_16(&g_usb0_host_pipecfg[pipe], USB_PIPECFG_BFRE_SHIFT, USB_PIPECFG_BFRE) == 0) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 106 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 107 | usb0_host_read_dma(pipe); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 108 | usb0_host_disable_brdy_int(pipe); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 109 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 110 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 111 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 112 | USB200.D0FIFOCTR = USB_HOST_BITBCLR; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 113 | g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_DONE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 114 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 115 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 116 | else if ((g_usb0_host_PipeTbl[pipe] & USB_HOST_FIFO_USE) == USB_HOST_D1FIFO_DMA) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 117 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 118 | if (g_usb0_host_DmaStatus[USB_HOST_D1FIFO] != USB_HOST_DMA_READY) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 119 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 120 | usb0_host_dma_interrupt_d1fifo(int_sense); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 121 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 122 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 123 | if (RZA_IO_RegRead_16(&g_usb0_host_pipecfg[pipe], USB_PIPECFG_BFRE_SHIFT, USB_PIPECFG_BFRE) == 0) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 124 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 125 | usb0_host_read_dma(pipe); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 126 | usb0_host_disable_brdy_int(pipe); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 127 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 128 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 129 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 130 | USB200.D1FIFOCTR = USB_HOST_BITBCLR; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 131 | g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_DONE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 132 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 133 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 134 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 135 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 136 | if (RZA_IO_RegRead_16(&g_usb0_host_pipecfg[pipe], USB_PIPECFG_DIR_SHIFT, USB_PIPECFG_DIR) == 0) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 137 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 138 | usb0_host_read_buffer(pipe); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 139 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 140 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 141 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 142 | usb0_host_write_buffer(pipe); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 143 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 144 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 145 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 146 | switch (g_usb0_host_pipe_status[pipe]) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 147 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 148 | case USB_HOST_PIPE_DONE: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 149 | ohciwrapp_loc_TransEnd(pipe, TD_CC_NOERROR); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 150 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 151 | case USB_HOST_PIPE_NORES: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 152 | case USB_HOST_PIPE_STALL: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 153 | case USB_HOST_PIPE_ERROR: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 154 | ohciwrapp_loc_TransEnd(pipe, TD_CC_STALL); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 155 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 156 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 157 | /* Do Nothing */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 158 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 159 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 160 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 161 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 162 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 163 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 164 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 165 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 166 | * Function Name: usb0_host_nrdy_int |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 167 | * Description : Executes NRDY interrupt(USB_HOST_PIPE1-9). |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 168 | * : Checks NRDY interrupt cause by PID. When the cause if STALL, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 169 | * : regards the pipe state as STALL and ends the processing. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 170 | * : Then the cause is not STALL, increments the error count to |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 171 | * : communicate again. When the error count is 3, determines |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 172 | * : the pipe state as USB_HOST_PIPE_NORES and ends the processing. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 173 | * : This function is executed in the NRDY interrupt handler. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 174 | * : This function clears NRDY interrupt status. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 175 | * Arguments : uint16_t status ; NRDYSTS Register Value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 176 | * : uint16_t int_enb ; NRDYENB Register Value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 177 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 178 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 179 | void usb0_host_nrdy_int (uint16_t status, uint16_t int_enb) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 180 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 181 | uint16_t pid; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 182 | uint16_t pipe; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 183 | uint16_t bitcheck; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 184 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 185 | bitcheck = (uint16_t)(status & int_enb); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 186 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 187 | USB200.NRDYSTS = (uint16_t)~status; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 188 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 189 | for (pipe = USB_HOST_PIPE1; pipe <= USB_HOST_MAX_PIPE_NO; pipe++) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 190 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 191 | if ((bitcheck&g_usb0_host_bit_set[pipe]) == g_usb0_host_bit_set[pipe]) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 192 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 193 | if (RZA_IO_RegRead_16(&USB200.SYSCFG0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 194 | USB_SYSCFG_DCFM_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 195 | USB_SYSCFG_DCFM) == 1) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 196 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 197 | if (g_usb0_host_pipe_status[pipe] == USB_HOST_PIPE_WAIT) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 198 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 199 | pid = usb0_host_get_pid(pipe); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 200 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 201 | if ((pid == USB_HOST_PID_STALL) || (pid == USB_HOST_PID_STALL2)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 202 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 203 | g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_STALL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 204 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 205 | ohciwrapp_loc_TransEnd(pipe, TD_CC_STALL); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 206 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 207 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 208 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 209 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 210 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 211 | g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_NORES; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 212 | ohciwrapp_loc_TransEnd(pipe, TD_CC_DEVICENOTRESPONDING); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 213 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 214 | g_usb0_host_PipeIgnore[pipe]++; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 215 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 216 | if (g_usb0_host_PipeIgnore[pipe] == 3) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 217 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 218 | g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_NORES; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 219 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 220 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 221 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 222 | usb0_host_set_pid_buf(pipe); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 223 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 224 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 225 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 226 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 227 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 228 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 229 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 230 | /* USB Function */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 231 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 232 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 233 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 234 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 235 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 236 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 237 | * Function Name: usb0_host_bemp_int |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 238 | * Description : Executes BEMP interrupt(USB_HOST_PIPE1-9). |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 239 | * Arguments : uint16_t status ; BEMPSTS Register Value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 240 | * : uint16_t int_enb ; BEMPENB Register Value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 241 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 242 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 243 | void usb0_host_bemp_int (uint16_t status, uint16_t int_enb) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 244 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 245 | uint16_t pid; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 246 | uint16_t pipe; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 247 | uint16_t bitcheck; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 248 | uint16_t inbuf; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 249 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 250 | bitcheck = (uint16_t)(status & int_enb); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 251 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 252 | USB200.BEMPSTS = (uint16_t)~status; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 253 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 254 | for (pipe = USB_HOST_PIPE1; pipe <= USB_HOST_MAX_PIPE_NO; pipe++) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 255 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 256 | if ((bitcheck&g_usb0_host_bit_set[pipe]) == g_usb0_host_bit_set[pipe]) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 257 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 258 | pid = usb0_host_get_pid(pipe); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 259 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 260 | if ((pid == USB_HOST_PID_STALL) || (pid == USB_HOST_PID_STALL2)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 261 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 262 | g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_STALL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 263 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 264 | ohciwrapp_loc_TransEnd(pipe, TD_CC_STALL); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 265 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 266 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 267 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 268 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 269 | inbuf = usb0_host_get_inbuf(pipe); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 270 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 271 | if (inbuf == 0) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 272 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 273 | usb0_host_disable_bemp_int(pipe); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 274 | usb0_host_set_pid_nak(pipe); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 275 | g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_DONE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 276 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 277 | ohciwrapp_loc_TransEnd(pipe, TD_CC_NOERROR); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 278 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 279 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 280 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 281 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 282 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 283 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 284 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 285 | /* End of File */ |