xref: /Kernel-v10.6.2/portable/Renesas/SH2A_FPU/portasm.src (revision ef7b253b56c9788077f5ecd6c9deb4021923d646)
1;/*
2; * FreeRTOS Kernel V10.6.2
3; * Copyright (C) 2021 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4; *
5; * SPDX-License-Identifier: MIT
6; *
7; * Permission is hereby granted, free of charge, to any person obtaining a copy of
8; * this software and associated documentation files (the "Software"), to deal in
9; * the Software without restriction, including without limitation the rights to
10; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11; * the Software, and to permit persons to whom the Software is furnished to do so,
12; * subject to the following conditions:
13; *
14; * The above copyright notice and this permission notice shall be included in all
15; * copies or substantial portions of the Software.
16; *
17; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23; *
24; * https://www.FreeRTOS.org
25; * https://github.com/FreeRTOS
26; *
27; */
28
29    .import _pxCurrentTCB
30    .import _vTaskSwitchContext
31    .import _xTaskIncrementTick
32
33    .export _vPortStartFirstTask
34    .export _ulPortGetGBR
35    .export _vPortYieldHandler
36    .export _vPortPreemptiveTick
37    .export _vPortCooperativeTick
38    .export _vPortSaveFlopRegisters
39    .export _vPortRestoreFlopRegisters
40
41    .section    P
42
43    .INCLUDE "ISR_Support.inc"
44
45_vPortStartFirstTask:
46
47    portRESTORE_CONTEXT
48
49;-----------------------------------------------------------
50
51_vPortYieldHandler:
52
53    portSAVE_CONTEXT
54
55    mov.l   #_vTaskSwitchContext, r0
56    jsr     @r0
57    nop
58
59    portRESTORE_CONTEXT
60
61;-----------------------------------------------------------
62
63_vPortPreemptiveTick
64
65    portSAVE_CONTEXT
66
67    mov.l   #_xTaskIncrementTick, r0
68    jsr     @r0
69    nop
70
71    mov.l   #_vTaskSwitchContext, r0
72    jsr     @r0
73    nop
74
75    portRESTORE_CONTEXT
76
77;-----------------------------------------------------------
78
79_vPortCooperativeTick
80
81    portSAVE_CONTEXT
82
83    mov.l   #_xTaskIncrementTick, r0
84    jsr     @r0
85    nop
86
87    portRESTORE_CONTEXT
88
89;-----------------------------------------------------------
90
91_ulPortGetGBR:
92
93    stc.l   gbr, r0
94    rts
95    nop
96
97;-----------------------------------------------------------
98
99_vPortSaveFlopRegisters:
100
101    fmov.s  fr0, @-r4
102    fmov.s  fr1, @-r4
103    fmov.s  fr2, @-r4
104    fmov.s  fr3, @-r4
105    fmov.s  fr4, @-r4
106    fmov.s  fr5, @-r4
107    fmov.s  fr6, @-r4
108    fmov.s  fr7, @-r4
109    fmov.s  fr8, @-r4
110    fmov.s  fr9, @-r4
111    fmov.s  fr10, @-r4
112    fmov.s  fr11, @-r4
113    fmov.s  fr12, @-r4
114    fmov.s  fr13, @-r4
115    fmov.s  fr14, @-r4
116    fmov.s  fr15, @-r4
117    sts.l   fpul, @-r4
118    sts.l   fpscr, @-r4
119
120    rts
121    nop
122
123;-----------------------------------------------------------
124
125_vPortRestoreFlopRegisters:
126
127    add.l  #-72, r4
128    lds.l  @r4+, fpscr
129    lds.l  @r4+, fpul
130    fmov.s @r4+, fr15
131    fmov.s @r4+, fr14
132    fmov.s @r4+, fr13
133    fmov.s @r4+, fr12
134    fmov.s @r4+, fr11
135    fmov.s @r4+, fr10
136    fmov.s @r4+, fr9
137    fmov.s @r4+, fr8
138    fmov.s @r4+, fr7
139    fmov.s @r4+, fr6
140    fmov.s @r4+, fr5
141    fmov.s @r4+, fr4
142    fmov.s @r4+, fr3
143    fmov.s @r4+, fr2
144    fmov.s @r4+, fr1
145    fmov.s @r4+, fr0
146
147    rts
148    nop
149
150    .end
151