python-on-a-chip online compiler

Dependencies:   mbed TSI

/media/uploads/va009039/p14p-f446re.png

more info: python-on-a-chip

Committer:
va009039
Date:
Thu Apr 14 22:32:57 2016 +0000
Revision:
15:94ca5c8003e5
Parent:
0:65f1469d6bfb
update Nucleo-F401RE.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
va009039 0:65f1469d6bfb 1 /*
va009039 0:65f1469d6bfb 2 # This file is Copyright 2007 Dean Hall.
va009039 0:65f1469d6bfb 3 # This file is part of the PyMite VM.
va009039 0:65f1469d6bfb 4 # This file is licensed under the MIT License.
va009039 0:65f1469d6bfb 5 # See the LICENSE file for details.
va009039 0:65f1469d6bfb 6 */
va009039 0:65f1469d6bfb 7
va009039 0:65f1469d6bfb 8
va009039 0:65f1469d6bfb 9 #undef __FILE_ID__
va009039 0:65f1469d6bfb 10 #define __FILE_ID__ 0x16
va009039 0:65f1469d6bfb 11
va009039 0:65f1469d6bfb 12
va009039 0:65f1469d6bfb 13 /**
va009039 0:65f1469d6bfb 14 * \file
va009039 0:65f1469d6bfb 15 * \brief VM Thread
va009039 0:65f1469d6bfb 16 *
va009039 0:65f1469d6bfb 17 * Encapsulating a frame pointer, a root code object and thread state.
va009039 0:65f1469d6bfb 18 */
va009039 0:65f1469d6bfb 19
va009039 0:65f1469d6bfb 20
va009039 0:65f1469d6bfb 21 #include "pm.h"
va009039 0:65f1469d6bfb 22
va009039 0:65f1469d6bfb 23
va009039 0:65f1469d6bfb 24 PmReturn_t
va009039 0:65f1469d6bfb 25 thread_new(pPmObj_t pframe, pPmObj_t *r_pobj)
va009039 0:65f1469d6bfb 26 {
va009039 0:65f1469d6bfb 27 PmReturn_t retval = PM_RET_OK;
va009039 0:65f1469d6bfb 28 pPmThread_t pthread = C_NULL;
va009039 0:65f1469d6bfb 29
va009039 0:65f1469d6bfb 30 C_ASSERT(pframe != C_NULL);
va009039 0:65f1469d6bfb 31
va009039 0:65f1469d6bfb 32 /* If it's not a frame, raise TypeError */
va009039 0:65f1469d6bfb 33 if (OBJ_GET_TYPE(pframe) != OBJ_TYPE_FRM)
va009039 0:65f1469d6bfb 34 {
va009039 0:65f1469d6bfb 35 PM_RAISE(retval, PM_RET_EX_TYPE);
va009039 0:65f1469d6bfb 36 return retval;
va009039 0:65f1469d6bfb 37 }
va009039 0:65f1469d6bfb 38
va009039 0:65f1469d6bfb 39 /* Allocate a thread */
va009039 0:65f1469d6bfb 40 retval = heap_getChunk(sizeof(PmThread_t), (uint8_t **)r_pobj);
va009039 0:65f1469d6bfb 41 PM_RETURN_IF_ERROR(retval);
va009039 0:65f1469d6bfb 42
va009039 0:65f1469d6bfb 43 /* Set type, frame and initialize status */
va009039 0:65f1469d6bfb 44 pthread = (pPmThread_t)*r_pobj;
va009039 0:65f1469d6bfb 45 OBJ_SET_TYPE(pthread, OBJ_TYPE_THR);
va009039 0:65f1469d6bfb 46 pthread->pframe = (pPmFrame_t)pframe;
va009039 0:65f1469d6bfb 47 pthread->interpctrl = INTERP_CTRL_CONT;
va009039 0:65f1469d6bfb 48
va009039 0:65f1469d6bfb 49 return retval;
va009039 0:65f1469d6bfb 50 }