mirror of
https://github.com/ep00ch/lwip-contrib-mac.git
synced 2024-06-10 18:29:27 +00:00
the contrib part of thread priority patch by floriZ.Also take out unused unix netifs from unixsim makefile for now
This commit is contained in:
parent
1b789f74aa
commit
0749599eab
|
@ -114,7 +114,7 @@ sys_arch_timeouts(void)
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
sys_thread_t
|
sys_thread_t
|
||||||
sys_thread_new(void (* function)(void *arg), void *arg)
|
sys_thread_new(void (* function)(void *arg), void *arg, int prio)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -741,7 +741,7 @@ etharp_timer_thread(void *arg)
|
||||||
static void
|
static void
|
||||||
etharp_timer_init(void *arg)
|
etharp_timer_init(void *arg)
|
||||||
{
|
{
|
||||||
sys_thread_new((void *)etharp_timer_thread, arg);
|
sys_thread_new((void *)etharp_timer_thread, arg, DEFAULT_THREAD_PRIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -200,4 +200,17 @@ a lot of data that needs to be copied, this should be set high. */
|
||||||
|
|
||||||
#define LWIP_COMPAT_SOCKETS 1
|
#define LWIP_COMPAT_SOCKETS 1
|
||||||
#define LWIP_PROVIDE_ERRNO 1
|
#define LWIP_PROVIDE_ERRNO 1
|
||||||
|
|
||||||
|
/* People often make a mistake on the priority of their communications task.
|
||||||
|
The TCP/IP stack should be at a relatively low priority if it is an endpoint
|
||||||
|
(not a router) on a somewhat underpowered CPU. You are'nt going to keep up
|
||||||
|
with network traffic during a denial of service attack or misconfigured network
|
||||||
|
and you don't want an overburdened network task to cause other important tasks
|
||||||
|
(including your UI) to stop working. Drop packets! It forces flow control and
|
||||||
|
lets the rest of your system run.
|
||||||
|
*/
|
||||||
|
#define TCPIP_THREAD_PRIO 220 // Relatively low priority
|
||||||
|
|
||||||
|
#define DEFAULT_THREAD_PRIO 240
|
||||||
|
|
||||||
#endif /* __LWIPOPTS_H__ */
|
#endif /* __LWIPOPTS_H__ */
|
||||||
|
|
|
@ -73,15 +73,6 @@ static struct sys_hisr *hisrs = NULL;
|
||||||
#define SYS_MBOX_SIZE 128 // Number of elements in mbox queue
|
#define SYS_MBOX_SIZE 128 // Number of elements in mbox queue
|
||||||
#define SYS_STACK_SIZE 2048 // A minimum Nucleus stack for coldfire
|
#define SYS_STACK_SIZE 2048 // A minimum Nucleus stack for coldfire
|
||||||
#define SYS_HISR_STACK_SIZE 2048 // A minimum Nucleus stack for coldfire
|
#define SYS_HISR_STACK_SIZE 2048 // A minimum Nucleus stack for coldfire
|
||||||
/* People often make a mistake on the priority of their communications task.
|
|
||||||
The TCP/IP stack should be at a relatively low priority if it is an endpoint
|
|
||||||
(not a router) on a somewhat underpowered CPU. You are'nt going to keep up
|
|
||||||
with network traffic during a denial of service attack or misconfigured network
|
|
||||||
and you don't want an overburdened network task to cause other important tasks
|
|
||||||
(including your UI) to stop working. Drop packets! It forces flow control and
|
|
||||||
lets the rest of your system run.
|
|
||||||
*/
|
|
||||||
#define SYS_THREAD_PRIORITY 220 // Relatively low priority
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
@ -127,7 +118,7 @@ introduce_thread(NU_TASK *id, void (*function)(void *arg), void *arg)
|
||||||
/* We use Nucleus task as thread. Create one with a standard size stack at a standard
|
/* We use Nucleus task as thread. Create one with a standard size stack at a standard
|
||||||
* priority. */
|
* priority. */
|
||||||
sys_thread_t
|
sys_thread_t
|
||||||
sys_thread_new(void (*function)(void *arg), void *arg)
|
sys_thread_new(void (*function)(void *arg), void *arg, int prio)
|
||||||
{
|
{
|
||||||
NU_TASK *p_thread;
|
NU_TASK *p_thread;
|
||||||
u8_t *p_stack;
|
u8_t *p_stack;
|
||||||
|
@ -156,7 +147,7 @@ sys_thread_new(void (*function)(void *arg), void *arg)
|
||||||
st,
|
st,
|
||||||
p_stack,
|
p_stack,
|
||||||
SYS_STACK_SIZE,
|
SYS_STACK_SIZE,
|
||||||
SYS_THREAD_PRIORITY,
|
prio,
|
||||||
0, //Disable timeslicing
|
0, //Disable timeslicing
|
||||||
NU_PREEMPT,
|
NU_PREEMPT,
|
||||||
NU_START);
|
NU_START);
|
||||||
|
|
|
@ -164,7 +164,7 @@ sioslipif_init(struct netif *netif)
|
||||||
netif->output = sioslipif_output;
|
netif->output = sioslipif_output;
|
||||||
|
|
||||||
netif_pass = netif;
|
netif_pass = netif;
|
||||||
sys_thread_new((void *)sioslipif_loop, NULL);
|
sys_thread_new((void *)sioslipif_loop, NULL, DEFAULT_THREAD_PRIO);
|
||||||
/* Do some magic to make it possible to receive data from the serial I/O device. */
|
/* Do some magic to make it possible to receive data from the serial I/O device. */
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -242,10 +242,10 @@ sys_thread(void)
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
sys_thread_t
|
sys_thread_t
|
||||||
sys_thread_new(void (* function)(void *arg), void *arg)
|
sys_thread_new(void (* function)(void *arg), void *arg, int prio)
|
||||||
{
|
{
|
||||||
TASK newtask;
|
TASK newtask;
|
||||||
PRIORITY pri = 2; /* This may have to be changed. */
|
PRIORITY pri = prio; /* This may have to be changed. */
|
||||||
char *stack;
|
char *stack;
|
||||||
int stacksize = 512; /* This may have to be changed. */
|
int stacksize = 512; /* This may have to be changed. */
|
||||||
struct sys_thread_arg threadarg;
|
struct sys_thread_arg threadarg;
|
||||||
|
|
|
@ -36,9 +36,9 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* Define platform endianness */
|
/* Define platform endianness */
|
||||||
#ifndef BYTE_ORDER
|
//#ifndef BYTE_ORDER
|
||||||
#define BYTE_ORDER LITTLE_ENDIAN
|
//#define BYTE_ORDER LITTLE_ENDIAN
|
||||||
#endif /* BYTE_ORDER */
|
//#endif /* BYTE_ORDER */
|
||||||
|
|
||||||
/* Define generic types used in lwIP */
|
/* Define generic types used in lwIP */
|
||||||
typedef unsigned char u8_t;
|
typedef unsigned char u8_t;
|
||||||
|
|
|
@ -314,7 +314,7 @@ delif_init_thread(struct netif *netif)
|
||||||
del->netif->netmask = netif->netmask;
|
del->netif->netmask = netif->netmask;
|
||||||
del->input = netif->input;
|
del->input = netif->input;
|
||||||
del->netif->input = delif_input;
|
del->netif->input = delif_input;
|
||||||
sys_thread_new(delif_thread, netif);
|
sys_thread_new(delif_thread, netif, DEFAULT_THREAD_PRIO);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -209,7 +209,7 @@ pcapif_init(struct netif *netif)
|
||||||
p->p = NULL;
|
p->p = NULL;
|
||||||
p->lasttime = 0;
|
p->lasttime = 0;
|
||||||
|
|
||||||
sys_thread_new(pcapif_thread, netif);
|
sys_thread_new(pcapif_thread, netif, DEFAULT_THREAD_PRIO);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -126,7 +126,7 @@ low_level_init(struct netif *netif)
|
||||||
|
|
||||||
DEBUGF(TAPIF_DEBUG, ("tapif_init: system(\"%s\");\n", buf));
|
DEBUGF(TAPIF_DEBUG, ("tapif_init: system(\"%s\");\n", buf));
|
||||||
system(buf);
|
system(buf);
|
||||||
sys_thread_new(tapif_thread, netif);
|
sys_thread_new(tapif_thread, netif, DEFAULT_THREAD_PRIO);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -97,7 +97,7 @@ low_level_init(struct netif *netif)
|
||||||
|
|
||||||
DEBUGF(TUNIF_DEBUG, ("tunif_init: system(\"%s\");\n", buf));
|
DEBUGF(TUNIF_DEBUG, ("tunif_init: system(\"%s\");\n", buf));
|
||||||
system(buf);
|
system(buf);
|
||||||
sys_thread_new(tunif_thread, netif);
|
sys_thread_new(tunif_thread, netif, DEFAULT_THREAD_PRIO);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -452,8 +452,8 @@ unixif_init_server(struct netif *netif)
|
||||||
|
|
||||||
unixif->fd = fd2;
|
unixif->fd = fd2;
|
||||||
unixif->sem = sys_sem_new(0);
|
unixif->sem = sys_sem_new(0);
|
||||||
sys_thread_new(unixif_thread, netif);
|
sys_thread_new(unixif_thread, netif, DEFAULT_THREAD_PRIO);
|
||||||
sys_thread_new(unixif_thread2, netif);
|
sys_thread_new(unixif_thread2, netif, DEFAULT_THREAD_PRIO);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
@ -476,8 +476,8 @@ unixif_init_client(struct netif *netif)
|
||||||
}
|
}
|
||||||
unixif->q = list_new(UNIXIF_QUEUELEN);
|
unixif->q = list_new(UNIXIF_QUEUELEN);
|
||||||
unixif->sem = sys_sem_new(0);
|
unixif->sem = sys_sem_new(0);
|
||||||
sys_thread_new(unixif_thread, netif);
|
sys_thread_new(unixif_thread, netif, DEFAULT_THREAD_PRIO);
|
||||||
sys_thread_new(unixif_thread2, netif);
|
sys_thread_new(unixif_thread2, netif, DEFAULT_THREAD_PRIO);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -66,7 +66,7 @@ NETIFFILES=$(LWIPDIR)/netif/loopif.c \
|
||||||
$(LWIPDIR)/netif/etharp.c $(LWIPDIR)/netif/slipif.c
|
$(LWIPDIR)/netif/etharp.c $(LWIPDIR)/netif/slipif.c
|
||||||
|
|
||||||
# ARCHFILES: Architecture specific files.
|
# ARCHFILES: Architecture specific files.
|
||||||
ARCHFILES=$(wildcard $(LWIPARCH)/*.c $(LWIPARCH)/netif/*.c)
|
ARCHFILES=$(wildcard $(LWIPARCH)/*.c $(LWIPARCH)/netif/tapif.c $(LWIPARCH)/netif/tcpdump.c)
|
||||||
|
|
||||||
# APPFILES: Applications.
|
# APPFILES: Applications.
|
||||||
APPFILES=apps/fs.c apps/httpd.c \
|
APPFILES=apps/fs.c apps/httpd.c \
|
||||||
|
|
|
@ -1052,7 +1052,7 @@ shell_thread(void *arg)
|
||||||
void
|
void
|
||||||
shell_init(void)
|
shell_init(void)
|
||||||
{
|
{
|
||||||
sys_thread_new(shell_thread, NULL);
|
sys_thread_new(shell_thread, NULL, DEFAULT_THREAD_PRIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ tcpecho_thread(void *arg)
|
||||||
void
|
void
|
||||||
tcpecho_init(void)
|
tcpecho_init(void)
|
||||||
{
|
{
|
||||||
sys_thread_new(tcpecho_thread, NULL);
|
sys_thread_new(tcpecho_thread, NULL, DEFAULT_THREAD_PRIO);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -62,5 +62,5 @@ udpecho_thread(void *arg)
|
||||||
void
|
void
|
||||||
udpecho_init(void)
|
udpecho_init(void)
|
||||||
{
|
{
|
||||||
sys_thread_new(udpecho_thread, NULL);
|
sys_thread_new(udpecho_thread, NULL, DEFAULT_THREAD_PRIO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
printf("System initialized.\n");
|
printf("System initialized.\n");
|
||||||
|
|
||||||
sys_thread_new((void *)(main_thread), NULL);
|
sys_thread_new((void *)(main_thread), NULL, DEFAULT_THREAD_PRIO);
|
||||||
pause();
|
pause();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
printf("System initialized.\n");
|
printf("System initialized.\n");
|
||||||
|
|
||||||
sys_thread_new((void *)(main_thread), NULL);
|
sys_thread_new((void *)(main_thread), NULL, DEFAULT_THREAD_PRIO);
|
||||||
pause();
|
pause();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
printf("System initialized.\n");
|
printf("System initialized.\n");
|
||||||
|
|
||||||
sys_thread_new((void *)(main_thread), NULL);
|
sys_thread_new((void *)(main_thread), NULL, DEFAULT_THREAD_PRIO);
|
||||||
pause();
|
pause();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ current_thread(void)
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
sys_thread_t
|
sys_thread_t
|
||||||
sys_thread_new(void (*function)(void *arg), void *arg)
|
sys_thread_new(void (*function)(void *arg), void *arg, int prio)
|
||||||
{
|
{
|
||||||
int code;
|
int code;
|
||||||
pthread_t tmp;
|
pthread_t tmp;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user