PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)
mbed-pokitto/targets/cmsis/TARGET_NXP/TARGET_LPC11U6X/TOOLCHAIN_GCC_CR/TARGET_LPC11U68/mtb.c@5:ea7377f3d1af, 2017-10-11 (annotated)
- Committer:
- Pokitto
- Date:
- Wed Oct 11 20:35:27 2017 +0000
- Revision:
- 5:ea7377f3d1af
Fixed PokittoLib. Includes a working custom mbed-src
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pokitto | 5:ea7377f3d1af | 1 | //***************************************************************************** |
Pokitto | 5:ea7377f3d1af | 2 | // +--+ |
Pokitto | 5:ea7377f3d1af | 3 | // | ++----+ |
Pokitto | 5:ea7377f3d1af | 4 | // +-++ | |
Pokitto | 5:ea7377f3d1af | 5 | // | | |
Pokitto | 5:ea7377f3d1af | 6 | // +-+--+ | |
Pokitto | 5:ea7377f3d1af | 7 | // | +--+--+ |
Pokitto | 5:ea7377f3d1af | 8 | // +----+ Copyright (c) 2013 Code Red Technologies Ltd. |
Pokitto | 5:ea7377f3d1af | 9 | // |
Pokitto | 5:ea7377f3d1af | 10 | // mtb.c |
Pokitto | 5:ea7377f3d1af | 11 | // |
Pokitto | 5:ea7377f3d1af | 12 | // Optionally defines an array to be used as a buffer for Micro Trace |
Pokitto | 5:ea7377f3d1af | 13 | // Buffer (MTB) instruction trace on Cortex-M0+ parts |
Pokitto | 5:ea7377f3d1af | 14 | // |
Pokitto | 5:ea7377f3d1af | 15 | // Version : 130502 |
Pokitto | 5:ea7377f3d1af | 16 | // |
Pokitto | 5:ea7377f3d1af | 17 | // Software License Agreement |
Pokitto | 5:ea7377f3d1af | 18 | // |
Pokitto | 5:ea7377f3d1af | 19 | // The software is owned by Code Red Technologies and/or its suppliers, and is |
Pokitto | 5:ea7377f3d1af | 20 | // protected under applicable copyright laws. All rights are reserved. Any |
Pokitto | 5:ea7377f3d1af | 21 | // use in violation of the foregoing restrictions may subject the user to criminal |
Pokitto | 5:ea7377f3d1af | 22 | // sanctions under applicable laws, as well as to civil liability for the breach |
Pokitto | 5:ea7377f3d1af | 23 | // of the terms and conditions of this license. |
Pokitto | 5:ea7377f3d1af | 24 | // |
Pokitto | 5:ea7377f3d1af | 25 | // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED |
Pokitto | 5:ea7377f3d1af | 26 | // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF |
Pokitto | 5:ea7377f3d1af | 27 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. |
Pokitto | 5:ea7377f3d1af | 28 | // USE OF THIS SOFTWARE FOR COMMERCIAL DEVELOPMENT AND/OR EDUCATION IS SUBJECT |
Pokitto | 5:ea7377f3d1af | 29 | // TO A CURRENT END USER LICENSE AGREEMENT (COMMERCIAL OR EDUCATIONAL) WITH |
Pokitto | 5:ea7377f3d1af | 30 | // CODE RED TECHNOLOGIES LTD. |
Pokitto | 5:ea7377f3d1af | 31 | // |
Pokitto | 5:ea7377f3d1af | 32 | //***************************************************************************** |
Pokitto | 5:ea7377f3d1af | 33 | |
Pokitto | 5:ea7377f3d1af | 34 | /******************************************************************* |
Pokitto | 5:ea7377f3d1af | 35 | * Symbols controlling behavior of this code... |
Pokitto | 5:ea7377f3d1af | 36 | * |
Pokitto | 5:ea7377f3d1af | 37 | * __MTB_DISABLE |
Pokitto | 5:ea7377f3d1af | 38 | * If this symbol is defined, then the buffer array for the MTB |
Pokitto | 5:ea7377f3d1af | 39 | * will not be created. |
Pokitto | 5:ea7377f3d1af | 40 | * |
Pokitto | 5:ea7377f3d1af | 41 | * __MTB_BUFFER_SIZE |
Pokitto | 5:ea7377f3d1af | 42 | * Symbol specifying the sizer of the buffer array for the MTB. |
Pokitto | 5:ea7377f3d1af | 43 | * This must be a power of 2 in size, and fit into the available |
Pokitto | 5:ea7377f3d1af | 44 | * RAM. The MTB buffer will also be aligned to its 'size' |
Pokitto | 5:ea7377f3d1af | 45 | * boundary and be placed at the start of a RAM bank (which |
Pokitto | 5:ea7377f3d1af | 46 | * should ensure minimal or zero padding due to alignment). |
Pokitto | 5:ea7377f3d1af | 47 | * |
Pokitto | 5:ea7377f3d1af | 48 | * __MTB_RAM_BANK |
Pokitto | 5:ea7377f3d1af | 49 | * Allows MTB Buffer to be placed into specific RAM bank. When |
Pokitto | 5:ea7377f3d1af | 50 | * this is not defined, the "default" (first if there are |
Pokitto | 5:ea7377f3d1af | 51 | * several) RAM bank is used. |
Pokitto | 5:ea7377f3d1af | 52 | *******************************************************************/ |
Pokitto | 5:ea7377f3d1af | 53 | |
Pokitto | 5:ea7377f3d1af | 54 | // Ignore with none Code Red tools |
Pokitto | 5:ea7377f3d1af | 55 | #if defined (__CODE_RED) |
Pokitto | 5:ea7377f3d1af | 56 | |
Pokitto | 5:ea7377f3d1af | 57 | // Allow MTB to be removed by setting a define (via command line) |
Pokitto | 5:ea7377f3d1af | 58 | #if !defined (__MTB_DISABLE) |
Pokitto | 5:ea7377f3d1af | 59 | |
Pokitto | 5:ea7377f3d1af | 60 | // Allow for MTB buffer size being set by define set via command line |
Pokitto | 5:ea7377f3d1af | 61 | // Otherwise provide small default buffer |
Pokitto | 5:ea7377f3d1af | 62 | #if !defined (__MTB_BUFFER_SIZE) |
Pokitto | 5:ea7377f3d1af | 63 | #define __MTB_BUFFER_SIZE 128 |
Pokitto | 5:ea7377f3d1af | 64 | #endif |
Pokitto | 5:ea7377f3d1af | 65 | |
Pokitto | 5:ea7377f3d1af | 66 | // Check that buffer size requested is >0 bytes in size |
Pokitto | 5:ea7377f3d1af | 67 | #if (__MTB_BUFFER_SIZE > 0) |
Pokitto | 5:ea7377f3d1af | 68 | // Pull in MTB related macros |
Pokitto | 5:ea7377f3d1af | 69 | #include <cr_mtb_buffer.h> |
Pokitto | 5:ea7377f3d1af | 70 | |
Pokitto | 5:ea7377f3d1af | 71 | // Check if MYTB buffer is to be placed in specific RAM bank |
Pokitto | 5:ea7377f3d1af | 72 | #if defined(__MTB_RAM_BANK) |
Pokitto | 5:ea7377f3d1af | 73 | // Place MTB buffer into explicit bank of RAM |
Pokitto | 5:ea7377f3d1af | 74 | __CR_MTB_BUFFER_EXT(__MTB_BUFFER_SIZE,__MTB_RAM_BANK); |
Pokitto | 5:ea7377f3d1af | 75 | #else |
Pokitto | 5:ea7377f3d1af | 76 | // Place MTB buffer into 'default' bank of RAM |
Pokitto | 5:ea7377f3d1af | 77 | __CR_MTB_BUFFER(__MTB_BUFFER_SIZE); |
Pokitto | 5:ea7377f3d1af | 78 | |
Pokitto | 5:ea7377f3d1af | 79 | #endif // defined(__MTB_RAM_BANK) |
Pokitto | 5:ea7377f3d1af | 80 | |
Pokitto | 5:ea7377f3d1af | 81 | #endif // (__MTB_BUFFER_SIZE > 0) |
Pokitto | 5:ea7377f3d1af | 82 | |
Pokitto | 5:ea7377f3d1af | 83 | #endif // !defined (__MTB_DISABLE) |
Pokitto | 5:ea7377f3d1af | 84 | |
Pokitto | 5:ea7377f3d1af | 85 | #endif // defined (__CODE_RED) |