Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sat Jun 03 00:22:44 2017 +0000
Revision:
46:b156ef445742
Parent:
18:6a4db94011d3
Final code for internal battlebot competition.

Who changed what in which revision?

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