mirror of
https://github.com/pvvx/RTL00_WEB.git
synced 2025-07-31 20:31:05 +00:00
add set mac, cmsis-dap load sdram, ...
This commit is contained in:
parent
0830a1244a
commit
b381813514
27 changed files with 255 additions and 88 deletions
|
|
@ -1269,20 +1269,21 @@ void fATFO(void *arg) {
|
|||
rdsize = size;
|
||||
else
|
||||
rdsize = 8 * symbs_line;
|
||||
flash_otp_read(&flashobj, addr, rdsize, flash_data);
|
||||
uint8_t *ptr = flash_data;
|
||||
while (ptr < flash_data + rdsize) {
|
||||
if (symbs_line > size)
|
||||
symbs_line = size;
|
||||
printf("%08X ", addr);
|
||||
print_hex_dump(ptr, symbs_line, ' ');
|
||||
printf("\r\n");
|
||||
addr += symbs_line;
|
||||
ptr += symbs_line;
|
||||
size -= symbs_line;
|
||||
if (size == 0)
|
||||
break;
|
||||
}
|
||||
if (flash_otp_read(&flashobj, addr, rdsize, flash_data)) {
|
||||
uint8_t *ptr = flash_data;
|
||||
while (ptr < flash_data + rdsize) {
|
||||
if (symbs_line > size)
|
||||
symbs_line = size;
|
||||
printf("%08X ", addr);
|
||||
print_hex_dump(ptr, symbs_line, ' ');
|
||||
printf("\r\n");
|
||||
addr += symbs_line;
|
||||
ptr += symbs_line;
|
||||
size -= symbs_line;
|
||||
if (size == 0)
|
||||
break;
|
||||
}
|
||||
} else break;
|
||||
}
|
||||
free(flash_data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -635,10 +635,38 @@ int wifi_is_ready_to_transceive(rtw_interface_t interface) {
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_set_mac_address(char * mac) {
|
||||
char buf[13 + 17 + 1];
|
||||
rtw_memset(buf, 0, sizeof(buf));
|
||||
snprintf(buf, 13 + 17, "write_mac %s", mac);
|
||||
int mactostr(char * s, unsigned char *mac, bool fmt)
|
||||
{
|
||||
char *ptrb = s;
|
||||
unsigned char *ptrm = mac;
|
||||
int i = 6;
|
||||
while(i--) {
|
||||
unsigned char x = ptrm[0] >> 4;
|
||||
if (x <= 9) ptrb[0] = x + '0';
|
||||
else ptrb[0] = x - 10 + 'a';
|
||||
ptrb++;
|
||||
x = ptrm[0] & 0x0f;
|
||||
if (x <= 9) ptrb[0] = x + '0';
|
||||
else ptrb[0] = x - 10 + 'a';
|
||||
ptrb++;
|
||||
ptrm++;
|
||||
if(fmt && i) {
|
||||
ptrb[0] = ':';
|
||||
ptrb++;
|
||||
}
|
||||
};
|
||||
*ptrb = '\0';
|
||||
if (fmt) return 12+5;
|
||||
return 12;
|
||||
}
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_set_mac_address(char * new_mac) {
|
||||
// char buf[13 + 17 + 1];
|
||||
char buf[10 + 12 + 1];
|
||||
memcpy(buf,"write_mac ", 10);
|
||||
// snprintf(buf, 13 + 17, "write_mac %s", mac);
|
||||
//BAG NotWork! rtl_sprintf(buf, "write_mac %02x%02x%02x%02x%02x%02x", new_mac[0], new_mac[1], new_mac[2], new_mac[3], new_mac[4], new_mac[5]);
|
||||
mactostr(&buf[10], new_mac, false);
|
||||
return wext_private_command(WLAN0_NAME, buf, SHOW_PRIVATE_OUT);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -703,6 +703,8 @@ int wifi_disable_packet_filter(unsigned char filter_id);
|
|||
int wifi_remove_packet_filter(unsigned char filter_id);
|
||||
#endif
|
||||
|
||||
int mactostr(char * s, unsigned char *mac, bool fmt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ int wext_set_mac_address(const char *ifname, char * mac)
|
|||
{
|
||||
char buf[13+17+1];
|
||||
memset(buf, 0, sizeof(buf));
|
||||
snprintf(buf, 13+17, "write_mac %s", mac);
|
||||
snprintf(buf, 13+17, "write_mac %02x%02x%02x%02x%02x%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
return wext_private_command(ifname, buf, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
#include "main.h"
|
||||
#include "wifi_user_set.h"
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
#undef debug_printf
|
||||
#define debug_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__)
|
||||
#undef info_printf
|
||||
|
|
@ -558,7 +558,7 @@ LOCAL int _wifi_on(rtw_mode_t mode) {
|
|||
wext_set_adaptivity(wifi_cfg.adaptivity & 3);
|
||||
|
||||
debug_printf("Wlan0 init...\n");
|
||||
|
||||
// rltk_wlan_deinit_fastly();
|
||||
ret = rltk_wlan_init(WLAN0_IDX, mode); // rtw_mode_t
|
||||
|
||||
debug_printf("netif_set_up 0...\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue