コード例 #1
0
ファイル: cmos_lowlevel.c プロジェクト: MikeeHawk/coreboot
/****************************************************************************
 * cmos_read_all
 *
 * Read all contents of CMOS memory into array 'data'.  The first 14 bytes of
 * 'data' are set to zero since this corresponds to the real time clock area.
 ****************************************************************************/
void cmos_read_all(unsigned char data[])
{
	unsigned i;

	for (i = 0; i < CMOS_RTC_AREA_SIZE; i++)
		data[i] = 0;

	for (; i < CMOS_SIZE; i++)
		data[i] = cmos_read_byte(i);
}
コード例 #2
0
ファイル: cmos_lowlevel.c プロジェクト: MikeeHawk/coreboot
/****************************************************************************
 * cmos_write_bits
 *
 * Write a chunk of bits (the low order 'nr_bits' bits of 'value') to an area
 * within a particular byte of CMOS memory.
 ****************************************************************************/
static void cmos_write_bits(const cmos_bit_op_location_t * where,
			    unsigned nr_bits, unsigned char value)
{
	unsigned char n, mask;

	if (nr_bits == 8) {
		cmos_write_byte(where->byte_index, value);
		return;
	}

	n = cmos_read_byte(where->byte_index);
	mask = ((unsigned char)((1 << nr_bits) - 1)) << where->bit_offset;
	n = (n & ~mask) + ((value << where->bit_offset) & mask);
	cmos_write_byte(where->byte_index, n);
}
コード例 #3
0
ファイル: cmos.c プロジェクト: michaelsippel/FruityOrange
void init_cmos(void) {
  cmos_data = malloc(sizeof(cmos_data_t));
  
  cmos_data->registers.register_a = cmos_read_byte(CMOS_REGISTER_A);
  cmos_data->registers.register_b = cmos_read_byte(CMOS_REGISTER_B);
  cmos_data->registers.register_c = cmos_read_byte(CMOS_REGISTER_C);
  cmos_data->registers.register_d = cmos_read_byte(CMOS_REGISTER_D);
  
  init_rtc();
  
  cmos_data->hardware.post_diagnostig_status_byte = cmos_read_byte(0x0E);
  cmos_data->hardware.shutdown_status_byte =        cmos_read_byte(0x0F);
  cmos_data->hardware.floppy_disk_type =            cmos_read_byte(0x10);
  cmos_data->hardware.hd_type =                     cmos_read_byte(0x12);
  cmos_data->hardware.device_byte =                 cmos_read_byte(0x14);
  
  cmos_data->hardware.basememory_size_low =         cmos_read_byte(0x15);
  cmos_data->hardware.basememory_size_high =        cmos_read_byte(0x16);
  cmos_data->hardware.expandablememory_size_low =   cmos_read_byte(0x17);
  cmos_data->hardware.expandablememory_size_high =  cmos_read_byte(0x18);
  cmos_data->hardware.extension_byte_hd1 =          cmos_read_byte(0x19);
  cmos_data->hardware.extension_byte_hd2 =          cmos_read_byte(0x1A);
  
  cmos_data->hardware.cmos_magic_low =              cmos_read_byte(0x2E);
  cmos_data->hardware.cmos_magic_high =             cmos_read_byte(0x2F);
  
  cmos_data->hardware.extendedmemory_low =          cmos_read_byte(0x30);
  cmos_data->hardware.extendedmenory_high =         cmos_read_byte(0x31);
}