ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts  1.0
ESP8266ILI9341DisplayProject
cont_util.c
Go to the documentation of this file.
1 /*
2  cont_util.s - 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 #include "cont.h"
22 #include <stddef.h>
23 #include "ets_sys.h"
24 
25 #define CONT_STACKGUARD 0xfeefeffe
26 
27 void cont_init(cont_t* cont)
28 {
31  cont->stack_end = cont->stack + (sizeof(cont->stack) / 4);
32  cont->struct_start = (unsigned*) cont;
33 }
34 
35 
36 int cont_check(cont_t* cont)
37 {
38  if(cont->stack_guard1 != CONT_STACKGUARD || cont->stack_guard2 != CONT_STACKGUARD) return 1;
39 
40  return 0;
41 }
42 
43 
45 {
46  return !ETS_INTR_WITHINISR() &&
47  cont->pc_ret != 0 && cont->pc_yield == 0;
48 }
void(* pc_ret)(void)
Definition: cont.h:32
bool ETS_INTR_WITHINISR()
Definition: ets_sys.h:65
unsigned stack[CONT_STACKSIZE/4]
Definition: cont.h:43
unsigned stack_guard2
Definition: cont.h:45
int cont_check(cont_t *cont)
Definition: cont_util.c:36
void cont_init(cont_t *cont)
Definition: cont_util.c:27
void(* pc_yield)(void)
Definition: cont.h:35
#define CONT_STACKGUARD
Definition: cont_util.c:25
bool cont_can_yield(cont_t *cont)
Definition: cont_util.c:44
Definition: cont.h:30
unsigned stack_guard1
Definition: cont.h:41
unsigned * stack_end
Definition: cont.h:38
unsigned * struct_start
Definition: cont.h:46