diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-24 18:39:53 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-24 18:39:53 +0000 |
commit | c511ddc4690d94ca1895aca2ef59d3837a263234 (patch) | |
tree | 55b7eb6317d421a891f82ebbec36542cc97c8dd2 | |
parent | 9ed566465c0f31106e2e3fd3be2b33dd9489d3b0 (diff) | |
download | px4-nuttx-c511ddc4690d94ca1895aca2ef59d3837a263234.tar.gz px4-nuttx-c511ddc4690d94ca1895aca2ef59d3837a263234.tar.bz2 px4-nuttx-c511ddc4690d94ca1895aca2ef59d3837a263234.zip |
Add psock_poll(); Fix some warnings reported by Lorenz Meier; lm4f logic from JP
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5557 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | apps/nshlib/nsh_ddcmd.c | 2 | ||||
-rw-r--r-- | nuttx/ChangeLog | 1 | ||||
-rw-r--r-- | nuttx/arch/arm/include/lm/chip.h | 26 | ||||
-rwxr-xr-x | nuttx/configs/lm3s6965-ek/tools/oocd.sh | 2 | ||||
-rw-r--r-- | nuttx/include/nuttx/net/net.h | 85 | ||||
-rw-r--r-- | nuttx/libc/stdio/lib_libfread.c | 4 | ||||
-rw-r--r-- | nuttx/net/send.c | 2 | ||||
-rw-r--r-- | nuttx/sched/mq_sndinternal.c | 2 |
8 files changed, 78 insertions, 46 deletions
diff --git a/apps/nshlib/nsh_ddcmd.c b/apps/nshlib/nsh_ddcmd.c index 40a3710b1..e6ef2523c 100644 --- a/apps/nshlib/nsh_ddcmd.c +++ b/apps/nshlib/nsh_ddcmd.c @@ -545,7 +545,7 @@ int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) } #endif - if (dd.skip < 0 || dd.skip > dd.nsectors) + if (dd.skip > dd.nsectors) { nsh_output(vtbl, g_fmtarginvalid, g_dd); goto errout_with_paths; diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 36286c77f..ffd1b66ae 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -4020,4 +4020,5 @@ Denis Carikli). * configs/olimex-lpc1766stk/nettest: Configuration converted to use the kconfig-frontends tools. + * net/net_poll.c: Split net_poll() to create psock_poll() too. diff --git a/nuttx/arch/arm/include/lm/chip.h b/nuttx/arch/arm/include/lm/chip.h index 6b49fe2ce..6214a50d0 100644 --- a/nuttx/arch/arm/include/lm/chip.h +++ b/nuttx/arch/arm/include/lm/chip.h @@ -3,6 +3,7 @@ * * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> + * Author: Jose Pablo Carballo <jcarballo@nx-engineering.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -50,6 +51,7 @@ #if defined(CONFIG_ARCH_CHIP_LM3S6918) # define LM_NTIMERS 4 /* Four general purpose timers */ +# define LM_NWIDETIMERS 0 /* No general purpose wide timers */ # define LM_NETHCONTROLLERS 1 /* One Ethernet controller */ # undef LM_ETHTS /* No timestamp register */ # define LM_NSSI 2 /* Two SSI modules */ @@ -59,8 +61,10 @@ # define LM_NPWM 0 /* No PWM generator modules */ # define LM_NQEI 0 /* No quadrature encoders */ # define LM_NPORTS 8 /* 8 Ports (GPIOA-H) 5-38 GPIOs */ +# define LM_NCANCONTROLLER 0 /* No CAN controllers */ #elif defined(CONFIG_ARCH_CHIP_LM3S6432) # define LM_NTIMERS 3 /* Three general purpose timers */ +# define LM_NWIDETIMERS 0 /* No general purpose wide timers */ # define LM_NETHCONTROLLERS 1 /* One Ethernet controller */ # undef LM_ETHTS /* No timestamp register */ # define LM_NSSI 1 /* One SSI module */ @@ -70,8 +74,10 @@ # define LM_NPWM 1 /* One PWM generator module */ # define LM_NQEI 0 /* No quadrature encoders */ # define LM_NPORTS 7 /* 7 Ports (GPIOA-G), 0-42 GPIOs */ +# define LM_NCANCONTROLLER 0 /* No CAN controllers */ #elif defined(CONFIG_ARCH_CHIP_LM3S6965) # define LM_NTIMERS 4 /* Four general purpose timers */ +# define LM_NWIDETIMERS 0 /* No general purpose wide timers */ # define LM_NETHCONTROLLERS 1 /* One Ethernet controller */ # undef LM_ETHTS /* No timestamp register */ # define LM_NSSI 1 /* One SSI module */ @@ -81,8 +87,10 @@ # define LM_NPWM 3 /* Three PWM generator modules */ # define LM_NQEI 2 /* Two quadrature encoders */ # define LM_NPORTS 7 /* 7 Ports (GPIOA-G), 0-42 GPIOs */ +# define LM_NCANCONTROLLER 0 /* No CAN controllers */ #elif defined(CONFIG_ARCH_CHIP_LM3S9B96) # define LM_NTIMERS 4 /* Four general purpose timers */ +# define LM_NWIDETIMERS 0 /* No general purpose wide timers */ # define LM_NETHCONTROLLERS 1 /* One Ethernet controller */ # undef LM_ETHTS /* No timestamp register */ # define LM_NSSI 2 /* Two SSI modules */ @@ -93,8 +101,10 @@ # define LM_NPWM 4 /* Four PWM generator modules */ # define LM_NQEI 2 /* Two quadrature encoders */ # define LM_NPORTS 9 /* 9 Ports (GPIOA-H,J) 0-65 GPIOs */ +# define LM_NCANCONTROLLER 0 /* No CAN controllers */ #elif defined(CONFIG_ARCH_CHIP_LM3S8962) -# define LM_NTIMERS 4 /* Four general purpose timers */ +# define LM_NTIMERS 6 /* Four general purpose timers */ +# define LM_NWIDETIMERS 0 /* No general purpose wide timers */ # define LM_NETHCONTROLLERS 1 /* One Ethernet controller */ # define LM_NSSI 1 /* One SSI module */ # define LM_NUARTS 3 /* Two UART modules */ @@ -103,7 +113,19 @@ # define LM_NPWM 3 /* Three PWM generator modules */ # define LM_NQEI 2 /* Two quadrature encoders */ # define LM_NPORTS 7 /* 7 Ports (GPIOA-G), 5-42 GPIOs */ -# define LM_CANCONTROLLER 1 /* One CAN controller */ +# define LM_NCANCONTROLLER 1 /* One CAN controller */ +#elif defined(CONFIG_ARCH_CHIP_LM4F120) +# define LM_NTIMERS 6 /* Six general purpose timers */ +# define LM_NWIDETIMERS 6 /* Six general purpose wide timers */ +# define LM_NETHCONTROLLERS 0 /* No Ethernet controller */ +# define LM_NSSI 4 /* Four SSI module */ +# define LM_NUARTS 8 /* Eight UART modules */ +# define LM_NI2C 4 /* Four I2C modules */ +# define LM_NADC 2 /* Two ADC modules */ +# define LM_NPWM 0 /* No PWM generator modules */ +# define LM_NQEI 0 /* No quadrature encoders */ +# define LM_NPORTS 6 /* 6 Ports (GPIOA-F), 0-43 GPIOs */ +# define LM_NCANCONTROLLER 1 /* One CAN controller */ #else # error "Capabilities not specified for this Stellaris chip" #endif diff --git a/nuttx/configs/lm3s6965-ek/tools/oocd.sh b/nuttx/configs/lm3s6965-ek/tools/oocd.sh index 28bcc48a7..758d11450 100755 --- a/nuttx/configs/lm3s6965-ek/tools/oocd.sh +++ b/nuttx/configs/lm3s6965-ek/tools/oocd.sh @@ -22,7 +22,7 @@ TARGET_PATH="/usr/share/openocd/scripts" # like environment #OPENOCD_EXE=openocd.exe OPENOCD_EXE=openocd -OPENOCD_CFG="${TOPDIR}/configs/lm3s6965-ek/tools/ek-lm3s6965.cfg" +OPENOCD_CFG="${TOPDIR}/configs/lm3s6965-ek/tools/lm3s6965-ek.cfg" OPENOCD_ARGS="-f ${OPENOCD_CFG} -s ${TARGET_PATH}" if [ "X$2" = "X-d" ]; then diff --git a/nuttx/include/nuttx/net/net.h b/nuttx/include/nuttx/net/net.h index b79dda755..b625b2fbe 100644 --- a/nuttx/include/nuttx/net/net.h +++ b/nuttx/include/nuttx/net/net.h @@ -117,110 +117,115 @@ struct uip_driver_s; /* Forward reference. See nuttx/net/uip/uip-arch.h */ typedef int (*netdev_callback_t)(FAR struct uip_driver_s *dev, void *arg); /**************************************************************************** - * Public Function Prototypes + * Public Data ****************************************************************************/ #ifdef __cplusplus #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + /* net_checksd.c *************************************************************/ /* Check if the socket descriptor is valid for the provided TCB and if it * supports the requested access. */ -EXTERN int net_checksd(int fd, int oflags); +int net_checksd(int fd, int oflags); /* net_sockets.c *************************************************************/ /* There interfaces are called only from OS scheduling and iniialization logic * under sched/ */ -EXTERN void weak_function net_initialize(void); -EXTERN FAR struct socketlist *net_alloclist(void); -EXTERN int net_addreflist(FAR struct socketlist *list); -EXTERN int net_releaselist(FAR struct socketlist *list); +void weak_function net_initialize(void); +FAR struct socketlist *net_alloclist(void); +int net_addreflist(FAR struct socketlist *list); +int net_releaselist(FAR struct socketlist *list); /* Given a socket descriptor, return the underly NuttX-specific socket * structure. */ -EXTERN FAR struct socket *sockfd_socket(int sockfd); +FAR struct socket *sockfd_socket(int sockfd); /* socket.c ******************************************************************/ /* socket using underlying socket structure */ -EXTERN int psock_socket(int domain, int type, int protocol, - FAR struct socket *psock); +int psock_socket(int domain, int type, int protocol, FAR struct socket *psock); /* net_close.c ***************************************************************/ /* The standard close() operation redirects operations on socket descriptors * to this function. */ -EXTERN int net_close(int sockfd); +int net_close(int sockfd); /* Performs the close operation on a socket instance */ -EXTERN int psock_close(FAR struct socket *psock); +int psock_close(FAR struct socket *psock); /* net_close.c ***************************************************************/ /* Performs the bind() operation on a socket instance */ -EXTERN int psock_bind(FAR struct socket *psock, - FAR const struct sockaddr *addr, socklen_t addrlen); +int psock_bind(FAR struct socket *psock, FAR const struct sockaddr *addr, + socklen_t addrlen); /* connect.c *****************************************************************/ /* Performs the connect() operation on a socket instance */ -EXTERN int psock_connect(FAR struct socket *psock, - FAR const struct sockaddr *addr, socklen_t addrlen); +int psock_connect(FAR struct socket *psock, FAR const struct sockaddr *addr, + socklen_t addrlen); /* send.c ********************************************************************/ /* Send using underlying socket structure */ -EXTERN ssize_t psock_send(FAR struct socket *psock, const void *buf, - size_t len, int flags); +ssize_t psock_send(FAR struct socket *psock, const void *buf, size_t len, + int flags); /* sendto.c ******************************************************************/ /* Sendto using underlying socket structure */ -EXTERN ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf, - size_t len, int flags, FAR const struct sockaddr *to, - socklen_t tolen); +ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf, + size_t len, int flags, FAR const struct sockaddr *to, + socklen_t tolen); /* recvfrom.c ****************************************************************/ /* recvfrom using the underlying socket structure */ -EXTERN ssize_t psock_recvfrom(FAR struct socket *psock, FAR void *buf, - size_t len, int flags,FAR struct sockaddr *from, - FAR socklen_t *fromlen); +ssize_t psock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, + int flags,FAR struct sockaddr *from, + FAR socklen_t *fromlen); /* recv using the underlying socket structure */ -#define psock_recv(psock,buf,len,flags) psock_recvfrom(psock,buf,len,flags,NULL,0) +#define psock_recv(psock,buf,len,flags) \ + psock_recvfrom(psock,buf,len,flags,NULL,0) /* getsockopt.c **************************************************************/ /* getsockopt using the underlying socket structure */ -EXTERN int psock_getsockopt(FAR struct socket *psock, int level, int option, - FAR void *value, FAR socklen_t *value_len); +int psock_getsockopt(FAR struct socket *psock, int level, int option, + FAR void *value, FAR socklen_t *value_len); /* setsockopt.c **************************************************************/ /* setsockopt using the underlying socket structure */ -EXTERN int psock_setsockopt(FAR struct socket *psock, int level, int option, - FAR const void *value, socklen_t value_len); +int psock_setsockopt(FAR struct socket *psock, int level, int option, + FAR const void *value, socklen_t value_len); /* net_ioctl.c ***************************************************************/ /* The standard ioctl() operation redirects operations on socket descriptors * to this function. */ -EXTERN int netdev_ioctl(int sockfd, int cmd, unsigned long arg); +int netdev_ioctl(int sockfd, int cmd, unsigned long arg); /* net_poll.c ****************************************************************/ /* The standard poll() operation redirects operations on socket descriptors @@ -229,7 +234,9 @@ EXTERN int netdev_ioctl(int sockfd, int cmd, unsigned long arg); #ifndef CONFIG_DISABLE_POLL struct pollfd; /* Forward reference -- see poll.h */ -EXTERN int net_poll(int sockfd, struct pollfd *fds, bool setup); + +int psock_poll(FAR struct socket *psock, struct pollfd *fds, bool setup); +int net_poll(int sockfd, struct pollfd *fds, bool setup); #endif /* net_dup.c *****************************************************************/ @@ -237,7 +244,7 @@ EXTERN int net_poll(int sockfd, struct pollfd *fds, bool setup); * this function */ -EXTERN int net_dup(int sockfd, int minsd); +int net_dup(int sockfd, int minsd); /* net_dup2.c ****************************************************************/ /* The standard dup2() operation redirects operations on socket descriptors to @@ -245,7 +252,7 @@ EXTERN int net_dup(int sockfd, int minsd); */ #if CONFIG_NFILE_DESCRIPTORS > 0 -EXTERN int net_dup2(int sockfd1, int sockfd2); +int net_dup2(int sockfd1, int sockfd2); #else # define net_dup2(sockfd1, sockfd2) dup2(sockfd1, sockfd2) #endif @@ -253,12 +260,12 @@ EXTERN int net_dup2(int sockfd1, int sockfd2); /* net_clone.c ***************************************************************/ /* Performs the low level, common portion of net_dup() and net_dup2() */ -EXTERN int net_clone(FAR struct socket *psock1, FAR struct socket *psock2); +int net_clone(FAR struct socket *psock1, FAR struct socket *psock2); /* net_vfcntl.c **************************************************************/ /* Performs fcntl operations on socket */ -EXTERN int net_vfcntl(int sockfd, int cmd, va_list ap); +int net_vfcntl(int sockfd, int cmd, va_list ap); /* netdev-register.c *********************************************************/ /* This function is called by network interface device drivers to inform the @@ -267,23 +274,23 @@ EXTERN int net_vfcntl(int sockfd, int cmd, va_list ap); * addresses */ -EXTERN int netdev_register(FAR struct uip_driver_s *dev); +int netdev_register(FAR struct uip_driver_s *dev); /* netdev-unregister.c *********************************************************/ /* Unregister a network device driver. */ -EXTERN int netdev_unregister(FAR struct uip_driver_s *dev); +int netdev_unregister(FAR struct uip_driver_s *dev); /* net_foreach.c ************************************************************/ /* Enumerates all registered network devices */ -EXTERN int netdev_foreach(netdev_callback_t callback, void *arg); +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); +int slip_initialize(int intf, const char *devname); #endif #undef EXTERN diff --git a/nuttx/libc/stdio/lib_libfread.c b/nuttx/libc/stdio/lib_libfread.c index 3e851bf17..f8cf0f40a 100644 --- a/nuttx/libc/stdio/lib_libfread.c +++ b/nuttx/libc/stdio/lib_libfread.c @@ -1,7 +1,7 @@ /**************************************************************************** * libc/stdio/lib_libfread.c * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -88,7 +88,9 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream) { unsigned char *dest = (unsigned char*)ptr; ssize_t bytes_read; +#if CONFIG_STDIO_BUFFER_SIZE > 0 int ret; +#endif /* Make sure that reading from this stream is allowed */ diff --git a/nuttx/net/send.c b/nuttx/net/send.c index 79dfef4ec..b26a0e5bb 100644 --- a/nuttx/net/send.c +++ b/nuttx/net/send.c @@ -448,7 +448,7 @@ end_wait: * equivalent to sendto(sockfd,buf,len,flags,NULL,0). * * Parameters: - * psock And instance of the internal socket structure. + * psock An instance of the internal socket structure. * buf Data to send * len Length of data to send * flags Send flags diff --git a/nuttx/sched/mq_sndinternal.c b/nuttx/sched/mq_sndinternal.c index 51f898875..f16f7de1a 100644 --- a/nuttx/sched/mq_sndinternal.c +++ b/nuttx/sched/mq_sndinternal.c @@ -124,7 +124,7 @@ int mq_verifysend(mqd_t mqdes, const void *msg, size_t msglen, int prio) return ERROR; } - if (msglen < 0 || msglen > (size_t)mqdes->msgq->maxmsgsize) + if (msglen > (size_t)mqdes->msgq->maxmsgsize) { set_errno(EMSGSIZE); return ERROR; |