libsmbios_c library
Functions
cmos.h File Reference
#include "smbios_c/compat.h"
#include "smbios_c/types.h"
Include dependency graph for cmos.h:

Go to the source code of this file.

Functions

LIBSMBIOS_C_DLL_SPEC int cmos_read_byte (u8 *byte, u32 indexPort, u32 dataPort, u32 offset)
 Read byte from CMOS.
 
LIBSMBIOS_C_DLL_SPEC int cmos_write_byte (u8 byte, u32 indexPort, u32 dataPort, u32 offset)
 Write byte to CMOS.
 
LIBSMBIOS_C_DLL_SPEC int cmos_run_callbacks (bool do_update)
 Run all registered CMOS callbacks.
 
LIBSMBIOS_C_DLL_SPEC const char * cmos_strerror ()
 Returns string describing the last error condition.
 

Function Documentation

◆ cmos_read_byte()

LIBSMBIOS_C_DLL_SPEC int cmos_read_byte ( u8 byte,
u32  indexPort,
u32  dataPort,
u32  offset 
)

Read byte from CMOS.

Parameters
bytepointer to buffer were byte will be stored
indexPortthe io port where we write the offset
dataPortthe io port where we will read the resulting value
offsetthe offset into cmos (usually cmos is 256 byte banks)
Returns
0 on success, < 0 on failure

◆ cmos_run_callbacks()

LIBSMBIOS_C_DLL_SPEC int cmos_run_callbacks ( bool  do_update)

Run all registered CMOS callbacks.

Higher layers can register callbacks that are run when any byte in CMOS is changed. Presently, all these callbacks are used to update checksums in CMOS. If do_update is false, return code indicates if checksums are currently correct.

Parameters
do_updateshould callback update checksum if it is wrong
Returns
The return value of all callbacks is 'or'-ed together. Checksum callbacks return 0 if checksum is good and do_update is false. (otherwise they just write the correct checksum)

◆ cmos_strerror()

LIBSMBIOS_C_DLL_SPEC const char * cmos_strerror ( )

Returns string describing the last error condition.

Can return 0. The buffer used is guaranteed to be valid until the next call to any cmos_* function. Copy the contents if you need it longer.

◆ cmos_write_byte()

LIBSMBIOS_C_DLL_SPEC int cmos_write_byte ( u8  byte,
u32  indexPort,
u32  dataPort,
u32  offset 
)

Write byte to CMOS.

Parameters
bytebyte to write
indexPortthe io port where we write the offset
dataPortthe io port where we will write the byte
offsetthe offset into cmos (usually cmos is 256 byte banks)
Returns
0 on success, < 0 on failure