亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? nios_isrmanager.s

?? 基于fpga和sopc的用VHDL語言編寫的EDA的32位Nios CPU嵌入式系統(tǒng)軟硬件設計
?? S
字號:

	.include "nios_macros.s"
	.text
	.global nr_installuserisr
	.global nr_installuserisr2

;-------------------------------
; void nr_installuserisr(int trapNumber, nios_isrhandlerproc *trapProc, int context);
; void nr_installuserisr2(int trapNumber, nios_isrhandlerproc2 *trapProc, int context);
;
; Definition: "System ISR" -- the routine pointed to in
;             the vector table. It cannot easily call other routines,
;             and traps are disabled.
;
;             "User ISR" -- A normal routine with normal
;             facilities; the only difference from a normal (noninterrupt)
;             routine is that it can only be itself interrupted by
;             a higher priority (lower numbered) interrupt.
;
; This installs a trap handler for a particular trap number, and
; ensures that the trap handler (trapProc) is called with
; interrupts reenabled (for interrupts of higher priority only),
; and passed its necessary "context" value, which can be anything.
;
; The two names are synonyms for the same routine -- but one
; is typed to accept a nios_isrhandlerproc2, which has additional
; arguments. The arguments are always passed, but would be ignored
; by original nios_isrhandlerproc-prototype routines.
;
;----------------------------------------
;         Name: nr_installuserisr
;  Description: Install a trap routine
;        Input: %o0 = trap number
;               %o1 = trap handler routine
;               %o2 = context to be passed to handler
;       Output: none
; Side Effects: %g0 & %g1 altered
;    CWP Depth: 0
;

.ifdef __nios32__
	.equ nmul,2
.else
	.equ nmul,1
.endif

.equ _ISRManagerDebugging_,0

nr_installuserisr:
nr_installuserisr2:
	MOV	%g0,%o0			; %g0 = Trap Number
	LSLI	%g0,nmul		; (2 on n32, 1 on n16) %g0 = offset into vector table

	MOVIA	%g1,_ns_userisrfunnel@h	; %g1 = funnel for the user trap handlers
	MOVIA	%g2,nasys_vector_table	; %g2 -> vector table
	ADD	%g2,%g0			; %g2 -> entry for this trap in vector table
	LSLI	%g0,1			; our info table is 2 words per trap...
	MOVIA	%g3,_nr_userisrtable
	ADD	%g3,%g0			; %g3 -> entry in our User ISR Table

	ST	[%g3],%o1		; Store the handler routine...
	PFX	1
	ST	[%g3],%o2		; Store the handler routine's context.

	ST	[%g2],%g1		; install the funnel proc last, of course, safety.

	JMP	%o7
	NOP

	.comm	_nr_userisrtable,64*2*2*nmul,4	; two words per 64 ISR's: proc & context

.equ __nios_flat__, 1	; comment this line out to use the normal register windowed isr manager

.if __nios_flat__

;  
; ISR funnel handler for non-flat systems running flat and/or non-flat code.  
;
; THIS IS NOT FULLY TESTED
;
.equ FLAT_STACK_SPACE, 	((24+19)*2*nmul)

_ns_userisrfunnel:

	SUBIP	%fp,FLAT_STACK_SPACE	; space to save the %g registers, ISTATUS, %o0, & return
	MOV	%sp,%fp			; let %sp=%fp, till we RESTORE.

	;
	; Save the globals: ISR may use them.
	;
	STS	[%sp,24+0],%g0
	STS	[%sp,24+1],%g1
	STS	[%sp,24+2],%g2
	STS	[%sp,24+3],%g3
	STS	[%sp,24+4],%g4
	STS	[%sp,24+5],%g5
	STS	[%sp,24+6],%g6
	STS	[%sp,24+7],%g7

	;
	; Save the return address to the interruptee, across the RESTORE
	;
	MOV	%g4,%o7

	RESTORE
	;
	; Save trap return address: calling
	; the user ISR will alter it.
	;
	STS	[%sp,24+8],%g4			; save the trap return address

	;
	; Save CTL1, ISTATUS, so we can later TRET
	;
	PFX	1				; CTL1 = ISTATUS
	RDCTL	%g0
	STS	[%sp,24+9],%g0			; save ISTATUS
	
        ; Save %o's, except %sp (%o6)
        STS    	[%sp,24+10],%o0
        STS    	[%sp,24+11],%o1
        STS    	[%sp,24+12],%o2
        STS    	[%sp,24+13],%o3
        STS    	[%sp,24+14],%o4
        STS    	[%sp,24+15],%o5
        STS    	[%sp,24+16],%o7
        
        ; Save %i7 and %fp
	STS	[%sp,24+17],%i7
        STS    	[%sp,24+18],%fp
        
	;
	; Find the user ISR in our table, and its context
	;

	RDCTL	%g5
	LSRI	%g5,9
	ANDIP	%g5,0x003f			; %g5 = irq number now

	MOV	%g0,%g5
.ifdef __nios32__
	LSLI	%g0,3
.else
	LSLI	%g0,2				; %g0 = offset into user isr table
.endif

	MOVIA	%g1,_nr_userisrtable
	ADD	%g0,%g1				; %g1 -> (proc,context) for this trap...
	LD	%g2,[%g0]			; %g2 = proc to call
	PFX	1
	LD	%o0,[%g0]			; %o0 = context for that proc

	;
	; Enable Interrupts
	;

	PFX 9
	WRCTL	%g0				; (value doesn't matter)

	;
	; And call the user ISR
	; user_isr_proc(context, irq_number, interruptee_pc)
	;

	MOV	%o1,%g5
	CALL	%g2
	MOV	%o2,%g4

	;
	; Disable interrupts.
	;

	PFX	8
	WRCTL	%g0			   

	; Assume %sp is not clobbered.  Flat code restores it, non-flat
        ; code uses it as %fp.

        ; Save %o's, except %sp (%o6)
        LDS    	%o0,[%sp,24+10]
        LDS    	%o1,[%sp,24+11]
        LDS    	%o2,[%sp,24+12]
        LDS    	%o3,[%sp,24+13]
        LDS    	%o4,[%sp,24+14]
        LDS    	%o5,[%sp,24+15]
        LDS    	%o7,[%sp,24+16]
        
        ; Save %i7 and %fp
	LDS	%i7,[%sp,24+17]
        LDS    	%fp,[%sp,24+18]

	;
	; To return from the interrupt, we must
	; restore all registers (%g's, ISTATUS, %i0)
	;
	; And, we have to bump the CWP down, for
	; only one reason: we need a register to load
	; with the address to return to from the
	; interrupt via TRET.
	;

	RDCTL	%g0
	SUBIP	%g0,0x0010		; CWP = what it was when we arrived at system ISR here.
	WRCTL	%g0			; (virtual SAVE: CWP -= 1)
	NOP				; curious WRCTL delay slot

	;
	; Restore some registers
	;

	MOV	%sp,%fp
	ADDIP	%fp,FLAT_STACK_SPACE		; Set interruptee's stack pointer to what it was.

	LDS	%o7,[%sp,24+8]			; restore the trap return address

	LDS	%g0,[%sp,24+9]			; get old ISTATUS
	PFX	1				; CTL1 = ISTATUS
	WRCTL	%g0				; and put it in.

	LDS	%g0,[%sp,24+0]			; restore all them %g registers
	LDS	%g1,[%sp,24+1]
	LDS	%g2,[%sp,24+2]
	LDS	%g3,[%sp,24+3]
	LDS	%g4,[%sp,24+4]
	LDS	%g5,[%sp,24+5]
	LDS	%g6,[%sp,24+6]
	LDS	%g7,[%sp,24+7]

	TRET	%o7

	NOP

.else

; NON-FLAT CPU
;
; This "user ISR funnel" code is a sort
; of tricky. A trap or interrupt bumps
; the CWP down one, and stores the old
; PC value in (new CWP's) %o7, the old
; processor STATUS into ISTATUS, and
; transfers control here.
;
; What we'll do is:
;   Preserve the %g registers on the stack,
;   Preserve ISTATUS on the stack,
;   Preserve the return address on the stack
;
;   Bump CWP up one
;   Reenable interrupts (for anything higher
;   priority than we're handling)
;
;   Execute a normal CALL to the user ISR
;
;   (Do the opposite of the above)
;   TRET %o7.
;
; Stack frame looks like:
;
;      sp[24+13] = %i7		(we alter %i7 when we CALL -- it's the ISR's return addr!)
;      sp[24+12] = %i0		(we alter %i0 to pass context to ISR.)
;      sp[24+11] = %i0		(we alter %i0 to pass context to ISR.)
;      sp[24+10] = %i0		(we alter %i0 to pass context to ISR.)
;      sp[24+9] = ISTATUS
;      sp[24+8] = RETURN ADDRESS
;      sp[24+7] = %g7
;      sp[24+...] = ...
;      sp[24+0] = %g0
;      sp[0..15] = space for CWP Underflow, as usual.
;                  there's already space for it, of course, but second-guessing where
;                  the C-compiler put stuff and offsetting more is too tedious, so we
;                  just bump further down.
;      ----sp----

_ns_userisrfunnel:

	SUBIP	%fp,(24+14)*2*nmul	; space to save the %g registers, ISTATUS, %o0, & return
	MOV	%sp,%fp			; let %sp=%fp, till we RESTORE.

	;
	; Save the globals: ISR may use them.
	;
	STS	[%sp,24+0],%g0
	STS	[%sp,24+1],%g1
	STS	[%sp,24+2],%g2
	STS	[%sp,24+3],%g3
	STS	[%sp,24+4],%g4
	STS	[%sp,24+5],%g5
	STS	[%sp,24+6],%g6
	STS	[%sp,24+7],%g7

	;
	; Save the return address to the interruptee, across the RESTORE
	;
	MOV	%g4,%o7

	RESTORE
	;
	; CWP is now in the interruptee's level.
	; Tread lightly.
	;

	;
	; Save trap return address: calling
	; the user ISR will alter it.
	;
	STS	[%sp,24+8],%g4			; save the trap return address

	;
	; Save CTL1, ISTATUS, so we can later TRET
	;
	PFX	1				; CTL1 = ISTATUS
	RDCTL	%g0
	STS	[%sp,24+9],%g0			; save ISTATUS

	;
	; Save %o0, since we pass an argument there.
	;
	STS	[%sp,24+10],%o0			; save %o0, which we use to pass context.
	STS	[%sp,24+11],%o1			; save %o1, which we use to pass context.
	STS	[%sp,24+12],%o2			; save %o2, which we use to pass context.

	;
	; Save %o7, since it's not ours, yet we're
	; doing a CALL, which puts return address
	; into %o7.
	;
	STS	[%sp,24+13],%o7

	;
	; Reenable interrupts: this is the earliest opportunity.
	;

	;PFX	9
	;WRCTL	%g0				; (value doesn't matter)

	;
	; Find the user ISR in our table, and its context
	;

	RDCTL	%g5

	LSRI	%g5,9
	ANDIP	%g5,0x003f			; %g5 = irq number now

	MOV	%g0,%g5
.ifdef __nios32__
	LSLI	%g0,3
.else
	LSLI	%g0,2				; %g0 = offset into user isr table
.endif

	MOVIA	%g1,_nr_userisrtable
	ADD	%g0,%g1				; %g1 -> (proc,context) for this trap...
	LD	%g2,[%g0]			; %g2 = proc to call
	PFX	1
	LD	%o0,[%g0]			; %o0 = context for that proc

	;
	; Enable Interrupts
	;

	PFX 9
	WRCTL	%g0				; (value doesn't matter)

	;
	; And call the user ISR
	; user_isr_proc(context, irq_number, interruptee_pc)
	;

	MOV	%o1,%g5
	CALL	%g2
	MOV	%o2,%g4

	;
	; Disable interrupts.
	;

	PFX	8
	WRCTL	%g0				; (value doesn't matter)

	;
	; To return from the interrupt, we must
	; restore all registers (%g's, ISTATUS, %i0)
	;
	; And, we have to bump the CWP down, for
	; only one reason: we need a register to load
	; with the address to return to from the
	; interrupt via TRET.
	;

	RDCTL	%g0
	SUBIP	%g0,0x0010		; CWP = what it was when we arrived at system ISR here.
	WRCTL	%g0			; (virtual SAVE: CWP -= 1)
	NOP				; curious WRCTL delay slot

	;
	; Restore some registers
	;

	MOV	%sp,%fp
	ADDIP	%fp,(24+14)*2*nmul		; Set interruptee's stack pointer to what it was.

	LDS	%o7,[%sp,24+8]			; restore the trap return address

	LDS	%g0,[%sp,24+9]			; get old ISTATUS
	PFX	1				; CTL1 = ISTATUS
	WRCTL	%g0				; and put it in.

	LDS	%i0,[%sp,24+10]			; restore %i0, which we corrupted passing context.
	LDS	%i1,[%sp,24+11]			; restore %i1, which we corrupted passing context.
	LDS	%i2,[%sp,24+12]			; restore %i2, which we corrupted passing context.
	LDS	%i7,[%sp,24+13]			; restore %i7, which we corrupted passing context.

	LDS	%g0,[%sp,24+0]			; restore all them %g registers
	LDS	%g1,[%sp,24+1]
	LDS	%g2,[%sp,24+2]
	LDS	%g3,[%sp,24+3]
	LDS	%g4,[%sp,24+4]
	LDS	%g5,[%sp,24+5]
	LDS	%g6,[%sp,24+6]
	LDS	%g7,[%sp,24+7]

	TRET	%o7

	NOP
        
.endif ; __nios_flat__

; end of file

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
7878成人国产在线观看| 国产成人日日夜夜| 亚洲精品视频在线观看免费| 欧美极品aⅴ影院| 51精品久久久久久久蜜臀| 丁香亚洲综合激情啪啪综合| 国产不卡在线视频| 国产suv一区二区三区88区| 91麻豆自制传媒国产之光| 色综合久久久久综合体桃花网| 91视频免费观看| 91精品国产乱码| 久久久www成人免费毛片麻豆| 精品对白一区国产伦| 久久久久99精品国产片| 亚洲欧美乱综合| 偷拍一区二区三区| 极品销魂美女一区二区三区| 99视频一区二区三区| 欧美偷拍一区二区| 国产三级久久久| 热久久国产精品| 欧美性视频一区二区三区| 久久综合视频网| 日韩国产精品久久久久久亚洲| 国产真实乱子伦精品视频| av一区二区三区在线| 欧美视频自拍偷拍| 国产亚洲精品7777| 免费成人小视频| 色综合久久久网| 中文字幕日韩欧美一区二区三区| 男人的天堂亚洲一区| 粉嫩av一区二区三区粉嫩| 91精品国模一区二区三区| 国产精品久久三| 国产成人福利片| 亚洲成人黄色影院| 欧美探花视频资源| 亚洲国产精品一区二区尤物区| 成人爱爱电影网址| 国产精品午夜春色av| 成人性生交大片免费看在线播放| 欧美一级搡bbbb搡bbbb| 午夜国产不卡在线观看视频| 色综合久久中文综合久久牛| 亚洲码国产岛国毛片在线| 在线看国产日韩| 亚洲国产日韩综合久久精品| 色综合久久66| 亚洲1区2区3区4区| 欧美一区二区三区男人的天堂| 日韩不卡免费视频| 中文字幕在线视频一区| 91在线国产观看| 天堂在线亚洲视频| 欧美mv日韩mv国产网站| 国产高清不卡一区二区| 国产精品传媒入口麻豆| 欧美精品在线观看播放| 国产一区 二区| 亚洲少妇中出一区| 欧美一区二区三区的| 久久99国产精品久久| 日韩一区在线免费观看| 日韩免费性生活视频播放| 欧美亚洲一区二区在线| 国产九色sp调教91| 丝袜诱惑制服诱惑色一区在线观看| 精品噜噜噜噜久久久久久久久试看 | 一区二区三区在线看| 欧美日韩高清一区二区三区| 成人网在线播放| 日韩国产在线观看| 国产精品福利影院| 欧美成人一区二区三区在线观看| av成人动漫在线观看| 亚洲成av人片一区二区三区| 亚洲欧洲三级电影| 欧美激情综合在线| 国产三级一区二区| 日韩美女视频在线| 欧美日韩国产区一| 欧美日本国产一区| 色综合婷婷久久| caoporm超碰国产精品| 国产伦精品一区二区三区在线观看| 奇米影视在线99精品| 另类欧美日韩国产在线| 久久超碰97人人做人人爱| 精品一区二区在线视频| 麻豆一区二区在线| 国产中文字幕一区| 国产成人午夜视频| 成人97人人超碰人人99| 成人免费视频一区| 欧美中文字幕一区二区三区| 欧美酷刑日本凌虐凌虐| 亚洲精品一区二区三区香蕉| 国产精品拍天天在线| 中文字幕一区二区三区色视频| 一区二区三区在线视频免费观看| 日韩一区欧美一区| 天天色天天爱天天射综合| 人人爽香蕉精品| 色悠悠久久综合| 精品久久一区二区三区| 1区2区3区欧美| 精品影视av免费| av一区二区三区四区| 538prom精品视频线放| 久久看人人爽人人| 亚洲一区二区在线免费看| 国产精品资源站在线| 日韩一级免费一区| 一区二区久久久久| 国产乱码字幕精品高清av| 欧美日韩免费视频| 久久久久久久综合日本| 日本不卡视频在线观看| 色又黄又爽网站www久久| 亚洲国产视频a| 91久久人澡人人添人人爽欧美| 久久尤物电影视频在线观看| 日韩精品视频网站| av亚洲精华国产精华精华| 国产日产精品一区| 国产成人精品免费在线| 欧美精品一区男女天堂| 免费在线看成人av| 欧美日韩国产另类一区| 日韩精品一二三| 日韩欧美国产系列| 国产乱码精品一区二区三区五月婷| 日韩欧美一区在线| 日本在线观看不卡视频| 777欧美精品| 久久www免费人成看片高清| 国产欧美一区二区精品性色超碰| 国产精品一区二区在线播放| 久久久蜜桃精品| 91在线观看美女| 亚洲国产成人一区二区三区| 91福利视频网站| 奇米影视在线99精品| 26uuu国产电影一区二区| 91丝袜国产在线播放| 免费亚洲电影在线| 日本一区二区三区在线不卡| 97成人超碰视| 全国精品久久少妇| 亚洲欧美在线观看| 精品国产欧美一区二区| 91欧美一区二区| 国产精品一级片| 亚洲午夜免费电影| 国产精品理论片| 欧美一区二区成人6969| 国产电影精品久久禁18| 亚洲一区二区欧美| 国产精品每日更新| 日韩欧美一二三| 7777精品伊人久久久大香线蕉的 | 亚洲欧美自拍偷拍色图| 日韩一级黄色大片| 欧美日韩aaaaa| xfplay精品久久| 精品少妇一区二区三区在线播放 | 欧美tickle裸体挠脚心vk| 欧美日韩中文国产| 欧美日本一区二区三区| 国产夜色精品一区二区av| 日韩美一区二区三区| 91精品国产综合久久久久久漫画| 91麻豆精品国产自产在线观看一区| 欧美精品久久99久久在免费线 | 免费成人深夜小野草| 在线观看国产一区二区| 欧美精品一区视频| 国产精品久久久久久久久快鸭| 国产精品午夜在线| 色呦呦一区二区三区| 日韩中文字幕av电影| 欧美tickling网站挠脚心| 久久99久久久久| 97精品国产97久久久久久久久久久久 | 欧美日韩久久久| 久久久91精品国产一区二区三区| 一区二区三区在线影院| 免费成人性网站| 97久久精品人人做人人爽| 91福利在线播放| 精品国产伦理网| 国产suv精品一区二区三区| 99国产精品一区| 日韩精品一区在线| 国内久久精品视频| 91搞黄在线观看| 国产精品伦理在线| 成人激情小说网站|