📄 tftpput.c
字号:
#include "tftpput.h"#include "hexput.h"#include "bioscall.h"extern int startup_mode;extern int startup_param;static unsigned char *buf;static int data_len;int tftp_put_begin(void){ switch (startup_mode) { case BOOT_LOAD_PROGRAM: case BOOT_UPDATE_FIRMWARE: case BOOT_UPDATE_BIOS: printf("Starting the TFTP download...\r\n"); buf = (unsigned char *)0x00008000; data_len = 0; break; default: break; } return 0;}int tftp_put(unsigned char *data, int len){ static int count = 0; count += len; if (count > 32 * 1024) { printf("."); count = 0; } switch (startup_mode) { case BOOT_LOAD_PROGRAM: case BOOT_UPDATE_FIRMWARE: case BOOT_UPDATE_BIOS: memcpy(buf + data_len, data, len); data_len += len; break; default: break; } return 0;}int update_bios(unsigned char *bios, int size){//IS NOT COMPLETED!; //void }int update_firmware(unsigned char *firmware, int size){//IS NOT COMPLETED!; //void }int tftp_put_end(void){ int ch; unsigned long l; printf("\r\n"); switch (startup_mode) { case BOOT_LOAD_PROGRAM: asm( " ldr r14, =0x00008000; mov PC, r14; " );//run uClinux break; case BOOT_UPDATE_FIRMWARE: update_firmware(buf, data_len); break; case BOOT_UPDATE_BIOS: update_bios(buf, data_len); break; default: break; } printf("Reboot? (y/n) "); while (1) { ch = getch(); if (ch == 'y' || ch == 'Y') { putch(ch); bios_reboot(); } if (ch == 'n' || ch == 'N') { putch(ch); break; } } printf("\r\n\r\n"); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -