1 /* 2 * ITrace.h 3 * 4 * Interface for trace module 5 * 6 * Copyright (C) 2007 - 2011 Texas Instruments Incorporated - http://www.ti.com/ 7 * 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 13 * Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 16 * Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the 19 * distribution. 20 * 21 * Neither the name of Texas Instruments Incorporated nor the names of 22 * its contributors may be used to endorse or promote products derived 23 * from this software without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 */ 37 38 #pragma once 39 40 #include <MessageData.h> 41 #include "../TriggerCondition/ITriggerCondition.h" 42 43 namespace TI { namespace DLL430 { 44 45 //Trace data contains the values of the address bus, data bus and control register 46 struct TraceData 47 { TraceDataTraceData48 TraceData() : mab(0), mdb(0), ctl(0) {} 49 50 uint32_t mab; 51 uint16_t mdb; 52 uint16_t ctl; 53 }; 54 55 typedef std::vector<TraceData> TraceBuffer; 56 57 58 //Trace will store the most recent device states in a ring buffer and notify on trace storage events 59 class ITrace 60 { 61 public: ~ITrace()62 virtual ~ITrace() {} 63 64 //Add a trigger condition to act as trace trigger (there is no distinction between different triggers) 65 virtual void addTriggerCondition(TriggerConditionPtr triggerCondition) = 0; 66 67 //Remove all trace triggers 68 virtual void clearTriggerConditions() = 0; 69 70 //Enable/disable trace feature (on 430 trace is mutually exclusive with variable watch) 71 virtual void enable() = 0; 72 virtual void disable() = 0; 73 74 //Reset/restart trace module (must always be called after changing sequencer configuration) 75 virtual void reset() = 0; 76 77 //Trace will start when a trace trigger is hit 78 virtual void setStartOnTrigger(bool startOnTrigger) = 0; 79 80 //Trace will stop when a trace trigger is hit 81 virtual void setStopOnTrigger(bool stopOnTrigger) = 0; 82 83 //Store state on instruction fetch, when trace trigger is hit or on every clock cycle 84 virtual void setStoreOnInstructionFetch() = 0; 85 virtual void setStoreOnTrigger() = 0; 86 virtual void setStoreOnClock() = 0; 87 88 //Store states indefinitely in ring buffer or stop trace when buffer is full 89 virtual void setStoreContinuously() = 0; 90 virtual void setStoreUntilFull() = 0; 91 92 //Return content of trace buffer at time of last trace event 93 virtual const TraceBuffer getTraceData() = 0; 94 95 //Only used by EmulationManager 96 virtual void writeConfiguration() = 0; 97 virtual void onEvent(MessageDataPtr msgData) = 0; 98 }; 99 100 }} 101