mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
Merge pull request #494 from tofurky/sdcc_4.6.0_warnings
Fix warnings seen on SDCC 4.6.0 due to missing const qualifiers
This commit is contained in:
22 files changed
+57
-57
No files matched your search
@@ -22,7 +22,7 @@ extern __xdata struct machine_runtime machine_detected;
|
|||||||
extern __xdata uint8_t sfr_data[4];
|
extern __xdata uint8_t sfr_data[4];
|
||||||
extern volatile __xdata uint32_t ticks;
|
extern volatile __xdata uint32_t ticks;
|
||||||
extern __xdata uint8_t tx_seq;
|
extern __xdata uint8_t tx_seq;
|
||||||
extern __code uint8_t * __code hex;
|
extern __code const uint8_t * __code const hex;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -26,15 +26,15 @@
|
|||||||
#pragma codeseg BANK2
|
#pragma codeseg BANK2
|
||||||
#pragma constseg BANK2
|
#pragma constseg BANK2
|
||||||
|
|
||||||
extern __code struct machine machine;
|
extern __code const struct machine machine;
|
||||||
extern __xdata bool stp_enabled;
|
extern __xdata bool stp_enabled;
|
||||||
extern __code uint8_t log_to_phys_port[9];
|
extern __code const uint8_t log_to_phys_port[9];
|
||||||
|
|
||||||
extern volatile __xdata uint32_t ticks;
|
extern volatile __xdata uint32_t ticks;
|
||||||
extern volatile __xdata uint8_t sfr_data[4];
|
extern volatile __xdata uint8_t sfr_data[4];
|
||||||
|
|
||||||
extern __code uint8_t * __code greeting;
|
extern __code const uint8_t * __code const greeting;
|
||||||
extern __code uint8_t * __code hex;
|
extern __code const uint8_t * __code const hex;
|
||||||
|
|
||||||
extern __xdata uint8_t flash_buf[FLASH_BUF_SIZE];
|
extern __xdata uint8_t flash_buf[FLASH_BUF_SIZE];
|
||||||
extern __xdata struct flash_region_t flash_region;
|
extern __xdata struct flash_region_t flash_region;
|
||||||
@@ -105,7 +105,7 @@ inline uint8_t isnumber(uint8_t l)
|
|||||||
return (l <= ('9'-'0'));
|
return (l <= ('9'-'0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t cmd_compare(uint8_t start, __code uint8_t * cmd)
|
uint8_t cmd_compare(uint8_t start, __code const uint8_t * cmd)
|
||||||
{
|
{
|
||||||
if (cmd_words_len == 0 || start > (cmd_words_len - 1)) {
|
if (cmd_words_len == 0 || start > (cmd_words_len - 1)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+5
-5
@@ -22,9 +22,9 @@
|
|||||||
extern volatile __xdata uint8_t sfr_data[4];
|
extern volatile __xdata uint8_t sfr_data[4];
|
||||||
extern volatile __xdata uint32_t ticks;
|
extern volatile __xdata uint32_t ticks;
|
||||||
extern __xdata uint8_t cmd_capture; /* owned by rtlplayground.c, see write_char_no_syslog() */
|
extern __xdata uint8_t cmd_capture; /* owned by rtlplayground.c, see write_char_no_syslog() */
|
||||||
extern __code uint8_t * __code hex;
|
extern __code const uint8_t * __code const hex;
|
||||||
extern __code struct f_data f_data[];
|
extern __code const struct f_data f_data[];
|
||||||
extern __code char * __code mime_strings[];
|
extern __code const char * __code const mime_strings[];
|
||||||
extern __xdata struct flash_region_t flash_region;
|
extern __xdata struct flash_region_t flash_region;
|
||||||
extern __xdata uint32_t flash_size;
|
extern __xdata uint32_t flash_size;
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ uint8_t find_entry(__xdata uint8_t *e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool is_word(__xdata uint8_t *xdata_str_p, __code uint8_t * __xdata code_str_p)
|
bool is_word(__xdata uint8_t *xdata_str_p, __code const uint8_t * __xdata code_str_p)
|
||||||
{
|
{
|
||||||
uint8_t u, c;
|
uint8_t u, c;
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ bool is_word(__xdata uint8_t *xdata_str_p, __code uint8_t * __xdata code_str_p)
|
|||||||
|
|
||||||
|
|
||||||
/* name must be lower-case, starting with the '\n' of the previous line's end */
|
/* name must be lower-case, starting with the '\n' of the previous line's end */
|
||||||
__xdata uint8_t *header_value(__xdata uint8_t *p, __code uint8_t *name)
|
__xdata uint8_t *header_value(__xdata uint8_t *p, __code const uint8_t *name)
|
||||||
{
|
{
|
||||||
uint8_t u, c;
|
uint8_t u, c;
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -30,7 +30,7 @@ extern __xdata uint16_t slen;
|
|||||||
extern __xdata uint16_t management_vlan;
|
extern __xdata uint16_t management_vlan;
|
||||||
extern __xdata uint16_t cont_len;
|
extern __xdata uint16_t cont_len;
|
||||||
extern __xdata uint32_t cont_addr;
|
extern __xdata uint32_t cont_addr;
|
||||||
extern __code uint8_t * __code hex;
|
extern __code const uint8_t * __code const hex;
|
||||||
extern __xdata uip_ipaddr_t uip_hostaddr, uip_draddr, uip_netmask;
|
extern __xdata uip_ipaddr_t uip_hostaddr, uip_draddr, uip_netmask;
|
||||||
|
|
||||||
extern __xdata uint8_t sfr_data[4];
|
extern __xdata uint8_t sfr_data[4];
|
||||||
@@ -47,8 +47,8 @@ extern __xdata char sfp_module_model[2][17];
|
|||||||
extern __xdata char sfp_module_serial[2][17];
|
extern __xdata char sfp_module_serial[2][17];
|
||||||
extern __xdata uint8_t sfp_options[2];
|
extern __xdata uint8_t sfp_options[2];
|
||||||
|
|
||||||
__code uint8_t * __code HTTP_RESPONCE_JSON = "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n";
|
__code const uint8_t * __code const HTTP_RESPONCE_JSON = "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Type: application/json\r\n\r\n";
|
||||||
__code uint8_t * __code HTTP_RESPONCE_TXT = "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Type: text/plain\r\n\r\n";
|
__code const uint8_t * __code const HTTP_RESPONCE_TXT = "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Type: text/plain\r\n\r\n";
|
||||||
|
|
||||||
// Convert uint8_t to ascii HEX char push on html-buffer.
|
// Convert uint8_t to ascii HEX char push on html-buffer.
|
||||||
void charhex_to_html(char c)
|
void charhex_to_html(char c)
|
||||||
@@ -127,7 +127,7 @@ void itoa16_html(uint16_t v) /* sufficient for VLAN IDs (max 4094) */
|
|||||||
char_to_html('0' + (v % 10));
|
char_to_html('0' + (v % 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
void string_to_html(__code char *s)
|
void string_to_html(__code const char *s)
|
||||||
{
|
{
|
||||||
while (*s) char_to_html(*s++);
|
while (*s) char_to_html(*s++);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
extern __code uint8_t * __code HTTP_RESPONCE_TXT;
|
extern __code const uint8_t * __code const HTTP_RESPONCE_TXT;
|
||||||
|
|
||||||
bool send_counters(uint8_t phys_port);
|
bool send_counters(uint8_t phys_port);
|
||||||
void send_status(void);
|
void send_status(void);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
__xdata uint8_t buffer[0x1000];
|
__xdata uint8_t buffer[0x1000];
|
||||||
__xdata uint8_t dio_enabled;
|
__xdata uint8_t dio_enabled;
|
||||||
|
|
||||||
__code uint8_t * __code hex = "0123456789abcdef";
|
__code const uint8_t * __code const hex = "0123456789abcdef";
|
||||||
|
|
||||||
void isr_timer0(void) __interrupt(1)
|
void isr_timer0(void) __interrupt(1)
|
||||||
{
|
{
|
||||||
@@ -67,7 +67,7 @@ void write_char(char c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void print_string(__code char *p)
|
void print_string(__code const char *p)
|
||||||
{
|
{
|
||||||
while (*p)
|
while (*p)
|
||||||
write_char(*p++);
|
write_char(*p++);
|
||||||
|
|||||||
+2
-2
@@ -183,13 +183,13 @@ uint16_t strlen(__code const char *s);
|
|||||||
uint16_t strcpy(__xdata uint8_t *dst, const char *s);
|
uint16_t strcpy(__xdata uint8_t *dst, const char *s);
|
||||||
char strcmp(__xdata const uint8_t *a, __code const uint8_t *b);
|
char strcmp(__xdata const uint8_t *a, __code const uint8_t *b);
|
||||||
#endif
|
#endif
|
||||||
void memcpyc(__xdata uint8_t *dst, __code uint8_t *src, uint16_t len);
|
void memcpyc(__xdata uint8_t *dst, __code const uint8_t *src, uint16_t len);
|
||||||
uint16_t strlen_x(__xdata const char *s);
|
uint16_t strlen_x(__xdata const char *s);
|
||||||
uint16_t strtox(__xdata uint8_t *dst, __code const char *s);
|
uint16_t strtox(__xdata uint8_t *dst, __code const char *s);
|
||||||
bool strstart(__xdata const uint8_t *a, __code const uint8_t *b);
|
bool strstart(__xdata const uint8_t *a, __code const uint8_t *b);
|
||||||
bool strstart_x(__xdata const uint8_t *a, __xdata const uint8_t *b);
|
bool strstart_x(__xdata const uint8_t *a, __xdata const uint8_t *b);
|
||||||
void tcpip_output(void);
|
void tcpip_output(void);
|
||||||
uint8_t read_flash(uint8_t bank, __code uint8_t *addr);
|
uint8_t read_flash(uint8_t bank, __code const uint8_t *addr);
|
||||||
void get_random_32(void);
|
void get_random_32(void);
|
||||||
void read_reg_timer(__xdata uint32_t * tmr);
|
void read_reg_timer(__xdata uint32_t * tmr);
|
||||||
bool gpio_pin_test(uint8_t pin);
|
bool gpio_pin_test(uint8_t pin);
|
||||||
|
|||||||
+1
-1
@@ -171,7 +171,7 @@ void flash_read_uid(void)
|
|||||||
flash_configure_mmio();
|
flash_configure_mmio();
|
||||||
}
|
}
|
||||||
|
|
||||||
__code char* get_flash_size_str(void)
|
__code const char* get_flash_size_str(void)
|
||||||
{
|
{
|
||||||
switch (flash_capacity_code) {
|
switch (flash_capacity_code) {
|
||||||
case 0x12: return "256 KB";
|
case 0x12: return "256 KB";
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ void flash_read_security(void);
|
|||||||
void flash_sector_erase(void);
|
void flash_sector_erase(void);
|
||||||
void flash_read_bulk(__xdata uint8_t *dst);
|
void flash_read_bulk(__xdata uint8_t *dst);
|
||||||
void flash_write_bytes(__xdata uint8_t *ptr);
|
void flash_write_bytes(__xdata uint8_t *ptr);
|
||||||
__code char* get_flash_size_str(void);
|
__code const char* get_flash_size_str(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
#include "rtl837x_igmp.h"
|
#include "rtl837x_igmp.h"
|
||||||
#include "machine.h"
|
#include "machine.h"
|
||||||
|
|
||||||
extern __code struct machine machine;
|
extern __code const struct machine machine;
|
||||||
extern __xdata uint8_t igmpEnabled;
|
extern __xdata uint8_t igmpEnabled;
|
||||||
|
|
||||||
#include "uip.h"
|
#include "uip.h"
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
#include "boot.h"
|
#include "boot.h"
|
||||||
|
|
||||||
extern __xdata uint8_t sfr_data[4];
|
extern __xdata uint8_t sfr_data[4];
|
||||||
extern __code struct machine machine;
|
extern __code const struct machine machine;
|
||||||
extern __xdata struct machine_runtime machine_detected;
|
extern __xdata struct machine_runtime machine_detected;
|
||||||
|
|
||||||
#pragma codeseg BANK2
|
#pragma codeseg BANK2
|
||||||
|
|||||||
+2
-2
@@ -15,7 +15,7 @@
|
|||||||
#include "rtl837x_leds.h"
|
#include "rtl837x_leds.h"
|
||||||
#include "machine.h"
|
#include "machine.h"
|
||||||
|
|
||||||
extern __code struct machine machine;
|
extern __code const struct machine machine;
|
||||||
|
|
||||||
#include "uip.h"
|
#include "uip.h"
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ void leds_setup(void) __banked
|
|||||||
sfr_data[3] = sfr_data[2] = sfr_data[1] = sfr_data[0] = 0;
|
sfr_data[3] = sfr_data[2] = sfr_data[1] = sfr_data[0] = 0;
|
||||||
reg_write_m(RTL837X_REG_LED3_0_SET1);
|
reg_write_m(RTL837X_REG_LED3_0_SET1);
|
||||||
reg_write_m(RTL837X_REG_LED3_0_SET3);
|
reg_write_m(RTL837X_REG_LED3_0_SET3);
|
||||||
__code uint8_t * __xdata lptr = &machine.led_sets[0][0];
|
__code const uint8_t * __xdata lptr = &machine.led_sets[0][0];
|
||||||
for (__xdata uint8_t set = 0; set < 4; set++) {
|
for (__xdata uint8_t set = 0; set < 4; set++) {
|
||||||
sfr_data[0] = *(lptr + 5);
|
sfr_data[0] = *(lptr + 5);
|
||||||
sfr_data[1] = *(lptr + 4);
|
sfr_data[1] = *(lptr + 4);
|
||||||
|
|||||||
+2
-2
@@ -20,7 +20,7 @@
|
|||||||
#pragma codeseg BANK2
|
#pragma codeseg BANK2
|
||||||
#pragma constseg BANK2
|
#pragma constseg BANK2
|
||||||
|
|
||||||
extern __code uint16_t bit_mask[16];
|
extern __code const uint16_t bit_mask[16];
|
||||||
extern __code const struct machine machine;
|
extern __code const struct machine machine;
|
||||||
extern __xdata struct machine_runtime machine_detected;
|
extern __xdata struct machine_runtime machine_detected;
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ __xdata struct phy_settings phy_settings;
|
|||||||
// Note: Adding `Swapping the RX for N-devices`-setting on the end of the array, didn't work.
|
// Note: Adding `Swapping the RX for N-devices`-setting on the end of the array, didn't work.
|
||||||
// Setting will apply but still no packets flow.
|
// Setting will apply but still no packets flow.
|
||||||
// Settings are `0x2000, 0xc10c`,
|
// Settings are `0x2000, 0xc10c`,
|
||||||
__code uint16_t rtl8224_sds0_setttings[42] = {
|
__code const uint16_t rtl8224_sds0_setttings[42] = {
|
||||||
// SDS_DATA, SDS_CMD
|
// SDS_DATA, SDS_CMD
|
||||||
0x4480, 0xc842,
|
0x4480, 0xc842,
|
||||||
0x0400, 0xc9c2,
|
0x0400, 0xc9c2,
|
||||||
|
|||||||
+3
-3
@@ -18,9 +18,9 @@
|
|||||||
#pragma codeseg BANK1
|
#pragma codeseg BANK1
|
||||||
#pragma constseg BANK1
|
#pragma constseg BANK1
|
||||||
|
|
||||||
extern __code uint8_t * __code hex;
|
extern __code const uint8_t * __code const hex;
|
||||||
extern __code uint16_t bit_mask[16];
|
extern __code const uint16_t bit_mask[16];
|
||||||
extern __code struct machine machine;
|
extern __code const struct machine machine;
|
||||||
extern __xdata uint8_t sfr_data[4];
|
extern __xdata uint8_t sfr_data[4];
|
||||||
extern __xdata uint16_t vlan_ptr;
|
extern __xdata uint16_t vlan_ptr;
|
||||||
extern __xdata uint8_t vlan_names[VLAN_NAMES_SIZE];
|
extern __xdata uint8_t vlan_names[VLAN_NAMES_SIZE];
|
||||||
|
|||||||
+2
-2
@@ -22,7 +22,7 @@ extern __xdata uint8_t err_status;
|
|||||||
#pragma codeseg BANK2
|
#pragma codeseg BANK2
|
||||||
#pragma constseg BANK2
|
#pragma constseg BANK2
|
||||||
|
|
||||||
extern __code struct machine machine;
|
extern __code const struct machine machine;
|
||||||
extern __xdata uint8_t sfr_data[4];
|
extern __xdata uint8_t sfr_data[4];
|
||||||
extern __xdata struct machine_runtime machine_detected;
|
extern __xdata struct machine_runtime machine_detected;
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ extern __xdata uint8_t cmd_buffer[CMD_BUF_SIZE];
|
|||||||
extern __xdata uint8_t cmd_words_len;
|
extern __xdata uint8_t cmd_words_len;
|
||||||
extern __xdata uint8_t cmd_words_b[15];
|
extern __xdata uint8_t cmd_words_b[15];
|
||||||
extern __xdata char save_cmd; /* 0 while execute_config() replays the saved config */
|
extern __xdata char save_cmd; /* 0 while execute_config() replays the saved config */
|
||||||
uint8_t cmd_compare(uint8_t start, __code uint8_t * cmd);
|
uint8_t cmd_compare(uint8_t start, __code const uint8_t * cmd);
|
||||||
uint8_t atoi_byte(uint8_t idx);
|
uint8_t atoi_byte(uint8_t idx);
|
||||||
uint8_t cmd_parse_port_separator(uint8_t idx);
|
uint8_t cmd_parse_port_separator(uint8_t idx);
|
||||||
extern __xdata uint8_t atoi_results_u8;
|
extern __xdata uint8_t atoi_results_u8;
|
||||||
|
|||||||
+8
-8
@@ -79,9 +79,9 @@ void crc16_bank1(__xdata uint8_t *v) __naked;
|
|||||||
|
|
||||||
__xdata uint8_t idle_ready;
|
__xdata uint8_t idle_ready;
|
||||||
|
|
||||||
__code uint8_t ownIP[] = { 192, 168, 2, 2 };
|
__code const uint8_t ownIP[] = { 192, 168, 2, 2 };
|
||||||
__code uint8_t gatewayIP[] = { 192, 168, 2, 22};
|
__code const uint8_t gatewayIP[] = { 192, 168, 2, 22};
|
||||||
__code uint8_t netmask[] = { 255, 255, 255, 0};
|
__code const uint8_t netmask[] = { 255, 255, 255, 0};
|
||||||
|
|
||||||
__xdata struct uip_eth_addr uip_ethaddr;
|
__xdata struct uip_eth_addr uip_ethaddr;
|
||||||
|
|
||||||
@@ -108,8 +108,8 @@ extern __xdata uint8_t gpio_last_value[8];
|
|||||||
|
|
||||||
extern __xdata struct flash_region_t flash_region;
|
extern __xdata struct flash_region_t flash_region;
|
||||||
|
|
||||||
__code uint8_t * __code greeting = "\nA minimal prompt to explore the RTL8372:\n";
|
__code const uint8_t * __code const greeting = "\nA minimal prompt to explore the RTL8372:\n";
|
||||||
__code uint8_t * __code hex = "0123456789abcdef";
|
__code const uint8_t * __code const hex = "0123456789abcdef";
|
||||||
|
|
||||||
__xdata uint8_t flash_buf[FLASH_BUF_SIZE];
|
__xdata uint8_t flash_buf[FLASH_BUF_SIZE];
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ __xdata bool stp_enabled;
|
|||||||
__xdata uint8_t igmpEnabled;
|
__xdata uint8_t igmpEnabled;
|
||||||
__xdata char hostname[24]; /* device hostname, default set at boot, see rtl837x_common.h */
|
__xdata char hostname[24]; /* device hostname, default set at boot, see rtl837x_common.h */
|
||||||
|
|
||||||
__code uint16_t bit_mask[16] = {
|
__code const uint16_t bit_mask[16] = {
|
||||||
0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
|
0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
|
||||||
0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000
|
0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000
|
||||||
};
|
};
|
||||||
@@ -349,7 +349,7 @@ int memcmp(__xdata const void *a, __xdata const void *b, uint16_t len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void memcpyc(__xdata uint8_t *dst, __code uint8_t *src, uint16_t len)
|
void memcpyc(__xdata uint8_t *dst, __code const uint8_t *src, uint16_t len)
|
||||||
{
|
{
|
||||||
while (len--)
|
while (len--)
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
@@ -785,7 +785,7 @@ void nic_tx_packet(uint16_t ring_ptr)
|
|||||||
* Note that the address in the flash memory is not simply 0xbbaddr, because
|
* Note that the address in the flash memory is not simply 0xbbaddr, because
|
||||||
* the size of a bank is merely 0xc000.
|
* the size of a bank is merely 0xc000.
|
||||||
*/
|
*/
|
||||||
uint8_t read_flash(uint8_t bank, __code uint8_t *addr)
|
uint8_t read_flash(uint8_t bank, __code const uint8_t *addr)
|
||||||
{
|
{
|
||||||
uint8_t v;
|
uint8_t v;
|
||||||
uint8_t current_bank = PSBANK;
|
uint8_t current_bank = PSBANK;
|
||||||
|
|||||||
@@ -39,12 +39,12 @@ __code enum sfp_quirk {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct sfp_quirk_entry {
|
struct sfp_quirk_entry {
|
||||||
__code char *vendor; // Set vendor or model to 0 to act as wildcard
|
__code const char *vendor; // Set vendor or model to 0 to act as wildcard
|
||||||
__code char *model;
|
__code const char *model;
|
||||||
uint8_t quirks;
|
uint8_t quirks;
|
||||||
};
|
};
|
||||||
|
|
||||||
static __code struct sfp_quirk_entry sfp_quirk_table[] = {
|
static __code const struct sfp_quirk_entry sfp_quirk_table[] = {
|
||||||
{ "QSFPTEK", "QT-SFP+-T", SFP_QUIRK_DDM },
|
{ "QSFPTEK", "QT-SFP+-T", SFP_QUIRK_DDM },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -90,7 +90,7 @@ struct uip_eth_addr uip_ethaddr = { .addr = { 0x02, 0x11, 0x22, 0x33, 0x44, 0x55
|
|||||||
|
|
||||||
/* ---- leaf calls into subsystems not under test ---- */
|
/* ---- leaf calls into subsystems not under test ---- */
|
||||||
void flash_read_bulk(uint8_t *dst) { (void)dst; }
|
void flash_read_bulk(uint8_t *dst) { (void)dst; }
|
||||||
char *get_flash_size_str(void) { return (char *)"2M"; }
|
const char *get_flash_size_str(void) { return "2M"; }
|
||||||
uint8_t sfp_read_reg(uint8_t slot, uint8_t reg) { (void)slot; (void)reg; return 0; }
|
uint8_t sfp_read_reg(uint8_t slot, uint8_t reg) { (void)slot; (void)reg; return 0; }
|
||||||
bool gpio_pin_test(uint8_t pin) { (void)pin; return false; }
|
bool gpio_pin_test(uint8_t pin) { (void)pin; return false; }
|
||||||
void phy_read(uint8_t phy_id, uint8_t dev_id, uint16_t reg) { (void)phy_id; (void)dev_id; (void)reg; }
|
void phy_read(uint8_t phy_id, uint8_t dev_id, uint16_t reg) { (void)phy_id; (void)dev_id; (void)reg; }
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#define FDATA_DEFS_H
|
#define FDATA_DEFS_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
typedef enum mime_type_e { mime_HTML = 0, mime_SVG, mime_ICO, mime_PNG, mime_JS, mime_CSS, mime_TXT } mime_type_t;
|
typedef enum mime_type_e { mime_HTML = 0, mime_SVG, mime_ICO, mime_PNG, mime_JS, mime_CSS, mime_TXT } mime_type_t;
|
||||||
struct f_data { __code char *file; uint32_t start; uint16_t len; mime_type_t mime; uint8_t gzip; };
|
struct f_data { __code const char *file; uint32_t start; uint16_t len; mime_type_t mime; uint8_t gzip; };
|
||||||
#define FDATA_START_login_html 0x00040000UL
|
#define FDATA_START_login_html 0x00040000UL
|
||||||
#define FDATA_START_favicon_ico 0x00041000UL
|
#define FDATA_START_favicon_ico 0x00041000UL
|
||||||
#endif
|
#endif
|
||||||
@@ -67,18 +67,18 @@ volatile uint8_t sfr_data[4];
|
|||||||
volatile uint32_t ticks;
|
volatile uint32_t ticks;
|
||||||
uint8_t cmd_capture;
|
uint8_t cmd_capture;
|
||||||
uint8_t err_status;
|
uint8_t err_status;
|
||||||
uint8_t *hex = (uint8_t *)"0123456789abcdef";
|
const uint8_t * const hex = (const uint8_t *)"0123456789abcdef";
|
||||||
uint16_t crc_value;
|
uint16_t crc_value;
|
||||||
uint8_t *HTTP_RESPONCE_TXT = (uint8_t *)"HTTP/1.1 200 OK\r\n\r\n";
|
const uint8_t * const HTTP_RESPONCE_TXT = (const uint8_t *)"HTTP/1.1 200 OK\r\n\r\n";
|
||||||
uint32_t flash_size = 0x80000;
|
uint32_t flash_size = 0x80000;
|
||||||
uint8_t flash_buf[FLASH_BUF_SIZE];
|
uint8_t flash_buf[FLASH_BUF_SIZE];
|
||||||
uint8_t rx_headers[16];
|
uint8_t rx_headers[16];
|
||||||
struct flash_region_t flash_region;
|
struct flash_region_t flash_region;
|
||||||
|
|
||||||
char *mime_strings[] = { "text/html", "image/svg+xml", "image/x-icon",
|
const char * const mime_strings[] = { "text/html", "image/svg+xml", "image/x-icon",
|
||||||
"image/png", "text/javascript", "text/css", "text/plain" };
|
"image/png", "text/javascript", "text/css", "text/plain" };
|
||||||
|
|
||||||
struct f_data f_data[] = {
|
const struct f_data f_data[] = {
|
||||||
{ FILE_NAME, FILE_START, FILE_LEN, mime_HTML, 0 },
|
{ FILE_NAME, FILE_START, FILE_LEN, mime_HTML, 0 },
|
||||||
{ 0, 0, 0, mime_HTML, 0 },
|
{ 0, 0, 0, mime_HTML, 0 },
|
||||||
};
|
};
|
||||||
@@ -92,7 +92,7 @@ void flash_read_bulk(uint8_t *dst)
|
|||||||
void flash_init(uint8_t enable_dio) { (void)enable_dio; }
|
void flash_init(uint8_t enable_dio) { (void)enable_dio; }
|
||||||
void flash_sector_erase(void) { }
|
void flash_sector_erase(void) { }
|
||||||
void flash_write_bytes(uint8_t *ptr) { (void)ptr; }
|
void flash_write_bytes(uint8_t *ptr) { (void)ptr; }
|
||||||
char *get_flash_size_str(void) { return "512 kB"; }
|
const char *get_flash_size_str(void) { return "512 kB"; }
|
||||||
void crc16_bank1(uint8_t *v) { (void)v; }
|
void crc16_bank1(uint8_t *v) { (void)v; }
|
||||||
void reset_chip(void) { }
|
void reset_chip(void) { }
|
||||||
void delay(uint16_t t) { (void)t; }
|
void delay(uint16_t t) { (void)t; }
|
||||||
@@ -124,7 +124,7 @@ uint16_t strtox(uint8_t *dst, const char *s)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
void memcpyc(uint8_t *dst, uint8_t *src, uint16_t len) { memcpy(dst, src, len); }
|
void memcpyc(uint8_t *dst, const uint8_t *src, uint16_t len) { memcpy(dst, src, len); }
|
||||||
|
|
||||||
bool strstart(const uint8_t *a, const uint8_t *b)
|
bool strstart(const uint8_t *a, const uint8_t *b)
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-3
@@ -318,7 +318,7 @@ int main(int argc, char **argv)
|
|||||||
defbuf_p += snprintf(&dbuf[defbuf_p], DEF_SIZE - defbuf_p, "#include <stdint.h>\n\n");
|
defbuf_p += snprintf(&dbuf[defbuf_p], DEF_SIZE - defbuf_p, "#include <stdint.h>\n\n");
|
||||||
defbuf_p += snprintf(&dbuf[defbuf_p], DEF_SIZE - defbuf_p,
|
defbuf_p += snprintf(&dbuf[defbuf_p], DEF_SIZE - defbuf_p,
|
||||||
"typedef enum mime_type_e {\n mime_HTML = 0,\n mime_SVG,\n mime_ICO,\n mime_PNG,\n mime_JS,\n mime_CSS,\n mime_TXT\n} mime_type_t;\n\n");
|
"typedef enum mime_type_e {\n mime_HTML = 0,\n mime_SVG,\n mime_ICO,\n mime_PNG,\n mime_JS,\n mime_CSS,\n mime_TXT\n} mime_type_t;\n\n");
|
||||||
defbuf_p += snprintf(&dbuf[defbuf_p], DEF_SIZE - defbuf_p, "struct f_data {\n __code char *file;\n uint32_t start;\n uint16_t len;\n mime_type_t mime;\n uint8_t gzip;\n};\n\n");
|
defbuf_p += snprintf(&dbuf[defbuf_p], DEF_SIZE - defbuf_p, "struct f_data {\n __code const char *file;\n uint32_t start;\n uint16_t len;\n mime_type_t mime;\n uint8_t gzip;\n};\n\n");
|
||||||
// defbuf_p += snprintf(&dbuf[defbuf_p], DEF_SIZE - defbuf_p, "typedef uint16_t (* fcall_ptr)(void);\n\n");
|
// defbuf_p += snprintf(&dbuf[defbuf_p], DEF_SIZE - defbuf_p, "typedef uint16_t (* fcall_ptr)(void);\n\n");
|
||||||
|
|
||||||
ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, "// This file is automatically generated, do not edit!\n\n");
|
ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, "// This file is automatically generated, do not edit!\n\n");
|
||||||
@@ -326,9 +326,9 @@ int main(int argc, char **argv)
|
|||||||
ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, "#include \"%s.h\"\n\n", arguments.prefix);
|
ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, "#include \"%s.h\"\n\n", arguments.prefix);
|
||||||
if (arguments.bank)
|
if (arguments.bank)
|
||||||
ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, "#pragma codeseg %s\n#pragma constseg %s\n\n", arguments.bank, arguments.bank);
|
ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, "#pragma codeseg %s\n#pragma constseg %s\n\n", arguments.bank, arguments.bank);
|
||||||
ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, " __code char * __code mime_strings[] = {\n \"text/html\",\n \"image/svg+xml\",\n"
|
ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, " __code const char * __code const mime_strings[] = {\n \"text/html\",\n \"image/svg+xml\",\n"
|
||||||
" \"image/svg+xml\",\n \"image/png\",\n \"text/javascript\",\n \"text/css\",\n \"text/plain\"};\n\n");
|
" \"image/svg+xml\",\n \"image/png\",\n \"text/javascript\",\n \"text/css\",\n \"text/plain\"};\n\n");
|
||||||
ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, "__code struct f_data f_data[] = {\n");
|
ibuf_p += snprintf(&ibuf[ibuf_p], INDEX_SIZE - ibuf_p, "__code const struct f_data f_data[] = {\n");
|
||||||
// fbuf_p += snprintf(&fbuf[fbuf_p], DEF_SIZE - fbuf_p, "\n__code fcall_ptr f_calls[] = {\n");
|
// fbuf_p += snprintf(&fbuf[fbuf_p], DEF_SIZE - fbuf_p, "\n__code fcall_ptr f_calls[] = {\n");
|
||||||
|
|
||||||
// Now that the beginning of the buffer is filled with out image, optionally resize the image
|
// Now that the beginning of the buffer is filled with out image, optionally resize the image
|
||||||
|
|||||||
@@ -912,8 +912,8 @@ __xdata struct uip_udp_conn *uip_udp_new(__xdata uip_ipaddr_t * __xdata ripaddr,
|
|||||||
((__xdata u16_t *)addr1)[1] == ((__xdata u16_t *)addr2)[1])
|
((__xdata u16_t *)addr1)[1] == ((__xdata u16_t *)addr2)[1])
|
||||||
#define uip_ipaddr_cmpx(addr1, addr2) (((__xdata u16_t *)addr1)[0] == ((__xdata u16_t *)addr2)[0] && \
|
#define uip_ipaddr_cmpx(addr1, addr2) (((__xdata u16_t *)addr1)[0] == ((__xdata u16_t *)addr2)[0] && \
|
||||||
((__xdata u16_t *)addr1)[1] == ((__xdata u16_t *)addr2)[1])
|
((__xdata u16_t *)addr1)[1] == ((__xdata u16_t *)addr2)[1])
|
||||||
#define uip_ipaddr_cmpc(addr1, addr2) (((__xdata u16_t *)addr1)[0] == ((__code u16_t *)addr2)[0] && \
|
#define uip_ipaddr_cmpc(addr1, addr2) (((__xdata u16_t *)addr1)[0] == ((__code const u16_t *)addr2)[0] && \
|
||||||
((__xdata u16_t *)addr1)[1] == ((__code u16_t *)addr2)[1])
|
((__xdata u16_t *)addr1)[1] == ((__code const u16_t *)addr2)[1])
|
||||||
#else /* !UIP_CONF_IPV6 */
|
#else /* !UIP_CONF_IPV6 */
|
||||||
#define uip_ipaddr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0)
|
#define uip_ipaddr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0)
|
||||||
#endif /* !UIP_CONF_IPV6 */
|
#endif /* !UIP_CONF_IPV6 */
|
||||||
|
|||||||
Reference in new issue
Block a user