File: getMB-via.c

package info (click to toggle)
xmbmon 2.05-6
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, lenny, squeeze, wheezy
  • size: 752 kB
  • ctags: 907
  • sloc: ansic: 6,089; sh: 2,923; makefile: 141; perl: 87
file content (63 lines) | stat: -rw-r--r-- 915 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

/* Direct access to VIA 686 Hardware Monitor Chip */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "methods.h"

/* VIA's HWM Base Address, global */
int  viahwm_base = -1;

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

#include "io_static.c"


static int ReadByte(int addr)
{
	int ret;
	ret = INb(viahwm_base + addr); WAIT;
	return (ret & 0xFF);
}

static void WriteByte(int addr, int value)
{
	OUTb(viahwm_base + addr, value); WAIT;
}

static int ReadWord(int addr)
{
	int ret;
	ret = INw(viahwm_base + addr); WAIT;
	return (ret & 0xFFFF);
}

static void WriteWord(int addr, int value)
{
	OUTw(viahwm_base + addr, value); WAIT;
}

static int ReadTemp1()
{
	return ReadByte(viahwm_base + 0x21);
}

static int ReadTemp2()
{
	return ReadByte(viahwm_base + 0x1F);
}

struct lm_methods method_via = {
	OpenIO,
	CloseIO,
	ReadByte,
	WriteByte,
	ReadWord,
	WriteWord,
	ReadTemp1,
	ReadTemp2
};