tools/runonphone/symbianutils/trkutils.h
changeset 30 5dc02b23752f
parent 18 2f34d5167611
child 33 3e2da88830cd
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
    41 
    41 
    42 #ifndef DEBUGGER_TRK_UTILS
    42 #ifndef DEBUGGER_TRK_UTILS
    43 #define DEBUGGER_TRK_UTILS
    43 #define DEBUGGER_TRK_UTILS
    44 
    44 
    45 #include "symbianutils_global.h"
    45 #include "symbianutils_global.h"
       
    46 
    46 #include <QtCore/QByteArray>
    47 #include <QtCore/QByteArray>
    47 #include <QtCore/QHash>
    48 #include <QtCore/QHash>
    48 #include <QtCore/QStringList>
    49 #include <QtCore/QStringList>
    49 #include <QtCore/QVariant>
    50 #include <QtCore/QVariant>
    50 
    51 
    55 namespace trk {
    56 namespace trk {
    56 
    57 
    57 typedef unsigned char byte;
    58 typedef unsigned char byte;
    58 
    59 
    59 enum Command {
    60 enum Command {
       
    61     //meta commands
    60     TrkPing = 0x00,
    62     TrkPing = 0x00,
    61     TrkConnect = 0x01,
    63     TrkConnect = 0x01,
    62     TrkDisconnect = 0x02,
    64     TrkDisconnect = 0x02,
       
    65     TrkReset = 0x03,
    63     TrkVersions = 0x04,
    66     TrkVersions = 0x04,
    64     TrkSupported = 0x05,
    67     TrkSupported = 0x05,
    65     TrkCpuType = 0x06,
    68     TrkCpuType = 0x06,
       
    69     TrkConfigTransport = 0x07,
       
    70     TrkVersions2 = 0x08,
    66     TrkHostVersions = 0x09,
    71     TrkHostVersions = 0x09,
       
    72 
       
    73     //state commands
       
    74     TrkReadMemory = 0x10,
       
    75     TrkWriteMemory = 0x11,
       
    76     TrkReadRegisters = 0x12,
       
    77     TrkWriteRegisters = 0x13,
       
    78     TrkFillMemory = 0x14,
       
    79     TrkCopyMemory = 0x15,
       
    80     TrkFlushCache = 0x16,
       
    81 
       
    82     //execution commands
    67     TrkContinue = 0x18,
    83     TrkContinue = 0x18,
       
    84     TrkStep = 0x19,
       
    85     TrkStop = 0x1a,
       
    86     TrkSetBreak = 0x1b,
       
    87     TrkClearBreak = 0x1c,
       
    88     TrkDownload = 0x1d,
       
    89     TrkModifyBreakThread = 0x1e,
       
    90 
       
    91     //host -> target IO management
       
    92     TrkNotifyFileInput = 0x20,
       
    93     TrkBlockFileIo = 0x21,
       
    94 
       
    95     //host -> target os commands
    68     TrkCreateItem = 0x40,
    96     TrkCreateItem = 0x40,
    69     TrkDeleteItem = 0x41,
    97     TrkDeleteItem = 0x41,
       
    98     TrkReadInfo = 0x42,
       
    99     TrkWriteInfo = 0x43,
    70 
   100 
    71     TrkWriteFile = 0x48,
   101     TrkWriteFile = 0x48,
       
   102     TrkReadFile = 0x49,
    72     TrkOpenFile = 0x4a,
   103     TrkOpenFile = 0x4a,
    73     TrkCloseFile = 0x4b,
   104     TrkCloseFile = 0x4b,
       
   105     TrkPositionFile = 0x4c,
    74     TrkInstallFile = 0x4d,
   106     TrkInstallFile = 0x4d,
    75     TrkInstallFile2 = 0x4e,
   107     TrkInstallFile2 = 0x4e,
    76 
   108 
       
   109     TrkPhoneSwVersion = 0x4f,
       
   110     TrkPhoneName = 0x50,
       
   111     TrkVersions3 = 0x51,
       
   112 
       
   113     //replies
    77     TrkNotifyAck = 0x80,
   114     TrkNotifyAck = 0x80,
    78     TrkNotifyNak = 0xff,
   115     TrkNotifyNak = 0xff,
       
   116 
       
   117     //target -> host notification
    79     TrkNotifyStopped = 0x90,
   118     TrkNotifyStopped = 0x90,
    80     TrkNotifyException = 0x91,
   119     TrkNotifyException = 0x91,
    81     TrkNotifyInternalError = 0x92,
   120     TrkNotifyInternalError = 0x92,
       
   121     TrkNotifyStopped2 = 0x94,
       
   122 
       
   123     //target -> host OS notification
    82     TrkNotifyCreated = 0xa0,
   124     TrkNotifyCreated = 0xa0,
    83     TrkNotifyDeleted = 0xa1,
   125     TrkNotifyDeleted = 0xa1,
    84     TrkNotifyProcessorStarted = 0xa2,
   126     TrkNotifyProcessorStarted = 0xa2,
    85     TrkNotifyProcessorStandBy = 0xa6,
   127     TrkNotifyProcessorStandBy = 0xa6,
    86     TrkNotifyProcessorReset = 0xa7
   128     TrkNotifyProcessorReset = 0xa7,
       
   129 
       
   130     //target -> host support commands (these are defined but not implemented in TRK)
       
   131     TrkDSWriteFile = 0xd0,
       
   132     TrkDSReadFile = 0xd1,
       
   133     TrkDSOpenFile = 0xd2,
       
   134     TrkDSCloseFile = 0xd3,
       
   135     TrkDSPositionFile = 0xd4
       
   136 };
       
   137 
       
   138 enum SerialMultiplexor {
       
   139     MuxRaw = 0,
       
   140     MuxTextTrace = 0x0102,
       
   141     MuxTrk = 0x0190
    87 };
   142 };
    88 
   143 
    89 inline byte extractByte(const char *data) { return *data; }
   144 inline byte extractByte(const char *data) { return *data; }
    90 SYMBIANUTILS_EXPORT ushort extractShort(const char *data);
   145 SYMBIANUTILS_EXPORT ushort extractShort(const char *data);
    91 SYMBIANUTILS_EXPORT uint extractInt(const char *data);
   146 SYMBIANUTILS_EXPORT uint extractInt(const char *data);
       
   147 SYMBIANUTILS_EXPORT quint64 extractInt64(const char *data);
    92 
   148 
    93 SYMBIANUTILS_EXPORT QString quoteUnprintableLatin1(const QByteArray &ba);
   149 SYMBIANUTILS_EXPORT QString quoteUnprintableLatin1(const QByteArray &ba);
    94 
   150 
    95 // produces "xx xx xx "
   151 // produces "xx xx xx "
    96 SYMBIANUTILS_EXPORT QString stringFromArray(const QByteArray &ba, int maxLen = - 1);
   152 SYMBIANUTILS_EXPORT QString stringFromArray(const QByteArray &ba, int maxLen = - 1);
   116 };
   172 };
   117 
   173 
   118 struct SYMBIANUTILS_EXPORT TrkAppVersion
   174 struct SYMBIANUTILS_EXPORT TrkAppVersion
   119 {
   175 {
   120     TrkAppVersion();
   176     TrkAppVersion();
   121     void reset();    
   177     void reset();
   122 
   178 
   123     int trkMajor;
   179     int trkMajor;
   124     int trkMinor;
   180     int trkMinor;
   125     int protocolMajor;
   181     int protocolMajor;
   126     int protocolMinor;
   182     int protocolMinor;
   166     QString toString() const;
   222     QString toString() const;
   167     // 0 for no error.
   223     // 0 for no error.
   168     int errorCode() const;
   224     int errorCode() const;
   169     QString errorString() const;
   225     QString errorString() const;
   170 
   226 
       
   227     ushort multiplex;
   171     byte code;
   228     byte code;
   172     byte token;
   229     byte token;
   173     QByteArray data;
   230     QByteArray data;
   174     QVariant cookie;
   231     QVariant cookie;
   175     bool isDebugOutput;
   232     bool isDebugOutput;