X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=sboot%2Fmagpie_1_1%2Fsboot%2Fathos%2Fsrc%2Fxtos%2Finit.c;fp=sboot%2Fmagpie_1_1%2Fsboot%2Fathos%2Fsrc%2Fxtos%2Finit.c;h=065fb083fb73e32b98639fd84ffae8198ec7626b;hb=ff66305a044be28464fa0969ea2d605bb268d478;hp=0000000000000000000000000000000000000000;hpb=60b496560eec004ded92ae4dad43b3d102c6658d;p=open-ath9k-htc-firmware.git diff --git a/sboot/magpie_1_1/sboot/athos/src/xtos/init.c b/sboot/magpie_1_1/sboot/athos/src/xtos/init.c new file mode 100755 index 0000000..065fb08 --- /dev/null +++ b/sboot/magpie_1_1/sboot/athos/src/xtos/init.c @@ -0,0 +1,64 @@ +/* init.c - context initialization */ + +/* + * Copyright (c) 1999-2006 Tensilica Inc. + * + * 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 +#if XCHAL_NUM_CONTEXTS > 1 +#include +#endif + + + +#if 0 /* XCHAL_NUM_CONTEXTS > 1 */ +extern void _xtos_setup_context(int context_num, SetupInfo *info); +extern void _xtos_start_context(void); + +/* + * Sets up a context for running code. + * + * Returns PC at which to set the new context, or 0 on error. + */ +unsigned _xtos_init_context(int context_num, int stack_size, + _xtos_handler_func *start_func, int arg1) +{ + SetupInfo info; + + /* Allocate stack: */ + char *sp; + char *stack = malloc(stack_size); + if (stack == NULL) + return 0; + + /* Setup stack for call8: */ + sp = stack + stack_size - 16; + *(unsigned*)(sp - 12) = (unsigned)(sp + 32); + + info.sp = (unsigned)sp; + info.funcpc = (unsigned)start_func; + info.arg1 = arg1; + _xtos_setup_context(context_num, &info); + return (unsigned) &_xtos_start_context; +} +#endif /* multiple contexts */ +