temperaturecontrol: allow setting background tool without activating
[clinton/Smoothieware.git] / mri / mri.h
CommitLineData
6c79da43 1/* Copyright 2012 Adam Green (http://mbed.org/users/AdamGreen/)\r
3c132bd0 2\r
ee8a0081
AG
3 This program is free software: you can redistribute it and/or modify\r
4 it under the terms of the GNU Lesser General Public License as published\r
5 by the Free Software Foundation, either version 3 of the License, or\r
6 (at your option) any later version.\r
3c132bd0 7\r
ee8a0081
AG
8 This program is distributed in the hope that it will be useful,\r
9 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
11 GNU Lesser General Public License for more details.\r
3c132bd0 12\r
ee8a0081
AG
13 You should have received a copy of the GNU Lesser General Public License\r
14 along with this program. If not, see <http://www.gnu.org/licenses/>. \r
3c132bd0 15*/\r
ee8a0081 16/* Monitor for Remote Inspection. */\r
3c132bd0
AW
17#ifndef _MRI_H_\r
18#define _MRI_H_\r
19\r
6c79da43
AG
20#include <stdint.h>\r
21\r
22/* Used to insert hardcoded breakpoint into user's code. */\r
ce6ee091
JM
23#ifndef __debugbreak\r
24 #define __debugbreak() { __asm volatile ("bkpt #0"); }\r
25#endif\r
3c132bd0 26\r
ee8a0081
AG
27/* Error strings that can be returned to GDB. */\r
28#define MRI_ERROR_INVALID_ARGUMENT "E01" /* Encountered error when parsing command arguments. */\r
29#define MRI_ERROR_MEMORY_ACCESS_FAILURE "E03" /* Couldn't access requested memory. */\r
30#define MRI_ERROR_BUFFER_OVERRUN "E04" /* Overflowed internal input/output buffer. */\r
31#define MRI_ERROR_NO_FREE_BREAKPOINT "E05" /* No free FPB breakpoint comparator slots. */\r
32\r
33\r
6c79da43
AG
34#ifdef __cplusplus\r
35extern "C"\r
36{\r
37#endif\r
38\r
39\r
40/* pDebuggerParameters string passed into __mriInit contains a space separated list of configuration parameters to be\r
41 used to initialize the debug monitor. The supported options include:\r
42 \r
43 One of these options to indicate which UART to be used for the debugger connection:\r
44 MRI_UART_MBED_USB\r
45 MRI_UART_MBED_P9_P10\r
46 MRI_UART_MBED_P13_P14\r
47 MRI_UART_MBED_P28_P27\r
23a346d3
AG
48 MRI_UART_0\r
49 MRI_UART_1\r
50 MRI_UART_2\r
51 MRI_UART_3\r
6c79da43
AG
52 \r
53 By default the debug monitor expects to take full control of the UART to configure baud rate, etc. However \r
54 including the following option will tell the monitor to assume that the user's firmware will configure and use the\r
55 serial port until the first exception occurs:\r
56 MRI_UART_SHARE\r
8fcce42e
AG
57 \r
58 When not sharing the UART, MRI will typically try to use the auto-baud functionality of the device so that the user\r
59 can select the desired baud rate when they start GDB. However it is possible to override this in the init string.\r
60 For example the following option would set the baud rate to 230400 (note that spaces aren't allowed before or after\r
61 the '=' character):\r
62 MRI_UART_BAUD=230400\r
63 NOTE: LPC176x version of MRI supports a maximum baud rate of 3Mbaud and the core clock can't run faster than\r
64 128MHz or calculating baud rate divisors will fail.\r
6c79da43
AG
65*/\r
66void __mriInit(const char* pDebuggerParameters);\r
67\r
68\r
23a346d3
AG
69/* Simple assembly language stubs that can be called from user's newlib stubs routines which will cause the operations\r
70 to be redirected to the GDB host via MRI. */\r
71int __mriNewLib_SemihostOpen(const char *pFilename, int flags, int mode);\r
72int __mriNewLib_SemihostRename(const char *pOldFilename, const char *pNewFilename);\r
73int __mriNewLib_SemihostUnlink(const char *pFilename);\r
74int __mriNewLib_SemihostStat(const char *pFilename, void *pStat);\r
75int __mriNewlib_SemihostWrite(int file, const char *ptr, int len);\r
ee8a0081 76int __mriNewlib_SemihostRead(int file, char *ptr, int len);\r
23a346d3
AG
77int __mriNewlib_SemihostLSeek(int file, int offset, int whence);\r
78int __mriNewlib_SemihostClose(int file);\r
79int __mriNewlib_SemihostFStat(int file, void *pStat);\r
80\r
81\r
82\r
83/* Can be used by semihosting hooks to determine the index of the UART being used by MRI. */\r
84int __mriPlatform_CommUartIndex(void);\r
ee8a0081
AG
85\r
86\r
6c79da43
AG
87#ifdef __cplusplus\r
88}\r
89#endif\r
90\r
3c132bd0 91#endif /* _MRI_H_ */\r
23a346d3
AG
92\r
93\r
94#ifndef MRI_VERSION_STRING\r
95\r
ce6ee091 96#define MRI_BRANCH "https://github.com/adamgreen/mri/tree/version_0.6"\r
23a346d3
AG
97\r
98#define MRI_VERSION_MAJOR 0\r
ce6ee091
JM
99#define MRI_VERSION_MINOR 6\r
100#define MRI_VERSION_BUILD 20140515\r
101#define MRI_VERSION_SUBBUILD 2\r
23a346d3
AG
102\r
103#define MRI_STR(X) MRI_STR2(X)\r
104#define MRI_STR2(X) #X\r
105\r
106#define MRI_VERSION_STRING MRI_STR(MRI_VERSION_MAJOR) "." MRI_STR(MRI_VERSION_MINOR) "-" MRI_STR(MRI_VERSION_BUILD) "." MRI_STR(MRI_VERSION_SUBBUILD)\r
107\r
108#endif\r