Hardware PropertiesInterfacing devices
Types of UARTs
Loop Back Plug
Unlike DOS, Windows 9x,NT,2000,XP work with hardware in a different way. While a DOS driver could be created with asm and have direct acsess to ports, it is a bit more complicated in Windows.It is connected with the fact that Windows, unlike DOS, is a multitasking system which makes it impossible to allow every application to directly change the hardware settings, as one application may fail to 'know' about the changes made to the hardware settings by some other application. Actually one can use asm in and out 378h functions under Windows 9x, but it is undesirable due to said above. To create programmes working with hardware under Windows one should use API (application programming interface). This interface allows to use Windows system services from application programmes. API realization is at that entrusted to the drivers. Windows Driver Developer Kit (DDK)is used to create drivers (there is a separate DDK for every Windows OS). Besides API one can use IOCTL codes (this method was widely used in DOS),but we shall deal with API functions only.
Work with hardware under Windows.
API standartizes work with hardware. To get access to hardware the following steps are used:
In Windows all input/output ports are presented as files, so work with ports is mainly carried out via i/o functions of the file (CreateFile, CloseHandle, ReadFile, ReadFileEx, WriteFile and WriteFileEx). These functions organize the main interface for opening and closing the connection resource descriptor and carrying out read/write operations. API also includes a set of connection functions which provide access to connection resourses.
The usage of the I/O file and connection functions allows the application to perform the following tasks:
fCoder © 1998 - 2002