mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Demagic FLASH_BUF_SIZE
This commit is contained in:
+1
-1
@@ -33,7 +33,7 @@ extern volatile __xdata uint8_t sfr_data[4];
|
||||
extern __code uint8_t * __code greeting;
|
||||
extern __code uint8_t * __code hex;
|
||||
|
||||
extern __xdata uint8_t flash_buf[512];
|
||||
extern __xdata uint8_t flash_buf[FLASH_BUF_SIZE];
|
||||
extern __xdata struct flash_region_t flash_region;
|
||||
|
||||
extern __xdata char passwd[21];
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ extern __code char * __code mime_strings[];
|
||||
extern __xdata struct flash_region_t flash_region;
|
||||
|
||||
// Flash buffer to optimize flash writing speed, write_len is the current filling position
|
||||
extern __xdata uint8_t flash_buf[512];
|
||||
extern __xdata uint8_t flash_buf[FLASH_BUF_SIZE];
|
||||
__xdata uint32_t uptr; // Current flash write position
|
||||
__xdata uint16_t write_len;
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
// Size of the memory area dedicated to VLAN-names
|
||||
#define VLAN_NAMES_SIZE 1024
|
||||
|
||||
// Size of the flash buffer used for writing to flash, must be a multiple of the flash page size (0x100)
|
||||
#define FLASH_BUF_SIZE 512
|
||||
|
||||
// For RX data, a propriatary RTL FRAME is inserted. Instead of 0x0800 for IPv4,
|
||||
// the RTL_FRAME_TAG_ID is used as part of an 8-byte tag. When VLAN is activated,
|
||||
// the VLAN tag is inserted after the RTL tag
|
||||
|
||||
+12
-12
@@ -99,7 +99,7 @@ extern __xdata struct flash_region_t flash_region;
|
||||
__code uint8_t * __code greeting = "\nA minimal prompt to explore the RTL8372:\n";
|
||||
__code uint8_t * __code hex = "0123456789abcdef";
|
||||
|
||||
__xdata uint8_t flash_buf[512];
|
||||
__xdata uint8_t flash_buf[FLASH_BUF_SIZE];
|
||||
|
||||
// NIC buffers for packet RX/TX
|
||||
__xdata uint8_t rx_headers[16]; // Packet header(s) on RX
|
||||
@@ -1073,13 +1073,13 @@ void flash_default_config(void)
|
||||
for (uint8_t i = 0; i < 8; i++) // 8 * 512 Byte = 4 kByte (1 sector)
|
||||
{
|
||||
flash_region.addr = source;
|
||||
flash_region.len = 0x200;
|
||||
flash_region.len = FLASH_BUF_SIZE;
|
||||
flash_read_bulk(flash_buf);
|
||||
flash_region.addr = dest;
|
||||
flash_region.len = 0x200;
|
||||
flash_region.len = FLASH_BUF_SIZE;
|
||||
flash_write_bytes(flash_buf);
|
||||
dest += 0x200;
|
||||
source += 0x200;
|
||||
dest += FLASH_BUF_SIZE;
|
||||
source += FLASH_BUF_SIZE;
|
||||
}
|
||||
|
||||
print_string("Written default config to flash\n");
|
||||
@@ -1883,13 +1883,13 @@ void check_and_flash_update_image(void)
|
||||
crc_value = 0x0000;
|
||||
for (i = 0; i < 1024; i++) {
|
||||
flash_region.addr = source;
|
||||
flash_region.len = 0x200;
|
||||
flash_region.len = FLASH_BUF_SIZE;
|
||||
flash_read_bulk(flash_buf);
|
||||
bptr = flash_buf;
|
||||
for (j = 0; j < 0x200; j++) {
|
||||
for (j = 0; j < FLASH_BUF_SIZE; j++) {
|
||||
crc16(bptr++);
|
||||
}
|
||||
source += 0x200;
|
||||
source += FLASH_BUF_SIZE;
|
||||
if (i%16 == 0)
|
||||
write_char('.');
|
||||
}
|
||||
@@ -1903,7 +1903,7 @@ void check_and_flash_update_image(void)
|
||||
// print_string("Writing block: ");
|
||||
// print_short(dest);
|
||||
flash_region.addr = source;
|
||||
flash_region.len = 0x200;
|
||||
flash_region.len = FLASH_BUF_SIZE;
|
||||
flash_read_bulk(flash_buf);
|
||||
if (!(i & 0x7)) {
|
||||
flash_region.addr = dest;
|
||||
@@ -1911,10 +1911,10 @@ void check_and_flash_update_image(void)
|
||||
write_char('.');
|
||||
}
|
||||
flash_region.addr = dest;
|
||||
flash_region.len = 0x200;
|
||||
flash_region.len = FLASH_BUF_SIZE;
|
||||
flash_write_bytes(flash_buf);
|
||||
dest += 0x200;
|
||||
source += 0x200;
|
||||
dest += FLASH_BUF_SIZE;
|
||||
source += FLASH_BUF_SIZE;
|
||||
}
|
||||
print_string("\nDeleting uploaded flash image\n");
|
||||
dest = FIRMWARE_UPLOAD_START;
|
||||
|
||||
Reference in New Issue
Block a user