OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 301 to Rev 302
    Reverse comparison

Rev 301 → Rev 302

/open8_urisc/trunk/taskmgr/taskmgr_const.s
223,8 → 223,8
Flag DB ; Single-byte flag variable for returning semaphores
.ENDST
 
.DEFINE TSB_SIZE 2 * TASK_COUNT
.DEFINE FREE_SYS 124 - TSB_SIZE
.DEFINE TSB_SIZE 2 * TASK_COUNT
.DEFINE FREE_SYS WP_Rgn_Size - 8 - TSB_SIZE
 
.STRUCT str_taskman
This_Task DB ; Holds the task number of the current task
231,6 → 231,10
Next_Task DB ; Specifieds which task to be executed next
Fault_Flag DB ; Memory write fault flag
Fault_Task DB ; Task active/responsible for write fault
Temp_R0 DB ; Temp storage for R0
Temp_R1 DB ; Temp storage for R1
Temp_R2 DB ; Temp storage for R2
Temp_R3 DB ; Temp storage for R3
Task_Stacks DSB TSB_SIZE ; First location for stack data*
Free_Mem DSB FREE_SYS ; Unused memory in system region
.ENDST
933,17 → 937,22
; ISR/Supervisory Mode Functions - Allows tasks to define up to 5 functions
; that will operate in supervisor mode by calling a soft-int.
;
; Note 1: Due to assembler limitations, it is actually necessary for each task
; Note 1: that using these functions requires at least 5 free bytes of stack
;
; Note 2: Due to assembler limitations, it is actually necessary for each task
; to define all 5 sets of these macros, even if not used. These are defined
; in the pattern of TASKx_SPV_FUNCy, where x is the task number and
; y is the function 0-4.
;
; Note 2: Task code for these functions should NOT use RTS or RTI, as this WILL
; Note 3: Task code for these functions should NOT use RTS or RTI, as this WILL
; corrupt their stacks and likely crash the whole system. These are intended
; for operations that are atomic in nature, or that require supervisor perms
; due to write access (writing flags/messages to other tasks)
; due to write access (writing flags/messages to other tasks) Registers will
; be preserved in local system memory and restored prior to entering the stub
; effectively meaning that registers will retain their state through the
; function call. The state of system flags will NOT be retained, however.
;
; Note 3: These functions will run to completion (or hang) regardless of the
; Note 4: These functions will run to completion (or hang) regardless of the
; task timer, as interrupts can't pre-empt each other, so caution should be
; used with them. However, both the internal and external interrupt managers
; will latch incoming interrupts while these are running.
953,7 → 962,10
; referenced in the ISR table. (EXEC_SUPVn is used in the interrupt table)
 
.MACRO CREATE_SUPV_FUNC
EXEC_SUPV\@: BACKUP_FULL_CONTEXT
EXEC_SUPV\@: STA R0, TaskMgr.Temp_R0 ; Copy R0-R3 to local RAM, not stack
STA R1, TaskMgr.Temp_R1
STA R2, TaskMgr.Temp_R2
STA R3, TaskMgr.Temp_R3
 
REINIT_TASK_TABLE_PTR ; Setup R3:R2 to point to the task table
 
963,10 → 975,16
LDO R2, SUPV_FN\@_ENTRY_LOW
PSH R0
 
LDA R3, TaskMgr.Temp_R3 ; Replace R0-R3 from local RAM so that
LDA R2, TaskMgr.Temp_R2 ; the stub has the same register space
LDA R1, TaskMgr.Temp_R1 ; as a function call - less the flag
LDA R0, TaskMgr.Temp_R0 ; state, which isn't preserved
 
RTS ; Use RTS to "return" to our jump addr
 
_F\@_EXIT: RESTORE_FULL_CONTEXT
RTI
.REPEAT TASK_COUNT ; Create a stub for each task. The final
CREATE_F\@_FUNCTION_STUB ; RTI will be handled in the stubs
.ENDR
.ENDM
 
; CREATE_Fn_FUNCTION_STUB creates an entry point that is referenced in the
976,28 → 994,28
; disrupting the stack. (These aren't technically subroutines)
 
.MACRO CREATE_F0_FUNCTION_STUB
_F0_EXE_S\@: TASK\@_SUPV_FN0
JMP _F0_EXIT
_F0_EXE_S\@: TASK\@_SUPV_FN0 ; Run the stub code from the task
RTI ; Return from the interrupt
.ENDM
 
.MACRO CREATE_F1_FUNCTION_STUB
_F1_EXE_S\@: TASK\@_SUPV_FN1
JMP _F1_EXIT
_F1_EXE_S\@: TASK\@_SUPV_FN1 ; Run the stub code from the task
RTI ; Return from the interrupt
.ENDM
 
.MACRO CREATE_F2_FUNCTION_STUB
_F2_EXE_S\@: TASK\@_SUPV_FN2
JMP _F2_EXIT
_F2_EXE_S\@: TASK\@_SUPV_FN2 ; Run the stub code from the task
RTI ; Return from the interrupt
.ENDM
 
.MACRO CREATE_F3_FUNCTION_STUB
_F3_EXE_S\@: TASK\@_SUPV_FN3
JMP _F3_EXIT
_F3_EXE_S\@: TASK\@_SUPV_FN3 ; Run the stub code from the task
RTI ; Return from the interrupt
.ENDM
 
.MACRO CREATE_F4_FUNCTION_STUB
_F4_EXE_S\@: TASK\@_SUPV_FN4
JMP _F4_EXIT
_F4_EXE_S\@: TASK\@_SUPV_FN4 ; Run the stub code from the task
RTI ; Return from the interrupt
.ENDM
 
; INSTANCE_SUPV_FUNCS creates all 5 supervisory function entry points and a set
1006,14 → 1024,6
.REPEAT 5
CREATE_SUPV_FUNC
.ENDR
 
.REPEAT TASK_COUNT
CREATE_F0_FUNCTION_STUB
CREATE_F1_FUNCTION_STUB
CREATE_F2_FUNCTION_STUB
CREATE_F3_FUNCTION_STUB
CREATE_F4_FUNCTION_STUB
.ENDR
.ENDM
 
;------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.