pjwork:你去一些英文网站上搜索一下,一些资料国内可能还没有!我这里有一份关于光驱软体基本原理编程的资料介绍,可以给你参考一下,不知道是否对你有用。<br>Firmware Instruction<br> Purpose<br>This document is used to instruction the firmware architecture of lite-on’s optical storage drives. By reading this document, the reader should be able to realize the basic concept and functions in firmware.<br> Scope<br>In the document, firmware architecture would be described into three parts, INTERFACE, SERVO and OPC(Optimal Power control). The concept of each part will be introduced in this document. In addition, basic functions of each part will be described, too. Some examples are also presented to help reader to understand the concept. Detail steps of each function might not be described in the document due to the document only proving an overall picture.<br> Architecture<br>There are three parts in lite-On’s optical storage drives’ firmware, including INTERFACE, SERVO and OPC. Each part has their major functionalities. INTERFACE is used to receive ATAPI Command from host and make decision. After that, Interface will translate the command into several sub-command and send them to the part who responses for the action. SERVO is the hardware controller that receive commands from interface and controller all actuators such as spindle motor, sled motor, tray motor, etc. OPC is the major part to set writing strategy because of different characters of different discs. The architecture blocks are shown as follows.<br><br>3.1. Interface<br>Interface is defined as host command handler in the system. All commands from host are all handled by interface. By controlling Servo and OPC part, interface can achieve certain functions such as reading data, writing data, audio play, tray in, etc. to response request from host. In order to handle command and read data from host, interface has to access DRAM and encoder/decoder register of DSP chip.<br>3.1.1 Interface framework<br>The architecture of interface is shown in Figure 2. There are two major parts in Interface, “Startup” and “Command Handle”, “Startup” would be presented at first, “Command Handle” is also described and is separated into 4 sub-topics, “command receiver”, “command check”, “command execution” and “return status”.<br>3.1.2 Startup<br>Startup is a very important function in interface. It has to initialize all system parameters, including asking SERVO and OPC to initialize theirs’. Besides, interface also gets to know what kind of disc and what kind of format it is in drive. Base on that, interface would be able to decide the strategy to work with disc. Basically, it would be separated into three steps.<br>1. SRVSTARTUP: Servo will initialize servo parameter.<br>2. READTOC: Read disc information in Lead-in area.<br>3. READPMA: Read track information in PMA area.<br>The brief flowchart is shown in Figure 3.<br><br>3.1.3 Command receiver<br>Command comes from two sources, Host command from PC, and Eject Key from external hardware, Interface would receive the command and act.<br>3.1.3.1 Host Command<br>When Host sends an ATAPI command to drive, and interrupt vector would be triggered. And a global flag, which means to request program to do something, would be raised. When the main-loop in interface detects the flag, it would execute certain dispatch command to response the request. The interrupt flow is shown in Figure 4.<br>3.1.3.2<br>When Eject Key is pressed, a 20ms timer in SERVO would detect the action and set the flag “_fgKEjtPressed”. As long as main-loop in interface detects the flag being raised, ProcKeyEject() function will be executed to judge the action.<br><br><br>3.1.4 Command check<br>3.1.4.1 Host request<br>All command from Host gets to obey ATA/ATAPI Specification. Detail specification won’t be described here. Only a Read 10 ATAPI command example is shown as follows to help reader understanding the meaning.<br><br>If the command violates ATAPI command specification, interface would return “Error Status” immediately without any action.<br>3.1.4.2 External Request<br> “Eject key pressed” is a typical external request. Interface also has to do some judgments before action. For example, when “Eject key” has been pressed, interface got to make sure if the drive is locked. If the drive were locked by system, such as in writing mode, the request would not be executed.<br>3.1.5 Command execution<br> 3.1.5.1 Read Data<br>Read data from disc is the most important function for a CD drive. Usually, Host would send a “Read 10” ATAPI command to Interface. And Interface would acts as the following steps.<br>1. Set Register: Set certain DSP register to prepare receiving data<br>2. Set Read Speed: Interface would try to read data from disc at the fastest speed. If drive’s speed were not at its max speed, interface would try to speed up step by step. The algorithm is shown in figure 6.<br>3. Seek Position: Ask Servo to move PUH(pickup head) to certain position on disc.<br>4. Read Data to Host: When PUH reaches correct position, Interface would set register on DSP, and data from disc would be stored in DRAM, After that, the data would be sent back to host.<br>5. Decode Error: At normal circumstance, drive would