Inheritance: BootloaderCommand
示例#1
0
        protected void SendData(byte[] data)
        {
            SendDataCommand cmd      = new SendDataCommand(_checksumType, data);
            EmptyResponse   response = new EmptyResponse();

            SendCommand(cmd, response);
        }
示例#2
0
        public void ProgramRow(int flashArrayId, int rowNumber, byte[] data)
        {
            int i;
            int maxChunkSize = (int)_channel.MaxTransferSize - 11;

            byte[]        chunk    = new byte[maxChunkSize];
            EmptyResponse response = new EmptyResponse();

            // Break the data transfer up into pieces that aren't too large
            for (i = 0; i < data.Length - maxChunkSize; i += maxChunkSize)
            {
                Array.Copy(data, i, chunk, 0, maxChunkSize);
                SendDataCommand sd = new SendDataCommand(_checksumType, chunk);
                SendCommand(sd, response);
            }

            // Send the last chunk and the program command
            chunk = new byte[data.Length - i];
            Array.Copy(data, i, chunk, 0, data.Length - i);
            ProgramRowCommand cmd = new ProgramRowCommand(_checksumType, (byte)flashArrayId, (ushort)rowNumber, chunk);

            SendCommand(cmd, response);
        }
示例#3
0
 protected void SendData(byte[] data)
 {
     SendDataCommand cmd = new SendDataCommand(_checksumType, data);
     EmptyResponse response = new EmptyResponse();
     SendCommand(cmd, response);
 }
示例#4
0
        public void ProgramRow(int flashArrayId, int rowNumber, byte[] data)
        {
            int i;
            int maxChunkSize = (int)_channel.MaxTransferSize - 11;
            byte[] chunk = new byte[maxChunkSize];
            EmptyResponse response = new EmptyResponse();

            // Break the data transfer up into pieces that aren't too large
            for (i = 0; i < data.Length - maxChunkSize; i += maxChunkSize)
            {
                Array.Copy(data, i, chunk, 0, maxChunkSize);
                SendDataCommand sd = new SendDataCommand(_checksumType, chunk);
                SendCommand(sd, response);
            }

            // Send the last chunk and the program command
            chunk = new byte[data.Length - i];
            Array.Copy(data, i, chunk, 0, data.Length - i);
            ProgramRowCommand cmd = new ProgramRowCommand(_checksumType, (byte)flashArrayId, (ushort)rowNumber, chunk);
            SendCommand(cmd, response);
        }