mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
@@ -15,7 +15,7 @@ OBJS = ${SRCS:.c=.rel}
|
|||||||
OBJS += uip/timer.rel uip/uip-fw.rel uip/uip-neighbor.rel uip/uip-split.rel uip/uip.rel uip/uip_arp.rel uip/uiplib.rel httpd/httpd.rel httpd/page_impl.rel
|
OBJS += uip/timer.rel uip/uip-fw.rel uip/uip-neighbor.rel uip/uip-split.rel uip/uip.rel uip/uip_arp.rel uip/uiplib.rel httpd/httpd.rel httpd/page_impl.rel
|
||||||
|
|
||||||
html_data.c html_data.h: html tools
|
html_data.c html_data.h: html tools
|
||||||
tools/fileadder -a -s -b BANK1 -d html -p html_data
|
tools/fileadder -a 458752 -s 524288 -b BANK1 -d html -p html_data
|
||||||
|
|
||||||
httpd: html_data.h
|
httpd: html_data.h
|
||||||
|
|
||||||
@@ -50,8 +50,8 @@ rtlplayground.ihx: crtstart.rel $(OBJS)
|
|||||||
cat $< >> $@
|
cat $< >> $@
|
||||||
truncate --size=16K $@
|
truncate --size=16K $@
|
||||||
dd if=$< skip=80 bs=1024 >>$@
|
dd if=$< skip=80 bs=1024 >>$@
|
||||||
tools/fileadder -s -d config.txt $@
|
tools/fileadder -a 458752 -s 524288 -d config.txt $@
|
||||||
tools/fileadder -a -s -d html -p html_data $@
|
tools/fileadder -a 262144 -s 524288 -d html -p html_data $@
|
||||||
|
|
||||||
.PHONY: clean all $(SUBDIRS)
|
.PHONY: clean all $(SUBDIRS)
|
||||||
.PRECIOUS: %.rel %.ihx .img
|
.PRECIOUS: %.rel %.ihx .img
|
||||||
|
|||||||
+50
-1
@@ -5,7 +5,7 @@
|
|||||||
// #define DEBUG
|
// #define DEBUG
|
||||||
// #define REGDBG 1
|
// #define REGDBG 1
|
||||||
|
|
||||||
#define CONFIG_START 0x1fd000
|
#define CONFIG_START 0x70000
|
||||||
#define CONFIG_LEN 0x1000
|
#define CONFIG_LEN 0x1000
|
||||||
|
|
||||||
#include "rtl837x_common.h"
|
#include "rtl837x_common.h"
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "rtl837x_flash.h"
|
#include "rtl837x_flash.h"
|
||||||
#include "rtl837x_phy.h"
|
#include "rtl837x_phy.h"
|
||||||
#include "rtl837x_regs.h"
|
#include "rtl837x_regs.h"
|
||||||
|
#include "uip/uip.h"
|
||||||
|
|
||||||
#pragma codeseg BANK1
|
#pragma codeseg BANK1
|
||||||
|
|
||||||
@@ -39,6 +40,8 @@ __xdata uint8_t l;
|
|||||||
__xdata uint8_t line_ptr;
|
__xdata uint8_t line_ptr;
|
||||||
__xdata char is_white;
|
__xdata char is_white;
|
||||||
|
|
||||||
|
__xdata uint8_t ip[4];
|
||||||
|
|
||||||
#define N_WORDS SBUF_SIZE
|
#define N_WORDS SBUF_SIZE
|
||||||
__xdata signed char cmd_words_b[N_WORDS];
|
__xdata signed char cmd_words_b[N_WORDS];
|
||||||
|
|
||||||
@@ -89,6 +92,25 @@ uint8_t atoi_short(register uint16_t *vlan, register uint8_t idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t parse_ip(register uint8_t idx)
|
||||||
|
{
|
||||||
|
__xdata uint8_t b;
|
||||||
|
|
||||||
|
for (b = 0; b < 4; b++) {
|
||||||
|
ip[b] = 0;
|
||||||
|
while (cmd_buffer[idx] >= '0' && cmd_buffer[idx] <= '9') {
|
||||||
|
ip[b] = (ip[b] * 10) + cmd_buffer[idx] - '0';
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
if (b < 3 && cmd_buffer[idx++] != '.') {
|
||||||
|
print_string("Error in IP format, expecting '.'\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void parse_trunk(void)
|
void parse_trunk(void)
|
||||||
{
|
{
|
||||||
__xdata uint8_t group;
|
__xdata uint8_t group;
|
||||||
@@ -347,6 +369,33 @@ void cmd_parser(void) __banked
|
|||||||
phy_set_mode(p, PHY_OFF, 0, 0);
|
phy_set_mode(p, PHY_OFF, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (cmd_compare(0, "ip")) {
|
||||||
|
print_string("Got ip command: ");
|
||||||
|
if (!parse_ip(cmd_words_b[1]))
|
||||||
|
uip_ipaddr(&uip_hostaddr, ip[0], ip[1], ip[2], ip[3]);
|
||||||
|
else
|
||||||
|
print_string("Invalid IP address\n");
|
||||||
|
print_byte(ip[0]); print_byte(ip[1]); print_byte(ip[2]); print_byte(ip[3]);
|
||||||
|
write_char('\n');
|
||||||
|
}
|
||||||
|
if (cmd_compare(0, "gw")) {
|
||||||
|
print_string("Got gw command: ");
|
||||||
|
if (!parse_ip(cmd_words_b[1]))
|
||||||
|
uip_ipaddr(&uip_draddr, ip[0], ip[1], ip[2], ip[3]);
|
||||||
|
else
|
||||||
|
print_string("Invalid IP address\n");
|
||||||
|
print_byte(ip[0]); print_byte(ip[1]); print_byte(ip[2]); print_byte(ip[3]);
|
||||||
|
write_char('\n');
|
||||||
|
}
|
||||||
|
if (cmd_compare(0, "netmask")) {
|
||||||
|
print_string("Got netmask command: ");
|
||||||
|
if (!parse_ip(cmd_words_b[1]))
|
||||||
|
uip_ipaddr(&uip_netmask, ip[0], ip[1], ip[2], ip[3]);
|
||||||
|
else
|
||||||
|
print_string("Invalid IP address\n");
|
||||||
|
print_byte(ip[0]);print_byte(ip[1]);print_byte(ip[2]);print_byte(ip[3]);
|
||||||
|
write_char('\n');
|
||||||
|
}
|
||||||
if (cmd_compare(0, "l2")) {
|
if (cmd_compare(0, "l2")) {
|
||||||
if (cmd_words_b[1] > 0 && cmd_compare(1, "forget"))
|
if (cmd_words_b[1] > 0 && cmd_compare(1, "forget"))
|
||||||
port_l2_forget();
|
port_l2_forget();
|
||||||
|
|||||||
+3
-2
@@ -39,10 +39,10 @@ const char *argp_program_bug_address = "<git@logicog.de>";
|
|||||||
static char doc[] = "Adds a file or a directory of files into an image";
|
static char doc[] = "Adds a file or a directory of files into an image";
|
||||||
static char args_doc[] = "addfile [options] INPUT_IMAGE";
|
static char args_doc[] = "addfile [options] INPUT_IMAGE";
|
||||||
static struct argp_option options[] = {
|
static struct argp_option options[] = {
|
||||||
{ "size", 's', "SIZE", OPTION_ARG_OPTIONAL, "Resize image"},
|
{ "size", 's', "SIZE", 0, "Resize image"},
|
||||||
{ "output", 'o', "FILE", 0, "Output image file name instead of overwriting input image"},
|
{ "output", 'o', "FILE", 0, "Output image file name instead of overwriting input image"},
|
||||||
{ "data", 'd', "FILE", 0, "File or directory to add to image"},
|
{ "data", 'd', "FILE", 0, "File or directory to add to image"},
|
||||||
{ "address", 'a', 0, OPTION_ARG_OPTIONAL, "Address where data is placed, default is 0x1000000 if option is used, otherwise 0x1fd000"},
|
{ "address", 'a', "SIZE", 0, "Address where data is placed, default is 0x1000000 if option is used, otherwise 0x1fd000"},
|
||||||
{ "prefix", 'p', "FILE", 0, "Prefix for header and index file generation"},
|
{ "prefix", 'p', "FILE", 0, "Prefix for header and index file generation"},
|
||||||
{ "bank", 'b', "BANKNAME", 0, "Generate #pragma with given bank-name"},
|
{ "bank", 'b', "BANKNAME", 0, "Generate #pragma with given bank-name"},
|
||||||
{ 0 }
|
{ 0 }
|
||||||
@@ -57,6 +57,7 @@ struct arguments {
|
|||||||
char *bank;
|
char *bank;
|
||||||
bool overwrite;
|
bool overwrite;
|
||||||
bool add_zero;
|
bool add_zero;
|
||||||
|
char *args[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user