DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
DDI: 8 sample driver

samp_read_cmos and samp_write_cmos subordinate routines

The samp_read_cmos( ) and samp_write_cmos( ) subordinate driver routines are called by the samp_ioctl( ) entry point routine to do the actual programmed I/O operation to the device.

Both use an ASSERT( ) statement to verify that the address range being addressed is within the boundary set by SAMP_DEVSIZE and, for write operations, SAMP_MINWRITE. Note that this same check is done by the samp_ioctl( ) routine, but the subroutine is also called by the samp_biostart( ) routine that does not do this check.

The code then calls the drv_usecwait(D3) function to wait 50 milliseconds before each I/O request. drv_usecwait( ) is similar to the SCO OpenServer 5 ODDI suspend(D3oddi). The purpose of the 50 millisecond wait is to produce a visible difference between using channel 0 and 1.

Note the different paradigm used for managing the idata structure for these single-byte I/O operations. Whereas the I/O operations initiated with the biostart(D2) entry point locked the idata structure, incremented a counter, then unlocked the idata while waiting for the I/O to complete, here the code locks the idata structure, issues the inb(D3) or outb(D3) call, and then unlocks the idata structure. This avoids the overhead of managing an I/O queue and is appropriate because of the small amount of data being transferred, but would, of course, be quite detremental to general system performance if done for larger I/O transfers.


© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005