mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
Add SLIP driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3369 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -1542,3 +1542,11 @@
|
|||||||
But, during development, you might want to have you applications
|
But, during development, you might want to have you applications
|
||||||
available and executable from the NSH command line. This apps/ addon
|
available and executable from the NSH command line. This apps/ addon
|
||||||
(and NSH hooks) was contributed by Uros to accomplish just that.
|
(and NSH hooks) was contributed by Uros to accomplish just that.
|
||||||
|
* sched/sched_waitpid() and include/sys/wait.h - Provides a simple and
|
||||||
|
very incomplete implementation of waitpid(). waitpid() is only available
|
||||||
|
if CONFIG_SCHED_WAITPID is defined in your configuration file.
|
||||||
|
* sched/atexit.c and sched/exit.c - The atexit function is not frequently
|
||||||
|
used. In order to save a few bytes, it is now conditioned on
|
||||||
|
CONFIG_SCHED_ATEXIT. It your application is currently using atexit(),
|
||||||
|
you will need to add CONFIG_SCHED_ATEXT to your configuration file.
|
||||||
|
* drivers/net/slip.c - Add a SLIP driver (untested on initial check-in).
|
||||||
|
|||||||
@@ -2166,6 +2166,14 @@ nuttx-5.19 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
|||||||
But, during development, you might want to have you applications
|
But, during development, you might want to have you applications
|
||||||
available and executable from the NSH command line. This apps/ addon
|
available and executable from the NSH command line. This apps/ addon
|
||||||
(and NSH hooks) was contributed by Uros to accomplish just that.
|
(and NSH hooks) was contributed by Uros to accomplish just that.
|
||||||
|
* sched/sched_waitpid() and include/sys/wait.h - Provides a simple and
|
||||||
|
very incomplete implementation of waitpid(). waitpid() is only available
|
||||||
|
if CONFIG_SCHED_WAITPID is defined in your configuration file.
|
||||||
|
* sched/atexit.c and sched/exit.c - The atexit function is not frequently
|
||||||
|
used. In order to save a few bytes, it is now conditioned on
|
||||||
|
CONFIG_SCHED_ATEXIT. It your application is currently using atexit(),
|
||||||
|
you will need to add CONFIG_SCHED_ATEXT to your configuration file.
|
||||||
|
* drivers/net/slip.c - Add a SLIP driver (untested on initial check-in).
|
||||||
|
|
||||||
pascal-2.1 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
pascal-2.1 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
|
||||||
|
|||||||
@@ -46,5 +46,8 @@ endif
|
|||||||
ifeq ($(CONFIG_NET_ENC28J60),y)
|
ifeq ($(CONFIG_NET_ENC28J60),y)
|
||||||
NET_CSRCS += enc28j60.c
|
NET_CSRCS += enc28j60.c
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(CONFIG_NET_SLIP),y)
|
||||||
|
NET_CSRCS += slip.c
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+8
-1
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* nuttx/net.h
|
* nuttx/net.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009-2010 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009-2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -207,6 +207,13 @@ EXTERN int netdev_register(FAR struct uip_driver_s *dev);
|
|||||||
|
|
||||||
EXTERN int netdev_foreach(netdev_callback_t callback, void *arg);
|
EXTERN int netdev_foreach(netdev_callback_t callback, void *arg);
|
||||||
|
|
||||||
|
/* drivers/net/slip.c ******************************************************/
|
||||||
|
/* Instantiate a SLIP network interface. */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_SLIP
|
||||||
|
EXTERN int slip_initialize(int intf, const char *devname);
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,8 +118,8 @@ typedef enum tstate_e tstate_t;
|
|||||||
|
|
||||||
typedef void (*start_t)(void);
|
typedef void (*start_t)(void);
|
||||||
|
|
||||||
/* This is the entry point into the main thread of the task
|
/* This is the entry point into the main thread of the task or into a created
|
||||||
* or into a created pthread within the task.
|
* pthread within the task.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
union entry_u
|
union entry_u
|
||||||
@@ -129,17 +129,20 @@ union entry_u
|
|||||||
};
|
};
|
||||||
typedef union entry_u entry_t;
|
typedef union entry_u entry_t;
|
||||||
|
|
||||||
/* This is the type of the function that is executed with
|
/* This is the type of the function that is executed with exit() is called
|
||||||
* exit() is called (if registered via atexit()).
|
* (if registered via atexit()).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_ATEXT
|
||||||
typedef void (*exitfunc_t)(void);
|
typedef void (*exitfunc_t)(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* POSIX Message queue */
|
/* POSIX Message queue */
|
||||||
|
|
||||||
typedef struct msgq_s msgq_t;
|
typedef struct msgq_s msgq_t;
|
||||||
|
|
||||||
/* The structure used to maintain environment variables */
|
/* The structure used to maintain environment variables */
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_ENVIRON
|
#ifndef CONFIG_DISABLE_ENVIRON
|
||||||
struct environ_s
|
struct environ_s
|
||||||
{
|
{
|
||||||
@@ -177,7 +180,9 @@ struct _TCB
|
|||||||
pid_t pid; /* This is the ID of the thread */
|
pid_t pid; /* This is the ID of the thread */
|
||||||
start_t start; /* Thread start function */
|
start_t start; /* Thread start function */
|
||||||
entry_t entry; /* Entry Point into the thread */
|
entry_t entry; /* Entry Point into the thread */
|
||||||
|
#ifdef CONFIG_SCHED_ATEXT
|
||||||
exitfunc_t exitfunc; /* Called if exit is called. */
|
exitfunc_t exitfunc; /* Called if exit is called. */
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_SCHED_WAITPID /* Experimental */
|
#ifdef CONFIG_SCHED_WAITPID /* Experimental */
|
||||||
sem_t exitsem; /* Support for waitpid */
|
sem_t exitsem; /* Support for waitpid */
|
||||||
int *stat_loc; /* Location to return exit status */
|
int *stat_loc; /* Location to return exit status */
|
||||||
|
|||||||
+17
-3
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************************
|
/************************************************************************
|
||||||
* sched/atexit.c
|
* sched/atexit.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -37,14 +37,20 @@
|
|||||||
* Included Files
|
* Included Files
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/fs.h>
|
#include <nuttx/fs.h>
|
||||||
|
|
||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_ATEXT
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
@@ -83,7 +89,7 @@
|
|||||||
* func
|
* func
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* zero on success.
|
* Zero on success. Non-zero on failure.
|
||||||
*
|
*
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
@@ -92,11 +98,19 @@ int atexit(void (*func)(void))
|
|||||||
_TCB *tcb = (_TCB*)g_readytorun.head;
|
_TCB *tcb = (_TCB*)g_readytorun.head;
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
|
|
||||||
if ((func) && (!tcb->exitfunc))
|
/* The following must be atomic */
|
||||||
|
|
||||||
|
sched_lock();
|
||||||
|
if (func && !tcb->exitfunc)
|
||||||
{
|
{
|
||||||
tcb->exitfunc = func;
|
tcb->exitfunc = func;
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sched_unlock();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_SCHED_ATEXT */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -130,11 +130,13 @@ void exit(int status)
|
|||||||
|
|
||||||
/* If an exit function was registered, call it now. */
|
/* If an exit function was registered, call it now. */
|
||||||
|
|
||||||
if (tcb->exitfunc) {
|
#ifdef CONFIG_SCHED_ATEXT
|
||||||
|
if (tcb->exitfunc)
|
||||||
|
{
|
||||||
|
(*tcb->exitfunc)();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
(*tcb->exitfunc)();
|
|
||||||
|
|
||||||
} /* end if */
|
|
||||||
/* Then "really" exit */
|
/* Then "really" exit */
|
||||||
|
|
||||||
_exit(status);
|
_exit(status);
|
||||||
|
|||||||
Reference in New Issue
Block a user