forked for unsupported target
Dependents: stm32-disco-example DISCO-F469NI_BD_SD_Card_Control
Fork of USBHOST by
USBHost/TARGET_RENESAS/TARGET_RZ_A1H/usb0/src/host/usb0_host_usbint.c@1:ab240722d7ef, 2017-02-15 (annotated)
- Committer:
- frq08711@LMECWL0871.LME.ST.COM
- Date:
- Wed Feb 15 10:49:44 2017 +0100
- Revision:
- 1:ab240722d7ef
update to mbed 5.3.5
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_usbint.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 | static void usb0_host_interrupt1(void); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 65 | static void usb0_host_BRDYInterrupt(uint16_t Status, uint16_t Int_enbl); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 66 | static void usb0_host_NRDYInterrupt(uint16_t Status, uint16_t Int_enbl); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 67 | static void usb0_host_BEMPInterrupt(uint16_t Status, uint16_t Int_enbl); |
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 | Private global variables and functions |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 72 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 73 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 74 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 75 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 76 | * Function Name: usb0_host_interrupt |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 77 | * Description : Executes USB interrupt. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 78 | * : Register this function in the USB interrupt handler. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 79 | * : Set CFIF0 in the pipe set before the interrupt after executing |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 80 | * : this function. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 81 | * Arguments : uint32_t int_sense ; Interrupts detection mode |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 82 | * : ; INTC_LEVEL_SENSITIVE : Level sense |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 83 | * : ; INTC_EDGE_TRIGGER : Edge trigger |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 84 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 85 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 86 | void usb0_host_interrupt (uint32_t int_sense) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 87 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 88 | uint16_t savepipe1; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 89 | uint16_t savepipe2; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 90 | uint16_t buffer; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 91 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 92 | savepipe1 = USB200.CFIFOSEL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 93 | savepipe2 = USB200.PIPESEL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 94 | usb0_host_interrupt1(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 95 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 96 | /* Control transmission changes ISEL within interruption processing. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 97 | /* For this reason, write return of ISEL cannot be performed. */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 98 | buffer = USB200.CFIFOSEL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 99 | buffer &= (uint16_t)~(USB_HOST_BITCURPIPE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 100 | buffer |= (uint16_t)(savepipe1 & USB_HOST_BITCURPIPE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 101 | USB200.CFIFOSEL = buffer; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 102 | USB200.PIPESEL = savepipe2; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 103 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 104 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 105 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 106 | * Function Name: usb0_host_interrupt1 |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 107 | * Description : Execue the USB interrupt. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 108 | * Arguments : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 109 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 110 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 111 | void usb0_host_interrupt1 (void) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 112 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 113 | uint16_t intsts0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 114 | uint16_t intsts1; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 115 | uint16_t intenb0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 116 | uint16_t intenb1; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 117 | uint16_t brdysts; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 118 | uint16_t nrdysts; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 119 | uint16_t bempsts; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 120 | uint16_t brdyenb; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 121 | uint16_t nrdyenb; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 122 | uint16_t bempenb; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 123 | volatile uint16_t dumy_sts; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 124 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 125 | intsts0 = USB200.INTSTS0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 126 | intsts1 = USB200.INTSTS1; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 127 | intenb0 = USB200.INTENB0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 128 | intenb1 = USB200.INTENB1; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 129 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 130 | if ((intsts1 & USB_HOST_BITBCHG) && (intenb1 & USB_HOST_BITBCHGE)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 131 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 132 | USB200.INTSTS1 = (uint16_t)~USB_HOST_BITBCHG; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 133 | RZA_IO_RegWrite_16(&USB200.INTENB1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 134 | 0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 135 | USB_INTENB1_BCHGE_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 136 | USB_INTENB1_BCHGE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 137 | g_usb0_host_bchg_flag = USB_HOST_YES; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 138 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 139 | else if ((intsts1 & USB_HOST_BITSACK) && (intenb1 & USB_HOST_BITSACKE)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 140 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 141 | USB200.INTSTS1 = (uint16_t)~USB_HOST_BITSACK; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 142 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 143 | ohciwrapp_loc_TransEnd(USB_HOST_PIPE0, TD_CC_NOERROR); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 144 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 145 | g_usb0_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 146 | g_usb0_host_CmdStage |= USB_HOST_CMD_DONE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 147 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 148 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 149 | else if ((intsts1 & USB_HOST_BITSIGN) && (intenb1 & USB_HOST_BITSIGNE)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 150 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 151 | USB200.INTSTS1 = (uint16_t)~USB_HOST_BITSIGN; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 152 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 153 | g_usb0_host_pipe_status[USB_HOST_PIPE0] = USB_HOST_PIPE_NORES; /* exit NORES */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 154 | ohciwrapp_loc_TransEnd(USB_HOST_PIPE0, TD_CC_STALL); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 155 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 156 | g_usb0_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 157 | g_usb0_host_CmdStage |= USB_HOST_CMD_NORES; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 158 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 159 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 160 | else if (((intsts1 & USB_HOST_BITDTCH) == USB_HOST_BITDTCH) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 161 | && ((intenb1 & USB_HOST_BITDTCHE) == USB_HOST_BITDTCHE)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 162 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 163 | USB200.INTSTS1 = (uint16_t)~USB_HOST_BITDTCH; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 164 | RZA_IO_RegWrite_16(&USB200.INTENB1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 165 | 0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 166 | USB_INTENB1_DTCHE_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 167 | USB_INTENB1_DTCHE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 168 | g_usb0_host_detach_flag = USB_HOST_YES; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 169 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 170 | Userdef_USB_usb0_host_detach(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 171 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 172 | usb0_host_UsbDetach2(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 173 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 174 | else if (((intsts1 & USB_HOST_BITATTCH) == USB_HOST_BITATTCH) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 175 | && ((intenb1 & USB_HOST_BITATTCHE) == USB_HOST_BITATTCHE)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 176 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 177 | USB200.INTSTS1 = (uint16_t)~USB_HOST_BITATTCH; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 178 | RZA_IO_RegWrite_16(&USB200.INTENB1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 179 | 0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 180 | USB_INTENB1_ATTCHE_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 181 | USB_INTENB1_ATTCHE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 182 | g_usb0_host_attach_flag = USB_HOST_YES; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 183 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 184 | Userdef_USB_usb0_host_attach(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 185 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 186 | usb0_host_UsbAttach(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 187 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 188 | else if ((intsts0 & intenb0 & (USB_HOST_BITBEMP | USB_HOST_BITNRDY | USB_HOST_BITBRDY))) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 189 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 190 | brdysts = USB200.BRDYSTS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 191 | nrdysts = USB200.NRDYSTS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 192 | bempsts = USB200.BEMPSTS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 193 | brdyenb = USB200.BRDYENB; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 194 | nrdyenb = USB200.NRDYENB; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 195 | bempenb = USB200.BEMPENB; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 196 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 197 | if ((intsts0 & USB_HOST_BITBRDY) && (intenb0 & USB_HOST_BITBRDYE) && (brdysts & brdyenb)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 198 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 199 | usb0_host_BRDYInterrupt(brdysts, brdyenb); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 200 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 201 | else if ((intsts0 & USB_HOST_BITBEMP) && (intenb0 & USB_HOST_BITBEMPE) && (bempsts & bempenb)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 202 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 203 | usb0_host_BEMPInterrupt(bempsts, bempenb); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 204 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 205 | else if ((intsts0 & USB_HOST_BITNRDY) && (intenb0 & USB_HOST_BITNRDYE) && (nrdysts & nrdyenb)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 206 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 207 | usb0_host_NRDYInterrupt(nrdysts, nrdyenb); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 208 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 209 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 210 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 211 | /* Do Nothing */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 212 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 213 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 214 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 215 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 216 | /* Do Nothing */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 217 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 218 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 219 | /* Three dummy read for clearing interrupt requests */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 220 | dumy_sts = USB200.INTSTS0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 221 | dumy_sts = USB200.INTSTS1; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 222 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 223 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 224 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 225 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 226 | * Function Name: usb0_host_BRDYInterrupt |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 227 | * Description : Executes USB BRDY interrupt. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 228 | * Arguments : uint16_t Status ; BRDYSTS Register Value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 229 | * : uint16_t Int_enbl ; BRDYENB Register Value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 230 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 231 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 232 | void usb0_host_BRDYInterrupt (uint16_t Status, uint16_t Int_enbl) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 233 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 234 | uint16_t buffer; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 235 | volatile uint16_t dumy_sts; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 236 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 237 | if ((Status & g_usb0_host_bit_set[USB_HOST_PIPE0]) && (Int_enbl & g_usb0_host_bit_set[USB_HOST_PIPE0])) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 238 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 239 | USB200.BRDYSTS = (uint16_t)~g_usb0_host_bit_set[USB_HOST_PIPE0]; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 240 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 241 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 242 | switch ((g_usb0_host_CmdStage & (USB_HOST_STAGE_FIELD | USB_HOST_CMD_FIELD))) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 243 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 244 | case (USB_HOST_STAGE_STATUS | USB_HOST_CMD_DOING): |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 245 | buffer = usb0_host_read_buffer_c(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 246 | usb0_host_disable_brdy_int(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 247 | g_usb0_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 248 | g_usb0_host_CmdStage |= USB_HOST_CMD_DONE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 249 | ohciwrapp_loc_TransEnd(USB_HOST_PIPE0, TD_CC_NOERROR); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 250 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 251 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 252 | case (USB_HOST_STAGE_DATA | USB_HOST_CMD_DOING): |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 253 | buffer = usb0_host_read_buffer_c(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 254 | switch (buffer) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 255 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 256 | case USB_HOST_READING: /* Continue of data read */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 257 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 258 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 259 | case USB_HOST_READEND: /* End of data read */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 260 | case USB_HOST_READSHRT: /* End of data read */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 261 | usb0_host_disable_brdy_int(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 262 | g_usb0_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 263 | g_usb0_host_CmdStage |= USB_HOST_CMD_DONE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 264 | ohciwrapp_loc_TransEnd(USB_HOST_PIPE0, TD_CC_NOERROR); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 265 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 266 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 267 | case USB_HOST_READOVER: /* buffer over */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 268 | USB200.CFIFOCTR = USB_HOST_BITBCLR; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 269 | usb0_host_disable_brdy_int(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 270 | g_usb0_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 271 | g_usb0_host_CmdStage |= USB_HOST_CMD_DONE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 272 | ohciwrapp_loc_TransEnd(USB_HOST_PIPE0, TD_CC_NOERROR); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 273 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 274 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 275 | case USB_HOST_FIFOERROR: /* FIFO access error */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 276 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 277 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 278 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 279 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 280 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 281 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 282 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 283 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 284 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 285 | switch ((g_usb0_host_CmdStage & (USB_HOST_MODE_FIELD | USB_HOST_STAGE_FIELD | USB_HOST_CMD_FIELD))) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 286 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 287 | case (USB_HOST_MODE_WRITE | USB_HOST_STAGE_STATUS | USB_HOST_CMD_DOING): |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 288 | case (USB_HOST_MODE_NO_DATA | USB_HOST_STAGE_STATUS | USB_HOST_CMD_DOING): |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 289 | buffer = usb0_host_read_buffer_c(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 290 | usb0_host_disable_brdy_int(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 291 | g_usb0_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 292 | g_usb0_host_CmdStage |= USB_HOST_CMD_DONE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 293 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 294 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 295 | case (USB_HOST_MODE_READ | USB_HOST_STAGE_DATA | USB_HOST_CMD_DOING): |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 296 | buffer = usb0_host_read_buffer_c(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 297 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 298 | switch (buffer) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 299 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 300 | case USB_HOST_READING: /* Continue of data read */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 301 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 302 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 303 | case USB_HOST_READEND: /* End of data read */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 304 | case USB_HOST_READSHRT: /* End of data read */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 305 | usb0_host_disable_brdy_int(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 306 | g_usb0_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 307 | g_usb0_host_CmdStage |= USB_HOST_CMD_DONE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 308 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 309 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 310 | case USB_HOST_READOVER: /* buffer over */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 311 | USB200.CFIFOCTR = USB_HOST_BITBCLR; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 312 | usb0_host_disable_brdy_int(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 313 | g_usb0_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 314 | g_usb0_host_CmdStage |= USB_HOST_CMD_DONE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 315 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 316 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 317 | case USB_HOST_FIFOERROR: /* FIFO access error */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 318 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 319 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 320 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 321 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 322 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 323 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 324 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 325 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 326 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 327 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 328 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 329 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 330 | usb0_host_brdy_int(Status, Int_enbl); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 331 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 332 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 333 | /* Three dummy reads for clearing interrupt requests */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 334 | dumy_sts = USB200.BRDYSTS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 335 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 336 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 337 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 338 | * Function Name: usb0_host_NRDYInterrupt |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 339 | * Description : Executes USB NRDY interrupt. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 340 | * Arguments : uint16_t Status ; NRDYSTS Register Value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 341 | * : uint16_t Int_enbl ; NRDYENB Register Value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 342 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 343 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 344 | void usb0_host_NRDYInterrupt (uint16_t Status, uint16_t Int_enbl) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 345 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 346 | uint16_t pid; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 347 | volatile uint16_t dumy_sts; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 348 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 349 | if ((Status & g_usb0_host_bit_set[USB_HOST_PIPE0]) && (Int_enbl & g_usb0_host_bit_set[USB_HOST_PIPE0])) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 350 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 351 | USB200.NRDYSTS = (uint16_t)~g_usb0_host_bit_set[USB_HOST_PIPE0]; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 352 | pid = usb0_host_get_pid(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 353 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 354 | if ((pid == USB_HOST_PID_STALL) || (pid == USB_HOST_PID_STALL2)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 355 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 356 | g_usb0_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 357 | g_usb0_host_CmdStage |= USB_HOST_CMD_STALL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 358 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 359 | g_usb0_host_pipe_status[USB_HOST_PIPE0] = USB_HOST_PIPE_STALL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 360 | ohciwrapp_loc_TransEnd(USB_HOST_PIPE0, TD_CC_STALL); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 361 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 362 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 363 | else if (pid == USB_HOST_PID_NAK) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 364 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 365 | g_usb0_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 366 | g_usb0_host_CmdStage |= USB_HOST_CMD_NORES; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 367 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 368 | g_usb0_host_pipe_status[USB_HOST_PIPE0] = USB_HOST_PIPE_NORES; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 369 | ohciwrapp_loc_TransEnd(USB_HOST_PIPE0, TD_CC_STALL); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 370 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 371 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 372 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 373 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 374 | /* Do Nothing */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 375 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 376 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 377 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 378 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 379 | usb0_host_nrdy_int(Status, Int_enbl); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 380 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 381 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 382 | /* Three dummy reads for clearing interrupt requests */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 383 | dumy_sts = USB200.NRDYSTS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 384 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 385 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 386 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 387 | * Function Name: usb0_host_BEMPInterrupt |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 388 | * Description : Executes USB BEMP interrupt. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 389 | * Arguments : uint16_t Status ; BEMPSTS Register Value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 390 | * : uint16_t Int_enbl ; BEMPENB Register Value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 391 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 392 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 393 | void usb0_host_BEMPInterrupt (uint16_t Status, uint16_t Int_enbl) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 394 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 395 | uint16_t buffer; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 396 | uint16_t pid; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 397 | volatile uint16_t dumy_sts; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 398 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 399 | if ((Status & g_usb0_host_bit_set[USB_HOST_PIPE0]) && (Int_enbl & g_usb0_host_bit_set[USB_HOST_PIPE0])) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 400 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 401 | USB200.BEMPSTS = (uint16_t)~g_usb0_host_bit_set[USB_HOST_PIPE0]; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 402 | pid = usb0_host_get_pid(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 403 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 404 | if ((pid == USB_HOST_PID_STALL) || (pid == USB_HOST_PID_STALL2)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 405 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 406 | g_usb0_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 407 | g_usb0_host_CmdStage |= USB_HOST_CMD_STALL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 408 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 409 | g_usb0_host_pipe_status[USB_HOST_PIPE0] = USB_HOST_PIPE_STALL; /* exit STALL */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 410 | ohciwrapp_loc_TransEnd(USB_HOST_PIPE0, TD_CC_STALL); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 411 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 412 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 413 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 414 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 415 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 416 | switch ((g_usb0_host_CmdStage & (USB_HOST_STAGE_FIELD | USB_HOST_CMD_FIELD))) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 417 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 418 | case (USB_HOST_STAGE_STATUS | USB_HOST_CMD_DOING): |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 419 | g_usb0_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 420 | g_usb0_host_CmdStage |= USB_HOST_CMD_DONE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 421 | ohciwrapp_loc_TransEnd(USB_HOST_PIPE0, TD_CC_NOERROR); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 422 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 423 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 424 | case (USB_HOST_STAGE_DATA | USB_HOST_CMD_DOING): |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 425 | buffer = usb0_host_write_buffer(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 426 | switch (buffer) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 427 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 428 | case USB_HOST_WRITING: /* Continue of data write */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 429 | case USB_HOST_WRITEEND: /* End of data write (zero-length) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 430 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 431 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 432 | case USB_HOST_WRITESHRT: /* End of data write */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 433 | g_usb0_host_CmdStage &= (~USB_HOST_STAGE_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 434 | g_usb0_host_CmdStage |= USB_HOST_STAGE_STATUS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 435 | ohciwrapp_loc_TransEnd(USB_HOST_PIPE0, TD_CC_NOERROR); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 436 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 437 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 438 | case USB_HOST_FIFOERROR: /* FIFO access error */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 439 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 440 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 441 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 442 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 443 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 444 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 445 | /* do nothing */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 446 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 447 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 448 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 449 | switch ((g_usb0_host_CmdStage & (USB_HOST_MODE_FIELD | USB_HOST_STAGE_FIELD | USB_HOST_CMD_FIELD))) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 450 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 451 | case (USB_HOST_MODE_READ | USB_HOST_STAGE_STATUS | USB_HOST_CMD_DOING): |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 452 | g_usb0_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 453 | g_usb0_host_CmdStage |= USB_HOST_CMD_DONE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 454 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 455 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 456 | case (USB_HOST_MODE_WRITE | USB_HOST_STAGE_DATA | USB_HOST_CMD_DOING): |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 457 | buffer = usb0_host_write_buffer(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 458 | switch (buffer) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 459 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 460 | case USB_HOST_WRITING: /* Continue of data write */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 461 | case USB_HOST_WRITEEND: /* End of data write (zero-length) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 462 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 463 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 464 | case USB_HOST_WRITESHRT: /* End of data write */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 465 | g_usb0_host_CmdStage &= (~USB_HOST_STAGE_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 466 | g_usb0_host_CmdStage |= USB_HOST_STAGE_STATUS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 467 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 468 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 469 | case USB_HOST_FIFOERROR: /* FIFO access error */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 470 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 471 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 472 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 473 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 474 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 475 | case (USB_HOST_MODE_WRITE | USB_HOST_STAGE_STATUS | USB_HOST_CMD_DOING): |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 476 | g_usb0_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 477 | g_usb0_host_CmdStage |= USB_HOST_CMD_IDLE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 478 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 479 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 480 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 481 | /* do nothing */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 482 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 483 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 484 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 485 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 486 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 487 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 488 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 489 | usb0_host_bemp_int(Status, Int_enbl); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 490 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 491 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 492 | /* Three dummy reads for clearing interrupt requests */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 493 | dumy_sts = USB200.BEMPSTS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 494 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 495 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 496 | /* End of File */ |