1 |
301 |
jshamlet |
; Copyright (c)2022 Jeremy Seth Henry
|
2 |
|
|
; All rights reserved.
|
3 |
|
|
;
|
4 |
|
|
; Redistribution and use in source and binary forms, with or without
|
5 |
|
|
; modification, are permitted provided that the following conditions are met:
|
6 |
|
|
; * Redistributions of source code must retain the above copyright
|
7 |
|
|
; notice, this list of conditions and the following disclaimer.
|
8 |
|
|
; * Redistributions in binary form must reproduce the above copyright
|
9 |
|
|
; notice, this list of conditions and the following disclaimer in the
|
10 |
|
|
; documentation and/or other materials provided with the distribution,
|
11 |
|
|
; where applicable (as part of a user interface, debugging port, etc.)
|
12 |
|
|
;
|
13 |
|
|
; THIS SOFTWARE IS PROVIDED BY JEREMY SETH HENRY ``AS IS'' AND ANY
|
14 |
|
|
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
15 |
|
|
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
16 |
|
|
; DISCLAIMED. IN NO EVENT SHALL JEREMY SETH HENRY BE LIABLE FOR ANY
|
17 |
|
|
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
18 |
|
|
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
19 |
|
|
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
20 |
|
|
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
21 |
|
|
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
22 |
|
|
; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
23 |
|
|
;
|
24 |
|
|
;------------------------------------------------------------------------------
|
25 |
|
|
; taskmgr_func.s
|
26 |
|
|
;
|
27 |
|
|
; Program Start, Task Setup, and Core Interrupt Service
|
28 |
|
|
;
|
29 |
|
|
; Note that the CPU must be in supervisory mode for this code to execute
|
30 |
|
|
; properly, which means the I bit MUST be set at startup. This is controlled
|
31 |
|
|
; by HDL generics - specifically the supervisor mode enable.
|
32 |
|
|
;
|
33 |
|
|
; Revision History
|
34 |
|
|
; Author Date Change
|
35 |
|
|
;---------------- -------- ---------------------------------------------------
|
36 |
|
|
; Seth Henry 7/15/22 Initial Release
|
37 |
|
|
;------------------------------------------------------------------------------
|
38 |
|
|
|
39 |
|
|
;------------------------------------------------------------------------------
|
40 |
|
|
; System Bootstrap / Start of ROM
|
41 |
|
|
;------------------------------------------------------------------------------
|
42 |
|
|
.ORG BOOT_BLOCK
|
43 |
|
|
BOOTSTRAP: JMP INIT_MAIN ; Jump past the pointer block
|
44 |
|
|
NOP ; Aligns the data block, but not executed
|
45 |
|
|
;------------------------------------------------------------------------------
|
46 |
|
|
|
47 |
|
|
;------------------------------------------------------------------------------
|
48 |
|
|
; Pointer table
|
49 |
|
|
;------------------------------------------------------------------------------
|
50 |
|
|
INSTANCE_TASK_POINTERS
|
51 |
|
|
;------------------------------------------------------------------------------
|
52 |
|
|
|
53 |
|
|
;------------------------------------------------------------------------------
|
54 |
|
|
; Task Parameter table
|
55 |
|
|
;------------------------------------------------------------------------------
|
56 |
|
|
INSTANCE_TASK_EXPORTS
|
57 |
|
|
;------------------------------------------------------------------------------
|
58 |
|
|
|
59 |
|
|
;------------------------------------------------------------------------------
|
60 |
|
|
; System start
|
61 |
|
|
;------------------------------------------------------------------------------
|
62 |
|
|
INIT_MAIN: BNI INIT_MAIN ; Trap in a loop if supervisor mode isn't set
|
63 |
|
|
BOOT_SYSTEM
|
64 |
|
|
;------------------------------------------------------------------------------
|
65 |
|
|
|
66 |
|
|
;------------------------------------------------------------------------------
|
67 |
|
|
; RAM Access Fault Shutdown (CALL_PANIC)
|
68 |
|
|
;------------------------------------------------------------------------------
|
69 |
|
|
RAM_FAULT: PROCESS_RAM_FAULT
|
70 |
|
|
;------------------------------------------------------------------------------
|
71 |
|
|
|
72 |
|
|
;------------------------------------------------------------------------------
|
73 |
|
|
; Task Switch ISR (CALL_TASK_SW)
|
74 |
|
|
;------------------------------------------------------------------------------
|
75 |
|
|
TASK_SW_INT: SWITCH_TASKS
|
76 |
|
|
;------------------------------------------------------------------------------
|
77 |
|
|
|
78 |
|
|
;------------------------------------------------------------------------------
|
79 |
|
|
; External Interrupt Handler ISR
|
80 |
|
|
;------------------------------------------------------------------------------
|
81 |
|
|
EXT_INT_MGR:
|
82 |
|
|
.IFDEF INTMGR16
|
83 |
|
|
CHECK_EXTERNAL_IO_INTS16
|
84 |
|
|
.ELSE
|
85 |
|
|
CHECK_EXTERNAL_IO_INTS
|
86 |
|
|
.ENDIF
|
87 |
|
|
;------------------------------------------------------------------------------
|
88 |
|
|
|
89 |
|
|
;------------------------------------------------------------------------------
|
90 |
|
|
; ISR Context Function Calls (CALL_SUPV_FN<n>)
|
91 |
|
|
;------------------------------------------------------------------------------
|
92 |
|
|
INSTANCE_SUPV_FUNCS
|
93 |
|
|
;------------------------------------------------------------------------------
|