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_usbsig.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_usbsig.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 | #include "dev_drv.h" |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 42 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 43 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 44 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 45 | Typedef definitions |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 46 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 47 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 48 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 49 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 50 | Macro definitions |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 51 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 52 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 53 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 54 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 55 | Imported global variables and functions (from other files) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 56 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 57 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 58 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 59 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 60 | Exported global variables and functions (to be accessed by other files) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 61 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 62 | static void usb0_host_EnableINT_Module(void); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 63 | static void usb0_host_Enable_AttachINT(void); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 64 | static void usb0_host_Disable_AttachINT(void); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 65 | static void usb0_host_Disable_BchgINT(void); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 66 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 67 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 68 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 69 | Private global variables and functions |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 70 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 71 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 72 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 73 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 74 | * Function Name: usb0_host_InitModule |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 75 | * Description : Initializes the USB module in USB host module. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 76 | * Arguments : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 77 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 78 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 79 | void usb0_host_InitModule (void) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 80 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 81 | uint16_t buf1; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 82 | uint16_t buf2; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 83 | uint16_t buf3; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 84 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 85 | usb0_host_init_pipe_status(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 86 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 87 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 88 | 1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 89 | USB_SYSCFG_DCFM_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 90 | USB_SYSCFG_DCFM); /* HOST mode */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 91 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 92 | 1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 93 | USB_SYSCFG_DRPD_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 94 | USB_SYSCFG_DRPD); /* PORT0 D+, D- setting */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 95 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 96 | do |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 97 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 98 | buf1 = RZA_IO_RegRead_16(&USB200.SYSSTS0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 99 | USB_SYSSTS0_LNST_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 100 | USB_SYSSTS0_LNST); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 101 | Userdef_USB_usb0_host_delay_xms(50); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 102 | buf2 = RZA_IO_RegRead_16(&USB200.SYSSTS0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 103 | USB_SYSSTS0_LNST_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 104 | USB_SYSSTS0_LNST); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 105 | Userdef_USB_usb0_host_delay_xms(50); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 106 | buf3 = RZA_IO_RegRead_16(&USB200.SYSSTS0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 107 | USB_SYSSTS0_LNST_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 108 | USB_SYSSTS0_LNST); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 109 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 110 | } while ((buf1 != buf2) || (buf1 != buf3)); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 111 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 112 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 113 | 1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 114 | USB_SYSCFG_USBE_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 115 | USB_SYSCFG_USBE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 116 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 117 | USB200.CFIFOSEL = (uint16_t)(USB_HOST_BITRCNT | USB_HOST_BITMBW_8 | USB_HOST_BITBYTE_LITTLE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 118 | USB200.D0FIFOSEL = (uint16_t)( USB_HOST_BITMBW_8 | USB_HOST_BITBYTE_LITTLE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 119 | USB200.D1FIFOSEL = (uint16_t)( USB_HOST_BITMBW_8 | USB_HOST_BITBYTE_LITTLE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 120 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 121 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 122 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 123 | * Function Name: usb0_host_CheckAttach |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 124 | * Description : Returns the USB device connection state. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 125 | * Arguments : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 126 | * Return Value : uint16_t ; USB_HOST_ATTACH : Attached |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 127 | * : ; USB_HOST_DETACH : not Attached |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 128 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 129 | uint16_t usb0_host_CheckAttach (void) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 130 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 131 | uint16_t buf1; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 132 | uint16_t buf2; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 133 | uint16_t buf3; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 134 | uint16_t rhst; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 135 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 136 | do |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 137 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 138 | buf1 = RZA_IO_RegRead_16(&USB200.SYSSTS0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 139 | USB_SYSSTS0_LNST_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 140 | USB_SYSSTS0_LNST); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 141 | Userdef_USB_usb0_host_delay_xms(50); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 142 | buf2 = RZA_IO_RegRead_16(&USB200.SYSSTS0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 143 | USB_SYSSTS0_LNST_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 144 | USB_SYSSTS0_LNST); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 145 | Userdef_USB_usb0_host_delay_xms(50); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 146 | buf3 = RZA_IO_RegRead_16(&USB200.SYSSTS0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 147 | USB_SYSSTS0_LNST_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 148 | USB_SYSSTS0_LNST); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 149 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 150 | } while ((buf1 != buf2) || (buf1 != buf3)); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 151 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 152 | rhst = RZA_IO_RegRead_16(&USB200.DVSTCTR0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 153 | USB_DVSTCTR0_RHST_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 154 | USB_DVSTCTR0_RHST); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 155 | if (rhst == USB_HOST_UNDECID) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 156 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 157 | if (buf1 == USB_HOST_FS_JSTS) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 158 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 159 | if (g_usb0_host_SupportUsbDeviceSpeed == USB_HOST_HIGH_SPEED) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 160 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 161 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 162 | 1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 163 | USB_SYSCFG_HSE_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 164 | USB_SYSCFG_HSE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 165 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 166 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 167 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 168 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 169 | 0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 170 | USB_SYSCFG_HSE_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 171 | USB_SYSCFG_HSE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 172 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 173 | return USB_HOST_ATTACH; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 174 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 175 | else if (buf1 == USB_HOST_LS_JSTS) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 176 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 177 | /* Low Speed Device */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 178 | RZA_IO_RegWrite_16(&USB200.SYSCFG0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 179 | 0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 180 | USB_SYSCFG_HSE_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 181 | USB_SYSCFG_HSE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 182 | return USB_HOST_ATTACH; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 183 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 184 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 185 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 186 | /* Do Nothing */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 187 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 188 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 189 | else if ((rhst == USB_HOST_HSMODE) || (rhst == USB_HOST_FSMODE)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 190 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 191 | return USB_HOST_ATTACH; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 192 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 193 | else if (rhst == USB_HOST_LSMODE) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 194 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 195 | return USB_HOST_ATTACH; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 196 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 197 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 198 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 199 | /* Do Nothing */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 200 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 201 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 202 | return USB_HOST_DETACH; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 203 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 204 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 205 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 206 | * Function Name: usb0_host_UsbAttach |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 207 | * Description : Connects the USB device. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 208 | * Arguments : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 209 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 210 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 211 | void usb0_host_UsbAttach (void) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 212 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 213 | usb0_host_EnableINT_Module(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 214 | usb0_host_Disable_BchgINT(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 215 | usb0_host_Disable_AttachINT(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 216 | usb0_host_Enable_DetachINT(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 217 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 218 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 219 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 220 | * Function Name: usb0_host_UsbDetach |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 221 | * Description : Disconnects the USB device. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 222 | * Arguments : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 223 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 224 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 225 | void usb0_host_UsbDetach (void) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 226 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 227 | uint16_t pipe; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 228 | uint16_t devadr; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 229 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 230 | g_usb0_host_driver_state = USB_HOST_DRV_DETACHED; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 231 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 232 | /* Terminate all the pipes in which communications on port */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 233 | /* are currently carried out */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 234 | for (pipe = 0; pipe < (USB_HOST_MAX_PIPE_NO + 1); ++pipe) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 235 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 236 | if (g_usb0_host_pipe_status[pipe] != USB_HOST_PIPE_IDLE) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 237 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 238 | if (pipe == USB_HOST_PIPE0) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 239 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 240 | devadr = RZA_IO_RegRead_16(&USB200.DCPMAXP, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 241 | USB_DCPMAXP_DEVSEL_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 242 | USB_DCPMAXP_DEVSEL); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 243 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 244 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 245 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 246 | devadr = RZA_IO_RegRead_16(&g_usb0_host_pipemaxp[pipe], USB_PIPEMAXP_DEVSEL_SHIFT, USB_PIPEMAXP_DEVSEL); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 247 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 248 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 249 | if (devadr == g_usb0_host_UsbAddress) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 250 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 251 | usb0_host_stop_transfer(pipe); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 252 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 253 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 254 | g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_IDLE; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 255 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 256 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 257 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 258 | g_usb0_host_ConfigNum = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 259 | g_usb0_host_UsbAddress = 0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 260 | g_usb0_host_default_max_packet[USB_HOST_DEVICE_0] = 64; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 261 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 262 | usb0_host_UsbDetach2(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 263 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 264 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 265 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 266 | * Function Name: usb0_host_UsbDetach2 |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 267 | * Description : Disconnects the USB device. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 268 | * Arguments : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 269 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 270 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 271 | void usb0_host_UsbDetach2 (void) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 272 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 273 | usb0_host_Disable_DetachINT(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 274 | usb0_host_Disable_BchgINT(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 275 | usb0_host_Enable_AttachINT(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 276 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 277 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 278 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 279 | * Function Name: usb0_host_UsbBusReset |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 280 | * Description : Issues the USB bus reset signal. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 281 | * Arguments : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 282 | * Return Value : uint16_t ; RHST |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 283 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 284 | uint16_t usb0_host_UsbBusReset (void) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 285 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 286 | uint16_t buffer; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 287 | uint16_t loop; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 288 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 289 | RZA_IO_RegWrite_16(&USB200.DVSTCTR0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 290 | 1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 291 | USB_DVSTCTR0_USBRST_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 292 | USB_DVSTCTR0_USBRST); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 293 | RZA_IO_RegWrite_16(&USB200.DVSTCTR0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 294 | 0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 295 | USB_DVSTCTR0_UACT_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 296 | USB_DVSTCTR0_UACT); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 297 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 298 | Userdef_USB_usb0_host_delay_xms(50); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 299 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 300 | buffer = USB200.DVSTCTR0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 301 | buffer &= (uint16_t)(~(USB_HOST_BITRST)); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 302 | buffer |= USB_HOST_BITUACT; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 303 | USB200.DVSTCTR0 = buffer; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 304 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 305 | Userdef_USB_usb0_host_delay_xms(20); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 306 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 307 | for (loop = 0, buffer = USB_HOST_HSPROC; loop < 3; ++loop) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 308 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 309 | buffer = RZA_IO_RegRead_16(&USB200.DVSTCTR0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 310 | USB_DVSTCTR0_RHST_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 311 | USB_DVSTCTR0_RHST); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 312 | if (buffer == USB_HOST_HSPROC) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 313 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 314 | Userdef_USB_usb0_host_delay_xms(10); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 315 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 316 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 317 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 318 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 319 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 320 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 321 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 322 | return buffer; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 323 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 324 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 325 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 326 | * Function Name: usb0_host_UsbResume |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 327 | * Description : Issues the USB resume signal. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 328 | * Arguments : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 329 | * Return Value : int32_t ; DEVDRV_SUCCESS |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 330 | * : ; DEVDRV_ERROR |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 331 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 332 | int32_t usb0_host_UsbResume (void) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 333 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 334 | uint16_t buf; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 335 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 336 | if ((g_usb0_host_driver_state & USB_HOST_DRV_SUSPEND) == 0) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 337 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 338 | /* not SUSPEND */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 339 | return DEVDRV_ERROR; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 340 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 341 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 342 | RZA_IO_RegWrite_16(&USB200.INTENB1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 343 | 0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 344 | USB_INTENB1_BCHGE_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 345 | USB_INTENB1_BCHGE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 346 | RZA_IO_RegWrite_16(&USB200.DVSTCTR0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 347 | 1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 348 | USB_DVSTCTR0_RESUME_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 349 | USB_DVSTCTR0_RESUME); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 350 | Userdef_USB_usb0_host_delay_xms(20); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 351 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 352 | buf = USB200.DVSTCTR0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 353 | buf &= (uint16_t)(~(USB_HOST_BITRESUME)); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 354 | buf |= USB_HOST_BITUACT; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 355 | USB200.DVSTCTR0 = buf; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 356 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 357 | g_usb0_host_driver_state &= (uint16_t)~USB_HOST_DRV_SUSPEND; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 358 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 359 | return DEVDRV_SUCCESS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 360 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 361 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 362 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 363 | * Function Name: usb0_host_UsbSuspend |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 364 | * Description : Issues the USB suspend signal. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 365 | * Arguments : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 366 | * Return Value : int32_t ; DEVDRV_SUCCESS :not SUSPEND |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 367 | * : ; DEVDRV_ERROR :SUSPEND |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 368 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 369 | int32_t usb0_host_UsbSuspend (void) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 370 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 371 | uint16_t buf; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 372 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 373 | if ((g_usb0_host_driver_state & USB_HOST_DRV_SUSPEND) != 0) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 374 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 375 | /* SUSPEND */ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 376 | return DEVDRV_ERROR; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 377 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 378 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 379 | RZA_IO_RegWrite_16(&USB200.DVSTCTR0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 380 | 0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 381 | USB_DVSTCTR0_UACT_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 382 | USB_DVSTCTR0_UACT); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 383 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 384 | Userdef_USB_usb0_host_delay_xms(5); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 385 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 386 | buf = RZA_IO_RegRead_16(&USB200.SYSSTS0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 387 | USB_SYSSTS0_LNST_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 388 | USB_SYSSTS0_LNST); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 389 | if ((buf != USB_HOST_FS_JSTS) && (buf != USB_HOST_LS_JSTS)) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 390 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 391 | usb0_host_UsbDetach(); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 392 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 393 | else |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 394 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 395 | g_usb0_host_driver_state |= USB_HOST_DRV_SUSPEND; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 396 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 397 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 398 | return DEVDRV_SUCCESS; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 399 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 400 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 401 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 402 | * Function Name: usb0_host_Enable_DetachINT |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 403 | * Description : Enables the USB disconnection interrupt. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 404 | * Arguments : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 405 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 406 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 407 | void usb0_host_Enable_DetachINT (void) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 408 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 409 | USB200.INTSTS1 = (uint16_t)(~(USB_HOST_BITDTCH)); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 410 | RZA_IO_RegWrite_16(&USB200.INTENB1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 411 | 1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 412 | USB_INTENB1_DTCHE_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 413 | USB_INTENB1_DTCHE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 414 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 415 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 416 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 417 | * Function Name: usb0_host_Disable_DetachINT |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 418 | * Description : Disables the USB disconnection interrupt. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 419 | * Arguments : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 420 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 421 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 422 | void usb0_host_Disable_DetachINT (void) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 423 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 424 | USB200.INTSTS1 = (uint16_t)(~(USB_HOST_BITDTCH)); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 425 | RZA_IO_RegWrite_16(&USB200.INTENB1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 426 | 0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 427 | USB_INTENB1_DTCHE_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 428 | USB_INTENB1_DTCHE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 429 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 430 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 431 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 432 | * Function Name: usb0_host_Enable_AttachINT |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 433 | * Description : Enables the USB connection detection interrupt. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 434 | * Arguments : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 435 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 436 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 437 | void usb0_host_Enable_AttachINT (void) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 438 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 439 | USB200.INTSTS1 = (uint16_t)(~(USB_HOST_BITATTCH)); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 440 | RZA_IO_RegWrite_16(&USB200.INTENB1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 441 | 1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 442 | USB_INTENB1_ATTCHE_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 443 | USB_INTENB1_ATTCHE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 444 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 445 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 446 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 447 | * Function Name: usb0_host_Disable_AttachINT |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 448 | * Description : Disables the USB connection detection interrupt. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 449 | * Arguments : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 450 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 451 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 452 | void usb0_host_Disable_AttachINT (void) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 453 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 454 | USB200.INTSTS1 = (uint16_t)(~(USB_HOST_BITATTCH)); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 455 | RZA_IO_RegWrite_16(&USB200.INTENB1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 456 | 0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 457 | USB_INTENB1_ATTCHE_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 458 | USB_INTENB1_ATTCHE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 459 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 460 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 461 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 462 | * Function Name: usb0_host_Disable_BchgINT |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 463 | * Description : Disables the USB bus change detection interrupt. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 464 | * Arguments : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 465 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 466 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 467 | void usb0_host_Disable_BchgINT (void) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 468 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 469 | USB200.INTSTS1 = (uint16_t)(~(USB_HOST_BITBCHG)); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 470 | RZA_IO_RegWrite_16(&USB200.INTENB1, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 471 | 0, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 472 | USB_INTENB1_BCHGE_SHIFT, |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 473 | USB_INTENB1_BCHGE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 474 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 475 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 476 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 477 | * Function Name: usb0_host_set_devadd |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 478 | * Description : DEVADDn register is set by specified value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 479 | * Arguments : uint16_t addr : Device address |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 480 | * : uint16_t *devadd : Set value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 481 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 482 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 483 | void usb0_host_set_devadd (uint16_t addr, uint16_t * devadd) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 484 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 485 | uint16_t * ptr; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 486 | uint16_t ret_flag = DEVDRV_FLAG_ON; // avoid warning. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 487 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 488 | switch (addr) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 489 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 490 | case USB_HOST_DEVICE_0: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 491 | ptr = (uint16_t *)&USB200.DEVADD0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 492 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 493 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 494 | case USB_HOST_DEVICE_1: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 495 | ptr = (uint16_t *)&USB200.DEVADD1; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 496 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 497 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 498 | case USB_HOST_DEVICE_2: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 499 | ptr = (uint16_t *)&USB200.DEVADD2; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 500 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 501 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 502 | case USB_HOST_DEVICE_3: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 503 | ptr = (uint16_t *)&USB200.DEVADD3; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 504 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 505 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 506 | case USB_HOST_DEVICE_4: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 507 | ptr = (uint16_t *)&USB200.DEVADD4; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 508 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 509 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 510 | case USB_HOST_DEVICE_5: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 511 | ptr = (uint16_t *)&USB200.DEVADD5; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 512 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 513 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 514 | case USB_HOST_DEVICE_6: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 515 | ptr = (uint16_t *)&USB200.DEVADD6; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 516 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 517 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 518 | case USB_HOST_DEVICE_7: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 519 | ptr = (uint16_t *)&USB200.DEVADD7; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 520 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 521 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 522 | case USB_HOST_DEVICE_8: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 523 | ptr = (uint16_t *)&USB200.DEVADD8; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 524 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 525 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 526 | case USB_HOST_DEVICE_9: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 527 | ptr = (uint16_t *)&USB200.DEVADD9; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 528 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 529 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 530 | case USB_HOST_DEVICE_10: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 531 | ptr = (uint16_t *)&USB200.DEVADDA; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 532 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 533 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 534 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 535 | ret_flag = DEVDRV_FLAG_OFF; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 536 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 537 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 538 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 539 | if (ret_flag == DEVDRV_FLAG_ON) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 540 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 541 | *ptr = (uint16_t)(*devadd & USB_HOST_DEVADD_MASK); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 542 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 543 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 544 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 545 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 546 | * Function Name: usb0_host_get_devadd |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 547 | * Description : DEVADDn register is obtained |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 548 | * Arguments : uint16_t addr : Device address |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 549 | * : uint16_t *devadd : USB_HOST_DEVADD register value |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 550 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 551 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 552 | void usb0_host_get_devadd (uint16_t addr, uint16_t * devadd) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 553 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 554 | uint16_t * ptr; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 555 | uint16_t ret_flag = DEVDRV_FLAG_ON; // avoid warning. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 556 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 557 | switch (addr) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 558 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 559 | case USB_HOST_DEVICE_0: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 560 | ptr = (uint16_t *)&USB200.DEVADD0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 561 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 562 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 563 | case USB_HOST_DEVICE_1: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 564 | ptr = (uint16_t *)&USB200.DEVADD1; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 565 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 566 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 567 | case USB_HOST_DEVICE_2: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 568 | ptr = (uint16_t *)&USB200.DEVADD2; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 569 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 570 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 571 | case USB_HOST_DEVICE_3: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 572 | ptr = (uint16_t *)&USB200.DEVADD3; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 573 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 574 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 575 | case USB_HOST_DEVICE_4: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 576 | ptr = (uint16_t *)&USB200.DEVADD4; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 577 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 578 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 579 | case USB_HOST_DEVICE_5: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 580 | ptr = (uint16_t *)&USB200.DEVADD5; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 581 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 582 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 583 | case USB_HOST_DEVICE_6: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 584 | ptr = (uint16_t *)&USB200.DEVADD6; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 585 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 586 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 587 | case USB_HOST_DEVICE_7: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 588 | ptr = (uint16_t *)&USB200.DEVADD7; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 589 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 590 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 591 | case USB_HOST_DEVICE_8: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 592 | ptr = (uint16_t *)&USB200.DEVADD8; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 593 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 594 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 595 | case USB_HOST_DEVICE_9: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 596 | ptr = (uint16_t *)&USB200.DEVADD9; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 597 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 598 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 599 | case USB_HOST_DEVICE_10: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 600 | ptr = (uint16_t *)&USB200.DEVADDA; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 601 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 602 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 603 | default: |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 604 | ret_flag = DEVDRV_FLAG_OFF; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 605 | break; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 606 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 607 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 608 | if (ret_flag == DEVDRV_FLAG_ON) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 609 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 610 | *devadd = *ptr; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 611 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 612 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 613 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 614 | /******************************************************************************* |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 615 | * Function Name: usb0_host_EnableINT_Module |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 616 | * Description : Enables BEMP/NRDY/BRDY interrupt and SIGN/SACK interrupt. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 617 | * : Enables NRDY/BEMP interrupt in the pipe0. |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 618 | * Arguments : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 619 | * Return Value : none |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 620 | *******************************************************************************/ |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 621 | void usb0_host_EnableINT_Module (void) |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 622 | { |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 623 | uint16_t buf; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 624 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 625 | buf = USB200.INTENB0; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 626 | buf |= (USB_HOST_BITBEMPE | USB_HOST_BITNRDYE | USB_HOST_BITBRDYE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 627 | USB200.INTENB0 = buf; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 628 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 629 | buf = USB200.INTENB1; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 630 | buf |= (USB_HOST_BITSIGNE | USB_HOST_BITSACKE); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 631 | USB200.INTENB1 = buf; |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 632 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 633 | usb0_host_enable_nrdy_int(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 634 | usb0_host_enable_bemp_int(USB_HOST_PIPE0); |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 635 | } |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 636 | |
frq08711@LMECWL0871.LME.ST.COM | 1:ab240722d7ef | 637 | /* End of File */ |