⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vsa2back.asm

📁 X86 GX1 BOOTLOAD代码 ,支持WINCE操作系统!
💻 ASM
📖 第 1 页 / 共 2 页
字号:
;*      geodePmBehavior
;*
;*	Reserved Function
;*
;*	Entry:
;*	  CH = 0D (Function D)
;*
;*	Exit:
;*	  None
;*
;*	Destroys:
;*	  None
;*
;**************************************************************************
geodePmBehavior PROC
	xor	dx, dx
	jmp	returnDX

	stc			; Not implemented
	ret
geodePmBehavior ENDP

geodePmExtTable LABEL WORD
	DW	vsaGetDelayParam
	DW	vsaSuspendEntry
	DW	vsaSuspendExit
	DW	vsaDelayParamCallback
	DW	vsaTimerCallback
	DW	vsaSuspendMask
geodePmExtTableLength EQU ($ - geodePmExtTable)/2

;**************************************************************************
;*
;*      geodePmExt
;*
;*	Entry:
;*	  CL = sub function to execute
;*
;*	Exit:
;*	Destroys:
;*
;**************************************************************************
geodePmExt PROC
        cmp     cl, LOW OFFSET geodePmExtTableLength    ; Test if within range
	jae	badPmParam

; Parse function number and call it
;
	mov	di, cx
	shl	di, 1			; Move function number to place with WORD adjustment
	and	di, 00FEh		; Mask Most Significant Byte for safty

        call    geodePmExtTable[di]     ; Call the corresponding function

	ret
geodePmExt ENDP

;**************************************************************************
;*
;*      geodePmExtDflt
;*
;*	A default return
;*
;*	Entry:
;*
;*	Exit:
;*	  DX = 0
;*
;*	Destroys:
;*
;**************************************************************************
geodePmExtDflt PROC
	mov	dx, 0
	jmp	returnDX
geodePmExtDflt ENDP

;**************************************************************************
;*
;*	vsaGetDelayParam
;*
;*	Called to get a delay paramater in seconds that will be used by
;*	VSA to call back SUBFUNCTION = 3 after suspend is entered.
;*
;*	Entry:
;*
;*	Exit:
;*	  Set DX = #seconds desired
;*
;*	Destroys:
;*
;**************************************************************************
vsaGetDelayParam PROC
	mov	dx, 5		; Assume good
	jmp	returnDX
vsaGetDelayParam ENDP

;**************************************************************************
;*
;*	vsaSuspendEntry
;*
;*	Called when either Standby or Suspend is entered
;*
;*	Entry:
;*	  CL = subfunction to execute
;*	  DX = APM Event code
;*
;*	Exit:
;*	Destroys:
;*;*
;**************************************************************************
vsaSuspendEntry PROC
	; Suspend ON LED
	mov	eax, CX55x0_ID
	mov	al,  Cx5530_REG90
	mov	dl, 3
	NOSTACK	bx,  cy55x0RegWrite8
	mov	eax, CX55x0_ID
	mov	al,  Cx5530_REG91
	mov	dl, 1
	NOSTACK	bx,  cy55x0RegWrite8
	; Suspend ON LED END
	mov	dx, 0			; Assume good

	jmp	returnDX
vsaSuspendEntry ENDP

;**************************************************************************
;*
;*	vsaSuspendExit
;*
;*	Called when either Standby or Suspend is exited
;*
;*	Entry:
;*	  DX = 0
;*
;*	Exit:
;*	Destroys:
;*
;**************************************************************************
vsaSuspendExit PROC
	; Power ON LED
	mov	eax, CX55x0_ID
	mov	al, Cx5530_REG90
	mov	dl, 3
	NOSTACK	bx, cy55x0RegWrite8
	mov	eax, CX55x0_ID
	mov	al,  Cx5530_REG91
	mov	dl, 2
	NOSTACK	bx, cy55x0RegWrite8
	; Power ON LED END
	mov	dx, 0
	jmp	returnDX
vsaSuspendExit ENDP

;**************************************************************************
;*
;*	vsaDelayParamCallback
;*
;*	Called after Suspend has been entered and the time specified in
;*	Function 0 has expired.
;*
;*	Entry:
;*	  DX=0
;*
;*	Exit:
;*	Destroys:
;*
;**************************************************************************
vsaDelayParamCallback PROC
	mov	dx, 1
	jmp	returnDX
vsaDelayParamCallback ENDP

;**************************************************************************
;*
;*	vsaTimerCallback
;*
;*	Called every 8ms while in Standby/Suspend
;*
;*	Have OEM function set AX to 0 to stay in Standby/Suspend or non 0
;*	to exit Standby/Suspend.  We want to preserve DX in case the OEM
;*	function wants to perform some routine based on every Nth callback.
;*
;*	Never Called in a 5530 system
;*
;*	Entry:
;*	  DX= # times this function has called
;*
;*	Exit:
;*	  DX = 0 to remain in Standby/Suspend
;*	       Non 0 to wakeup
;*	Destroys:
;*
;**************************************************************************
vsaTimerCallback PROC
	mov	dx, 0
	jmp	returnDX
vsaTimerCallback ENDP

;**************************************************************************
;*
;*	vsaSuspendMask
;*
;*	In DX place the 5520 GPIO that the Suspend switch is hooked too.
;*	For example, GPIO1 DX=02h.  Return 0 if none used.
;*	NOTE: AS OF 11/07/97 ONLY 5520 GPIO1 IS SUPPORTED.
;*
;*	Entry:
;*	Exit:
;*	Destroys:
;*
;**************************************************************************
vsaSuspendMask PROC
	mov	dx, 0
	Jmp	returnDX
vsaSuspendMask ENDP

;**************************************************************************
;*
;*	virtual register initialization code
;*
;**************************************************************************
;*	The VSA2 Init Tables consist of matched pairs of values.  The first value is
;*	the virtual register class in the upper byte, and the "function" in the lower 
;*	byte.  The second value is the 16-bit value to be written to that register.

miscVRegs		EQU $
; Miscellaneous virtual register values - 
;	Pattern is (VRC_MISCELLANEOUS SHL 8)+<reg offset>, 0xxxxh
;	Currently defined registers: 0-4, none used for VSA2 initialization.
miscTblEnd		EQU	$
miscTblSize		EQU	$-miscVRegs

audioVRegs		EQU $
; Audio virtual register default values.  Turn power on after bases are set.
; The order is important for the audio initialization. 
	dw	(VRC_AUDIO SHL 8)+SB_16_IO_BASE, XP_AUD_BASE 	; SB16 base address
	dw	(VRC_AUDIO SHL 8)+MIDI_BASE, 00h 	; MPU base address, 0 = No MIDI
	dw	(VRC_AUDIO SHL 8)+PM_STATE, 00h		; PM state, 0=ON, 5=OFF 
	dw	(VRC_AUDIO SHL 8)+CPU_USAGE, 00h	; Max sampling freq, 0 => VSM makes choice
audioTblEnd		EQU	$
audioTblSize	EQU	$-audioVRegs

videoVRegs		EQU $
; XPressVideo virtual register values.  If it is used, it starts enabled.
	dw	(VRC_VGA SHL 8)+VGA_MEM_SIZE, (VID_MEM SHL 1) OR  XPVIDEO
videoTblEnd		EQU	$
videoTblSize	EQU	$-videoVRegs

apmVRegs		EQU $
; APM virtual register values - 
;	Pattern is (VRC_APM SHL 8)+<reg offset>, 0xxxxh
	dw	(VRC_PM SHL 8) + PM_MODE, PMENABLE		; PM enable/disable
	dw	(VRC_PM SHL 8) + POWER_STATE, 00h		; Power state
	dw	(VRC_PM SHL 8) + DOZE_TIMEOUT, DOZESEC		; Doze timeout
	dw	(VRC_PM SHL 8) + STANDBY_TIMEOUT, STANDBYSEC	; Standby timeout
	dw	(VRC_PM SHL 8) + SUSPEND_TIMEOUT, SUSPENDSEC	; Suspend timeout
	dw	(VRC_PM SHL 8) + KEYBOARD_TIMEOUT, 00h		; Keyboard timeout
	dw	(VRC_PM SHL 8) + MOUSE_TIMEOUT, 00h		; Mouse timeout
	dw	(VRC_PM SHL 8) + VIDEO_TIMEOUT, 00h		; Mouse timeout
	dw	(VRC_PM SHL 8) + DISK_TIMEOUT, HDSEC		; Disk timeout
	dw	(VRC_PM SHL 8) + FLOPPY_TIMEOUT, 00h		; Floppy timeout
	dw	(VRC_PM SHL 8) + SERIAL_TIMEOUT, 00h		; Serial port timeout
	dw	(VRC_PM SHL 8) + PARALLEL_TIMEOUT, 00h		; Parallel port timeout
	dw	(VRC_PM SHL 8) + IRQ_WAKEUP_MASK, 1002h		; IRQ wakeup mask  1,12
	dw	(VRC_PM SHL 8) + SUSPEND_MODULATION, 0901h	; Suspend modulation, CPU throttling
	dw	(VRC_PM SHL 8) + VIDEO_SPEEDUP, 00h		; Video Speedup
	dw	(VRC_PM SHL 8) + IRQ_SPEEDUP, 00h		; IRQ speedup
	dw	(VRC_PM SHL 8) + WAKEUP_SMI_MASK, 00h		; Wakeup SMI mask
	dw	(VRC_PM SHL 8) + SCI_CONTROL, 00h		; SCI Control
	dw	(VRC_PM SHL 8) + SCI_ROUTING, 00h		; SCI Routing
	dw	(VRC_PM SHL 8) + INACTIVITY_CONTROL, 00h	; Inactivity control
	dw	(VRC_PM SHL 8) + MOUSE_CONTROL, 00h		; Mouse Control
	dw	(VRC_PM SHL 8) + RESUME_ON_RING, 00h		; Resume on ring
	dw	(VRC_PM SHL 8) + VECTOR_SEGMENT, 00h		;
	dw	(VRC_PM SHL 8) + VECTOR_OFFSET, 00h		;
apmTblEnd		EQU	$
apmTblSize		EQU	$-apmVRegs

pmVRegs			EQU $
; PM virtual register values
;	Pattern is (VRC_PM SHL 8)+<reg offset>, 0xxxxh
pmTblEnd		EQU	$
pmTblSize		EQU	$-pmVRegs

irVRegs			EQU $
; Infrared virtual register values - 
;	Pattern is (VRC_INFRARED SHL 8)+<reg offset>, 0xxxxh
irTblEnd		EQU	$
irTblSize		EQU	$-irVRegs

tvVRegs			EQU $
; Television virtual register values
;	Pattern is (VRC_TV SHL 8)+<reg offset>, 0xxxxh
tvTblEnd		EQU	$
tvTblSize		EQU	$-tvVRegs

eapVRegs		EQU $
; External amp virtual register values
;	Pattern is (VRC_EXTERNAL_AMP SHL 8)+<reg offset>, 0xxxxh
eapTblEnd		EQU	$
eapTblSize		EQU	$-eapVRegs

acpiVRegs		EQU $
; ACPI virtual register values - 
;	Pattern is (VRC_ACPI SHL 8)+<reg offset>, 0xxxxh
acpiTblEnd		EQU	$
acpiTblSize		EQU	$-acpiVRegs

oemacpiVRegs	EQU $
; OEM ACPI virtual register values - 
;	Pattern is (VRC_ACPI_OEM SHL 8)+<reg offset>, 0xxxxh
oemacpiTblEnd	EQU	$
oemacpiTblSize	EQU	$-oemacpiVRegs

powerVRegs		EQU $
; Battery and power related virtual register values
;	Pattern is (VRC_POWER SHL 8)+<reg offset>, 0xxxxh
powerTblEnd		EQU	$
powerTblSize	EQU	$-powerVRegs

vuartVRegs		EQU $
; Virtual UART initialization virtual registers.  Default is standard COM1
; and COM2.  VUART is capable of handling COM1 - COM4.
;	Pattern is (VRC_VUART SHL 8)+<reg offset>, 0xxxxh
	dw	(VRC_VUART SHL 8)+VRC_URT_ADDR, VUART_PORTS
	dw	(VRC_VUART SHL 8)+VRC_URT_IRQ, VUART_IRQS
vuartTblEnd		EQU	$
vuartTblSize	EQU	$-vuartVRegs

ohciVRegs		EQU $
; OHCI/USB virtual registers initialization.  
;	Pattern is (VRC_OHCI SHL 8)+<reg offset>, 0xxxxh
	dw	(VRC_OHCI SHL 8)+INIT_OHCI, 1
ohciTblEnd		EQU	$
ohciTblSize	EQU	$-ohciVRegs


;**************************************************************************
;*
;*	sb16init
;*
;*	Initialize audio IRQ and DMAs via SoundBlaster15 interface
;*
;*	Entry:
;*	None
;*
;*	Exit:
;*	None
;*
;*	Destroys:
;*	  AX, CX
;*
;**************************************************************************
sb16init PROC NEAR PUBLIC
	push	dx

	; Initialize the audio IRQ and DMA using the SoundBlaster interface.
	; These are set by writing the appropriate values to the mixer.  The
	; mixer index port is at SB_IO_BASE+4 and the data port is SB_IO_BASE+5
	mov	dx, XP_AUD_BASE+4	; Start with the IRQ
	mov	ax, 80h			; Set IRQ index
	out	dx, al
	inc	dx			; Point to data port
	mov	ax, XPAUDIO
	shr	ax, 6
	and	ax, 07h
	cmp	ax, 5
	jne	wrt_irq
	mov	ax, 8
wrt_irq:
	out	dx, al			; Set the IRQ

	mov	ax, XPAUDIO
	shr	ax, 9
	and	ax, 03h			; A 2-bit field
	cmp	ax, 03h
	jne	dma_hi
	mov	ax, 08h

dma_hi:
	mov	cl, al			; Park the value for safe keeping
	mov	ax, XPAUDIO
	shr	ax, 11
	and	ax, 03h			; A 2-bit field
	cmp	ax, 03h
	jne	dma_done
	mov	ax, 04h
dma_done:
	shl	ax, 5			; Move bits into correst position
	or 	cl, al			; Merge both DMA masks

	mov	dx, XP_AUD_BASE+4	; Point back to mixer index port
	mov	ax, 81h			; DMA index
	out	dx, al
	inc	dx			; Point to data port
	mov	al, cl
	out	dx, al			; Set the DMAs

	pop	dx
	ret
sb16init ENDP

;**************************************************************************
;*
;*	v2TBLInit
;*
;*	Output table entries to virtual registers.
;*
;*	Entry:
;*	  SI = Table start offset
;*
;*	Exit:
;*	  CX = Table length
;*
;*	Destroys:
;*
;**************************************************************************
v2TblInit PROC NEAR PUBLIC

	jcxz	v2TblExit		; Leave if nothing to do
	
	xor	bx, bx			; Use BX as index

v2TblLoop:
	mov	dx, VRC_INDEX		; VRC_INDEX

	mov ax, VR_UNLOCK	    ; Unlock the virtual registers
	out	dx, ax

	mov	ax, cs:[si+bx]
	out	dx, ax

	add	bx, 2

	mov	dx, VRC_DATA		; VRC_DATA
	mov	ax, cs:[si+bx]
	out	dx, ax

	add	bx, 2

	cmp	bx, cx
	jb	v2TblLoop

v2TblExit:
	ret
v2TblInit ENDP

;**************************************************************************
;*
;*	virtualRegInit
;*
;*	Initialize VSA2 system.
;*
;*	Entry:
;*	  BX = Return address
;*
;*	Exit:
;*	  BX = Return address
;*
;*	Destroys:
;*
;**************************************************************************
virtualRegInit PROC NEAR PUBLIC
	push	bx			; Save return address and friends
	push	cx

	lea	si, miscVRegs
	mov	cx, miscTblSize
	call	v2TblInit

	lea	si, audioVRegs
	mov	cx, audioTblSize
	call	v2TblInit
	; Now specify the IRQ and DMA channels via the SoundBlaster16 interface
	call	sb16init

	; SoftVGA initialization - if needed.  Checks first for results of ISA
	; video card scan.
	push	ds
	push	BDA_SEG
	pop	ds			; set ds to BDA
	mov	al, ds:[BDA_VIDEO_BOARDS_B]
	pop	ds			; restore DS

	test	al, 06h			; see if external video card
	jnz	noSoftVga		; yes 
	and	al, 1			; have softvga?
	Jz	noSoftVga		; no soft either 

	lea	si, videoVRegs		; No ISA video, init SoftVGA
	mov	cx, videoTblSize
	call	v2TblInit

noSoftVga:

	lea	si, apmVRegs
	mov	cx, apmTblSize
	call	v2TblInit

	lea	si, pmVRegs
	mov	cx, pmTblSize
	call	v2TblInit

	lea	si, irVRegs
	mov	cx, irTblSize
	call	v2TblInit

	lea	si, tvVRegs
	mov	cx, tvTblSize
	call	v2TblInit

	lea	si, eapVRegs
	mov	cx, eapTblSize
	call	v2TblInit

	lea	si, acpiVRegs
	mov	cx, acpiTblSize
	call	v2TblInit

	lea	si, oemacpiVRegs
	mov	cx, oemacpiTblSize
	call	v2TblInit

	lea	si, powerVRegs
	mov	cx, powerTblSize
	call	v2TblInit

; VUART initialization.  VUART_PORTS is set to zero if there are no virtual
; UARTs required.
	mov ax, VUART_PORTS
	cmp ax, 0
	je		pastVuartInit

	lea	si, vuartVRegs
	mov	cx, vuartTblSize
	call	v2TblInit

pastVuartInit:
v2VRegInitExit:

; OHCI USB KBD INIT
	lea	si, ohciVRegs
	mov	cx, ohciTblSize
	call	v2TblInit

	pop	cx
	pop	bx
	ret
virtualRegInit ENDP

_TEXT ENDS

END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -