Part 1.
Obtaining primary information about creation
of PnP devices for RS232.
- Serial Mice;
- COM Modems;
- Other COM devices;
The main difference between them is a way, how these devices support
enumeration. On the PC's side the PnP manager tries to execute certain
steps at the certain time .Perhaps it sounds not clear, therefore
if you want to understand this process better, please see WINDOWS
2000 DDK , "Features of Serial and Serenum","Inside
Microsoft WINDOWS 2000" book (David A. Solomon, Mark E. Russinovich)
, Microsoft Press, chapter 9 "I/O System", an excellent
book, containing the full description of this process (additionally,
chapter 4, "Startup and Shutdown").
At first let's speak about the first type (SERIAL Mice, the most
primitive type), the full description of all three types it is not
goal of this document, the specification itself contains all necessary
information.
In order to a serial port based device could be identified as a
serial mouse by PnP Manager(with help of I/O manager) the next steps
have to be executed (it will be used in PART 3):
- echo DTR to DSR, always in hardware (everything
what is received from DTR has to be sent to DSR, it can be direct
connection);
- while (RTS ! = 0) { just wait, unless
RTS = 1};
- if (RTS = 1), identify itself, sending
COM ID (fixed structure);
- go be a mouse, doing something (in my
case the prototype just moves the cursor in a certain path (rectangle),
with uniform speed);
- if (RTS = 0) GOTO step 2;
Our new created device has to report about itself
at the speed of 1200 bit/s. The standard strictly defines the data
formats, which should be used: nine bit frame: one start bit, 7
data bits (LSB first) and one stop bit. Examples of compatible formats
are:
- nine bit frame: one start bit, 7 data
bits, no parity, one stop bit;
- ten bit frame: one start bit, 7 data bits,
no parity, two stop bits;
- ten bit frame: one start bit, 7 data bits,
Mark parity, one stop bit;
- ten bit frame: one start bit, 8 data bits
with MSB set to 1; one stop bit;
Only one momen is not described yet, the data ( COM
ID ), which has to be sent to the PC from the external serial port
based device structure. This information is exactly one which allows
to OS (PnP manager) distinguish among different devices, obtain
and show the certain information during enumeration, load necessary
drivers and so on.
Table
1, Plug and Play COM Device ID Fields
(Plug
and Play External COM Device Specification rev. 1.00, page 10)
|
Field Name
|
Size
|
Required?
|
Short Description
|
|
Other
ID
|
<17
|
no
|
Reserved
for short non-PnP ID (e.g. "0x4D"). May be saved
or ignored by the COM Enumerator
|
|
Begin
PnP
|
1
|
yes
|
Begin
PnP ID. This is "(": either 0x28 or 0x08
|
|
PnP
Rev
|
2
|
yes
|
Plug and Play revision (e.g. 0x00,01)
|
|
EISA
ID
|
3
|
yes
|
EISA
determined unique Mfr Identifier
|
|
Product
ID
|
4
|
yes
|
Mfr
determined unique Product Identifier
|
|
Extend
|
1
|
no
|
"\":
either 0x5C or 0x3C
|
|
Serial
Number
|
8
|
no
|
Optional
device serial number
|
|
Extend
|
1
|
no
|
see
the original document
|
|
Class
Name
|
<33
|
no
|
Plug
and Play Class Identifier (Annex C of the original doc)
|
|
Extend
|
1
|
no
|
see
the original document
|
|
Driver
ID
|
<41
|
no
|
Compatible
Device IDs
|
|
Extend
|
1
|
no
|
see
the original document
|
|
User
Name
|
<41
|
no
|
end-user
legible Product Description
|
|
Checksum
|
2 |
yes,
if any optional fields
|
8 bit arithmetic checksum of all characters from Begin PnP
to End PnP inclusive, exclusive of the checksum bytes themselves,
represented as a two character hexadecimal number
|
|
End
PnP
|
1
|
yes
|
End
PnP ID. This is ")": either 0x29 or 0x09
|
The items, having blue color are mandatory attributes.
The detail descriptions of these fields you can find on the specification,(3.2
Definitions, pages 11-12).
Now lets try to preliminary fill this structure with our own values,
for future usage with software emulator (PART
2):
- PnP Rev = 1.08. Any value which suits
this filed requirements (see specification);
- EISA ID = SRD (a unique three characters
EISA identifier);
- Product ID = 0003 (32 bit value in 8 character
hexadecimal code);
- Serial number = 01234567;
- Class Name= MULTIFUNCTION;
- User name = "Virtual serial port
based device";
I used these parameters without any special intentions,
for example "SRD" is "Serial poRt Device", Product
ID was taken as 0003 just for fun, but anyway, later I used these
data in my INF file, therefore now, if you want to use offered by
me software, you have to leave all these values as they are, otherwise
you should make certain correction of all necessary part.
The last item (User name) will be shown on the test
PC in the window ("Found
New Hardware"), during installation of the driver of our
virtual device, therefore this is a good idea to make this information
understandable and meaning something.
In order to finish the first part (the main description), I would
like to say a couple words about the way, how OS determines the
presence of the new device on the serial port. The OS, (WIN2K in
my case) can discover the presence of the new serial port based
device during loading(restarting) OS or only if user activates "Search
new hardware"("Scan for hardware changes") through
Device Manager (these two ways are obvious enough). OS itself does
not see changes on serial port; this is different from USB devices
management (for example), when OS (not directly, but with help of
bus driver and other related software parts (I/O manager, PnP manager))
respond to all changes on USB immediately. For now, this is just
a notice, it will be used later. If you are interested in getting
more information about enumeration-based drivers loading procedure,
please check "Inside Microsoft WINDOWS 2000" book (David
A. Solomon, Mark E. Russinovich) , Microsoft Press or similar literature.
PART
2
|
|