1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-08 17:02:26 +03:00

Continuations support

This commit is contained in:
Ivan Grokhotkov
2014-11-20 17:25:27 +03:00
parent 27b0163958
commit 705928fdee
3 changed files with 250 additions and 0 deletions

49
cores/esp8266/cont_util.c Normal file
View File

@ -0,0 +1,49 @@
/////////////////////////////////////////////////////////////////////////////
//
// cont_util.c: continuations support for Xtensa call0 ABI
// Copyright (c) Ivan Grokhotkov 2014
//
// This file is licensed under MIT license
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
/////////////////////////////////////////////////////////////////////////////
#include "cont.h"
#define CONT_STACKGUARD 0xfeefeffe
void cont_init(cont_t* cont)
{
cont->stack_guard1 = CONT_STACKGUARD;
cont->stack_guard2 = CONT_STACKGUARD;
cont->stack_end = cont->stack + (sizeof(cont->stack) / 4 - 1);
cont->struct_start = cont;
}
int cont_check(cont_t* cont)
{
if (cont->stack_guard1 != CONT_STACKGUARD ||
cont->stack_guard2 != CONT_STACKGUARD )
return 1;
return 0;
}