forked for unsupported target
Dependents: stm32-disco-example DISCO-F469NI_BD_SD_Card_Control
Fork of USBHOST by
USBHost/TARGET_RENESAS/TARGET_RZ_A1H/usb1/src/host/usb1_host_usbint.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 : usb1_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 "usb1_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 usb1_host_interrupt1(void); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 65 | static void usb1_host_BRDYInterrupt(uint16_t Status, uint16_t Int_enbl); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 66 | static void usb1_host_NRDYInterrupt(uint16_t Status, uint16_t Int_enbl); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 67 | static void usb1_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: usb1_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 usb1_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 = USB201.CFIFOSEL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 93 | savepipe2 = USB201.PIPESEL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 94 | usb1_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 = USB201.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 | USB201.CFIFOSEL = buffer; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 102 | USB201.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: usb1_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 usb1_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 = USB201.INTSTS0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 126 | intsts1 = USB201.INTSTS1; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 127 | intenb0 = USB201.INTENB0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 128 | intenb1 = USB201.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 | USB201.INTSTS1 = (uint16_t)~USB_HOST_BITBCHG; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 133 | RZA_IO_RegWrite_16(&USB201.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_usb1_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 | USB201.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_usb1_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 146 | g_usb1_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 | USB201.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_usb1_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_usb1_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 157 | g_usb1_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 | USB201.INTSTS1 = (uint16_t)~USB_HOST_BITDTCH; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 164 | RZA_IO_RegWrite_16(&USB201.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_usb1_host_detach_flag = USB_HOST_YES; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 169 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 170 | Userdef_USB_usb1_host_detach(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 171 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 172 | usb1_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 | USB201.INTSTS1 = (uint16_t)~USB_HOST_BITATTCH; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 178 | RZA_IO_RegWrite_16(&USB201.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_usb1_host_attach_flag = USB_HOST_YES; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 183 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 184 | Userdef_USB_usb1_host_attach(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 185 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 186 | usb1_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 = USB201.BRDYSTS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 191 | nrdysts = USB201.NRDYSTS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 192 | bempsts = USB201.BEMPSTS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 193 | brdyenb = USB201.BRDYENB; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 194 | nrdyenb = USB201.NRDYENB; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 195 | bempenb = USB201.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 | usb1_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 | usb1_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 | usb1_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 = USB201.INTSTS0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 221 | dumy_sts = USB201.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: usb1_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 usb1_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_usb1_host_bit_set[USB_HOST_PIPE0]) && (Int_enbl & g_usb1_host_bit_set[USB_HOST_PIPE0])) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 238 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 239 | USB201.BRDYSTS = (uint16_t)~g_usb1_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_usb1_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 = usb1_host_read_buffer_c(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 246 | usb1_host_disable_brdy_int(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 247 | g_usb1_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 248 | g_usb1_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 = usb1_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 | usb1_host_disable_brdy_int(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 262 | g_usb1_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 263 | g_usb1_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 | USB201.CFIFOCTR = USB_HOST_BITBCLR; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 269 | usb1_host_disable_brdy_int(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 270 | g_usb1_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 271 | g_usb1_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_usb1_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 = usb1_host_read_buffer_c(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 290 | usb1_host_disable_brdy_int(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 291 | g_usb1_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 292 | g_usb1_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 = usb1_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 | usb1_host_disable_brdy_int(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 306 | g_usb1_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 307 | g_usb1_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 | USB201.CFIFOCTR = USB_HOST_BITBCLR; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 312 | usb1_host_disable_brdy_int(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 313 | g_usb1_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 314 | g_usb1_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 | usb1_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 = USB201.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: usb1_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 usb1_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_usb1_host_bit_set[USB_HOST_PIPE0]) && (Int_enbl & g_usb1_host_bit_set[USB_HOST_PIPE0])) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 350 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 351 | USB201.NRDYSTS = (uint16_t)~g_usb1_host_bit_set[USB_HOST_PIPE0]; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 352 | pid = usb1_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_usb1_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 357 | g_usb1_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_usb1_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 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 364 | else if (pid == USB_HOST_PID_NAK) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 365 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 366 | g_usb1_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 367 | g_usb1_host_CmdStage |= USB_HOST_CMD_NORES; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 368 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 369 | g_usb1_host_pipe_status[USB_HOST_PIPE0] = USB_HOST_PIPE_NORES; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 370 | ohciwrapp_loc_TransEnd(USB_HOST_PIPE0, TD_CC_STALL); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 371 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 372 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 373 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 374 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 375 | /* Do Nothing */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 376 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 377 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 378 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 379 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 380 | usb1_host_nrdy_int(Status, Int_enbl); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 381 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 382 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 383 | /* Three dummy reads for clearing interrupt requests */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 384 | dumy_sts = USB201.NRDYSTS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 385 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 386 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 387 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 388 | * Function Name: usb1_host_BEMPInterrupt |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 389 | * Description : Executes USB BEMP interrupt. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 390 | * Arguments : uint16_t Status ; BEMPSTS Register Value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 391 | * : uint16_t Int_enbl ; BEMPENB Register Value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 392 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 393 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 394 | void usb1_host_BEMPInterrupt (uint16_t Status, uint16_t Int_enbl) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 395 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 396 | uint16_t buffer; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 397 | uint16_t pid; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 398 | volatile uint16_t dumy_sts; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 399 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 400 | if ((Status & g_usb1_host_bit_set[USB_HOST_PIPE0]) && (Int_enbl & g_usb1_host_bit_set[USB_HOST_PIPE0])) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 401 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 402 | USB201.BEMPSTS = (uint16_t)~g_usb1_host_bit_set[USB_HOST_PIPE0]; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 403 | pid = usb1_host_get_pid(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 404 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 405 | if ((pid == USB_HOST_PID_STALL) || (pid == USB_HOST_PID_STALL2)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 406 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 407 | g_usb1_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 408 | g_usb1_host_CmdStage |= USB_HOST_CMD_STALL; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 409 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 410 | g_usb1_host_pipe_status[USB_HOST_PIPE0] = USB_HOST_PIPE_STALL; /* exit STALL */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 411 | ohciwrapp_loc_TransEnd(USB_HOST_PIPE0, TD_CC_STALL); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 412 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 413 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 414 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 415 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 416 | #if(1) /* ohci_wrapp */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 417 | switch ((g_usb1_host_CmdStage & (USB_HOST_STAGE_FIELD | USB_HOST_CMD_FIELD))) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 418 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 419 | case (USB_HOST_STAGE_STATUS | USB_HOST_CMD_DOING): |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 420 | g_usb1_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 421 | g_usb1_host_CmdStage |= USB_HOST_CMD_DONE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 422 | ohciwrapp_loc_TransEnd(USB_HOST_PIPE0, TD_CC_NOERROR); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 423 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 424 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 425 | case (USB_HOST_STAGE_DATA | USB_HOST_CMD_DOING): |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 426 | buffer = usb1_host_write_buffer(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 427 | switch (buffer) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 428 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 429 | case USB_HOST_WRITING: /* Continue of data write */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 430 | case USB_HOST_WRITEEND: /* End of data write (zero-length) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 431 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 432 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 433 | case USB_HOST_WRITESHRT: /* End of data write */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 434 | g_usb1_host_CmdStage &= (~USB_HOST_STAGE_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 435 | g_usb1_host_CmdStage |= USB_HOST_STAGE_STATUS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 436 | ohciwrapp_loc_TransEnd(USB_HOST_PIPE0, TD_CC_NOERROR); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 437 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 438 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 439 | case USB_HOST_FIFOERROR: /* FIFO access error */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 440 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 441 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 442 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 443 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 444 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 445 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 446 | /* do nothing */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 447 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 448 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 449 | #else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 450 | switch ((g_usb1_host_CmdStage & (USB_HOST_MODE_FIELD | USB_HOST_STAGE_FIELD | USB_HOST_CMD_FIELD))) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 451 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 452 | case (USB_HOST_MODE_READ | USB_HOST_STAGE_STATUS | USB_HOST_CMD_DOING): |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 453 | g_usb1_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 454 | g_usb1_host_CmdStage |= USB_HOST_CMD_DONE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 455 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 456 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 457 | case (USB_HOST_MODE_WRITE | USB_HOST_STAGE_DATA | USB_HOST_CMD_DOING): |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 458 | buffer = usb1_host_write_buffer(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 459 | switch (buffer) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 460 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 461 | case USB_HOST_WRITING: /* Continue of data write */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 462 | case USB_HOST_WRITEEND: /* End of data write (zero-length) */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 463 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 464 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 465 | case USB_HOST_WRITESHRT: /* End of data write */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 466 | g_usb1_host_CmdStage &= (~USB_HOST_STAGE_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 467 | g_usb1_host_CmdStage |= USB_HOST_STAGE_STATUS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 468 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 469 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 470 | case USB_HOST_FIFOERROR: /* FIFO access error */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 471 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 472 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 473 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 474 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 475 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 476 | case (USB_HOST_MODE_WRITE | USB_HOST_STAGE_STATUS | USB_HOST_CMD_DOING): |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 477 | g_usb1_host_CmdStage &= (~USB_HOST_CMD_FIELD); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 478 | g_usb1_host_CmdStage |= USB_HOST_CMD_IDLE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 479 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 480 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 481 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 482 | /* do nothing */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 483 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 484 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 485 | #endif |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 486 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 487 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 488 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 489 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 490 | usb1_host_bemp_int(Status, Int_enbl); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 491 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 492 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 493 | /* Three dummy reads for clearing interrupt requests */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 494 | dumy_sts = USB201.BEMPSTS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 495 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 496 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 497 | /* End of File */ |