]> begriffs open source - cmsis-freertos/blob - Source/portable/IAR/MSP430/portasm.h
Merge branch 'CMSIS_FreeRTOS_10.4.3'
[cmsis-freertos] / Source / portable / IAR / MSP430 / portasm.h
1 /*
2  * FreeRTOS Kernel V10.4.3
3  * Copyright (C) 2020 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * https://www.FreeRTOS.org
23  * https://github.com/FreeRTOS
24  *
25  * 1 tab == 4 spaces!
26  */
27
28 #ifndef PORTASM_H
29 #define PORTASM_H
30
31 portSAVE_CONTEXT macro
32
33                 IMPORT pxCurrentTCB
34                 IMPORT usCriticalNesting
35
36                 /* Save the remaining registers. */
37                 push    r4
38                 push    r5
39                 push    r6
40                 push    r7
41                 push    r8
42                 push    r9
43                 push    r10
44                 push    r11
45                 push    r12
46                 push    r13
47                 push    r14
48                 push    r15
49                 mov.w   &usCriticalNesting, r14
50                 push    r14
51                 mov.w   &pxCurrentTCB, r12
52                 mov.w   r1, 0(r12)
53                 endm
54 /*-----------------------------------------------------------*/
55                 
56 portRESTORE_CONTEXT macro
57                 mov.w   &pxCurrentTCB, r12
58                 mov.w   @r12, r1
59                 pop             r15
60                 mov.w   r15, &usCriticalNesting
61                 pop             r15
62                 pop             r14
63                 pop             r13
64                 pop             r12
65                 pop             r11
66                 pop             r10
67                 pop             r9
68                 pop             r8
69                 pop             r7
70                 pop             r6
71                 pop             r5
72                 pop             r4
73
74                 /* The last thing on the stack will be the status register.
75         Ensure the power down bits are clear ready for the next
76         time this power down register is popped from the stack. */
77                 bic.w   #0xf0,0(SP)
78
79                 reti
80                 endm
81 /*-----------------------------------------------------------*/
82
83 #endif
84