iPXE
isa_ids.c
Go to the documentation of this file.
00001 #include <stdint.h>
00002 #include <stdio.h>
00003 #include <byteswap.h>
00004 #include <ipxe/isa_ids.h>
00005 
00006 /* 
00007  * EISA and ISAPnP IDs are actually mildly human readable, though in a
00008  * somewhat brain-damaged way.
00009  *
00010  */
00011 char * isa_id_string ( unsigned int vendor, unsigned int product ) {
00012         static char buf[7];
00013         int i;
00014 
00015         /* Vendor ID is a compressed ASCII string */
00016         vendor = bswap_16 ( vendor );
00017         for ( i = 2 ; i >= 0 ; i-- ) {
00018                 buf[i] = ( 'A' - 1 + ( vendor & 0x1f ) );
00019                 vendor >>= 5;
00020         }
00021         
00022         /* Product ID is a 4-digit hex string */
00023         sprintf ( &buf[3], "%04x", bswap_16 ( product ) );
00024 
00025         return buf;
00026 }