99
1010#ifdef __AVR__
1111
12- /*
13- It is highly unlikely to understand the following code without:
14- a) basic understanding of AVR assembly language;
15- b) reading about avr-gcc's ABI beforehand (https://gcc.gnu.org/wiki/avr-gcc).
16- */
17-
1812/* AVR machine context definition. Please keep the corresponding routines/macros synchronised with this definition. */
1913typedef struct avr_context_t_ {
2014 uint8_t sreg ;
@@ -35,6 +29,28 @@ typedef struct avr_context_t_ {
3529 } sp ;
3630} avr_context_t ;
3731
32+ #ifdef __cplusplus
33+ extern "C" {
34+ #endif /*__cplusplus */
35+
36+ extern void avr_getcontext (avr_context_t * cp );
37+ extern void avr_setcontext (const avr_context_t * cp );
38+ extern void avr_swapcontext (avr_context_t * oucp , const avr_context_t * cp );
39+ extern void avr_makecontext (avr_context_t * cp ,
40+ void * stackp , const size_t stack_size ,
41+ const avr_context_t * successor_cp ,
42+ void (* funcp )(void * ), void * funcargp );
43+
44+ #ifdef __cplusplus
45+ }
46+ #endif /*__cplusplus */
47+
48+ /*
49+ It is highly unlikely to understand the following code without:
50+ a) basic understanding of AVR assembly language;
51+ b) reading about avr-gcc's ABI beforehand (https://gcc.gnu.org/wiki/avr-gcc).
52+ */
53+
3854/* Some utility macros, most of them define offsets to simplify working on the
3955 machine context structure from within assembly code. */
4056#define AVR_CONTEXT_ASMCONST (name , value )\
@@ -290,22 +306,6 @@ please make sure that you understand how they work.
290306 "lds ZL, " #global_context_pointer "\n" \
291307 "lds ZH, " #global_context_pointer " + 1\n" )
292308
293- #ifdef __cplusplus
294- extern "C" {
295- #endif /*__cplusplus */
296-
297- extern void avr_getcontext (avr_context_t * cp );
298- extern void avr_setcontext (avr_context_t * cp );
299- extern void avr_swapcontext (avr_context_t * oucp , avr_context_t * cp );
300- extern void avr_makecontext (avr_context_t * cp ,
301- void * stackp , size_t stack_size ,
302- avr_context_t * successor_cp ,
303- void (* funcp )(void * ), void * funcargp );
304-
305- #ifdef __cplusplus
306- }
307- #endif /*__cplusplus */
308-
309309#endif /* __AVR__ */
310310
311311#endif /* AVRCONTEXT_H */
0 commit comments