Changeset 12295
- Timestamp:
- 06/16/09 04:12:29 (4 years ago)
- Location:
- ar5315_microredboot/microredboot/boot/src
- Files:
-
- 4 edited
-
Makefile (modified) (1 diff)
-
lib/LzmaDecode.c (modified) (12 diffs)
-
lib/LzmaDecode.h (modified) (2 diffs)
-
misc_lzma.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ar5315_microredboot/microredboot/boot/src/Makefile
r12281 r12295 47 47 HEAD = head.o 48 48 OBJS = misc_lzma.o 49 MEMCPY = mem cpy.o memset.o49 MEMCPY = memset.o 50 50 # CFLAGS = $(CPPFLAGS) -O2 -DSTDC_HEADERS $(CFLAGS_BOOT) 51 51 ZLDFLAGS = -G 0 -static -X -T ld.script -
ar5315_microredboot/microredboot/boot/src/lib/LzmaDecode.c
r12281 r12295 45 45 } CRangeDecoder; 46 46 47 Byte RangeDecoderReadByte(CRangeDecoder *rd)47 static Byte RangeDecoderReadByte(CRangeDecoder *rd) 48 48 { 49 49 if (rd->Buffer == rd->BufferLim) … … 66 66 #define ReadByte (RangeDecoderReadByte(rd)) 67 67 68 void RangeDecoderInit(CRangeDecoder *rd)68 static void RangeDecoderInit(CRangeDecoder *rd) 69 69 { 70 70 int i; … … 86 86 #define RC_NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | ReadByte; } 87 87 88 UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits)88 static UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits) 89 89 { 90 90 RC_INIT_VAR … … 114 114 } 115 115 116 int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd)116 static int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd) 117 117 { 118 118 UInt32 bound = (rd->Range >> kNumBitModelTotalBits) * *prob; … … 152 152 #define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;) 153 153 154 int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)154 static int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd) 155 155 { 156 156 int mi = 1; … … 174 174 } 175 175 176 int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)176 static int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd) 177 177 { 178 178 int mi = 1; … … 199 199 } 200 200 201 Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd)201 static Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd) 202 202 { 203 203 int symbol = 1; … … 221 221 } 222 222 223 Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte)223 static Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte) 224 224 { 225 225 int symbol = 1; … … 279 279 #define kNumLenProbs (LenHigh + kLenNumHighSymbols) 280 280 281 int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState)281 static int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState) 282 282 { 283 283 if(RangeDecoderBitDecode(p + LenChoice, rd) == 0) … … 340 340 } LzmaVarState; 341 341 342 int LzmaDecoderInit(342 static int LzmaDecoderInit( 343 343 unsigned char *buffer, UInt32 bufferSize, 344 344 int lc, int lp, int pb, … … 371 371 } 372 372 373 int LzmaDecode(unsigned char *buffer,373 static int LzmaDecode(unsigned char *buffer, 374 374 unsigned char *outStream, UInt32 outSize, 375 375 UInt32 *outSizeProcessed) … … 415 415 #else 416 416 417 int LzmaDecode(417 static int LzmaDecode( 418 418 Byte *buffer, UInt32 bufferSize, 419 419 int lc, int lp, int pb, -
ar5315_microredboot/microredboot/boot/src/lib/LzmaDecode.h
r12281 r12295 66 66 67 67 #ifdef _LZMA_OUT_READ 68 int LzmaDecoderInit(68 static int LzmaDecoderInit( 69 69 unsigned char *buffer, UInt32 bufferSize, 70 70 int lc, int lp, int pb, … … 73 73 #endif 74 74 75 int LzmaDecode(75 static int LzmaDecode( 76 76 unsigned char *buffer, 77 77 #ifndef _LZMA_OUT_READ -
ar5315_microredboot/microredboot/boot/src/misc_lzma.c
r12294 r12295 189 189 * searches for a directory entry named linux* vmlinux* or kernel and returns its flash address (it also initializes entrypoint and load address) 190 190 */ 191 unsigned int getLinux(void)191 static unsigned int getLinux(void) 192 192 { 193 193 int count; … … 215 215 puts("no bootable image found, try default location 0xbfc10000\r\n"); 216 216 bootoffset = 0x80041000; 217 output_data = (uch *) 0x80041000;217 output_data = (uch *) 0x80041000; 218 218 return 0xbfc10000; 219 219 } … … 225 225 static int resettrigger = 0; 226 226 227 int fill_inbuf(void)227 static int fill_inbuf(void) 228 228 { 229 229 if (insize != 0) 230 230 error("ran out of input data"); 231 231 if (resettrigger) { 232 inbuf = (uch *) linuxaddr;232 inbuf = (uch *) linuxaddr; 233 233 insize = 0x400000; 234 234 inptr = 1; … … 491 491 __u32 sector_size; 492 492 __u32 cs_addrmask; 493 } flashconfig_tbl[MAX_FLASH] = { 494 { 495 0, 0, 0, 0}, { 496 STM_1MB_BYTE_COUNT, STM_1MB_SECTOR_COUNT, STM_1MB_SECTOR_SIZE, 0x0}, 497 { 498 STM_2MB_BYTE_COUNT, STM_2MB_SECTOR_COUNT, STM_2MB_SECTOR_SIZE, 0x0}, 499 { 500 STM_4MB_BYTE_COUNT, STM_4MB_SECTOR_COUNT, STM_4MB_SECTOR_SIZE, 0x0}, 501 { 502 STM_8MB_BYTE_COUNT, STM_8MB_SECTOR_COUNT, STM_8MB_SECTOR_SIZE, 0x0}, 503 { 504 STM_16MB_BYTE_COUNT, STM_16MB_SECTOR_COUNT, 505 STM_16MB_SECTOR_SIZE, 0x0} 493 } static flashconfig_tbl[MAX_FLASH] = { 494 { 495 0, 0, 0, 0}, { 496 STM_1MB_BYTE_COUNT, STM_1MB_SECTOR_COUNT, 497 STM_1MB_SECTOR_SIZE, 0x0}, 498 { 499 STM_2MB_BYTE_COUNT, STM_2MB_SECTOR_COUNT, STM_2MB_SECTOR_SIZE, 0x0}, 500 { 501 STM_4MB_BYTE_COUNT, STM_4MB_SECTOR_COUNT, STM_4MB_SECTOR_SIZE, 0x0}, 502 { 503 STM_8MB_BYTE_COUNT, STM_8MB_SECTOR_COUNT, STM_8MB_SECTOR_SIZE, 0x0}, 504 { 505 STM_16MB_BYTE_COUNT, STM_16MB_SECTOR_COUNT, 506 STM_16MB_SECTOR_SIZE, 0x0} 506 507 }; 507 508 … … 510 511 __s8 tx_cnt; 511 512 __s8 rx_cnt; 512 } stm_opcodes[] = { 513 { 514 STM_OP_WR_ENABLE, 1, 0}, { 515 STM_OP_WR_DISABLE, 1, 0}, { 516 STM_OP_RD_STATUS, 1, 1}, { 517 STM_OP_WR_STATUS, 1, 0}, { 518 STM_OP_RD_DATA, 4, 4}, { 519 STM_OP_FAST_RD_DATA, 5, 0}, { 520 STM_OP_PAGE_PGRM, 8, 0}, { 521 STM_OP_SECTOR_ERASE, 4, 0}, { 522 STM_OP_BULK_ERASE, 1, 0}, { 523 STM_OP_DEEP_PWRDOWN, 1, 0}, { 524 STM_OP_RD_SIG, 4, 1},}; 513 } static stm_opcodes[] = { 514 { 515 STM_OP_WR_ENABLE, 1, 0}, { 516 STM_OP_WR_DISABLE, 1, 0}, { 517 STM_OP_RD_STATUS, 518 1, 1}, { 519 STM_OP_WR_STATUS, 520 1, 0}, { 521 STM_OP_RD_DATA, 522 4, 523 4}, 524 { 525 STM_OP_FAST_RD_DATA, 5, 0}, { 526 STM_OP_PAGE_PGRM, 8, 0}, { 527 STM_OP_SECTOR_ERASE, 528 4, 0}, { 529 STM_OP_BULK_ERASE, 530 1, 0}, { 531 STM_OP_DEEP_PWRDOWN, 532 1, 533 0}, 534 { 535 STM_OP_RD_SIG, 4, 1}, 536 }; 525 537 526 538 static __u32 spiflash_regread32(int reg) … … 538 550 return; 539 551 } 540 541 552 542 553 #define busy_wait(condition, wait) \ … … 634 645 puts("\r\n"); 635 646 636 637 647 ptr_opcode = &stm_opcodes[SPI_SECTOR_ERASE]; 638 648 639 649 temp = ((__u32)offset << 8) | (__u32)(ptr_opcode->code); 640 spiflash_sendcmd(SPI_WRITE_ENABLE, 0);650 spiflash_sendcmd(SPI_WRITE_ENABLE, 0); 641 651 busy_wait((reg = spiflash_regread32(SPI_FLASH_CTL)) & SPI_CTL_BUSY, 0); 642 652 643 653 spiflash_regwrite32(SPI_FLASH_OPCODE, temp); 644 654 645 reg = (reg & ~SPI_CTL_TX_RX_CNT_MASK) | ptr_opcode->tx_cnt | SPI_CTL_START; 655 reg = 656 (reg & ~SPI_CTL_TX_RX_CNT_MASK) | ptr_opcode->tx_cnt | 657 SPI_CTL_START; 646 658 spiflash_regwrite32(SPI_FLASH_CTL, reg); 647 659 648 660 busy_wait(spiflash_sendcmd(SPI_RD_STATUS, 0) & SPI_STATUS_WIP, 20); 649 650 661 651 662 puts("done\r\n"); … … 656 667 decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p) 657 668 { 658 output_data = (uch *) output_start; /* Points to kernel start */669 output_data = (uch *) output_start; 659 670 free_mem_ptr = free_mem_ptr_p; 660 671 free_mem_ptr_end = free_mem_ptr_end_p; … … 669 680 int count = 5; 670 681 while (count--) { 671 if (!resetTouched()) // check if reset button is unpressed again682 if (!resetTouched()) // check if reset button is unpressed again 672 683 break; 673 684 udelay(1000000); … … 685 696 sectorsize = flashconfig_tbl[index].sector_size; 686 697 puts("\r\n"); 687 flash_erase_nvram(flashconfig_tbl [index].688 byte_cnt,689 flashconfig_tbl [index].690 sector_size);698 flash_erase_nvram(flashconfig_tbl 699 [index].byte_cnt, 700 flashconfig_tbl 701 [index].sector_size); 691 702 } 692 703 … … 702 713 unsigned int mask = RESET_ENET0 | RESET_EPHY0; 703 714 unsigned int regtmp; 704 715 705 716 /* important, enable ethernet bus, if the following lines are not initialized linux will not be able to use the ethernet mac, taken from redboot source */ 706 717 regtmp = sysRegRead(AR2316_AHB_ARB_CTL);
Note: See TracChangeset
for help on using the changeset viewer.
