]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
Change parameters list for sys_thread_new (see "task #7252 : Create sys_thread_new_ex...
authorfbernon <fbernon>
Wed, 5 Sep 2007 16:14:28 +0000 (16:14 +0000)
committerfbernon <fbernon>
Wed, 5 Sep 2007 16:14:28 +0000 (16:14 +0000)
CHANGELOG
doc/sys_arch.txt
src/api/tcpip.c
src/include/lwip/opt.h
src/include/lwip/sys.h
src/netif/ppp/ppp.c
src/netif/slipif.c

index d0723951fcdbaa39b8bc996c753b73c945fac1d4..58bf30f087322ca86e30e184f3f5727166d78c0a 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -19,6 +19,15 @@ HISTORY
 
   ++ New features:
 
+  2007-09-05 Frédéric Bernon, Bill Florac
+  * opt.h, sys.h, tcpip.c, slipif.c, ppp.c, sys_arch.txt: Change parameters list
+    for sys_thread_new (see "task #7252 : Create sys_thread_new_ex()"). Two new
+    parameters have to be provided: a task name, and a task stack size. For this
+    one, since it's platform dependant, you could define the best one for you in
+    your lwipopts.h. For port maintainers, you can just add these new parameters
+    in your sys_arch.c file, and but it's not mandatory, use them in your OS
+    specific functions.
+
   2007-09-05 Frédéric Bernon
   * inet.c, autoip.c, msg_in.c, msg_out.c, init.c: Move some build time checkings
     inside init.c for task #7142 "Sanity check user-configurable values".
index 5cb7778dcc9ece0d30950eb80d6c436affbeefc2..77a52424665c83ad97bb857050d430c1eb0ecc24 100644 (file)
@@ -128,12 +128,13 @@ If threads are supported by the underlying operating system and if
 such functionality is needed in lwIP, the following function will have
 to be implemented as well:
 
-- sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg, int prio)
+- sys_thread_t sys_thread_new(char *name, void (* thread)(void *arg), void *arg, int stacksize, int prio)
 
-  Starts a new thread with priority "prio" that will begin its execution in the
-  function "thread()". The "arg" argument will be passed as an argument to the
-  thread() function. The id of the new thread is returned. Both the id and
-  the priority are system dependent.
+  Starts a new thread named "name" with priority "prio" that will begin its
+  execution in the function "thread()". The "arg" argument will be passed as an
+  argument to the thread() function. The stack size to used for this thread is
+  the "stacksize" parameter. The id of the new thread is returned. Both the id
+  and the priority are system dependent.
 
 - sys_prot_t sys_arch_protect(void)
 
index c0302a793f5354195b12ead4c6166259c8730ba1..476fa7aec141374ec993398f947ab9fa034a6bee 100644 (file)
@@ -543,7 +543,7 @@ tcpip_init(void (* initfunc)(void *), void *arg)
   lock_tcpip_core = sys_sem_new(1);
 #endif /* LWIP_TCPIP_CORE_LOCKING */
 
-  sys_thread_new(tcpip_thread, NULL, TCPIP_THREAD_PRIO);
+  sys_thread_new(TCPIP_THREAD_NAME, tcpip_thread, NULL, TCPIP_THREAD_STACKSIZE, TCPIP_THREAD_PRIO);
 }
 
 #endif /* !NO_SYS */
index 3dc313e8ec3bcb5dd6ed9eeb36fd32eb8e403e31..2d1c964a3879a0b4b3ca959079bc24ea50e5cb5d 100644 (file)
    ---------- Thread options ----------
    ------------------------------------
 */
+/**
+ * TCPIP_THREAD_NAME: The name assigned to the main tcpip thread.
+ */
+#ifndef TCPIP_THREAD_NAME
+#define TCPIP_THREAD_NAME              "tcpip_thread"
+#endif
+
+/**
+ * TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread.
+ * The stack size value itself is platform-dependent, but is passed to
+ * sys_thread_new() when the thread is created.
+ */
+#ifndef TCPIP_THREAD_STACKSIZE
+#define TCPIP_THREAD_STACKSIZE          0
+#endif
+
 /**
  * TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread.
  * The priority value itself is platform-dependent, but is passed to
- * sys_thread_new() when tcpip_thread is created.
+ * sys_thread_new() when the thread is created.
  */
 #ifndef TCPIP_THREAD_PRIO
 #define TCPIP_THREAD_PRIO               1
 #endif
 
+/**
+ * SLIPIF_THREAD_NAME: The name assigned to the slipif_loop thread.
+ */
+#ifndef SLIPIF_THREAD_NAME
+#define SLIPIF_THREAD_NAME             "slipif_loop"
+#endif
+
+/**
+ * SLIP_THREAD_STACKSIZE: The stack size used by the slipif_loop thread.
+ * The stack size value itself is platform-dependent, but is passed to
+ * sys_thread_new() when the thread is created.
+ */
+#ifndef SLIPIF_THREAD_STACKSIZE
+#define SLIPIF_THREAD_STACKSIZE         0
+#endif
+
 /**
  * SLIPIF_THREAD_PRIO: The priority assigned to the slipif_loop thread.
  * The priority value itself is platform-dependent, but is passed to
- * sys_thread_new() when slipif_loop is created.
+ * sys_thread_new() when the thread is created.
  */
 #ifndef SLIPIF_THREAD_PRIO
 #define SLIPIF_THREAD_PRIO              1
 #endif
 
+/**
+ * PPP_THREAD_NAME: The name assigned to the pppMain thread.
+ */
+#ifndef PPP_THREAD_NAME
+#define PPP_THREAD_NAME                "pppMain"
+#endif
+
+/**
+ * PPP_THREAD_STACKSIZE: The stack size used by the pppMain thread.
+ * The stack size value itself is platform-dependent, but is passed to
+ * sys_thread_new() when the thread is created.
+ */
+#ifndef PPP_THREAD_STACKSIZE
+#define PPP_THREAD_STACKSIZE            0
+#endif
+
 /**
  * PPP_THREAD_PRIO: The priority assigned to the pppMain thread.
  * The priority value itself is platform-dependent, but is passed to
- * sys_thread_new() when pppMain is created.
+ * sys_thread_new() when the thread is created.
  */
 #ifndef PPP_THREAD_PRIO
 #define PPP_THREAD_PRIO                 1
 #endif
 
 /**
- * DEFAULT_THREAD_PRIO: The priority assigned to the pppMain thread.
+ * DEFAULT_THREAD_NAME: The name assigned to any other lwIP thread.
+ */
+#ifndef DEFAULT_THREAD_NAME
+#define DEFAULT_THREAD_NAME            "lwIP"
+#endif
+
+/**
+ * DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread.
+ * The stack size value itself is platform-dependent, but is passed to
+ * sys_thread_new() when the thread is created.
+ */
+#ifndef DEFAULT_THREAD_STACKSIZE
+#define DEFAULT_THREAD_STACKSIZE        0
+#endif
+
+/**
+ * DEFAULT_THREAD_PRIO: The priority assigned to any other lwIP thread.
  * The priority value itself is platform-dependent, but is passed to
- * sys_thread_new() when pppMain is created.
+ * sys_thread_new() when the thread is created.
  */
 #ifndef DEFAULT_THREAD_PRIO
 #define DEFAULT_THREAD_PRIO             1
index 0a2d3fc416d81f1a15659ad97519f05cb68a202a..3cde32f0ee12a81a884975330a9fea31fe00a4b2 100644 (file)
@@ -62,7 +62,7 @@ struct sys_timeo {u8_t dummy;};
 #define sys_mbox_post(m,d)
 #define sys_mbox_free(m)
 
-#define sys_thread_new(t,a,p)
+#define sys_thread_new(n,t,a,s,p)
 
 #else /* NO_SYS */
 
@@ -134,7 +134,7 @@ void sys_mbox_free(sys_mbox_t mbox);
 void sys_mbox_fetch(sys_mbox_t mbox, void **msg);
 
 /* Thread functions. */
-sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg, int prio);
+sys_thread_t sys_thread_new(char *name, void (* thread)(void *arg), void *arg, int stacksize, int prio);
 
 /* The following functions are used only in Unix code, and
    can be omitted when porting the stack. */
index 6c0329121579ecda54db441822e87af881b27a6d..b5aac3c9350da1a94373eb08c8d051a647f8ebeb 100644 (file)
@@ -532,7 +532,7 @@ int pppOverSerialOpen(sio_fd_t fd, void (*linkStatusCB)(void *ctx, int errCode,
        pc->linkStatusCB = linkStatusCB;
        pc->linkStatusCtx = linkStatusCtx;
 
-       sys_thread_new(pppMain, (void*)pd, PPP_THREAD_PRIO);
+       sys_thread_new(PPP_THREAD_NAME, pppMain, (void*)pd, PPP_THREAD_STACKSIZE, PPP_THREAD_PRIO);
        if(!linkStatusCB) {
                while(pd >= 0 && !pc->if_up) {
                        sys_msleep(500);
index eadb3c317a0c1f991f599e779ef522ddd4433bc5..162d6a8a49cef77305dbdfd2087a607e9b0ad6c9 100644 (file)
@@ -267,6 +267,6 @@ slipif_init(struct netif *netif)
   NETIF_INIT_SNMP(netif, snmp_ifType_slip, 0);
 
   /* Create a thread to poll the serial line. */
-  sys_thread_new(slipif_loop, netif, SLIPIF_THREAD_PRIO);
+  sys_thread_new(SLIPIF_THREAD_NAME, slipif_loop, netif, SLIPIF_THREAD_STACKSIZE, SLIPIF_THREAD_PRIO);
   return ERR_OK;
 }