Showing posts with label cmos. Show all posts
Showing posts with label cmos. Show all posts

Thursday, March 24, 2011

IO/CMOS read/wirte in Windows

In Linux, it is easy to read/write to port, you could just write a user level program, and use function inb(), outb(); you don't need to do kernel operations.

But in Windows, you cannot directly access hardware by using user level program. You could write a device driver to do it, which is in kernel level.
Or you could use some tool to do this:

1. Download tool: read/write everything
http://jacky5488.myweb.hinet.net/

2. Open I/O Index/Data window.
Input 0x70 as index, and 0x71 as data, and it will display all the data in the CMOS. For example, you want to change the 125th = 0x7d byte in CMOS from 0x00 to 0x01, just go 125th byte, and change it.

Thursday, February 3, 2011

Get the time information from CMOS

Get the layout of CMOS on current motherboard.
E.g. First byte indicates the seconds of current time

outb(0, 0x70);
unsigned char sec = inb(0x71);

CMOS read write please see previous post

Monday, November 29, 2010

CMOS read/wirte in coreboot/Linux

0x70 is the CMOS memory address I/O port,and 0x71 is the CMOS memory data I/O port

There are 128 bytes data in CMOS, or say 1024 bits in CMOS. The layout format of CMOS is at:
/coreboot/src/mainboard/asus/m2v-mx_se/cmos.layout
or link
http://www.bioscentral.com/misc/cmosmap.htm


If you want to read the 125th byte of CMOS memory:

#include <arch/io.h>
unsigned char addr = 125;
unsigned char data
outb(addr, 0x70);
data = inb(0x71)

If you want to write to the 125th byte of CMOS memory:

#include <arch/io.h>
unsigned char addr = 125;
unsgined char data = 0x01;
outb(addr, 0x70);
outb(data, 0x71);
There are also cmos_read() and cmos_write function at /coreboot/src/include/pc80/mc146818rtc.h