summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386/ts_386ex/start/ts_1325.inc
blob: e10999abc0adc6648066f395f64c97f5370cb0a9 (plain) (blame)
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
/*
  These are just some useful macros that control the TS-1325's
  LEDs and push-button switch. Useful for debugging.

  NOTE:	This *must* be 16-bit compatible code to work in start.s
	
  Tony Ambardar
*/

	.macro	LED_OFF
	movw	$P1LTC,	dx
	inb	dx,	al
	orb	$0b01000000,	al
	andb	$0b11011111,	al
	outb	al,	dx
	.endm

	.macro	LED_GREEN
	movw	$P1LTC,	dx
	inb	dx,	al
	orb	$0b01100000,	al
	outb	al,	dx
	.endm

	.macro	LED_YELLOW
	movw	$P1LTC,	dx
	inb	dx,	al
	orb	$0b00100000,	al
	andb	$0b10111111,	al
	outb	al,	dx
	.endm

	.macro	LED_RED
	movw	$P1LTC,	dx
	inb	dx,	al
	andb	$0b10011111,	al
	outb	al,	dx
	.endm

	.macro	WAIT_BUTTON     # Wait till the button is pressed for a bit.
	movw	$P1PIN,	dx      # ~25-30 cycles per loop, 25MHz -> 1 sec.
	movl	$300000,ecx    # "Timer" count determines how long.
0:	inb	dx,	al
	andb	$0b00000001,al
	jnz	0b              # Button pressed?
	decl	ecx
	jnz	0b              # CX count expired?
	.endm