Fix avr progmem string accesses, add DEBUGLOGIC, configure sky defaults

This commit is contained in:
David Kopf 2011-07-25 15:08:49 -04:00
parent 0e59a0360e
commit e3368ffb67
4 changed files with 95 additions and 33 deletions

View file

@ -44,6 +44,7 @@
* The RAM needed for each entry depends on script enabling and buffer sizes; see struct httpd_state below.
* Typical range is 100 - 200 bytes per connection
*/
#if CONTIKI_TARGET_SKY
#define WEBSERVER_CONF_CONNS 2
#define WEBSERVER_CONF_NAMESIZE 16
#define WEBSERVER_CONF_BUFSIZE 40
@ -83,6 +84,47 @@ extern char httpd_query[WEBSERVER_CONF_PASSQUERY];
/* Include referrer in log */
#define WEBSERVER_CONF_REFERER 0
#else /* !sky */
#define WEBSERVER_CONF_CONNS 6
#define WEBSERVER_CONF_NAMESIZE 20
#define WEBSERVER_CONF_BUFSIZE 40
/* Allow include in .shtml pages, e.g. %!: /header.html */
#define WEBSERVER_CONF_INCLUDE 1
/* Allow cgi in .shtml pages, e.g. %! file-stats . */
#define WEBSERVER_CONF_CGI 1
/* MAX_SCRIPT_NAME_LENGTH should be at least the maximum file name length+2 for %!: includes */
#define MAX_SCRIPT_NAME_LENGTH WEBSERVER_CONF_NAMESIZE+2
/* Enable specific cgi's */
#define WEBSERVER_CONF_HEADER 1
//#define WEBSERVER_CONF_HEADER_W3C 1 //Proper header
#define WEBSERVER_CONF_HEADER_MENU 1 //with links to other pages
//#define WEBSERVER_CONF_HEADER_ICON 1 //with favicon
#define WEBSERVER_CONF_FILESTATS 1
#define WEBSERVER_CONF_TCPSTATS 1
#define WEBSERVER_CONF_PROCESSES 1
#define WEBSERVER_CONF_ADDRESSES 1
#define WEBSERVER_CONF_NEIGHBORS 1
#define WEBSERVER_CONF_ROUTES 1
#define WEBSERVER_CONF_SENSORS 1
#define WEBSERVER_CONF_TICTACTOE 1 //Needs passquery of at least 10 chars
#define WEBSERVER_CONF_PASSQUERY 10
#if WEBSERVER_CONF_PASSQUERY
extern char httpd_query[WEBSERVER_CONF_PASSQUERY];
#endif
/* Enable specific file types */
#define WEBSERVER_CONF_JPG 1
#define WEBSERVER_CONF_PNG 1
#define WEBSERVER_CONF_GIF 1
#define WEBSERVER_CONF_TXT 1
#define WEBSERVER_CONF_CSS 1
#define WEBSERVER_CONF_BIN 1
/* Log page accesses */
#define WEBSERVER_CONF_LOG 1
/* Include referrer in log */
#define WEBSERVER_CONF_REFERER 1
#endif
/* Address printing used by cgi's and logging, but it can be turned off if desired */
#if WEBSERVER_CONF_LOG || WEBSERVER_CONF_ADDRESSES || WEBSERVER_CONF_NEIGHBORS || WEBSERVER_CONF_ROUTES
#define WEBSERVER_CONF_PRINTADDR 1
@ -108,6 +150,7 @@ uint8_t httpd_cgi_sprint_ip6(uip_ip6addr_t addr, char * result);
#define httpd_strlen strlen_P
#define httpd_snprintf snprintf_P
#define httpd_fs_cpy memcpy_P
#define httpd_fs_strcmp strcmp_P
#define httpd_fs_strchr strchr_P
#define httpd_fs_getchar(x) pgm_read_byte(x)
@ -122,6 +165,7 @@ uint8_t httpd_cgi_sprint_ip6(uip_ip6addr_t addr, char * result);
#define httpd_strncmp strncmp
#define httpd_strlen strlen
#define httpd_fs_strchr strchr
#define httpd_fs_strcmp strcmp
#define httpd_fs_getchar(c) *(c)
#endif
@ -152,4 +196,27 @@ struct httpd_state {
void httpd_init(void);
void httpd_appcall(void *state);
/* DEBUGLOGIC is a convenient way to debug without a tcp/ip connection.
* After initialization, break the program and set the program counter
* to the beginning of httpd.c::httpd_appcall:
* s = sg = (struct httpd_state *)memb_alloc(&conns);
* The global sg points to the s data to get around "not in scope" optimization.
* The input file is forced to /index.html and the output directed to TCPBUF.
* However the socket will hang on acknowledgement when any data is sent.
* To prevent this just add a break to /core/net/psock.c::psock_generator_send
* ...
* // Wait until all data is sent and acknowledged.
* break; //<---add this line
* PT_YIELD_UNTIL(&s->psockpt, uip_acked() || uip_rexmit());
* ...
*/
#define DEBUGLOGIC 0
#if DEBUGLOGIC
struct httpd_state *sg;
#define uip_mss(...) 512
#define uip_appdata TCPBUF
char TCPBUF[512];
#endif
#endif /* __HTTPD_H__ */