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.
src/vm/plat.h@0:14e5e829dffe, 2010-07-21 (annotated)
- Committer:
- dadaista
- Date:
- Wed Jul 21 12:50:41 2010 +0000
- Revision:
- 0:14e5e829dffe
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dadaista | 0:14e5e829dffe | 1 | /* |
dadaista | 0:14e5e829dffe | 2 | # This file is Copyright 2007, 2009 Dean Hall. |
dadaista | 0:14e5e829dffe | 3 | # |
dadaista | 0:14e5e829dffe | 4 | # This file is part of the PyMite VM. |
dadaista | 0:14e5e829dffe | 5 | # The PyMite VM is free software: you can redistribute it and/or modify |
dadaista | 0:14e5e829dffe | 6 | # it under the terms of the GNU GENERAL PUBLIC LICENSE Version 2. |
dadaista | 0:14e5e829dffe | 7 | # |
dadaista | 0:14e5e829dffe | 8 | # The PyMite VM is distributed in the hope that it will be useful, |
dadaista | 0:14e5e829dffe | 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
dadaista | 0:14e5e829dffe | 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
dadaista | 0:14e5e829dffe | 11 | # A copy of the GNU GENERAL PUBLIC LICENSE Version 2 |
dadaista | 0:14e5e829dffe | 12 | # is seen in the file COPYING in this directory. |
dadaista | 0:14e5e829dffe | 13 | */ |
dadaista | 0:14e5e829dffe | 14 | |
dadaista | 0:14e5e829dffe | 15 | |
dadaista | 0:14e5e829dffe | 16 | #ifndef __PLAT_H__ |
dadaista | 0:14e5e829dffe | 17 | #define __PLAT_H__ |
dadaista | 0:14e5e829dffe | 18 | |
dadaista | 0:14e5e829dffe | 19 | |
dadaista | 0:14e5e829dffe | 20 | /** |
dadaista | 0:14e5e829dffe | 21 | * \file |
dadaista | 0:14e5e829dffe | 22 | * \brief PyMite's Porting Interface |
dadaista | 0:14e5e829dffe | 23 | */ |
dadaista | 0:14e5e829dffe | 24 | |
dadaista | 0:14e5e829dffe | 25 | |
dadaista | 0:14e5e829dffe | 26 | /** |
dadaista | 0:14e5e829dffe | 27 | * Initializes the platform as needed by the routines |
dadaista | 0:14e5e829dffe | 28 | * in the platform implementation file. |
dadaista | 0:14e5e829dffe | 29 | */ |
dadaista | 0:14e5e829dffe | 30 | PmReturn_t plat_init(void); |
dadaista | 0:14e5e829dffe | 31 | |
dadaista | 0:14e5e829dffe | 32 | /** De-initializes the platform after the VM is done running. */ |
dadaista | 0:14e5e829dffe | 33 | PmReturn_t plat_deinit(void); |
dadaista | 0:14e5e829dffe | 34 | |
dadaista | 0:14e5e829dffe | 35 | /** |
dadaista | 0:14e5e829dffe | 36 | * Returns the byte at the given address in memspace. |
dadaista | 0:14e5e829dffe | 37 | * |
dadaista | 0:14e5e829dffe | 38 | * Increments the address (just like getc and read(1)) |
dadaista | 0:14e5e829dffe | 39 | * to make image loading work (recursively). |
dadaista | 0:14e5e829dffe | 40 | * |
dadaista | 0:14e5e829dffe | 41 | * PORT: fill in getByte for each memspace in the system; |
dadaista | 0:14e5e829dffe | 42 | * call sys_error for invalid memspaces. |
dadaista | 0:14e5e829dffe | 43 | * |
dadaista | 0:14e5e829dffe | 44 | * @param memspace memory space/type |
dadaista | 0:14e5e829dffe | 45 | * @param paddr ptr to address |
dadaista | 0:14e5e829dffe | 46 | * @return byte from memory. |
dadaista | 0:14e5e829dffe | 47 | * paddr - points to the next byte |
dadaista | 0:14e5e829dffe | 48 | */ |
dadaista | 0:14e5e829dffe | 49 | uint8_t plat_memGetByte(PmMemSpace_t memspace, uint8_t const **paddr); |
dadaista | 0:14e5e829dffe | 50 | |
dadaista | 0:14e5e829dffe | 51 | /** |
dadaista | 0:14e5e829dffe | 52 | * Receives one byte from the default connection, |
dadaista | 0:14e5e829dffe | 53 | * usually UART0 on a target device or stdio on the desktop |
dadaista | 0:14e5e829dffe | 54 | */ |
dadaista | 0:14e5e829dffe | 55 | PmReturn_t plat_getByte(uint8_t *b); |
dadaista | 0:14e5e829dffe | 56 | |
dadaista | 0:14e5e829dffe | 57 | |
dadaista | 0:14e5e829dffe | 58 | /** |
dadaista | 0:14e5e829dffe | 59 | * Sends one byte out on the default connection, |
dadaista | 0:14e5e829dffe | 60 | * usually UART0 on a target device or stdio on the desktop |
dadaista | 0:14e5e829dffe | 61 | */ |
dadaista | 0:14e5e829dffe | 62 | PmReturn_t plat_putByte(uint8_t b); |
dadaista | 0:14e5e829dffe | 63 | |
dadaista | 0:14e5e829dffe | 64 | |
dadaista | 0:14e5e829dffe | 65 | /** |
dadaista | 0:14e5e829dffe | 66 | * Gets the number of timer ticks that have passed since system start. |
dadaista | 0:14e5e829dffe | 67 | */ |
dadaista | 0:14e5e829dffe | 68 | PmReturn_t plat_getMsTicks(uint32_t *r_ticks); |
dadaista | 0:14e5e829dffe | 69 | |
dadaista | 0:14e5e829dffe | 70 | |
dadaista | 0:14e5e829dffe | 71 | /** |
dadaista | 0:14e5e829dffe | 72 | * Reports an exception or other error that caused the thread to quit |
dadaista | 0:14e5e829dffe | 73 | */ |
dadaista | 0:14e5e829dffe | 74 | void plat_reportError(PmReturn_t result); |
dadaista | 0:14e5e829dffe | 75 | |
dadaista | 0:14e5e829dffe | 76 | #endif /* __PLAT_H__ */ |