NetBurner 3.5.0
PDF Version
 
constants.h File Reference

NetBurner System Constants. More...

#include <predef.h>

Go to the source code of this file.

Macros

#define TICK_IRQ_LEVEL   (5)
 System clock IRQ level.
 
#define SERIAL_IRQ_LEVEL   (3)
 
 
#define SERIAL_VECTOR_BASE   (64)
 
 
#define TICKS_PER_SECOND   (20)
 System clock ticks per second.
 
#define OS_MAX_TASKS   32
 Max number of system tasks.
 
#define OS_MAX_PRIOS   64
 Maximum number of system priorities.
 
#define SSH_TASK_PRIORITY   (56)
 ief SSH server must be lower than main for progress displays
 
#define TASK_TABLE_SIZE   2
 
 
#define MAX_IP_ERRS   3
 
 
#define BUFFER_POOL_SIZE   (256)
 was 64 in last release, we increased buffer segments to handle higher throughput events
 
#define POOL_BUFFER_SIZE   (sizeof(pool_buffer))
 Size of each buffer - 1712 bytes by default.
 
#define UDP_DISPATCH_SIZE   (15)
 
 
#define UDP_MIN_BUFFER_THRESHOLD   (10)
 
 
#define ARP_ENTRY_SIZE   (256)
 
 
#define UDP_NETBURNERID_PORT   (0x4E42)
 NB.
 
#define UDP_DHCP_SERVER_PORT   (67)
 
 
#define UDP_DHCP_CLIENT_PORT   (68)
 
 
#define UDP_MDNS_PORT   (5353)
 
 
#define TFTP_RX_PORT   (1414)
 
 
#define LINK_STATUS_CHECK_INTERVAL   (2 * TICKS_PER_SECOND)
 
 
#define FTPD_SOCKET_TIMEOUT   (5 * 60 * TICKS_PER_SECOND)
 
 
#define ENABLE_SRAM_SYS
 
 
#define FAST_SYS_VAR   __attribute__((section("SYS_VAR_SECT")))
 
 
#define FAST_SYS_VAR_REL   __attribute__((section("SYS_VAR_SECT_REL")))
 
 
#define FAST_SYS_VAR_REL_STR   __attribute__((section("SYS_VAR_SECT_REL_STR")))
 
 
#define FAST_IDLE_STK
 
 
#define FAST_MAIN_STK   __attribute__((section("MAIN_STK_SECT")))
 
 
#define FAST_USER_STK   __attribute__((section("USER_STK_SECT")))
 
 
#define FAST_USER_VAR   __attribute__((section("USER_VAR_SECT")))
 
 
#define FAST_ETHER_VAR   __attribute__((section("ETHER_VAR_SECT")))
 
 
#define FAST_ETHER_VAR_REL   __attribute__((section("ETHER_VAR_SECT_REL")))
 
 
#define FAST_ETHER_STK   __attribute__((section("ETHER_STK_SECT")))
 
 
#define FAST_IP_VAR   __attribute__((section("IP_VAR_SECT")))
 
 
#define FAST_IP_VAR_REL   __attribute__((section("IP_VAR_SECT_REL")))
 
 
#define FAST_IP_STK   __attribute__((section("IP_STK_SECT")))
 
 
#define FAST_TCP_VAR   __attribute__((section("TCP_VAR_SECT")))
 
 
#define FAST_TCP_VAR_REL   __attribute__((section("TCP_VAR_SECT_REL")))
 
 
#define FAST_TCP_STK   __attribute__((section("TCP_STK_SECT")))
 
 
#define FAST_HTTP_STK   __attribute__((section("HTTP_STK_SECT")))
 
 
#define FAST_FTP_STK
 
 
#define FAST_WIFI_STK
 
 
#define FAST_PPP_STK
 
 
#define FAST_COMMAND_STK
 
 
#define FAST_BUFF_VAR   __attribute__((section("BUFFERS_VAR_SECT")))
 
 
#define FAST_BUFF_VAR_REL   __attribute__((section("BUFFERS_VAR_SECT_REL")))
 
 
#define FAST_TLS_VAR   __attribute__((section("TLS_VAR_SECT")))
 
 
#define FAST_TLS_VAR_REL   __attribute__((section("TLS_VAR_SECT_REL")))
 
 
#define FAST_USB_VAR   __attribute__((section("USB_VAR_SECT")))
 
 
#define FAST_USB_VAR_REL   __attribute__((section("USB_VAR_SECT_REL")))
 
 
#define FAST_USB_STK   __attribute__((section("USB_STK_SECT")))
 
 
#define DO_NOT_CACHE   __attribute__((section("NO_CACHE_SECT")))
 
 
#define FIRST_UNUSED_TIMER   (-1)
 
 
#define NUM_DNS_CACHE   (16)
 
 
Ethernet buffer defines

OS Maximum Interrupt Level

OS_MAX_IRQ_MASK - Optional, Maximum IRQ level that the RTOS is allowed to mask. RTOS objects may not be used in ISRs above this level.

#define ETHER_BUFFER_SIZE   1548
 
 
#define ETH_MAX_PAYLOAD   (1500)
 
 
#define ETH_MAX_SIZE   (1522)
 
 
#define ETH_MIN_SIZE   (46)
 
 
#define IP_HEADER_SIZE   (20)
 
 
#define UDP_HEADER_SIZE   (8)
 
 
#define MAX_UDPDATA   (ETH_MAX_PAYLOAD - (IP_HEADER_SIZE + UDP_HEADER_SIZE))
 
 
#define SERIAL_TX_BUFFERS   (2)
 ETHERN_BUFFER_SIZE = bytes of serial TX fifo.
 
#define SERIAL_RX_BUFFERS   (2)
 ETHERN_BUFFER_SIZE = bytes of serial RX fifo.
 
#define stdin_buffer_size   (200)
 
 
System task priorities

Restating the NBRTOS RTOS Library document (NBRtosLibrary.pdf) Lowest priority is OS_MAX_PRIOS-1, 1 is the highest. There can only be one task at each priority level. Idle task is created at priority 63.

UserMain is created at priority 10. It is recommended and is supported by examples and default projects that a call to OSChangePrio( MAIN_PRIO ); be made to lower the priority to the range recommended for the main application.

Factory applications use priorities 46 through 56.

Netburner Runtime library support and driver tasks use 36 through 45.

Care should be taken in use of priorities it can affect reliability and performance.

#define MAIN_PRIO   (50)
 Recommend UserMain priority.
 
Runtime library driver and support task priorities
#define USB_HW_PRIO   (45)
 
 
#define PPP_PRIO   (44)
 
 
#define SECURITY_TASK_PRIO   (43)
 
 
#define WIFI_STATION_TASK_PRIO   (42)
 
 
#define WIFI_TASK_PRIO   (41)
 
 
#define CONFIG_SERVER_PRIO   (40)
 
 
#define HTTP_PRIO   (39)
 
 
#define ETHER_SEND_PRIO   (38)
 
 
Stack size definitions

SSH requires larger stacks for session key generation see predef.h

#define MAIN_TASK_STK_SIZE   (3072)
 
 
#define IP_STK_SIZE   (2048)
 
 
#define TCP_STK_SIZE   (3072)
 
 
#define HTTP_STK_SIZE   (3072)
 
 
#define IDLE_STK_SIZE   (2048)
 
 
#define ETHER_SEND_STK_SIZE   (2048)
 
 
#define PPP_STK_SIZE   (2048)
 
 
#define USB_HW_STK_SIZE   (2048)
 
 
#define USER_TASK_STK_SIZE   (3072)
 
 
TCP definitions
#define DEFAULT_TCP4_MSS   (512)
 
 
#define DEFAULT_TCP6_MSS   (1200)
 
 
#define TCP_CONN_TO   (75 * TICKS_PER_SECOND)
 75 seconds Min
 
#define TCP_ACK_TICK_DLY   (TICKS_PER_SECOND / 5)
 200 msec delayed ACK timer
 
#define TCP_BUFFER_SEGMENTS   (5)
 Store 4 segments max in tx and rx buffers allows fast retransmit when packets lost.
 
#define HTTP_TIMEOUT   (TICKS_PER_SECOND * 10)
 10 idle Seconds and a partially received request is abandoned
 
#define HTTP_READ_TIME_LIMIT   (30)
 Seconds to allow reading to avoid denial of service.
 
#define HTTP_RX_BUFFERSIZE   (10000)
 
 
#define MAX_HTTP_PENDING_SOCKETS   (5)
 Number of sockets allowed to be pending on listening socket, performance will degrade < 3.
 
#define MAX_HTTP_CONNECTED_SOCKETS   (5)
 Number of sockets allowed to be connected to http server simultaneously.
 
#define MAX_HTTP_POST_VAR_NAME_SIZE   (256)
 Max HTTP POST variable name length.
 
#define MAX_HTTP_POST_VAR_VALUE_SIZE   (256)
 Max HTTP POST variable value length.
 
#define DHCP_DEFAULTTIMEOUT   (4)
 
 
#define DHCP_DEFAULTRETRY   (5)
 
 
#define DHCP_MAXTIMEOUT   (64)
 
 
File Descriptor (FD) definitions

FDs are preallocated: STDOUT STDIN STDERR <-SERIAL_SOCKET_OFFSET Serial 0 Serial 1 <-TCP_SOCKET_OFFSET TCP FD's <-EXTRA_IO_OFFSET Extra FDS

#define SERIAL_SOCKET_OFFSET   (3)
 
 
#define TCP_SOCKET_OFFSET   (5)
 
 
#define TCP_SOCKET_STRUCTS   (128)
 
 
#define EXTRA_IO_OFFSET   (TCP_SOCKET_OFFSET + TCP_SOCKET_STRUCTS)
 
 
#define EXTRA_FDS   (122)
 
 
#define TOTAL_FDS   (TCP_SOCKET_OFFSET + TCP_SOCKET_STRUCTS + EXTRA_FDS)
 
 
#define FDSET_ELEMENTS   ((TOTAL_FDS) / 32)
 
 
Enable SRAM Definitions

If ENABLE _SRAM_SYS is TRUE, then the processor's on-chip SRAM will be used for fast network buffering and OS tasks as defined below:

#define FAST_SYSTEM_VARIABLES
 
 
System Tasks

Uncommented system tasks will be stored in SRAM, otherwise SDRAM will be used.

#define FAST_MAIN_STACK
 
 
#define FAST_ETHERNET_VARIABLES
 
 
#define FAST_ETHERNET_STACK
 
 
#define FAST_BUFFERS_VARIABLES
 
 
#define FAST_BUFFERS
 
 
#define FAST_IP_VARIABLES
 
 
#define FAST_IP_STACK
 
 
#define FAST_TCP_VARIABLES
 
 
#define FAST_TCP_STACK
 
 
#define FAST_USB_VARIABLES
 
 
#define FAST_USB_STACK
 
 
#define FAST_HTTP_STACK
 
 
User Variable/Stack SRAM Definitions

If these defines are enabled, any user variables or tasks declared with FAST_USR_STK or FAST_USR_VAR will be stored in SRAM.

#define FAST_USER_VARIABLES
 
 
#define FAST_USER_STACK
 
 
#define FAST_TLS_VARIABLES
 
 
Config server stuff
#define NumberOfConfigWebChannels   12
 
 
#define ConfigActionIdleTimeout   (TICKS_PER_SECOND * 30)
 
 
#define MAX_HDR_SIZE   (256)
 Size of web client recieve single header maximum.
 
#define MAX_CONFIG_TCP_OUTPUT_BUFFERS   (40)
 
 

Detailed Description

NetBurner System Constants.