NetBurner 3.5.7
PDF Version
coldfire/include/debugtraps.h
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4#ifndef DBUGTRAP_H
5#define DBUGTRAP_H
6
7void SetAddressWrittenTrap(uint32_t addr);
8void SetAddressWriteRangeTrap(uint32_t startaddr, uint32_t endaddr);
9void SetAddressReadTrap(uint32_t addr);
10void SetAddressReadRangeTrap(uint32_t startaddr, uint32_t endaddr);
11
12/* Call this macro to monitor writes to a single variable */
13/* You may only monitor ONE VARIABLE */
14/* You may not write to this variable after making this call unless */
15/* You first use the BEFORE_WRITING_MONITORED_VAR macro */
16#define MONITOR_VAR_WRITES(x) SetAddressWrittenTrap((uint32_t)&x);
17
18/* use this before writing to a monitored var */
19#define BEFORE_WRITING_MONITORED_VAR(x) \
20 asm(" move.w #0x2700,%sr "); \
21 SetAddressWrittenTrap(0);
22
23/* Use this after writing to a monitored var */
24#define AFTER_WRITING_MONITORED_VAR(x) \
25 asm(" nop"); \
26 SetAddressWrittenTrap((uint32_t)&x); \
27 asm(" move.w (OSISRLevel),%d0 "); \
28 asm(" move.w %d0,%sr ");
29
30#endif