From: Werner Almesberger Date: Tue, 16 Apr 2013 16:55:27 +0000 (-0300) Subject: tftp.c: use symbolic constant for block size X-Git-Tag: 24jan2021_ls180~2975 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=22f39b9d262b82de7123fc700c3f9b479600a93f;p=litex.git tftp.c: use symbolic constant for block size --- diff --git a/software/bios/tftp.c b/software/bios/tftp.c index ff34cc24..2ceadb94 100644 --- a/software/bios/tftp.c +++ b/software/bios/tftp.c @@ -15,6 +15,9 @@ enum { TFTP_ERROR = 5, /* Error */ }; +#define BLOCK_SIZE 512 /* block size in bytes */ + + static int format_request(uint8_t *buf, uint16_t op, const char *filename) { int len = strlen(filename); @@ -63,11 +66,11 @@ static void rx_callback(uint32_t src_ip, uint16_t src_port, if(block < 1) return; if(opcode == TFTP_DATA) { /* Data */ length -= 4; - offset = (block-1)*512; + offset = (block-1)*BLOCK_SIZE; for(i=0;i