상속: BootloaderCommand
예제 #1
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);
        }
예제 #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);
        }