예제 #1
0
        public Func <List <UInt32> > reg_read_repeat(UInt16 num_repeats, REG_APnDP_A3_A2 reg_id, byte dap_index = 0, bool now = true)
        {
            //Debug.Assert(num_repeats is six.integer_types);
            Debug.Assert(Enum.IsDefined(typeof(REG_APnDP_A3_A2), reg_id));
            //Debug.Assert(dap_index is six.integer_types);
            //Debug.Assert(now is @bool);
            EDapTransferRequestByte request = DebugUnitV2_0_0.DapReadTransferRequestByte(reg_id);
            var transfer = this._write(dap_index, num_repeats, request, null);

            Debug.Assert(transfer != null);
            List <uint> reg_read_repeat_cb()
            {
                List <UInt32> res = transfer.get_result();

                Debug.Assert(res.Count == num_repeats);
                return(res);
            }

            if (now)
            {
                List <UInt32> result = reg_read_repeat_cb();
                return(new Func <List <UInt32> >(() => result));
            }
            else
            {
                return(new Func <List <UInt32> >(() => reg_read_repeat_cb()));
            }
        }
예제 #2
0
        public Func <UInt32> read_reg(REG_APnDP_A3_A2 reg_id, byte dap_index = 0, bool now = true)
        {
            Debug.Assert(Enum.IsDefined(typeof(REG_APnDP_A3_A2), reg_id));
            EDapTransferRequestByte request = DebugUnitV2_0_0.DapReadTransferRequestByte(reg_id);
            var transfer = this._write(dap_index, 1, request, null);

            Debug.Assert(transfer != null);
            uint read_reg_cb()
            {
                List <UInt32> res = transfer.get_result();

                Debug.Assert(res.Count == 1);
                return(res[0]);
            }

            if (now)
            {
                UInt32 result = read_reg_cb();
                return(new Func <UInt32>(() => result));
            }
            else
            {
                return(new Func <UInt32>(() => read_reg_cb()));
            }
        }
예제 #3
0
        public void write_reg(REG_APnDP_A3_A2 reg_id, UInt32 value, byte dap_index = 0)
        {
            Debug.Assert(Enum.IsDefined(typeof(REG_APnDP_A3_A2), reg_id));
            EDapTransferRequestByte request = DebugUnitV2_0_0.DapWriteTransferRequestByte(reg_id);

            this._write(dap_index, 1, request, new List <UInt32> {
                value
            });
        }
예제 #4
0
        public void reg_write_repeat(UInt16 num_repeats, REG_APnDP_A3_A2 reg_id, List <UInt32> data_array, byte dap_index = 0)
        {
            //Debug.Assert(num_repeats is six.integer_types);
            Debug.Assert(num_repeats == data_array.Count);
            Debug.Assert(Enum.IsDefined(typeof(REG_APnDP_A3_A2), reg_id));
            //Debug.Assert(dap_index is six.integer_types);
            EDapTransferRequestByte request = DebugUnitV2_0_0.DapWriteTransferRequestByte(reg_id);

            this._write(dap_index, num_repeats, request, data_array);
        }
예제 #5
0
 public void open()
 {
     if (this._backend_interface == null)
     {
         IEnumerable <IBackend> all_interfaces = DapAccessConsts._get_interfaces();
         foreach (var anInterface in all_interfaces)
         {
             try
             {
                 string unique_id = DapAccessConsts._get_unique_id(anInterface);
                 if (this._unique_id == unique_id)
                 {
                     // This assert could indicate that two boards
                     // had the same ID
                     Debug.Assert(this._backend_interface == null);
                     this._backend_interface = anInterface;
                 }
             }
             catch (Exception)
             {
                 Trace.TraceError("Failed to get unique id for open");
             }
         }
         if (this._backend_interface == null)
         {
             throw new Exception("Unable to open device", new DeviceError());
         }
     }
     this._backend_interface.open();
     this._protocol = new DebugUnitV2_0_0(this._backend_interface);
     if (DapSettings.limit_packets)
     {
         this._packet_count = 1;
         Trace.TraceInformation("Limiting packet count to {0}", this._packet_count);
     }
     else
     {
         object dapInfo = this._protocol.dapInfo(EDapInfoIDByte.MAX_PACKET_COUNT);
         Debug.Assert(dapInfo != null);
         this._packet_count = (byte)dapInfo;
     }
     this._backend_interface.packet_count = (byte)this._packet_count;
     {
         object dapInfo = this._protocol.dapInfo(EDapInfoIDByte.MAX_PACKET_SIZE);
         Debug.Assert(dapInfo != null);
         this._packet_size = (UInt16)dapInfo;
     }
     this._backend_interface.setPacketSize((UInt16)this._packet_size);
     this._init_deferred_buffers();
 }
예제 #6
0
 public DapAccessLink(string unique_id, IBackend backend_interface = null)
 {
     // super(DAPAccessCMSISDAP, this).@__init__();
     this._backend_interface    = backend_interface;
     this._deferred_transfer    = false;
     this._protocol             = null;
     this._packet_count         = null;
     this._unique_id            = unique_id;
     this._frequency            = 1000000;
     this._dap_port             = null;
     this._transfer_list        = null;
     this._crnt_cmd             = null;
     this._packet_size          = null;
     this._commands_to_read     = null;
     this._command_response_buf = null;
     //this._logger = logging.getLogger(@__name__);
     return;
 }