Subversion Repositories Kolibri OS

Rev

Rev 223 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
205 heavyiron 1
; Integrated Technology Express
2
;	Chip	Temp	Volt	Fan
3
;	it8705	 3	 8	 3
4
;	it8712	 3	 8	 3
5
 
6
; SiS
7
;	Chip	Temp	Volt	Fan
8
;	sis950	 3	 8	 3
9
 
10
IT87_REGCHIP	equ	0x58
11
IT87_CHIPID	equ	0x90
12
IT87_FANDIV	equ	0x0B
13
uglobal
14
it_chip_id	db	0
15
endg
16
it8705		db	15, 'IT8705F/SiS 950'
17
it8712		db	 7, 'IT8712F'
18
it8716		db	 7, 'IT8716F'
19
ite_unk		db	11, 'Unknown ITE'
20
 
21
ite_coeff:	dd 0.016		; Vcore
22
		dd 0.016		; Vin0
23
		dd 0.016		; Vin1 (+3.3V)
24
		dd 0.02688		; AVcc (+5V)
25
		dd 0.0608		; Vin2 (+12V)
26
		dd -0.055632		; -12V
27
		dd -0.02408		; -5V
28
;-----------------------------------
29
it87_init:
30
; Проверка наличия и инициализация
31
; OUT - CF = 1 - error
32
	;--- Проверяем IT87* --------
33
	mov	dx, 0x295
34
	mov	al, IT87_REGCHIP
35
	out	dx, al
36
	inc	edx
37
	in	al, dx
38
	cmp	al, IT87_CHIPID
39
	jne	it87_no		; это не it87 !!!
40
	; -~- not tested ~-~-
41
	dec	edx		; --- узнаём идентификатор чипа --
42
	mov	al, 0x21
43
	out	dx, al
44
	inc	edx
45
	in	al, dx
46
	mov	byte[it_chip_id], al
47
	; -~-~-~-~-~-~-~-~-~-
48
	clc
49
	ret
50
it87_no:stc
51
	ret
52
;-----------------------------------
53
it87_get_temp:
54
	mov	dx, 0x296
55
	xor	ecx, ecx
56
	mov	esi, temps
57
@@:	dec	edx
58
	mov	eax, ecx
59
	add	al, 0x29
60
	out	dx, al
61
	inc	edx
62
	in	al, dx
63
	mov	[esi + ecx * 2], al
64
	inc	ecx
65
	cmp	ecx, 3
66
	jb	@b
67
	ret
68
;-----------------------------------
69
it87_fan_div	db	1, 1, 1
70
it87_get_fan_speed:
71
; читаем делители
72
	mov	dx, 0x295
73
	mov	al, IT87_FANDIV
74
	out	dx, al
75
	inc	dx
76
	in	al, dx
77
	mov	ah, al
78
	and	al, 0x07
79
	mov	[it87_fan_div], al
80
	shr	ah, 3
81
	and	ah, 0x07
82
	mov	[it87_fan_div + 1], ah
83
 
84
	xor	ecx, ecx
85
@@:	mov	dx, 0x295
86
	mov	al, 0x0D
87
	add	al, cl
88
	out	dx, al
89
	inc	edx
90
	in	al, dx
91
	movzx	ebx, al
92
	push	ecx
93
	mov	cl, [it87_fan_div + ecx]
94
	shl	ebx, cl
95
	pop	ecx
96
	mov	eax, 1350000
97
	xor	edx, edx
98
	div	ebx
99
	mov	[rpms + 4 * ecx], eax
100
	inc	ecx
101
	cmp	ecx, 3
102
	jb	@b
103
 
104
	ret
105
;--------------------------------------------------------------------------
106
it87_get_name:
107
	mov	edx, it8705
108
	cmp	byte[it_chip_id], 0x05
109
	je	@f
110
	mov	edx, it8712
111
	cmp	byte[it_chip_id], 0x12
112
	je	@f
113
	mov	edx, it8716
114
	cmp	byte[it_chip_id], 0x16
115
	je	@f
116
	mov	edx, ite_unk
117
@@:	ret