File:  [Qemu by Fabrice Bellard] / qemu / roms / ipxe / src / drivers / bus / isa_ids.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 18:58:25 2018 UTC (8 years, 1 month ago) by root
Branches: qemu, MAIN
CVS tags: qemu1101, qemu1001, qemu1000, qemu0151, HEAD
qemu 0.15.1

#include <stdint.h>
#include <stdio.h>
#include <byteswap.h>
#include <ipxe/isa_ids.h>

/* 
 * EISA and ISAPnP IDs are actually mildly human readable, though in a
 * somewhat brain-damaged way.
 *
 */
char * isa_id_string ( unsigned int vendor, unsigned int product ) {
	static char buf[7];
	int i;

	/* Vendor ID is a compressed ASCII string */
	vendor = bswap_16 ( vendor );
	for ( i = 2 ; i >= 0 ; i-- ) {
		buf[i] = ( 'A' - 1 + ( vendor & 0x1f ) );
		vendor >>= 5;
	}
	
	/* Product ID is a 4-digit hex string */
	sprintf ( &buf[3], "%04x", bswap_16 ( product ) );

	return buf;
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.