ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts  1.0
ESP8266ILI9341DisplayProject
cont.h
Go to the documentation of this file.
1 /*
2  cont.h - continuations support for Xtensa call0 ABI
3  Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
4  This file is part of the esp8266 core for Arduino environment.
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15 
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
21 #ifndef CONT_H_
22 #define CONT_H_
23 
24 #include <stdbool.h>
25 
26 #ifndef CONT_STACKSIZE
27 #define CONT_STACKSIZE (1024*4)
28 #endif
29 
30 typedef struct cont_
31 {
32  void (*pc_ret)(void);
33  unsigned* sp_ret;
34 
35  void (*pc_yield)(void);
36  unsigned* sp_yield;
37 
38  unsigned* stack_end;
39  unsigned unused1;
40  unsigned unused2;
41  unsigned stack_guard1;
42 
43  unsigned stack[CONT_STACKSIZE / 4];
44 
45  unsigned stack_guard2;
46  unsigned* struct_start;
47 } cont_t;
48 
49 // Initialize the cont_t structure before calling cont_run
50 void cont_init(cont_t*);
51 
52 // Run function pfn in a separate stack, or continue execution
53 // at the point where cont_yield was called
54 void cont_run(cont_t*, void (*pfn)(void));
55 
56 // Return to the point where cont_run was called, saving the
57 // execution state (registers and stack)
58 void cont_yield(cont_t*);
59 
60 // Check guard bytes around the stack. Return 0 in case everything is ok,
61 // return 1 if guard bytes were overwritten.
62 int cont_check(cont_t* cont);
63 
64 // Check if yield() may be called. Returns true if we are running inside
65 // continuation stack
66 bool cont_can_yield(cont_t* cont);
67 #endif /* CONT_H_ */
void(* pc_ret)(void)
Definition: cont.h:32
void cont_yield(cont_t *)
unsigned stack[CONT_STACKSIZE/4]
Definition: cont.h:43
unsigned stack_guard2
Definition: cont.h:45
#define CONT_STACKSIZE
Definition: cont.h:27
int cont_check(cont_t *cont)
Definition: cont_util.c:36
unsigned * sp_ret
Definition: cont.h:33
bool cont_can_yield(cont_t *cont)
Definition: cont_util.c:44
void(* pc_yield)(void)
Definition: cont.h:35
unsigned * sp_yield
Definition: cont.h:36
unsigned unused2
Definition: cont.h:40
void cont_run(cont_t *, void(*pfn)(void))
Definition: cont.h:30
void cont_init(cont_t *)
Definition: cont_util.c:27
unsigned stack_guard1
Definition: cont.h:41
unsigned * stack_end
Definition: cont.h:38
unsigned unused1
Definition: cont.h:39
unsigned * struct_start
Definition: cont.h:46
struct cont_ cont_t