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

📄 sccx9211.asm

📁 X86 GX1 BOOTLOAD代码 ,支持WINCE操作系统!
💻 ASM
📖 第 1 页 / 共 2 页
字号:
	ret
cx9211readReg ENDP


;**************************************************************************
;*
;*	Proc Name: cx9211writeReg
;*
;*	Use: write an indexed register to Cx9211
;*
;*	Entry: BX contains Register to Read
;*
;*	Exit: EAX contains Data 
;*
;*	Destroys:
;*
;**************************************************************************
cx9211writeReg PROC NEAR PUBLIC
	push	ebx
	push	edx
	push	ecx
	xchg	ax, bx

	; Set CS
	; Send   Write command
	;
	call	cx9211clearDataOut
	call	cx9211setDataOut
	call	cx9211setCS		; Set CS
	call	cx9211toggleClock	; 1 clock
	call	cx9211setDataOut
	call	cx9211toggleClock	; 1 clock

	mov	cx, 12			; 12 bits to send
	cld				; Count down
wrRegIndexSend:
	mov	dl, al			; Put lower 8 bits into DL
	and	dl, 01h			; Mask off all but data bit 

	cmp	dl, 1			; Is it SET?
	jne	wrRegIndexClr		; no Its CLEAR

wrRegIndexSet:
	call	cx9211setDataOut
	jmp	wrRegIndexClock

wrRegIndexClr:
	call	cx9211clearDataOut

wrRegIndexClock:
	call	cx9211toggleClock	; 1 clock
	ror	ax, 1
	loop	wrRegIndexSend

wrRegIndexIdle:
	call	cx9211setDataOut	; set write flag
	call	cx9211toggleClock	; 1 clock

	; write data
	xchg	ax, bx

	mov	cx, 32			; 8 bits to send
	cld				; Count down
wrRegDataSend:
	mov	dl, al			; Put lower 8 bits into DL
	and	dl, 01h			; Mask off all but data bit 

	cmp	dl, 1			; Is it SET?
	jne	wrRegDataClr		; no Its CLEAR

wrRegDataSet:
	call	cx9211setDataOut
	jmp	wrRegDataClock

wrRegDataClr:
	call	cx9211clearDataOut

wrRegDataClock:
	call	cx9211toggleClock	; 1 clock
	
	ror	eax, 1
	loop	wrRegDataSend

	call	cx9211clearCS		; Set CS

	call	cx9211toggleClock	; 1 clock
	call	cx9211toggleClock	; 1 clock
	call	cx9211toggleClock	; 1 clock
	call	cx9211toggleClock	; 1 clock

	pop	ecx
	pop	edx
	pop	ebx
	ret
cx9211writeReg ENDP



;**************************************************************************
;*
;*	Proc Name: cx9211setCS
;*
;*	Use: set the 9211 chip select high
;*
;*	Entry:
;*
;*	Exit:
;*
;*	Destroys: None
;*
;**************************************************************************
cx9211setCS PROC NEAR PUBLIC
	push	dx
	push	eax

	; Set CS HIGH
	mov	dx, GPIODATAIN
	in	eax, dx
	or	eax, CS9211
	mov	dx, GPIODATAOUT
	out	dx, eax

	pop	eax
	pop	dx
	ret
cx9211setCS ENDP

;**************************************************************************
;*
;*	Proc Name: cx9211clearCS
;*
;*	Use: sets 9211 chip select low
;*
;*	Entry:
;*
;*	Exit:
;*
;*	Destroys: none
;*
;**************************************************************************
cx9211clearCS PROC NEAR PUBLIC
	push	dx
	push	eax

	; Set CS LOW
	mov	dx, GPIODATAIN
	in	eax, dx
	and	eax, NOT CS9211
	mov	dx, GPIODATAOUT
	out	dx, eax

	pop	eax
	pop	dx
	ret
cx9211clearCS ENDP

;**************************************************************************
;*
;*	Proc Name: cx9211setDataOut
;*
;*	Use: sets 9211 DataOut high
;*
;*	Entry:
;*
;*	Exit:
;*
;*	Destroys: none
;*
;**************************************************************************
cx9211setDataOut PROC NEAR PUBLIC
	push	dx
	push	eax

	; Set DATA HIGH
	mov	dx, GPIODATAIN
	in	eax, dx
	or	eax, DATAIN9211
	mov	dx, GPIODATAOUT
	out	dx, eax

	pop	eax
	pop	dx
	ret
cx9211setDataOut ENDP

;**************************************************************************
;*
;*	Proc Name: cx9211clearDataOut
;*
;*	Use: sets 9211 dataOut Low
;*
;*	Entry:
;*
;*	Exit:
;*
;*	Destroys: none
;*
;**************************************************************************
cx9211clearDataOut PROC NEAR PUBLIC
	push	dx
	push	eax

	; Set Data LOW
	mov	dx, GPIODATAIN
	in	eax, dx
	and	eax, NOT DATAIN9211
	mov	dx, GPIODATAOUT
	out	dx, eax

	pop	eax
	pop	dx
	ret
cx9211clearDataOut ENDP

;**************************************************************************
;*
;*	Proc Name: cx9211ReadDataIn
;*
;*	Use: Reads the current bit from the 9211
;*
;*	Entry:
;*
;*	Exit: al = value of DataIn line
;*
;*	Destroys: eax
;*
;**************************************************************************
cx9211ReadDataIn PROC NEAR PUBLIC
	push	dx

	mov	dx, GPIODATAIN
	in	eax, dx
	in	eax, dx
	in	eax, dx
	in	eax, dx 			; For sub-decode and settle time
	and	eax, DATAOUT9211	; Preserve just Data IN bit

	cmp	eax, 0			; Is it LOW?
	je	readDataLow
	mov	al, 1			; must be HIGH
readDataLow:

	pop	dx
	ret
cx9211ReadDataIn ENDP

;**************************************************************************
;*
;*	Proc Name: cx9211toggleClock
;*
;*	Use: toggles the 9211 clock line
;*
;*	Entry:
;*
;*	Exit:
;*
;*	Destroys: none
;*
;**************************************************************************
cx9211toggleClock  PROC NEAR PUBLIC
	push	dx
	push	eax

	; SET CLOCK
	mov	dx, GPIODATAIN
	in	eax, dx
	or	eax, CLOCK9211
	mov	dx, GPIODATAOUT
	out	dx, eax

	nop
	nop

	; CLEAR CLOCK
	mov	dx, GPIODATAIN
	in	eax, dx
	and	eax, NOT CLOCK9211
	mov	dx, GPIODATAOUT
	out	dx, eax

	pop	eax
	pop	dx
	ret
cx9211toggleClock  ENDP

;**************************************************************************
;*
;*	Proc Name: cx9211SetClock
;*
;*	Use: sets 9211 clock line high
;*
;*	Entry:
;*
;*	Exit:
;*
;*	Destroys: none
;*
;**************************************************************************
cx9211SetClock  PROC NEAR PUBLIC
	push	dx
	push	eax

	; SET CLOCK
	mov	dx, GPIODATAIN
	in	eax, dx
	or	eax, CLOCK9211
	mov	dx, GPIODATAOUT
	out	dx, eax

	pop	eax
	pop	dx
	ret
cx9211SetClock  ENDP

;**************************************************************************
;*
;*	Proc Name: cx9211ClearClock
;*
;*	Use: clears 9211 clock line
;*
;*	Entry:
;*
;*	Exit:
;*
;*	Destroys: none
;*
;**************************************************************************
cx9211ClearClock  PROC NEAR PUBLIC
	push	dx
	push	eax

	; CLEAR CLOCK
	mov	dx, GPIODATAIN
	in	eax, dx
	and	eax, NOT CLOCK9211
	mov	dx, GPIODATAOUT
	out	dx, eax

	pop	eax
	pop	dx
	ret
cx9211ClearClock  ENDP


;**************************************************************************
;*
;*	Proc Name: RevCFRMload
;*
;*	Use: programs the rev C Frame rate modulation table into the 9211
;*
;*	Entry:
;*
;*	Exit:
;*
;*	Destroys: none
;*
;**************************************************************************
RevCFRMload  PROC NEAR PUBLIC
	pushad

	mov	bx, 0418h
	xor	eax, eax			; Make sure index is 0 to start
	call	cx9211writeReg			;  Index will auto-increment upon write to 41Ch

	mov	si, cs:(FP_FUNC PTR [si]).FRMTABLE
	mov	bx, 041Ch
	mov	cx, 32
writeFRM:
	mov	eax, cs:[si]
	call	cx9211writeReg			; Program lower 32-bits
	mov	eax, cs:[si+4]
	call	cx9211writeReg			; Program upper 32-bits

	add	si, 8						; Point to next 64-bit entry
	loop	writeFRM				; Do it for 32 times

; The first FRM location (64 bits) does not program correctly.
; This location always reads back with the last value programmed.
; ie. If 32 64-bit values are programmed, location 0 reads back as the 32nd
; If 30 locations are programmed, location 0 reads back as the 30th, etc.
; Fix this by re-writing location 0 after programming all 64 in the writeFRM loop in RevCFrmload() in CS9211.
	mov	bx, 0418h
	xor	eax, eax
	call	cx9211writeReg
	mov	bx, 041Ch
	xor	eax, eax
	call	cx9211writeReg
	mov	bx, 041Ch
	xor	eax, eax
	call	cx9211writeReg
	; end fix

	popad
	ret
RevCFRMload  ENDP


FP86TC18	LABEL DWORD
FP64SC8		LABEL DWORD
FP107TC18	LABEL DWORD
FP64DC16	LABEL DWORD
FP64TC18	LABEL DWORD
FP107DC24	LABEL DWORD
FP64DM8		LABEL DWORD
FP86DC16	LABEL DWORD
dd 000000000h		;0
dd 000000000h		;1
dd 001000100h		;2
dd 001000100h		;3
dd 001010101h		;4
dd 001010101h		;5
dd 002081041h		;6
dd 002081041h		;7
dd 010111111h		;8
dd 011111101h		;9
dd 049249241h		;10
dd 012412492h		;11
dd 092244891h		;12
dd 092244891h		;13
dd 022252525h		;14
dd 022252525h		;15
dd 0528294a5h		;16
dd 02528494ah		;17
dd 0294a5295h		;18
dd 0294a5295h		;19
dd 054a54a95h		;20
dd 02952a52ah		;21
dd 02a552a55h		;22
dd 02a552a55h		;23
dd 0554aa955h		;24
dd 02a9552aah		;25
dd 02aaa5555h		;26
dd 02aaa5555h		;27
dd 055555555h		;28
dd 02aaaaaaah		;29
dd 055555555h		;30
dd 055555555h		;31
dd 0aaaaaaabh		;32
dd 055555555h		;33
dd 05555aaabh		;34
dd 05555aaabh		;35
dd 0aab556abh		;36
dd 0556aad55h		;37
dd 055ab55abh		;38
dd 055ab55abh		;39
dd 0ab5ab56bh		;40
dd 056ad5ad5h		;41
dd 056b5ad6bh		;42
dd 056b5ad6bh		;43
dd 0ad6d6b5bh		;44
dd 05ad6b6b6h		;45
dd 05b5b5b5bh		;46
dd 05b5b5b5bh		;47
dd 05F6db6dbh		;48
dd 05F6db6dbh		;49
dd 0F776F776h		;50
dd 0F776F776h		;51
dd 0FBDEFBDEh		;52
dd 0FBDEFBDEh		;53
dd 07eFFBFF7h		;54
dd 07eFFBFF7h		;55
dd 0FF7FF7F7h		;56
dd 0FF7FF7F7h		;57
dd 0FF7FFF7Fh		;58
dd 0FF7FFF7Fh		;59
dd 0FFF7FFFFh		;60
dd 0FFF7FFFFh		;61
dd 0FFFFFFFFh		;62
dd 0FFFFFFFFh		;63

_TEXT ENDS

END

⌨️ 快捷键说明

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