NAR-5071 User`s Manual


Add to my manuals
53 Pages

advertisement

NAR-5071 User`s Manual | Manualzz

regs.x.ax = 0xb10b; /* set PCI Cfg. Byte */

regs.x.di = 0x0068; /* get CR.0x68 */

regs.h.cl = 0x02; /* WDT is WDT mode, WDT enable, Unlock*/

__dpmi_int(0x1a, &regs);

} int main(){

int i,j;

unsigned char k;

Search_PCI_WDT();

prepare_access_above_1mb();

Show_Select();

do

{

do

i = getkey();

while ((i <= KEY_1) && (i >= KEY_3));

switch(i)

{

case KEY_1:

enable_wdt();

break;

case KEY_2:

reload_wdt();

break;

case KEY_3:

disable_wdt();

return(0);

break;

}

Show_Select();

}

while(1);

}

2.19 GPIO Information

; For PPAP-3714 GPIO testing

;

; By Frank Hsu , 06/03/2004

;

; GPIO on PPAP-3714

; PPAP-3714 J11_Pin1 =GPIO4:from HR_GPIO43

; J11_Pin3 =GPIO3:from HR_GPIO42

; J11_Pin5 =GPIO2:from HR_GPIO41

; J11_Pin7 =GPIO1:from HR_GPIO40

;

;

; J11_Pin9 =VCC

; J11_Pin10=GND

; Programming Guide :

;

; PG_Step1 : Enable GPIO IO function and get GPIOBASE, then save to

; ECX_Bit[31..16]

;

; How to program GPIO[40,41,42,43]

; -------------------------------------------------------

; Get GPIOBASE =: B0:D31:F0:Offset[58..5Bh] ;(and let bit0 = 0 )

; GPIO_CNTL =: B0:D31:F0:Offset_5Ch_bit4P1 ;Enable ICH4 GPIO

;

; GPIO_USE_SEL2=:GPIOBASE + 30h, Bit[11..8]P[1,1,1,1]

; GP_IO_SEL2 =:GPIOBASE + 34h, Bit[11..8],1-->Input,0-->Output

NAR-5100 User’s Manual

32

; GP_LVL2 =:GPIOBASE + 38h, Bit[11..8],Input: readback,

; output:1:high,0:low

; GPIO40 --> bit8,

; GPIO41 --> bit9,

; GPIO42 --> bit10,

; GPIO43 --> bit11,

;

; Let GPIO40,41,42,43 as GPIO pins by

; GPIO_USE_SEL2 (=:(GPIOBASE + 30h))_bit[11..8]P[1,1,1,1];

;

; Define GPIO as input or output pin, 1=input pin, 0=output pin

; GP_IO_SEL2 (=:(GPIOBASE + 34h))_bit[11..8]P[0/1,0/1,0/1,0/1];

;

; Output value or read status ?

; GP_LVL2 (=:(GPIOBASE + 38h))_bit[11..8];

; Output value When output pin defined

; Read returned status when input pin defined

.MODEL tiny

.386

.STACK 200h

.data

PROMP1 DB'PORTWELL PPAP-3714 GPIO,3714GPIO.exe, V1.00 06-03-2004,All rights reserved.$'

PROMP1_1 DB ' For PEB-3714 GPIO test .',13,10,'$'

PROMP_2_CR_LF db 0Dh, 0Ah,0Dh, 0Ah, '$'

PROMP_Str1 db ' PPAP-3714 J11_Pin1=GPIO4:from HR-ICH_GPIO43 ',0dh,0ah,'$'

PROMP_Str2 db ' J11_Pin3=GPIO3:from HR-ICH_GPIO42 ',0dh,0ah,'$'

PROMP_Str3 db ' J11_Pin5=GPIO2:from HR-ICH_GPIO41 ',0dh,0ah,'$'

PROMP_Str4 db ' J11_Pin7=GPIO1:from HR-ICH_GPIO40 ',0dh,0ah,'$'

PROMP_Str5 db ' ',0dh,0ah,'$'

PROMP_Str6 db ' Put a jumper cap on J11-pin1 and 3 , another jumper cap on pin5 and 7',0dh,0ah,'$'

PROMP_anykey db 0dh,0ah,' Ready ? If yes , then Press any key to start test ....... $'

PROMP_err1 db 0dh,0ah,'"GPO43,41 write 1,1 to GPI42,40" failed.',0dh,0ah,'$'

PROMP_err2 db 0dh,0ah,'"GPO43,41 write 0,0 to GPI42,40" failed.',0dh,0ah,'$'

PROMP_err3 db 0dh,0ah,'"GPO42,40 write 1,1 to GPI43,41" failed.',0dh,0ah,'$'

PROMP_err4 db 0dh,0ah,'"GPO42,40 write 0,0 to GPI43,41" failed.',0dh,0ah,'$'

PROMP_TEST_OK db ' ^_^ ..... PPAP-3714 GPIO test ( 3714GPIO.EXE ) OK ..... ^_^',0dh,0ah,'$'

PROMP_TEST_fail db ' <<..... PPAP-3714 GPIO test ( 3714GPIO.EXE ) FAIL .....>>',0dh,0ah,'$'

PROMP_Qkey db 0dh,0ah,'Press "Q" key to stop test and return to DOS; or other key will go on next test.$'

GPIO_USE_SEL2_OFFSET db 30h ; The offset value from GPIOBASE

GP_IO_SEL2_OFFSET db 34h ; The offset value from GPIOBASE

GP_LVL2_OFFSET db 38h ; The offset value from GPIOBASE

; ECX_bit[31..16] save GPIOBASE ( B0:D31:F0:Offset[58..5Bh] )

.code programstart:

mov ax,@data

mov ds,ax

lea dx,PROMP_2_CR_LF

mov ah,09h

int 21h

lea dx,PROMP1

mov ah,09h

int 21h

lea dx,PROMP_2_CR_LF

mov ah,09h

int 21h

lea dx,PROMP1_1

NAR-5100 User’s Manual

33

mov ah,09h

int 21h

lea dx,PROMP_2_CR_LF

mov ah,09h

int 21h

lea dx,PROMP_Str1

mov ah,09h

int 21h

lea dx,PROMP_Str2

mov ah,09h

int 21h

lea dx,PROMP_Str3

mov ah,09h

int 21h

lea dx,PROMP_Str4

mov ah,09h

int 21h

lea dx,PROMP_Str5

mov ah,09h

int 21h

lea dx,PROMP_Str6

mov ah,09h

int 21h

lea dx,PROMP_anykey ; ready to go ?

mov ah,09h

int 21h

xor al,al

WAIT_KB_0:

mov ah,1

int 21h

cmp al,0

je WAIT_KB_0

lea dx,PROMP_2_CR_LF

mov ah,09h

int 21h

mov edx,00000000h ; Error flag in EDX_BIT[16..19], 0=ok, 1=failed

;

; PG_Step1 : Enable GPIO IO function and get GPIOBASE, then save to

; ECX_Bit[31..16]

; ==================================================== 1_start

; Get GPIOBASE Base Address , and save to ECX_bit[31..16]

mov dx,0CF8h

mov eax,8000F85Ch ; B0:D31:F0:Offset_5Ch

out dx,eax

mov dx,0CFCh

in eax,dx

or al,10h ; 5Ch_Bit4P1 to Enable GPIO

out dx,eax

mov dx,0CF8h ; Get GPIOBASE

mov eax,8000F858h ; B0:D31:F0:Offset_58h

NAR-5100 User’s Manual

34

out dx,eax

mov dx,0CFCh

in eax,dx

and al,0feh ; bit 0 cleared to 0.

rol eax,10h

mov ecx,eax ; Save GPIOBASE to ECX[31..16]

; Get GPIOBASE Base Address , and save to ECX_bit[31..16]

; ==================================================== 1_end

; Testing way :

; --- t1

; GPO43 Write 1 to GPI42 , GPI42 = 1 ? ,if yes, pass ; if no, failed

; GPO41 Write 1 to GPI40 , GPI40 = 1 ? ,if yes, pass ; if no, failed

; --- t2

; GPO43 Write 0 to GPI42 , GPI42 = 0 ? ,if yes, pass ; if no, failed

; GPO41 Write 0 to GPI40 , GPI40 = 0 ? ,if yes, pass ; if no, failed

;

; --- t3

; GPO42 Write 1 to GPI43 , GPI43 = 1 ? ,if yes, pass ; if no, failed

; GPO40 Write 1 to GPI41 , GPI41 = 1 ? ,if yes, pass ; if no, failed

; --- t4

; GPO42 Write 0 to GPI43 , GPI43 = 0 ? ,if yes, pass ; if no, failed

; GPO40 Write 0 to GPI41 , GPI41 = 0 ? ,if yes, pass ; if no, failed

;

rol ecx,10h ; Restore GPIOBASE from ECX[31..16] to ECX[15..0]

; Let GPIO43,42,41,40 as GPIO pins by

; GPIO_USE_SEL2 (=:(GPIOBASE + 30h))_bit[11..8]P[1,1,1,1];

xor bh,bh

mov bl,GPIO_USE_SEL2_OFFSET ; Define as GPIO pins

mov dx,cx ; GPIOBASE

add dx,bx ; GPIO_USE_SEL2

inc dx ;

in al,dx ; Read first

or al,0fh ; Set GPIO40~43 as GPIO pins

out dx,al

; --- for t1 and t2 define GPO43,41 ; GPI42,40

; Define GPIO as input or output pin 1=input pin , 0=output pin

; GP_IO_SEL2 (=:(GPIOBASE + 34h))_bit[11..8]P[0,1,0,1];

mov bl,GP_IO_SEL2_OFFSET ; Define GPO,GPI pin

mov dx,cx ; GPIOBASE

add dx,bx ; GP_IO_SEL2

inc dx ;

in al,dx ; Read First

and al,0F0h ; GPO43,41 , GPI42,40

or al,05h ;

out dx,al

; ---- t1 start

; GPO43 Write 1 to GPI42 , GPI42 = 1 ? ,if yes, pass ; if no, failed

; GPO41 Write 1 to GPI40 , GPI40 = 1 ? ,if yes, pass ; if no, failed

; Output value or read status ?

; GP_LVL2 (=:(GPIOBASE + 38h))_bit[3..0];

; Output value When output pin defined

; Read returned status when input pin defined

NAR-5100 User’s Manual

35

mov bl,GP_LVL2_OFFSET ; GPO43 Write 1 to GPI42

mov dx,cx ; GPO41 write 1 to GPI40

add dx,bx ; GP_LVL2

inc dx ;

in al,dx ; Read First

or al,0Ah ;

out dx,al

call IODELAY ; io delay

in al,dx

and al,05h ; Mask bit2,0 ( GPI42,40 )

cmp al,05h

je next_test1 ; okay , go on test

; no , error message display

lea dx,promp_err1

mov ah,09h

int 21h

ror edx,10h ; error falg EDX_Bit16 , 1 --> Error happened

or dl,01h

rol edx,10h

call KB_Wait

next_test1 :

; ---- t1 end

; ---- t2 start

; GPO43 Write 0 to GPI42 , GPI42 = 0 ? ,if yes, pass ; if no, failed

; GPO41 Write 0 to GPI40 , GPI40 = 0 ? ,if yes, pass ; if no, failed

; Output value or read status ?

; GP_LVL2 (=:(GPIOBASE + 38h))_bit[11..8];

; Output value When output pin defined

; Read returned status when input pin defined

mov bl,GP_LVL2_OFFSET ; GPO43 Write 0 to GPI42

mov dx,cx ; GPO41 write 0 to GPI40

add dx,bx ; GP_LVL2

inc dx ;

in al,dx ; Read First

and al,0F5h ;

call IODELAY ; io delay

out dx,al

call IODELAY ; io delay

in al,dx

and al,05h ; Mask bit 2,0

cmp al,00h

je next_test2 ; okay , go on test

; no , error message display

NAR-5100 User’s Manual

36

lea dx,promp_err2

mov ah,09h

int 21h

ror edx,10h ; error falg EDX_Bit17 , 1 --> Error happened

or dl,02h

rol edx,10h

call KB_Wait

next_test2 :

; ---- t2 end

; --- for t3 and t4 define GPI43,41 ; GPO42,40

; Define GPIO as input or output pin 1=input pin , 0=output pin

; GP_IO_SEL2 (=:(GPIOBASE + 34h))_bit[11..8]P[1,0,1,0];

mov bl,GP_IO_SEL2_OFFSET ; Define GPO,GPI pin

mov dx,cx

add dx,bx ; GP_IO_SEL2

inc dx ;

in al,dx ; Read First

and al,0F0h ; GPI43,41 , GPO42,40

or al,0Ah ;

call IODELAY ; io delay

out dx,al

; ---- t3 start

; GPO42 Write 1 to GPI43 , GPI43 = 1 ? ,if yes, pass ; if no, failed

; GPO40 Write 1 to GPI41 , GPI41 = 1 ? ,if yes, pass ; if no, failed

; Output value or read status ?

; GP_LVL2 (=:(GPIOBASE + 38h))_bit[11..8];

; Output value When output pin defined

; Read returned status when input pin defined

mov bl,GP_LVL2_OFFSET ; GPO42 Write 1 to GPI43

mov dx,cx ; GPO40 write 1 to GPI41

add dx,bx ; GP_LVL2

inc dx ;

in al,dx ; Read First

or al,05h ;

call IODELAY ; io delay

out dx,al

call IODELAY ; io delay

in al,dx

and al,0ah ; Mask bit3,1 GPI43,41

cmp al,0ah

je next_test3 ; okay , go on test

; no , error message display

lea dx,promp_err3

mov ah,09h

int 21h

NAR-5100 User’s Manual

37

ror edx,10h ; error falg EDX_Bit18 , 1 --> Error happened

or dl,04h

rol edx,10h

call KB_Wait

next_test3 :

; ---- t3 end

; ---- t4 start

; GPO42 Write 0 to GPI43 , GPI43 = 0 ? ,if yes, pass ; if no, failed

; GPO40 Write 0 to GPI41 , GPI41 = 0 ? ,if yes, pass ; if no, failed

; Output value or read status ?

; GP_LVL2 (=:(GPIOBASE + 38h))_bit[11..8];

; Output value When output pin defined

; Read returned status when input pin defined

mov bl,GP_LVL2_OFFSET ; GPO42 Write 0 to GPI43

mov dx,cx ; GPO40 write 0 to GPI41

add dx,bx ; GP_LVL2

inc dx ;

in al,dx ; Read First

and al,0FAh ;

call IODELAY ; io delay

out dx,al

call IODELAY ; io delay

in al,dx

and al,0ah ; Mask bit 3,1

cmp al,00h

je test_end ; okay , end of test

; no , error message display

lea dx,promp_err4

mov ah,09h

int 21h

ror edx,10h ; error falg EDX_Bit19 , 1 --> Error happened

or dl,08h

rol edx,10h

; ---- t4 end

test_end :

ror edx,10h

cmp dl,00h

je test_ok

test_fail :

lea dx,PROMP_2_CR_LF

mov ah,09h

int 21h

lea dx,promp_TEST_fail

NAR-5100 User’s Manual

38

mov ah,09h

int 21h

jmp return_to_dos

test_ok :

lea dx,promp_TEST_OK

mov ah,09h

int 21h

ror ecx,10h ; ECX[15..0] to ECX[31..16]

; Restore GPIOBASE to ECX[31..16] return_to_dos :

mov ah,4ch ; Return to DOS

int 21h

IODELAY PROC near

push ax

push dx

mov dx,0edh

in al,dx

jmp $+2

mov dx,0edh

in al,dx

pop dx

pop ax

ret

IODELAY ENDP

KB_wait PROC near

push ax

push bx

push cx

push dx

lea dx,PROMP_Qkey

mov ah,9 ; Display "Q" key prompt

int 21h

xor al,al

WAIT_KB:

mov ah,1

int 21h

cmp al,0

je WAIT_KB

cmp al,51h ; "Q" pressed ?

je test_fail

cmp al,71h ; "q" pressed ?

jne call_return

jmp test_fail ;

call_return :

pop dx

pop cx

pop bx

pop ax

ret

NAR-5100 User’s Manual

39

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals