8月2日 USB的繼續

來源:互聯網
上載者:User

        今天沒有做太多的技術活,被Yamazaki和longhorn給玩了(我也不知道是主動還是被動)。

一些紀錄:

電源管理之核心狀態

當一個裝置被要求掛起的時候,持續供電,保持在一點,RAM保持在一個自重新整理狀態。當一個中斷來的時候會喚醒裝置。
一般有3個途徑掛起:
1 鍵盤驅動發送一個VK_OFF給GWES。最終導致函數GwesPowerOffSystem 被調用;
2 OEM層直接調用GwesPowerOffSystem;
3 OEM層直接調用SetSystemPowerState.

The GwesPowerOff function performs key operations before a device can suspend.

To suspend a device

Notify the Taskbar that the device is being suspended.
Post the WM_POWERBROADCAST message with the flag PBT_APMSUSPEND. Only the registered Taskbar will get this message.

Abort calibration if the calibration screen is up and in one of the following states:
Waiting at cross hairs.
If calibration was waiting at confirmation.
Turn off window message queues, stopping the processing of messages.
Determine if the Startup UI screen needs to appear on resume.
Save video RAM to system RAM is necessary to preserve state on resume.
Call SetSystemPowerState with the arguments (NULL, POWER_STATE_SUSPEND, POWER_FORCE). This calls into the power manager that coordinates the rest of the suspend operation. At this point, GwesPowerOff is not completed until the system resumes.
Power manager performs the following actions:
Calls FileSystemPowerFunction(FSNOTIFY_POWER_OFF) to power off file system drivers.
Calls PowerOffSystem.
Calls Sleep(0) to allow the kernel scheduler to run and perform the final suspend process.
The kernel performs the following final steps to suspend:
Power off GWES process.
Power off Filesys.exe.
If this is an SHx microprocessor, call OEMFlushCache.
Call OEMPowerOff.

=======================================================
When a resume occurs the kernel is the first to execute. A device will only resume from a halted state if an interrupt occurs and the CPU has been programmed to wake when an interrupt occurs.

To resume a device

The kernel performs the following clean-up tasks before resuming normal scheduling:
If this is an SHx, it calls OEMFlushCache.
Calls InitClock to re-initialize timer hardware to a 1 ms tick.
Calls Filesys.exe with a power on notification.
Calls GWES with a power on notification.
Initializes the KITL interrupt if one is in use.
Power manager then calls FileSystemPowerFunction with the (FSNOTIFY_POWER_ON) argument.
On the resume, GWES performs the following tasks:
Restores video memory from RAM.
Powers on the Window Manager.
Sets the screen contrast.
Shows the Startup UI screen, if required.
Posts a message to the Taskbar to tell it the device has resumed by send a WM_POWERBROADCAST message with PBT_APMRESUMESUSPEND parameter.
Sends the same message to the User notification subsystem.
Triggers applications that have requested to be triggered on resume.

 USB Function Driver
        也是分為Function Controller和Function Client Driver.
        從USB SPEC 2.0上看,Function屬於Device的最上層。

Boot-time Initialization

The following steps show the boot-time initialization process:

  1. The OS locates the function controller, and then loads the function controller driver by loading the dynamic-link library (DLL) that contains the PDD and the MDD.
  2. The DllMain function in the PDD calls DllEntry in the MDD.
  3. The OS activates the stream interface that the MDD contains by calling UFN_Init.
  4. UFN_Init calls into the PDD to initialize the hardware.
  5. UFN_Init determines the client driver to load, and then calls the client driver's initialization routine.

The hardware initialization function carries out its responsibilities in the following order:

  1. Initializes the function controller on its bus.
  2. Places the function controller in the initialized state because the configuration might persist after a soft reset.
  3. Disables the USB connection.
  4. Disables device and endpoint interrupts.
  5. Clears pending device and endpoint interrupts.
  6. Clears configuration registers and the first in, first out (FIFO) buffer.
  7. Resets any internal data structures.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.