Subversion Repositories svn.mios

Rev

Rev 840 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 840 Rev 850
Line 23... Line 23...
23
import java.io.BufferedReader;
23
import java.io.BufferedReader;
24
import java.io.FileNotFoundException;
24
import java.io.FileNotFoundException;
25
import java.io.FileReader;
25
import java.io.FileReader;
26
import java.io.IOException;
26
import java.io.IOException;
27
import java.util.Arrays;
27
import java.util.Arrays;
28
import java.util.Map;
-
 
29
import java.util.HashMap;
28
import java.util.HashMap;
30
import java.util.LinkedList;
29
import java.util.LinkedList;
31
30
32
public class HexFile {
31
public class HexFile {
33
32
Line 271... Line 270...
271
        // BSL block is never between two hex file lines, accordingly we 
270
        // BSL block is never between two hex file lines, accordingly we
272
        // can check for a valid block here before starting the insertion
271
        // can check for a valid block here before starting the insertion
273
272
274
        // Addendum2: block addresses are stored in a HashMap now
273
        // Addendum2: block addresses are stored in a HashMap now
275
        // this speeds up hex load significantly! :-)
274
        // this speeds up hex load significantly! :-)
276
-
 
277
275
278
        long lByteAddress = newBlock.lAddress;
276
        long lByteAddress = newBlock.lAddress;
279
277
280
        int nBlockSize = BLOCK_SIZE_DEFAULT;
278
        int nBlockSize = BLOCK_SIZE_DEFAULT;
281
        long lMapAddressOffset = 0;
279
        long lMapAddressOffset = 0;
Line 304... Line 302...
304
            } else {
302
            } else {
305
                // We don't store the block.
303
                // We don't store the block.
306
                return true;
304
                return true;
307
            }
305
            }
308
        }
306
        }
309
-
 
310
307
311
        int nBytePos;
308
        int nBytePos;
312
        for (nBytePos = 0; nBytePos < newBlock.axData.length; ++nBytePos, ++lByteAddress) {
309
        for (nBytePos = 0; nBytePos < newBlock.axData.length; ++nBytePos, ++lByteAddress) {
313
            byte bData = newBlock.axData[nBytePos];
310
            byte bData = newBlock.axData[nBytePos];
314
311
315
            Long lBigBlockAddress = lByteAddress / nBlockSize * nBlockSize;
312
            Long lBigBlockAddress = lByteAddress / nBlockSize * nBlockSize;
316
313
317
            Integer nBigBlockIndex = (Integer)_block_address_map.get(lBigBlockAddress);
314
            Integer nBigBlockIndex = (Integer) _block_address_map
-
 
315
                    .get(lBigBlockAddress);
318
            if (nBigBlockIndex == null) {
316
            if (nBigBlockIndex == null) {
319
                Block newBigBlock = new Block();
317
                Block newBigBlock = new Block();
320
                newBigBlock.axData = new byte[nBlockSize];
318
                newBigBlock.axData = new byte[nBlockSize];
321
                Arrays.fill(newBigBlock.axData, (byte) 0xFF);
319
                Arrays.fill(newBigBlock.axData, (byte) 0xFF);
322
                newBigBlock.lAddress = lBigBlockAddress;
320
                newBigBlock.lAddress = lBigBlockAddress;