TAILIEUCHUNG - HandBooks Professional Java-C-Scrip-SQL part 200

Tham khảo tài liệu 'handbooks professional java-c-scrip-sql part 200', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | keyword static this restriction is automatically enforced for us by the C compiler. The most important thing to learn from the class declaration is that although all of the software timers are driven by the same hardware timer counter unit each has its own private data store. This allows the application programmer to create multiple simultaneous software timers and the device driver to manage them behind the scenes. Once you grasp that idea you re ready to look at the implementation of the driver s initialization routine API and interrupt service routine. The constructor for the Timer class is responsible for initializing both the software timer and the underlying hardware. With respect to the latter it is responsible for configuring the timer counter unit inserting the address of the interrupt service routine into the interrupt vector table and enabling timer interrupts. However because this method is a constructor that may be called several times once for each of the Timer objects declared our implementation of the constructor must be smart enough to perform these hardware initializations only during the very first call to it. Otherwise the timer counter unit might be reset at an inopportune time or become out of sync with the device driver. That is the reason for the static variable blnitialized in the following code. This variable is declared with an initial value of zero and set to one after the hardware initialization sequence has been performed. Subsequent calls to the Timer constructor will see that blnitialized is no longer zero and skip that part of the initialization sequence. include include define CYCLES_PER_TICK 25000 4 Number of clock cycles per tick. Method Timer Description Constructor for the Timer class. Notes Returns None defined. T imer T imer void static int blnitialized 0 Initialize the new software timer. state Idle type OneShot length 0 count 0 pNext NULL Initialize the timer hardware if not previously done. if .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.