public override void SetupSignalTracing(CpuNode cpuNode, Register register, ChannelMode channelMode) { // Make sure the CpuNode is present in our dictionary if (DebugChannels.ContainsKey(cpuNode)) { if (!this.DebugChannels[cpuNode].ContainsValue(register) && channelMode != ChannelMode.Off) { for (byte i = 0; i < 255; i++) { if (!register.CpuNode.DebugChannels.ContainsKey(i)) { this.DebugChannels[cpuNode].Add(i, register); break; } } } if (this.DebugChannels[cpuNode].ContainsValue(register)) { Version protocolVersion = cpuNode.ProtocolVersion; ConfigChannelMessage msg = new ConfigChannelMessage() { ChannelId = this.DebugChannels[cpuNode].First(x => x.Value.Id == register.Id).Key, Mode = channelMode, Offset = register.Offset, Control = MessageCodec.GetControlByte(protocolVersion, register.ReadWrite, register.Source, register.DerefDepth), Size = register.Size, }; SendMessage(cpuNode.Id, msg); if (this.DebugChannels[cpuNode].ContainsValue(register) && channelMode == ChannelMode.Off) { this.DebugChannels[cpuNode].Remove(this.DebugChannels[cpuNode].First(x => x.Value.Id == register.Id).Key); } } } }
public override void QueryValue(CpuNode cpuNode, Register register) { Version protocolVersion = cpuNode.ProtocolVersion; byte control = MessageCodec.GetControlByte(protocolVersion, register.ReadWrite, register.Source, register.DerefDepth); QueryRegisterMessage msg = new QueryRegisterMessage() { Offset = register.Offset, Control = control, }; // TODO add the msgID this.SendMessage(MessageCodec.EncodeMessage(msg.ToProtocolMessage(cpuNode.Id, 0x01))); }