python-on-a-chip online compiler

Dependencies:   mbed TSI

Embed: (wiki syntax)

« Back to documentation index

pm.h File Reference

pm.h File Reference

PyMite Header. More...

Go to the source code of this file.

Typedefs

typedef enum PmReturn_e PmReturn_t
 Return values for system functions to report status, errors, exceptions, etc.
typedef PmReturn_t(* pPmNativeFxn_t )(pPmFrame_t *)
 Pointer to a native function used for lookup tables in interp.c.

Enumerations

enum  PmReturn_e {
  PM_RET_OK = 0, PM_RET_NO = 0xFF, PM_RET_ERR = 0xFE, PM_RET_STUB = 0xFD,
  PM_RET_ASSERT_FAIL = 0xFC, PM_RET_FRAME_SWITCH = 0xFB, PM_RET_ALIGNMENT = 0xFA, PM_RET_EX = 0xE0,
  PM_RET_EX_EXIT = 0xE1, PM_RET_EX_IO = 0xE2, PM_RET_EX_ZDIV = 0xE3, PM_RET_EX_ASSRT = 0xE4,
  PM_RET_EX_ATTR = 0xE5, PM_RET_EX_IMPRT = 0xE6, PM_RET_EX_INDX = 0xE7, PM_RET_EX_KEY = 0xE8,
  PM_RET_EX_MEM = 0xE9, PM_RET_EX_NAME = 0xEA, PM_RET_EX_SYNTAX = 0xEB, PM_RET_EX_SYS = 0xEC,
  PM_RET_EX_TYPE = 0xED, PM_RET_EX_VAL = 0xEE, PM_RET_EX_STOP = 0xEF, PM_RET_EX_WARN = 0xF0,
  PM_RET_EX_OFLOW = 0xF1
}
 

Return values for system functions to report status, errors, exceptions, etc.

More...

Functions

PmReturn_t pm_init (uint8_t *heap_base, uint32_t heap_size, PmMemSpace_t memspace, uint8_t const *const pusrimg)
 Initializes the PyMite virtual machine and indexes the user's application image.
PmReturn_t pm_run (uint8_t const *modstr)
 Executes the named module.
PmReturn_t pm_vmPeriodic (uint16_t usecsSinceLastCall)
 Needs to be called periodically by the host program.

Variables

volatile uint32_t pm_timerMsTicks
 Stores the timer millisecond-ticks since system start.

Detailed Description

PyMite Header.

Include things that are needed by nearly everything.

Definition in file pm.h.


Typedef Documentation

typedef enum PmReturn_e PmReturn_t

Return values for system functions to report status, errors, exceptions, etc.

Normally, functions which use these values should propagate the same return value up the call tree to the interpreter.

Pointer to a native function used for lookup tables in interp.c.

Definition at line 218 of file pm.h.


Enumeration Type Documentation

enum PmReturn_e

Return values for system functions to report status, errors, exceptions, etc.

Normally, functions which use these values should propagate the same return value up the call tree to the interpreter.

Enumerator:
PM_RET_OK 

Everything is ok.

PM_RET_NO 

General "no result".

PM_RET_ERR 

General failure.

PM_RET_STUB 

Return val for stub fxn.

PM_RET_ASSERT_FAIL 

Assertion failure.

PM_RET_FRAME_SWITCH 

Frame pointer was modified.

PM_RET_ALIGNMENT 

Heap is not aligned.

PM_RET_EX 

General exception.

PM_RET_EX_EXIT 

System exit.

PM_RET_EX_IO 

Input/output error.

PM_RET_EX_ZDIV 

Zero division error.

PM_RET_EX_ASSRT 

Assertion error.

PM_RET_EX_ATTR 

Attribute error.

PM_RET_EX_IMPRT 

Import error.

PM_RET_EX_INDX 

Index error.

PM_RET_EX_KEY 

Key error.

PM_RET_EX_MEM 

Memory error.

PM_RET_EX_NAME 

Name error.

PM_RET_EX_SYNTAX 

Syntax error.

PM_RET_EX_SYS 

System error.

PM_RET_EX_TYPE 

Type error.

PM_RET_EX_VAL 

Value error.

PM_RET_EX_STOP 

Stop iteration.

PM_RET_EX_WARN 

Warning.

PM_RET_EX_OFLOW 

Overflow.

Definition at line 152 of file pm.h.


Function Documentation

PmReturn_t pm_init ( uint8_t *  heap_base,
uint32_t  heap_size,
PmMemSpace_t  memspace,
uint8_t const *const   pusrimg 
)

Initializes the PyMite virtual machine and indexes the user's application image.

The VM heap and globals are reset. The argument, pusrimg, may be null for interactive sessions.

Parameters:
heap_baseThe address where the contiguous heap begins
heap_sizeThe size in bytes (octets) of the given heap. Must be a multiple of four.
memspaceMemory space in which the user image is located
pusrimgAddress of the user image in the memory space
Returns:
Return status

Definition at line 36 of file pm.c.

PmReturn_t pm_run ( uint8_t const *  modstr )

Executes the named module.

Parameters:
modstrName of module to run
Returns:
Return status

Definition at line 63 of file pm.c.

PmReturn_t pm_vmPeriodic ( uint16_t  usecsSinceLastCall )

Needs to be called periodically by the host program.

For the desktop target, it is periodically called using a signal. For embedded targets, it needs to be called periodically. It should be called from a timer interrupt.

Parameters:
usecsSinceLastCallMicroseconds (not less than those) that passed since last call. This must be <64535.
Returns:
Return status

Definition at line 102 of file pm.c.


Variable Documentation

volatile uint32_t pm_timerMsTicks

Stores the timer millisecond-ticks since system start.

Definition at line 29 of file pm.c.