Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: src/vm/plat.h
- Revision:
- 0:14e5e829dffe
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/vm/plat.h Wed Jul 21 12:50:41 2010 +0000 @@ -0,0 +1,76 @@ +/* +# This file is Copyright 2007, 2009 Dean Hall. +# +# This file is part of the PyMite VM. +# The PyMite VM is free software: you can redistribute it and/or modify +# it under the terms of the GNU GENERAL PUBLIC LICENSE Version 2. +# +# The PyMite VM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# A copy of the GNU GENERAL PUBLIC LICENSE Version 2 +# is seen in the file COPYING in this directory. +*/ + + +#ifndef __PLAT_H__ +#define __PLAT_H__ + + +/** + * \file + * \brief PyMite's Porting Interface + */ + + +/** + * Initializes the platform as needed by the routines + * in the platform implementation file. + */ +PmReturn_t plat_init(void); + +/** De-initializes the platform after the VM is done running. */ +PmReturn_t plat_deinit(void); + +/** + * Returns the byte at the given address in memspace. + * + * Increments the address (just like getc and read(1)) + * to make image loading work (recursively). + * + * PORT: fill in getByte for each memspace in the system; + * call sys_error for invalid memspaces. + * + * @param memspace memory space/type + * @param paddr ptr to address + * @return byte from memory. + * paddr - points to the next byte + */ +uint8_t plat_memGetByte(PmMemSpace_t memspace, uint8_t const **paddr); + +/** + * Receives one byte from the default connection, + * usually UART0 on a target device or stdio on the desktop + */ +PmReturn_t plat_getByte(uint8_t *b); + + +/** + * Sends one byte out on the default connection, + * usually UART0 on a target device or stdio on the desktop + */ +PmReturn_t plat_putByte(uint8_t b); + + +/** + * Gets the number of timer ticks that have passed since system start. + */ +PmReturn_t plat_getMsTicks(uint32_t *r_ticks); + + +/** + * Reports an exception or other error that caused the thread to quit + */ +void plat_reportError(PmReturn_t result); + +#endif /* __PLAT_H__ */