Switching to C99 stdint.h types

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2340 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-12-14 23:32:23 +00:00
parent a350286c7c
commit eeec4073a9
85 changed files with 1405 additions and 1061 deletions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arpa/inet.h
* include/arpa/inet.h
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,7 +41,9 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <netinet/in.h>
/****************************************************************************
@ -89,10 +91,10 @@ extern "C" {
/* Functions to convert between nost and network byte ordering */
EXTERN uint32 ntohl (uint32 nl);
EXTERN uint16 ntohs (uint16 ns);
EXTERN uint32 htonl (uint32 hl);
EXTERN uint16 htons (uint16 hs);
EXTERN uint32_t ntohl(uint32_t nl);
EXTERN uint16_t ntohs(uint16_t ns);
EXTERN uint32_t htonl(uint32_t hl);
EXTERN uint16_t htons(uint16_t hs);
/* Functions to manipulate address representations */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/assert.h
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -40,11 +40,11 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
#include <nuttx/compiler.h>
#include <stdint.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/* Macro Name: ASSERT, ASSERTCODE, et al. */
@ -57,27 +57,27 @@
#ifdef CONFIG_HAVE_FILENAME
# define ASSERT(f) \
{ if (!(f)) up_assert((const ubyte *)__FILE__, (int)__LINE__); }
{ if (!(f)) up_assert((const uint8_t *)__FILE__, (int)__LINE__); }
# define ASSERTCODE(f, errCode) \
{ if (!(f)) up_assert_code((const ubyte *)__FILE__, (int)__LINE__, errCode); }
# define ASSERTCODE(f, code) \
{ if (!(f)) up_assert_code((const uint8_t *)__FILE__, (int)__LINE__, code); }
# ifdef CONFIG_DEBUG
# define DEBUGASSERT(f) \
{ if (!(f)) up_assert((const ubyte *)__FILE__, (int)__LINE__); }
{ if (!(f)) up_assert((const uint8_t *)__FILE__, (int)__LINE__); }
# else
# define DEBUGASSERT(f)
# endif /* CONFIG_DEBUG */
# define PANIC(errCode) \
up_assert_code((const ubyte *)__FILE__, (int)__LINE__, (errCode)|0x8000)
# define PANIC(code) \
up_assert_code((const uint8_t *)__FILE__, (int)__LINE__, (code)|0x8000)
#else
# define ASSERT(f) \
{ if (!(f)) up_assert(); }
# define ASSERTCODE(f, errCode) \
{ if (!(f)) up_assert_code(errCode); }
# define ASSERTCODE(f, code) \
{ if (!(f)) up_assert_code(code); }
# ifdef CONFIG_DEBUG
# define DEBUGASSERT(f) \
@ -86,8 +86,8 @@
# define DEBUGASSERT(f)
# endif /* CONFIG_DEBUG */
# define PANIC(errCode) \
up_assert_code((errCode)|0x8000)
# define PANIC(code) \
up_assert_code((code)|0x8000)
#endif
@ -107,12 +107,12 @@ extern "C" {
#endif
#ifdef CONFIG_HAVE_FILENAME
EXTERN void up_assert(const ubyte *filename, int linenum);
EXTERN void up_assert_code(const ubyte *filename, int linenum,
int error_code);
EXTERN void up_assert(FAR const uint8_t *filename, int linenum);
EXTERN void up_assert_code(FAR const uint8_t *filename, int linenum,
int errcode);
#else
EXTERN void up_assert(void);
EXTERN void up_assert_code(int error_code);
EXTERN void up_assert_code(int errcode);
#endif
#undef EXTERN

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/ctype.h
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -46,10 +46,8 @@
* Included Files
************************************************************/
#include <sys/types.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
************************************************************/
/****************************************************************************

View File

@ -42,6 +42,7 @@
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <stddef.h>
//***************************************************************************
@ -50,22 +51,6 @@
namespace std
{
// NuttX specific types
using ::sbyte;
using ::ubyte;
using ::uint8;
using ::boolean;
using ::sint16;
using ::uint16;
using ::sint32;
using ::uint32;
#ifdef CONFIG_HAVE_LONG_LONG
using ::sint64;
using ::uint64;
#endif
using ::irqstate_t;
// Standard types
using ::float32;

View File

@ -42,10 +42,11 @@
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <sys/types.h>
#include <stdint.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/* Debug macros to runtime filter the debug messages sent to the console. In
@ -496,15 +497,16 @@ extern "C" {
* on or the other of the following.
*/
EXTERN int lib_rawprintf(const char *format, ...);
EXTERN int lib_rawprintf(FAR const char *format, ...);
#ifdef CONFIG_ARCH_LOWPUTC
EXTERN int lib_lowprintf(const char *format, ...);
EXTERN int lib_lowprintf(FAR const char *format, ...);
#endif
/* Dump a buffer of data */
EXTERN void lib_dumpbuffer(FAR const char *msg, FAR const ubyte *buffer, unsigned int buflen);
EXTERN void lib_dumpbuffer(FAR const char *msg, FAR const uint8_t *buffer,
unsigned int buflen);
/* If the cross-compiler's pre-processor does not support variable
* length arguments, then these additional APIs will be built.

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/dirent.h
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,11 +41,13 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <limits.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/* File type code for the d_type field in dirent struct.
@ -75,7 +77,7 @@
struct dirent
{
ubyte d_type; /* type of file */
uint8_t d_type; /* type of file */
char d_name[NAME_MAX+1]; /* filename */
};

View File

@ -41,7 +41,9 @@
********************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
/********************************************************************************
* Definitions
@ -113,11 +115,11 @@
struct flock
{
sint16 l_type; /* Type of lock: F_RDLCK, F_WRLCK, F_UNLCK */
sint16 l_whence; /* How to interpret l_start: SEEK_SET, SEEK_CUR, SEEK_END */
off_t l_start; /* Starting offset for lock */
off_t l_len; /* Number of bytes to lock */
pid_t l_pid; /* PID of process blocking our lock (F_GETLK only) */
int16_t l_type; /* Type of lock: F_RDLCK, F_WRLCK, F_UNLCK */
int16_t l_whence; /* How to interpret l_start: SEEK_SET, SEEK_CUR, SEEK_END */
off_t l_start; /* Starting offset for lock */
off_t l_len; /* Number of bytes to lock */
pid_t l_pid; /* PID of process blocking our lock (F_GETLK only) */
};
/********************************************************************************

View File

@ -1,7 +1,7 @@
/********************************************************************************
* include/limits.h
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -47,7 +47,7 @@
#include <arch/limits.h>
/********************************************************************************
* Definitions
* Pre-processor Definitions
********************************************************************************/
/* Configurable limits required by POSIX

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/net/ethernet.h
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -40,7 +40,7 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
#include <stdint.h>
/****************************************************************************
* Pre-Processor Definitions
@ -54,14 +54,14 @@
struct ether_addr
{
uint8 ether_addr_octet[6]; /* 48-bit Ethernet address */
uint8_t ether_addr_octet[6]; /* 48-bit Ethernet address */
};
struct ether_header
{
uint8 ether_dhost[ETHER_ADDR_LEN]; /* Destination Ethernet address */
uint8 ether_shost[ETHER_ADDR_LEN]; /* Source Ethernet address */
uint16 ether_type; /* Ethernet packet type*/
uint8_t ether_dhost[ETHER_ADDR_LEN]; /* Destination Ethernet address */
uint8_t ether_shost[ETHER_ADDR_LEN]; /* Source Ethernet address */
uint16_t ether_type; /* Ethernet packet type*/
};
/****************************************************************************

View File

@ -42,10 +42,10 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
#include <stdint.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
@ -54,7 +54,7 @@
struct dhcpc_state
{
uint16 lease_time[2];
uint16_t lease_time[2];
struct in_addr serverid;
struct in_addr ipaddr;
struct in_addr netmask;

View File

@ -42,10 +42,8 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************

View File

@ -1,7 +1,7 @@
/****************************************************************************
* net/uip/httpd.h
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Based on uIP which also has a BSD style license:
@ -44,8 +44,6 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
/****************************************************************************
* Public Function Prototypes
****************************************************************************/

View File

@ -33,7 +33,6 @@
#ifndef __UIP_RESOLV_H__
#define __UIP_RESOLV_H__
#include <sys/types.h>
#include <net/uip/uipopt.h>
#undef EXTERN

View File

@ -44,8 +44,6 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
#include <net/uip/uipopt.h>
#include <net/uip/uip.h>

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/net/uip/tftp.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -40,11 +40,11 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
#include <stdbool.h>
#include <arpa/inet.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
@ -62,8 +62,8 @@ extern "C" {
#define EXTERN extern
#endif
EXTERN int tftpget(const char *remote, const char *local, in_addr_t addr, boolean binary);
EXTERN int tftpput(const char *local, const char *remote, in_addr_t addr, boolean binary);
EXTERN int tftpget(const char *remote, const char *local, in_addr_t addr, bool binary);
EXTERN int tftpput(const char *local, const char *remote, in_addr_t addr, bool binary);
#undef EXTERN
#ifdef __cplusplus

View File

@ -41,7 +41,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/symtab.h>
/****************************************************************************
@ -69,7 +69,7 @@ extern "C" {
*/
EXTERN FAR const struct symtab_s *g_thttpdsymtab;
EXTERN int g_thttpdnsymbols;
EXTERN int g_thttpdnsymbols;
/****************************************************************************
* Public Function Prototypes

View File

@ -43,8 +43,9 @@
#define __UIP_ARCH_H
#include <nuttx/config.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <stdint.h>
#include <net/if.h>
#include <net/uip/uip.h>
@ -56,7 +57,7 @@
#include <net/ethernet.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
@ -121,30 +122,30 @@ struct uip_driver_s
* }
*/
uint8 d_buf[CONFIG_NET_BUFSIZE + 2];
uint8_t d_buf[CONFIG_NET_BUFSIZE + 2];
/* d_appdata points to the location where application data can be read from
* or written into a packet.
*/
uint8 *d_appdata;
uint8_t *d_appdata;
/* This is a pointer into d_buf where a user application may append
* data to be sent.
*/
uint8 *d_snddata;
uint8_t *d_snddata;
#ifdef CONFIG_NET_TCPURGDATA
/* This pointer points to any urgent TCP data that has been received. Only
* present if compiled with support for urgent data (CONFIG_NET_TCPURGDATA).
*/
uint8 *d_urgdata;
uint8_t *d_urgdata;
/* Length of the (received) urgent data */
uint16 d_urglen;
uint16_t d_urglen;
#endif
/* The length of the packet in the d_buf buffer.
@ -160,13 +161,13 @@ struct uip_driver_s
* packet.
*/
uint16 d_len;
uint16_t d_len;
/* When d_buf contains outgoing xmit data, xmtlen is nonzero and represents
* the amount of appllcation data after d_snddata
*/
uint16 d_sndlen;
uint16_t d_sndlen;
/* Driver callbacks */
@ -315,8 +316,8 @@ extern int uip_timer(struct uip_driver_s *dev, uip_poll_callback_t callback, int
* uip_add32 only.
*/
extern void uip_add32(const uint8 *op32, uint16 op16, uint8 *sum);
extern void uip_incr32(uint8 *op32, uint16 op16);
extern void uip_add32(const uint8_t *op32, uint16_t op16, uint8_t *sum);
extern void uip_incr32(uint8_t *op32, uint16_t op16);
/* Calculate the Internet checksum over a buffer.
*
@ -337,7 +338,7 @@ extern void uip_incr32(uint8 *op32, uint16 op16);
* Return: The Internet checksum of the buffer.
*/
extern uint16 uip_chksum(uint16 *buf, uint16 len);
extern uint16_t uip_chksum(uint16_t *buf, uint16_t len);
/* Calculate the IP header checksum of the packet header in d_buf.
*
@ -348,7 +349,7 @@ extern uint16 uip_chksum(uint16 *buf, uint16 len);
* buffer.
*/
extern uint16 uip_ipchksum(struct uip_driver_s *dev);
extern uint16_t uip_ipchksum(struct uip_driver_s *dev);
/* Calculate the TCP checksum of the packet in d_buf and d_appdata.
*
@ -363,10 +364,10 @@ extern uint16 uip_ipchksum(struct uip_driver_s *dev);
* to by d_appdata.
*/
extern uint16 uip_tcpchksum(struct uip_driver_s *dev);
extern uint16_t uip_tcpchksum(struct uip_driver_s *dev);
extern uint16 uip_udpchksum(struct uip_driver_s *dev);
extern uint16 uip_icmpchksum(struct uip_driver_s *dev, int len);
extern uint16_t uip_udpchksum(struct uip_driver_s *dev);
extern uint16_t uip_icmpchksum(struct uip_driver_s *dev, int len);
#endif /* __UIP_ARCH_H */

View File

@ -46,8 +46,9 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/compiler.h>
#include <stdint.h>
#include <net/ethernet.h>
#include <net/uip/uip.h>
@ -72,9 +73,9 @@
struct uip_eth_hdr
{
uint8 dest[6]; /* Ethernet destination address (6 bytes) */
uint8 src[6]; /* Ethernet source address (6 bytes) */
uint16 type; /* Type code (2 bytes) */
uint8_t dest[6]; /* Ethernet destination address (6 bytes) */
uint8_t src[6]; /* Ethernet source address (6 bytes) */
uint16_t type; /* Type code (2 bytes) */
};
/* One entry in the ARP table (volatile!) */
@ -83,7 +84,7 @@ struct arp_entry
{
in_addr_t at_ipaddr; /* IP address */
struct ether_addr at_ethaddr; /* Hardware address */
uint8 at_time;
uint8_t at_time;
};
/****************************************************************************
@ -181,15 +182,15 @@ EXTERN void uip_arp_timer(void);
* address of an existing association.
*
* Input parameters:
* pipaddr - Refers to an IP address uint16[2] in network order
* ethaddr - Refers to a HW address uint8[IFHWADDRLEN]
* pipaddr - Refers to an IP address uint16_t[2] in network order
* ethaddr - Refers to a HW address uint8_t[IFHWADDRLEN]
*
* Assumptions
* Interrupts are disabled
*
****************************************************************************/
EXTERN void uip_arp_update(uint16 *pipaddr, uint8 *ethaddr);
EXTERN void uip_arp_update(uint16_t *pipaddr, uint8_t *ethaddr);
/****************************************************************************
* Name: uip_arp_find

View File

@ -46,11 +46,12 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <net/uip/uipopt.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/* ICMP/ICMP6 definitions */
@ -115,12 +116,12 @@ struct uip_icmpip_hdr
/* IPv6 Ip header */
uint8 vtc; /* Bits 0-3: version, bits 4-7: traffic class (MS) */
uint8 tcf; /* Bits 0-3: traffic class (LS), bits 4-7: flow label (MS) */
uint16 flow; /* 16-bit flow label (LS) */
uint8 len[2]; /* 16-bit Payload length */
uint8 proto; /* 8-bit Next header (same as IPv4 protocol field) */
uint8 ttl; /* 8-bit Hop limit (like IPv4 TTL field) */
uint8_t vtc; /* Bits 0-3: version, bits 4-7: traffic class (MS) */
uint8_t tcf; /* Bits 0-3: traffic class (LS), bits 4-7: flow label (MS) */
uint16_t flow; /* 16-bit flow label (LS) */
uint8_t len[2]; /* 16-bit Payload length */
uint8_t proto; /* 8-bit Next header (same as IPv4 protocol field) */
uint8_t ttl; /* 8-bit Hop limit (like IPv4 TTL field) */
uip_ip6addr_t srcipaddr; /* 128-bit Source address */
uip_ip6addr_t destipaddr; /* 128-bit Destination address */
@ -128,24 +129,24 @@ struct uip_icmpip_hdr
/* IPv4 IP header */
uint8 vhl; /* 8-bit Version (4) and header length (5 or 6) */
uint8 tos; /* 8-bit Type of service (e.g., 6=TCP) */
uint8 len[2]; /* 16-bit Total length */
uint8 ipid[2]; /* 16-bit Identification */
uint8 ipoffset[2]; /* 16-bit IP flags + fragment offset */
uint8 ttl; /* 8-bit Time to Live */
uint8 proto; /* 8-bit Protocol */
uint16 ipchksum; /* 16-bit Header checksum */
uint16 srcipaddr[2]; /* 32-bit Source IP address */
uint16 destipaddr[2]; /* 32-bit Destination IP address */
uint8_t vhl; /* 8-bit Version (4) and header length (5 or 6) */
uint8_t tos; /* 8-bit Type of service (e.g., 6=TCP) */
uint8_t len[2]; /* 16-bit Total length */
uint8_t ipid[2]; /* 16-bit Identification */
uint8_t ipoffset[2]; /* 16-bit IP flags + fragment offset */
uint8_t ttl; /* 8-bit Time to Live */
uint8_t proto; /* 8-bit Protocol */
uint16_t ipchksum; /* 16-bit Header checksum */
uint16_t srcipaddr[2]; /* 32-bit Source IP address */
uint16_t destipaddr[2]; /* 32-bit Destination IP address */
#endif /* CONFIG_NET_IPv6 */
/* ICMP header */
uint8 type; /* Defines the format of the ICMP message */
uint8 icode; /* Further qualifies the ICMP messsage */
uint16 icmpchksum; /* Checksum of ICMP header and data */
uint8_t type; /* Defines the format of the ICMP message */
uint8_t icode; /* Further qualifies the ICMP messsage */
uint16_t icmpchksum; /* Checksum of ICMP header and data */
/* Data following the ICMP header contains the data specific to the
* message type indicated by the Type and Code fields.
@ -155,19 +156,19 @@ struct uip_icmpip_hdr
/* ICMP_ECHO_REQUEST and ICMP_ECHO_REPLY data */
uint16 id; /* Used to match requests with replies */
uint16 seqno; /* " " "" " " " " " " " " */
uint16_t id; /* Used to match requests with replies */
uint16_t seqno; /* " " "" " " " " " " " " */
#else /* !CONFIG_NET_IPv6 */
/* ICMP6_ECHO_REQUEST and ICMP6_ECHO_REPLY data */
uint8 flags;
uint8 reserved1;
uint8 reserved2;
uint8 reserved3;
uint8 icmp6data[16];
uint8 options[1];
uint8_t flags;
uint8_t reserved1;
uint8_t reserved2;
uint8_t reserved3;
uint8_t icmp6data[16];
uint8_t options[1];
#endif /* !CONFIG_NET_IPv6 */
};
@ -201,7 +202,7 @@ extern "C" {
#define EXTERN extern
#endif
EXTERN int uip_ping(uip_ipaddr_t addr, uint16 id, uint16 seqno, uint16 datalen, int dsecs);
EXTERN int uip_ping(uip_ipaddr_t addr, uint16_t id, uint16_t seqno, uint16_t datalen, int dsecs);
#undef EXTERN
#ifdef __cplusplus

View File

@ -50,12 +50,14 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <pthread.h>
#include <netinet/in.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/* SOCK_DGRAM is the preferred socket type to use when we just want a
@ -89,12 +91,12 @@
* Return: Non-zero If the IP address was parsed.
*/
extern boolean uiplib_ipaddrconv(const char *addrstr, ubyte *addr);
extern bool uiplib_ipaddrconv(const char *addrstr, uint8_t *addr);
/* Get and set IP/MAC addresses */
extern int uip_setmacaddr(const char *ifname, const uint8 *macaddr);
extern int uip_getmacaddr(const char *ifname, uint8 *macaddr);
extern int uip_setmacaddr(const char *ifname, const uint8_t *macaddr);
extern int uip_getmacaddr(const char *ifname, uint8_t *macaddr);
#ifdef CONFIG_NET_IPv6
extern int uip_gethostaddr(const char *ifname, struct in6_addr *addr);
@ -110,12 +112,12 @@ extern int uip_setnetmask(const char *ifname, const struct in_addr *addr);
/* HTTP support */
extern int uip_parsehttpurl(const char *url, uint16 *port,
extern int uip_parsehttpurl(const char *url, uint16_t *port,
char *hostname, int hostlen,
char *filename, int namelen);
/* Generic server logic */
extern void uip_server(uint16 portno, pthread_startroutine_t handler, int stacksize);
extern void uip_server(uint16_t portno, pthread_startroutine_t handler, int stacksize);
#endif /* __NET_UIP_UIP_LIB_H */

View File

@ -6,7 +6,7 @@
* of C macros that are used by uIP programs as well as internal uIP
* structures, TCP/IP header structures and function declarations.
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* This logic was leveraged from uIP which also has a BSD-style license:
@ -52,11 +52,12 @@
#include <nuttx/config.h>
#ifdef CONFIG_NET_TCP
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <net/uip/uipopt.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/* TCP definitions */
@ -124,25 +125,25 @@ struct uip_conn
{
dq_entry_t node; /* Implements a doubly linked list */
uip_ipaddr_t ripaddr; /* The IP address of the remote host */
uint16 lport; /* The local TCP port, in network byte order */
uint16 rport; /* The remoteTCP port, in network byte order */
uint8 rcv_nxt[4]; /* The sequence number that we expect to
uint16_t lport; /* The local TCP port, in network byte order */
uint16_t rport; /* The remoteTCP port, in network byte order */
uint8_t rcv_nxt[4]; /* The sequence number that we expect to
* receive next */
uint8 snd_nxt[4]; /* The sequence number that was last sent by us */
uint16 len; /* Length of the data that was previously sent */
uint16 mss; /* Current maximum segment size for the
uint8_t snd_nxt[4]; /* The sequence number that was last sent by us */
uint16_t len; /* Length of the data that was previously sent */
uint16_t mss; /* Current maximum segment size for the
* connection */
uint16 initialmss; /* Initial maximum segment size for the
uint16_t initialmss; /* Initial maximum segment size for the
* connection */
uint8 crefs; /* Reference counts on this instance */
uint8 sa; /* Retransmission time-out calculation state
uint8_t crefs; /* Reference counts on this instance */
uint8_t sa; /* Retransmission time-out calculation state
* variable */
uint8 sv; /* Retransmission time-out calculation state
uint8_t sv; /* Retransmission time-out calculation state
* variable */
uint8 rto; /* Retransmission time-out */
uint8 tcpstateflags; /* TCP state and flags */
uint8 timer; /* The retransmission timer (units: half-seconds) */
uint8 nrtx; /* The number of retransmissions for the last
uint8_t rto; /* Retransmission time-out */
uint8_t tcpstateflags; /* TCP state and flags */
uint8_t timer; /* The retransmission timer (units: half-seconds) */
uint8_t nrtx; /* The number of retransmissions for the last
* segment sent */
/* Read-ahead buffering.
@ -204,7 +205,7 @@ struct uip_conn
/* connection_event() is called on any of the subset of connection-related events */
FAR void *connection_private;
void (*connection_event)(FAR struct uip_conn *conn, uint16 flags);
void (*connection_event)(FAR struct uip_conn *conn, uint16_t flags);
};
/* The following structure is used to handle read-ahead buffering for TCP
@ -217,8 +218,8 @@ struct uip_conn
struct uip_readahead_s
{
sq_entry_t rh_node; /* Supports a singly linked list */
uint16 rh_nbytes; /* Number of bytes available in this buffer */
uint8 rh_buffer[CONFIG_NET_TCP_READAHEAD_BUFSIZE];
uint16_t rh_nbytes; /* Number of bytes available in this buffer */
uint8_t rh_buffer[CONFIG_NET_TCP_READAHEAD_BUFSIZE];
};
#endif
@ -271,12 +272,12 @@ struct uip_tcpip_hdr
/* IPv6 Ip header */
uint8 vtc; /* Bits 0-3: version, bits 4-7: traffic class (MS) */
uint8 tcf; /* Bits 0-3: traffic class (LS), 4-bits: flow label (MS) */
uint16 flow; /* 16-bit flow label (LS) */
uint8 len[2]; /* 16-bit Payload length */
uint8 proto; /* 8-bit Next header (same as IPv4 protocol field) */
uint8 ttl; /* 8-bit Hop limit (like IPv4 TTL field) */
uint8_t vtc; /* Bits 0-3: version, bits 4-7: traffic class (MS) */
uint8_t tcf; /* Bits 0-3: traffic class (LS), 4-bits: flow label (MS) */
uint16_t flow; /* 16-bit flow label (LS) */
uint8_t len[2]; /* 16-bit Payload length */
uint8_t proto; /* 8-bit Next header (same as IPv4 protocol field) */
uint8_t ttl; /* 8-bit Hop limit (like IPv4 TTL field) */
uip_ip6addr_t srcipaddr; /* 128-bit Source address */
uip_ip6addr_t destipaddr; /* 128-bit Destination address */
@ -284,31 +285,31 @@ struct uip_tcpip_hdr
/* IPv4 IP header */
uint8 vhl; /* 8-bit Version (4) and header length (5 or 6) */
uint8 tos; /* 8-bit Type of service (e.g., 6=TCP) */
uint8 len[2]; /* 16-bit Total length */
uint8 ipid[2]; /* 16-bit Identification */
uint8 ipoffset[2]; /* 16-bit IP flags + fragment offset */
uint8 ttl; /* 8-bit Time to Live */
uint8 proto; /* 8-bit Protocol */
uint16 ipchksum; /* 16-bit Header checksum */
uint16 srcipaddr[2]; /* 32-bit Source IP address */
uint16 destipaddr[2]; /* 32-bit Destination IP address */
uint8_t vhl; /* 8-bit Version (4) and header length (5 or 6) */
uint8_t tos; /* 8-bit Type of service (e.g., 6=TCP) */
uint8_t len[2]; /* 16-bit Total length */
uint8_t ipid[2]; /* 16-bit Identification */
uint8_t ipoffset[2]; /* 16-bit IP flags + fragment offset */
uint8_t ttl; /* 8-bit Time to Live */
uint8_t proto; /* 8-bit Protocol */
uint16_t ipchksum; /* 16-bit Header checksum */
uint16_t srcipaddr[2]; /* 32-bit Source IP address */
uint16_t destipaddr[2]; /* 32-bit Destination IP address */
#endif /* CONFIG_NET_IPv6 */
/* TCP header */
uint16 srcport;
uint16 destport;
uint8 seqno[4];
uint8 ackno[4];
uint8 tcpoffset;
uint8 flags;
uint8 wnd[2];
uint16 tcpchksum;
uint8 urgp[2];
uint8 optdata[4];
uint16_t srcport;
uint16_t destport;
uint8_t seqno[4];
uint8_t ackno[4];
uint8_t tcpoffset;
uint8_t flags;
uint8_t wnd[2];
uint16_t tcpchksum;
uint8_t urgp[2];
uint8_t optdata[4];
};
/****************************************************************************
@ -401,9 +402,9 @@ extern int uip_backlogdestroy(FAR struct uip_conn *conn);
extern int uip_backlogadd(FAR struct uip_conn *conn, FAR struct uip_conn *blconn);
#ifndef CONFIG_DISABLE_POLL
extern boolean uip_backlogavailable(FAR struct uip_conn *conn);
extern bool uip_backlogavailable(FAR struct uip_conn *conn);
#else
# define uip_backlogavailable(conn) (FALSE);
# define uip_backlogavailable(conn) (false);
#endif
extern FAR struct uip_conn *uip_backlogremove(FAR struct uip_conn *conn);
extern int uip_backlogdelete(FAR struct uip_conn *conn, FAR struct uip_conn *blconn);
@ -412,7 +413,7 @@ extern int uip_backlogdelete(FAR struct uip_conn *conn, FAR struct uip_conn *blc
# define uip_backlogcreate(conn,nblg) (-ENOSYS)
# define uip_backlogdestroy(conn) (-ENOSYS)
# define uip_backlogadd(conn,blconn) (-ENOSYS)
# define uip_backlogavailable(conn) (FALSE);
# define uip_backlogavailable(conn) (false);
# define uip_backlogremove(conn) (NULL)
#endif

View File

@ -6,7 +6,7 @@
* of C macros that are used by uIP programs as well as internal uIP
* structures, UDP header structures and function declarations.
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* This logic was leveraged from uIP which also has a BSD-style license:
@ -50,11 +50,12 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <net/uip/uipopt.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/* Header sizes */
@ -74,10 +75,10 @@ struct uip_udp_conn
{
dq_entry_t node; /* Supports a doubly linked list */
uip_ipaddr_t ripaddr; /* The IP address of the remote peer */
uint16 lport; /* The local port number in network byte order */
uint16 rport; /* The remote port number in network byte order */
uint8 ttl; /* Default time-to-live */
uint8 crefs; /* Reference counts on this instance */
uint16_t lport; /* The local port number in network byte order */
uint16_t rport; /* The remote port number in network byte order */
uint8_t ttl; /* Default time-to-live */
uint8_t crefs; /* Reference counts on this instance */
/* Defines the list of UDP callbacks */
@ -92,12 +93,12 @@ struct uip_udpip_hdr
/* IPv6 Ip header */
uint8 vtc; /* Bits 0-3: version, bits 4-7: traffic class (MS) */
uint8 tcf; /* Bits 0-3: traffic class (LS), 4-bits: flow label (MS) */
uint16 flow; /* 16-bit flow label (LS) */
uint8 len[2]; /* 16-bit Payload length */
uint8 proto; /* 8-bit Next header (same as IPv4 protocol field) */
uint8 ttl; /* 8-bit Hop limit (like IPv4 TTL field) */
uint8_t vtc; /* Bits 0-3: version, bits 4-7: traffic class (MS) */
uint8_t tcf; /* Bits 0-3: traffic class (LS), 4-bits: flow label (MS) */
uint16_t flow; /* 16-bit flow label (LS) */
uint8_t len[2]; /* 16-bit Payload length */
uint8_t proto; /* 8-bit Next header (same as IPv4 protocol field) */
uint8_t ttl; /* 8-bit Hop limit (like IPv4 TTL field) */
uip_ip6addr_t srcipaddr; /* 128-bit Source address */
uip_ip6addr_t destipaddr; /* 128-bit Destination address */
@ -105,25 +106,25 @@ struct uip_udpip_hdr
/* IPv4 header */
uint8 vhl; /* 8-bit Version (4) and header length (5 or 6) */
uint8 tos; /* 8-bit Type of service (e.g., 6=TCP) */
uint8 len[2]; /* 16-bit Total length */
uint8 ipid[2]; /* 16-bit Identification */
uint8 ipoffset[2]; /* 16-bit IP flags + fragment offset */
uint8 ttl; /* 8-bit Time to Live */
uint8 proto; /* 8-bit Protocol */
uint16 ipchksum; /* 16-bit Header checksum */
uint16 srcipaddr[2]; /* 32-bit Source IP address */
uint16 destipaddr[2]; /* 32-bit Destination IP address */
uint8_t vhl; /* 8-bit Version (4) and header length (5 or 6) */
uint8_t tos; /* 8-bit Type of service (e.g., 6=TCP) */
uint8_t len[2]; /* 16-bit Total length */
uint8_t ipid[2]; /* 16-bit Identification */
uint8_t ipoffset[2]; /* 16-bit IP flags + fragment offset */
uint8_t ttl; /* 8-bit Time to Live */
uint8_t proto; /* 8-bit Protocol */
uint16_t ipchksum; /* 16-bit Header checksum */
uint16_t srcipaddr[2]; /* 32-bit Source IP address */
uint16_t destipaddr[2]; /* 32-bit Destination IP address */
#endif /* CONFIG_NET_IPv6 */
/* UDP header */
uint16 srcport;
uint16 destport;
uint16 udplen;
uint16 udpchksum;
uint16_t srcport;
uint16_t destport;
uint16_t udplen;
uint16_t udpchksum;
};
/* The structure holding the UDP statistics that are gathered if
@ -133,10 +134,10 @@ struct uip_udpip_hdr
#ifdef CONFIG_NET_STATISTICS
struct uip_udp_stats_s
{
uip_stats_t drop; /* Number of dropped UDP segments */
uip_stats_t recv; /* Number of recived UDP segments */
uip_stats_t sent; /* Number of sent UDP segments */
uip_stats_t chkerr; /* Number of UDP segments with a bad checksum */
uip_stats_t drop; /* Number of dropped UDP segments */
uip_stats_t recv; /* Number of recived UDP segments */
uip_stats_t sent; /* Number of sent UDP segments */
uip_stats_t chkerr; /* Number of UDP segments with a bad checksum */
};
#endif

View File

@ -50,14 +50,15 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <queue.h>
#include <arpa/inet.h>
#include <net/uip/uipopt.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/* The following flags may be set in the set of flags before calling the
@ -350,9 +351,9 @@ extern void uip_send(struct uip_driver_s *dev, const void *buf, int len);
/* Convert an IPv4 address of the form uint16_t[2] to an in_addr_t */
#ifdef CONFIG_ENDIAN_BIG
# define uip_ip4addr_conv(addr) (((in_addr_t)((uint16_t*)addr)[0] << 16) | (in_addr_t)((uint16*)addr)[1])
# define uip_ip4addr_conv(addr) (((in_addr_t)((uint16_t*)addr)[0] << 16) | (in_addr_t)((uint16_t*)addr)[1])
#else
# define uip_ip4addr_conv(addr) (((in_addr_t)((uint16*)addr)[1] << 16) | (in_addr_t)((uint16_t*)addr)[0])
# define uip_ip4addr_conv(addr) (((in_addr_t)((uint16_t*)addr)[1] << 16) | (in_addr_t)((uint16_t*)addr)[0])
#endif
/* Construct an IPv6 address from eight 16-bit words.
@ -452,8 +453,8 @@ extern void uip_send(struct uip_driver_s *dev, const void *buf, int len);
(((in_addr_t)(addr1) & (in_addr_t)(mask)) == \
((in_addr_t)(addr2) & (in_addr_t)(mask)))
#else
extern boolean uip_ipaddr_maskcmp(uip_addr_t addr1, uip_addr_t addr2,
uip_addr_t mask);
extern bool uip_ipaddr_maskcmp(uip_addr_t addr1, uip_addr_t addr2,
uip_addr_t mask);
#endif
/* Mask out the network part of an IP address.

View File

@ -52,7 +52,7 @@
#include <sys/types.h>
/****************************************************************************
* Pre-processor definitions
* Pre-processor Definitions
****************************************************************************/
#ifndef CONFIG_WEBCLIENT_MAXHTTPLINE

View File

@ -41,11 +41,12 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <nuttx/ioctl.h>
/****************************************************************************
* Public Definitions
* Pre-processor Definitions
****************************************************************************/
/* Three ioctls are available on all PF_INET sockets, but only if the NuttX
@ -59,12 +60,12 @@
/* Values for the FLAGS field in struct arpreq */
#define ATF_COM 0x01 /* Lookup complete */
#define ATF_PERM 0x02 /* Permanent entry */
#define ATF_PUBL 0x04 /* Publish entry */
#define ATF_USETRAILERS 0x10 /* Trailers requested */
#define ATF_NETMASK 0x20 /* Use a netmask */
#define ATF_DONTPUB 0x40 /* Don't answer */
#define ATF_COM 0x01 /* Lookup complete */
#define ATF_PERM 0x02 /* Permanent entry */
#define ATF_PUBL 0x04 /* Publish entry */
#define ATF_USETRAILERS 0x10 /* Trailers requested */
#define ATF_NETMASK 0x20 /* Use a netmask */
#define ATF_DONTPUB 0x40 /* Don't answer */
/****************************************************************************
* Public Type Definitions
@ -74,11 +75,11 @@
struct arpreq
{
struct sockaddr arp_pa; /* Protocol address */
struct sockaddr arp_ha; /* Hardware address */
struct sockaddr arp_netmask; /* Netmask of protocol address */
ubyte arp_flags; /* Flags */
ubyte arp_dev[IFNAMSIZ+1]; /* Device name (zero terminated)*/
struct sockaddr arp_pa; /* Protocol address */
struct sockaddr arp_ha; /* Hardware address */
struct sockaddr arp_netmask; /* Netmask of protocol address */
uint8_t arp_flags; /* Flags */
uint8_t arp_dev[IFNAMSIZ+1]; /* Device name (zero terminated)*/
};
/****************************************************************************

View File

@ -41,11 +41,11 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <net/ethernet.h>
/****************************************************************************
* Public Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************

View File

@ -40,10 +40,13 @@
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
/****************************************************************************
* Public Macro Definitions
* Pre-processor Definitions
****************************************************************************/
/* Values for protocol argument to socket() */
@ -79,7 +82,7 @@
/* IPv4 Internet address */
typedef uint32 in_addr_t;
typedef uint32_t in_addr_t;
struct in_addr
{
in_addr_t s_addr; /* Address (network byte order) */

View File

@ -41,7 +41,10 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <sched.h>
#include <arch/arch.h>
@ -284,7 +287,7 @@ EXTERN void up_release_pending(void);
*
****************************************************************************/
EXTERN void up_reprioritize_rtr(FAR _TCB *tcb, ubyte priority);
EXTERN void up_reprioritize_rtr(FAR _TCB *tcb, uint8_t priority);
/****************************************************************************
* Name: _exit
@ -383,12 +386,12 @@ EXTERN void up_allocate_heap(FAR void **heap_start, size_t *heap_size);
* Name: up_interrupt_context
*
* Description:
* Return TRUE is we are currently executing in
* Return true is we are currently executing in
* the interrupt handler context.
*
****************************************************************************/
EXTERN boolean up_interrupt_context(void);
EXTERN bool up_interrupt_context(void);
/****************************************************************************
* Name: up_enable_irq

View File

@ -1,7 +1,7 @@
/************************************************************************************
* include/nuttx/can.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,16 +41,19 @@
************************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <semaphore.h>
#include <nuttx/fs.h>
/************************************************************************************
* Definitions
* Pre-processor Definitions
************************************************************************************/
/* Default configuration settings that may be overridden in the board configuration.
* file. The configured size is limited to 255 to fit into a ubyte.
* file. The configured size is limited to 255 to fit into a uint8_t.
*/
#if !defined(CONFIG_CAN_FIFOSIZE)
@ -82,7 +85,7 @@
/* CAN message support */
#define CAN_MAXDATALEN 8
#define CAN_ID(hdr) ((uint16)(hdr) >> 5)
#define CAN_ID(hdr) ((uint16_t)(hdr) >> 5)
#define CAN_RTR(hdr) (((hdr) & 0x0010) != 0)
#define CAN_DLC(hdr) ((hdr) & 0x0f)
#define CAN_MSGLEN(hdr) (sizeof(struct can_msg_s) - (CAN_MAXDATALEN - CAN_DLC(hdr)))
@ -122,8 +125,8 @@
struct can_msg_s
{
uint16 cm_hdr; /* The 16-bit CAN header */
ubyte cm_data[CAN_MAXDATALEN]; /* CAN message data (0-8 byte) */
uint16_t cm_hdr; /* The 16-bit CAN header */
uint8_t cm_data[CAN_MAXDATALEN]; /* CAN message data (0-8 byte) */
};
/* This structure defines a CAN message FIFO. */
@ -131,8 +134,8 @@ struct can_msg_s
struct can_fifo_s
{
sem_t cf_sem; /* Counting semaphore */
ubyte cf_head; /* Index to the head [IN] index in the circular buffer */
ubyte cf_tail; /* Index to the tail [OUT] index in the circular buffer */
uint8_t cf_head; /* Index to the head [IN] index in the circular buffer */
uint8_t cf_tail; /* Index to the tail [OUT] index in the circular buffer */
/* Circular buffer of CAN messages */
struct can_msg_s cf_buffer[CONFIG_CAN_FIFOSIZE];
};
@ -142,7 +145,7 @@ struct can_fifo_s
struct can_rtrwait_s
{
sem_t cr_sem; /* Wait for RTR response */
uint16 cr_id; /* The ID that is waited for */
uint16_t cr_id; /* The ID that is waited for */
FAR struct can_msg_s *cr_msg; /* This is where the RTR reponse goes */
};
@ -176,11 +179,11 @@ struct can_ops_s
/* Call to enable or disable RX interrupts */
CODE void (*co_rxint)(FAR struct can_dev_s *dev, boolean enable);
CODE void (*co_rxint)(FAR struct can_dev_s *dev, bool enable);
/* Call to enable or disable TX interrupts */
CODE void (*co_txint)(FAR struct can_dev_s *dev, boolean enable);
CODE void (*co_txint)(FAR struct can_dev_s *dev, bool enable);
/* All ioctl calls will be routed through this method */
@ -188,19 +191,19 @@ struct can_ops_s
/* Send a remote request */
CODE int (*co_remoterequest)(FAR struct can_dev_s *dev, uint16 id);
CODE int (*co_remoterequest)(FAR struct can_dev_s *dev, uint16_t id);
/* This method will send one message on the CAN */
CODE int (*co_send)(FAR struct can_dev_s *dev, FAR struct can_msg_s *msg);
/* Return TRUE if all message have been sent. If for example, the CAN
/* Return true if all message have been sent. If for example, the CAN
* hardware implements FIFOs, then this would mean the transmit FIFO is
* empty. This method is called when the driver needs to make sure that
* all characters are "drained" from the TX hardware before calling co_shutdown().
*/
CODE boolean (*co_txempty)(FAR struct can_dev_s *dev);
CODE bool (*co_txempty)(FAR struct can_dev_s *dev);
};
/* This is the device structure used by the driver. The caller of
@ -214,8 +217,8 @@ struct can_ops_s
struct can_dev_s
{
ubyte cd_ocount; /* The number of times the device has been opened */
ubyte cd_npendrtr; /* Number of pending RTR messages */
uint8_t cd_ocount; /* The number of times the device has been opened */
uint8_t cd_npendrtr; /* Number of pending RTR messages */
sem_t cd_closesem; /* Locks out new opens while close is in progress */
sem_t cd_recvsem; /* Used to wakeup user waiting for space in cd_recv.buffer */
struct can_fifo_s cd_xmit; /* Describes transmit FIFO */
@ -230,7 +233,7 @@ struct can_dev_s
struct canioctl_rtr_s
{
uint16 ci_id; /* The 11-bit ID to use in the RTR message */
uint16_t ci_id; /* The 11-bit ID to use in the RTR message */
FAR struct can_msg_s *ci_msg; /* The location to return the RTR response */
};
@ -276,7 +279,7 @@ EXTERN int can_register(FAR const char *path, FAR struct can_dev_s *dev);
*
************************************************************************************/
EXTERN int can_receive(FAR struct can_dev_s *dev, uint16 hdr, FAR ubyte *data);
EXTERN int can_receive(FAR struct can_dev_s *dev, uint16_t hdr, FAR uint8_t *data);
/************************************************************************************
* Name: can_txdone

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/clock.h
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,9 +41,10 @@
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
/****************************************************************************
* Definitions
* Pro-processor Definitions
****************************************************************************/
/* Timing constants */
@ -103,7 +104,7 @@
/* Access to raw system clock ***********************************************/
#ifndef CONFIG_DISABLE_CLOCK
extern volatile uint32 g_system_timer;
extern volatile uint32_t g_system_timer;
#endif
/****************************************************************************

View File

@ -1,167 +1,168 @@
/****************************************************************************
* include/nuttx/cs89x0.h
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_CS89x0_H
#define __INCLUDE_NUTTX_CS89x0_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <sys/types.h>
#include <wdog.h>
/****************************************************************************
* Public Types
****************************************************************************/
/* This structure returns driver statistics (if enabled) */
#ifdef CONFIG_C89x0_STATISTICS
struct cs89x0_statistics_s
{
uint32 tx_packets;
uint32 tx_errors;
uint32 tx_carriererrors;
uint32 tx_heartbeaterrors;
uint32 tx_windowerrors;
uint32 tx_abortederrors;
uint32 rx_missederrors;
uint32 rx_packets;
uint32 rx_errors;
uint32 rx_lengtherrors;
uint32 rx_crcerrors;
uint32 rx_frameerrors;
uint32 rx_dropped;
uint32 rx_missederrors;
uint32 collisions;
};
#endif
/* This structure encapsulates all state information for a single hardware
* interface. It includes values that must be provided by the user to in
* to describe details of the CS89x00 implementation on a particular board.
* An instance if this structure is passed to cs89x00 to instantiate the
* driver.
*
* This structure also includes internal driver state information that should
* be of no concern to the caller of cs89x0_initialize(). These fields must
* be zeroed.
*/
struct cs89x0_driver_s
{
/* User-provided CS89x00 platform-specific implementation details. The
* caller of cs89x0_initialize() must provide all of these values.
*/
FAR void *cs_base; /* CS89x0 region base address */
#ifdef CONFIG_CS89x0_MEMMODE
FAR void *cs_ppbase; /* CS89x0 page packet base address */
#endif
ubyte cs_irq; /* CS89x00 IRQ number */
/* Driver internal state fields. These must be zeroed by before the
* instance of this structure is passed to cs89x0_initialize
*/
#ifdef CONFIG_CS89x0_XMITEARLY
ubyte txstart; /* Bits 6-7 of TxCMD controls Tx race */
#endif
boolean cs_memmode; /* TRUE:memory mode FALSE: I/O mode */
boolean cs_bifup; /* TRUE:ifup FALSE:ifdown */
WDOG_ID cs_txpoll; /* TX poll timer */
WDOG_ID cs_txtimeout; /* TX timeout timer */
#ifdef CONFIG_CS89x0_XMITEARLY
uint32 cs_txunderrun; /* Count of Tx underrun errors */
#endif
/* This holds the information visible to uIP/NuttX */
struct uip_driver_s cs_dev; /* Interface understood by uIP */
/* Driver statistics */
#ifdef CONFIG_C89x0_STATISTICS
struct cs89x0_statistics_s cs_stats;
#endif
};
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Function: cs89x0_initialize
*
* Description:
* Initialize the Ethernet driver
*
* Parameters:
* impl - decribes the implementation of the cs89x00 implementation.
* This reference is retained so so must remain stable throughout the
* life of the driver instance.
* devno - Identifies the device number. This must be a number between
* zero CONFIG_CS89x0_NINTERFACES and the same devno must not be
* initialized twice. The associated network device will be referred
* to with the name "eth" followed by this number (eth0, eth1, etc).
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
/* Initialize the CS89x0 chip and driver */
EXTERN int cs89x0_initialize(FAR const cs89x0_driver_s *cs89x0, int devno);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __INCLUDE_NUTTX_CS89x0_H */
/****************************************************************************
* include/nuttx/cs89x0.h
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_CS89x0_H
#define __INCLUDE_NUTTX_CS89x0_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdint.h>
#include <stdbool.h>
#include <wdog.h>
/****************************************************************************
* Public Types
****************************************************************************/
/* This structure returns driver statistics (if enabled) */
#ifdef CONFIG_C89x0_STATISTICS
struct cs89x0_statistics_s
{
uint32_t tx_packets;
uint32_t tx_errors;
uint32_t tx_carriererrors;
uint32_t tx_heartbeaterrors;
uint32_t tx_windowerrors;
uint32_t tx_abortederrors;
uint32_t rx_missederrors;
uint32_t rx_packets;
uint32_t rx_errors;
uint32_t rx_lengtherrors;
uint32_t rx_crcerrors;
uint32_t rx_frameerrors;
uint32_t rx_dropped;
uint32_t rx_missederrors;
uint32_t collisions;
};
#endif
/* This structure encapsulates all state information for a single hardware
* interface. It includes values that must be provided by the user to in
* to describe details of the CS89x00 implementation on a particular board.
* An instance if this structure is passed to cs89x00 to instantiate the
* driver.
*
* This structure also includes internal driver state information that should
* be of no concern to the caller of cs89x0_initialize(). These fields must
* be zeroed.
*/
struct cs89x0_driver_s
{
/* User-provided CS89x00 platform-specific implementation details. The
* caller of cs89x0_initialize() must provide all of these values.
*/
FAR void *cs_base; /* CS89x0 region base address */
#ifdef CONFIG_CS89x0_MEMMODE
FAR void *cs_ppbase; /* CS89x0 page packet base address */
#endif
uint8_t cs_irq; /* CS89x00 IRQ number */
/* Driver internal state fields. These must be zeroed by before the
* instance of this structure is passed to cs89x0_initialize
*/
#ifdef CONFIG_CS89x0_XMITEARLY
uint8_t txstart; /* Bits 6-7 of TxCMD controls Tx race */
#endif
bool cs_memmode; /* true:memory mode false: I/O mode */
bool cs_bifup; /* true:ifup false:ifdown */
WDOG_ID cs_txpoll; /* TX poll timer */
WDOG_ID cs_txtimeout; /* TX timeout timer */
#ifdef CONFIG_CS89x0_XMITEARLY
uint32_t cs_txunderrun; /* Count of Tx underrun errors */
#endif
/* This holds the information visible to uIP/NuttX */
struct uip_driver_s cs_dev; /* Interface understood by uIP */
/* Driver statistics */
#ifdef CONFIG_C89x0_STATISTICS
struct cs89x0_statistics_s cs_stats;
#endif
};
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Function: cs89x0_initialize
*
* Description:
* Initialize the Ethernet driver
*
* Parameters:
* impl - decribes the implementation of the cs89x00 implementation.
* This reference is retained so so must remain stable throughout the
* life of the driver instance.
* devno - Identifies the device number. This must be a number between
* zero CONFIG_CS89x0_NINTERFACES and the same devno must not be
* initialized twice. The associated network device will be referred
* to with the name "eth" followed by this number (eth0, eth1, etc).
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
/* Initialize the CS89x0 chip and driver */
EXTERN int cs89x0_initialize(FAR const cs89x0_driver_s *cs89x0, int devno);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __INCLUDE_NUTTX_CS89x0_H */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/fat.h
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -40,10 +40,10 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
#include <stdint.h>
/****************************************************************************
* Type Definitions
* Pre-processor Definitions
****************************************************************************/
/* File attribute bits in FAT directory entry */
@ -62,7 +62,7 @@
* Type Definitions
****************************************************************************/
typedef ubyte fat_attrib_t;
typedef uint8_t fat_attrib_t;
/****************************************************************************
* Public Function Prototypes

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/fb.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -104,7 +104,7 @@
/* Packed YUV Formats *******************************************************/
#define FB_FMT_AYUV 19 /* BPP=32 Combined YUV and alpha */
#define FB_FMT_CLJR 20 /* BPP=8 4 pixels packed into a uint32.
#define FB_FMT_CLJR 20 /* BPP=8 4 pixels packed into a uint32_t.
* YUV 4:1:1 with l< 8 bits per YUV sample */
#define FB_FMT_CYUV 21 /* BPP=16 UYVY except that height is reversed */
#define FB_FMT_IRAW 22 /* BPP=? Intel uncompressed YUV.
@ -196,7 +196,7 @@ struct fb_videoinfo_s
struct fb_planeinfo_s
{
FAR void *fbmem; /* Start of frame buffer memory */
uint32 fblen; /* Length of frame buffer memory in bytes */
uint32_t fblen; /* Length of frame buffer memory in bytes */
fb_coord_t stride; /* Length of a line in bytes */
uint8_t bpp; /* Bits per pixel */
};

View File

@ -40,10 +40,14 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
#include <semaphore.h>
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <semaphore.h>
/****************************************************************************
* Definitions
****************************************************************************/
@ -76,7 +80,7 @@ struct file_operations
off_t (*seek)(FAR struct file *filp, off_t offset, int whence);
int (*ioctl)(FAR struct file *filp, int cmd, unsigned long arg);
#ifndef CONFIG_DISABLE_POLL
int (*poll)(FAR struct file *filp, struct pollfd *fds, boolean setup);
int (*poll)(FAR struct file *filp, struct pollfd *fds, bool setup);
#endif
/* The two structures need not be common after this point */
@ -87,11 +91,11 @@ struct file_operations
#ifndef CONFIG_DISABLE_MOUNTPOUNT
struct geometry
{
boolean geo_available; /* TRUE: The device is vailable */
boolean geo_mediachanged; /* TRUE: The media has changed since last query */
boolean geo_writeenabled; /* TRUE: It is okay to write to this device */
size_t geo_nsectors; /* Number of sectors on the device */
size_t geo_sectorsize; /* Size of one sector */
bool geo_available; /* true: The device is vailable */
bool geo_mediachanged; /* true: The media has changed since last query */
bool geo_writeenabled; /* true: It is okay to write to this device */
size_t geo_nsectors; /* Number of sectors on the device */
size_t geo_sectorsize; /* Size of one sector */
};
/* This structure is provided by block devices when they register with the
@ -201,8 +205,8 @@ struct inode
{
FAR struct inode *i_peer; /* Pointer to same level inode */
FAR struct inode *i_child; /* Pointer to lower level inode */
sint16 i_crefs; /* References to inode */
uint16 i_flags; /* Flags for inode */
int16_t i_crefs; /* References to inode */
uint16_t i_flags; /* Flags for inode */
union inode_ops_u u; /* Inode operations */
#ifdef CONFIG_FILE_MODE
mode_t i_mode; /* Access mode flags */
@ -230,8 +234,8 @@ struct file
#if CONFIG_NFILE_DESCRIPTORS > 0
struct filelist
{
sem_t fl_sem; /* Manage access to the file list */
sint16 fl_crefs; /* Reference count */
sem_t fl_sem; /* Manage access to the file list */
int16_t fl_crefs; /* Reference count */
struct file fl_files[CONFIG_NFILE_DESCRIPTORS];
};
#endif
@ -268,7 +272,7 @@ struct file_struct
int fs_filedes; /* File descriptor associated with stream */
mode_t fs_oflags; /* Open mode flags */
#if CONFIG_NUNGET_CHARS > 0
uint8 fs_nungotten; /* The number of characters buffered for ungetc */
uint8_t fs_nungotten; /* The number of characters buffered for ungetc */
unsigned char fs_ungotten[CONFIG_NUNGET_CHARS];
#endif
#if CONFIG_STDIO_BUFFER_SIZE > 0
@ -402,8 +406,8 @@ EXTERN void devzero_register(void);
* as a block device.
*/
EXTERN int losetup(const char *devname, const char *filename, uint16 sectsize,
off_t offset, boolean readonly);
EXTERN int losetup(const char *devname, const char *filename, uint16_t sectsize,
off_t offset, bool readonly);
EXTERN int loteardown(const char *devname);
/* Setup so that the block driver referenced by 'blkdev' can be accessed
@ -412,14 +416,14 @@ EXTERN int loteardown(const char *devname);
* Access via a character device:
*/
EXTERN int bchdev_register(const char *blkdev, const char *chardev, boolean readonly);
EXTERN int bchdev_register(const char *blkdev, const char *chardev, bool readonly);
EXTERN int bchdev_unregister(const char *chardev);
/* Low level, direct access. NOTE: low-level access and character driver access
* are incompatible. One and only one access method should be implemented.
*/
EXTERN int bchlib_setup(const char *blkdev, boolean readonly, FAR void **handle);
EXTERN int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle);
EXTERN int bchlib_teardown(FAR void *handle);
EXTERN ssize_t bchlib_read(FAR void *handle, FAR char *buffer, size_t offset, size_t len);
EXTERN ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset, size_t len);

View File

@ -41,10 +41,11 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/* I2C address calculation. Convert 7- and 10-bit address to 8-bit and
@ -160,10 +161,10 @@
struct i2c_dev_s;
struct i2c_ops_s
{
uint32 (*setfrequency)(FAR struct i2c_dev_s *dev, uint32 frequency);
uint32_t (*setfrequency)(FAR struct i2c_dev_s *dev, uint32_t frequency);
int (*setaddress)(FAR struct i2c_dev_s *dev, int addr, int nbits);
int (*write)(FAR struct i2c_dev_s *dev, const ubyte *buffer, int buflen);
int (*read)(FAR struct i2c_dev_s *dev, ubyte *buffer, int buflen);
int (*write)(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int buflen);
int (*read)(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen);
};
/* I2C private data. This structure only defines the initial fields of the

View File

@ -41,13 +41,12 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/* Each NuttX ioctl commands are uint16's consisting of an 8-bit type
/* Each NuttX ioctl commands are uint16_t's consisting of an 8-bit type
* identifier and an 8-bit command number. All comman type identifiers are
* defined below:
*/

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/irq.h
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,7 +41,6 @@
****************************************************************************/
#ifndef __ASSEMBLY__
# include <sys/types.h>
# include <assert.h>
#endif
@ -61,8 +60,7 @@
#ifndef __ASSEMBLY__
typedef int (*xcpt_t)(int irq, FAR void *context);
typedef int (*swint_t)(int code, int parm2, int parm3,
FAR void *context);
typedef int (*swint_t)(int code, int parm2, int parm3, FAR void *context);
#endif
/* Now include architecture-specific types */

View File

@ -41,7 +41,6 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
/****************************************************************************
* Pre-Processor Definitions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/mkfat.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,10 +41,10 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
#define MKFATFS_DEFAULT_NFATS 2 /* 2: Default number of FATs */
@ -82,16 +82,16 @@
struct fat_format_s
{
ubyte ff_nfats; /* Number of FATs */
ubyte ff_fattype; /* FAT size: 0 (autoselect), 12, 16, or 32 */
ubyte ff_clustshift; /* Log2 of sectors per cluster: 0-5, 0xff (autoselect) */
ubyte ff_volumelabel[11]; /* Volume label */
uint16 ff_backupboot; /* Sector number of the backup boot sector (0=use default)*/
uint16 ff_rootdirentries; /* Number of root directory entries */
uint16 ff_rsvdseccount; /* Reserved sectors */
uint32 ff_hidsec; /* Count of hidden sectors preceding fat */
uint32 ff_volumeid; /* FAT volume id */
uint32 ff_nsectors; /* Number of sectors from device to use: 0: Use all */
uint8_t ff_nfats; /* Number of FATs */
uint8_t ff_fattype; /* FAT size: 0 (autoselect), 12, 16, or 32 */
uint8_t ff_clustshift; /* Log2 of sectors per cluster: 0-5, 0xff (autoselect) */
uint8_t ff_volumelabel[11]; /* Volume label */
uint16_t ff_backupboot; /* Sector number of the backup boot sector (0=use default)*/
uint16_t ff_rootdirentries; /* Number of root directory entries */
uint16_t ff_rsvdseccount; /* Reserved sectors */
uint32_t ff_hidsec; /* Count of hidden sectors preceding fat */
uint32_t ff_volumeid; /* FAT volume id */
uint32_t ff_nsectors; /* Number of sectors from device to use: 0: Use all */
};
/****************************************************************************

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/mm.h
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,6 +41,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
/****************************************************************************
* Pre-Processor Definitions

View File

@ -41,7 +41,6 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
/****************************************************************************
* Pre-Processor Definitions

View File

@ -42,7 +42,9 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
/****************************************************************************
* Pre-Processor Definitions
@ -68,8 +70,8 @@
struct mtd_geometry_s
{
uint16 blocksize; /* Size of one read/write block */
uint16 erasesize; /* Size of one erase blocks -- must be a multiple
uint16_t blocksize; /* Size of one read/write block */
uint16_t erasesize; /* Size of one erase blocks -- must be a multiple
* of blocksize. */
size_t neraseblocks; /* Number of erase blocks */
};
@ -90,9 +92,9 @@ struct mtd_dev_s
/* Read/write from the specified read/write blocks */
ssize_t (*bread)(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks,
FAR ubyte *buffer);
FAR uint8_t *buffer);
ssize_t (*bwrite)(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks,
FAR const ubyte *buffer);
FAR const uint8_t *buffer);
/* Some devices may support byte oriented reads (optional). Most MTD devices
* are inherently block oriented so byte-oriented writing is not supported. It
@ -101,7 +103,7 @@ struct mtd_dev_s
*/
ssize_t (*read)(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes,
FAR ubyte *buffer);
FAR uint8_t *buffer);
/* Support other, less frequently used commands:
* - MTDIOC_GEOMETRY: Get MTD geometry
@ -138,7 +140,7 @@ extern "C" {
*
****************************************************************************/
EXTERN int ftl_initialize(int minor, ubyte *buffer, FAR struct mtd_dev_s *mtd);
EXTERN int ftl_initialize(int minor, uint8_t *buffer, FAR struct mtd_dev_s *mtd);
/************************************************************************************
* Name: m25p_initialize

View File

@ -44,6 +44,7 @@
#ifdef CONFIG_NET
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <semaphore.h>
@ -104,8 +105,8 @@ struct socket
#if CONFIG_NSOCKET_DESCRIPTORS > 0
struct socketlist
{
sem_t sl_sem; /* Manage access to the socket list */
sint16 sl_crefs; /* Reference count */
sem_t sl_sem; /* Manage access to the socket list */
int16_t sl_crefs; /* Reference count */
struct socket sl_sockets[CONFIG_NSOCKET_DESCRIPTORS];
};
#endif
@ -162,7 +163,7 @@ EXTERN int netdev_ioctl(int sockfd, int cmd, struct ifreq *req);
#ifndef CONFIG_DISABLE_POLL
struct pollfd; /* Forward reference -- see poll.h */
EXTERN int net_poll(int sockfd, struct pollfd *fds, boolean setup);
EXTERN int net_poll(int sockfd, struct pollfd *fds, bool setup);
#endif
/* net_dup.c *****************************************************************/

View File

@ -41,7 +41,9 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <nuttx/fb.h>
#include <nuttx/nxglib.h>
@ -100,7 +102,7 @@ struct nx_callback_s
* hwnd - Window handle
* rect - The rectangle that needs to be re-drawn (in window relative
* coordinates)
* more - TRUE: More re-draw requests will follow
* more - true: More re-draw requests will follow
* arg - User provided argument (see nx_openwindow, nx_constructwindow)
*
* Returned Value:
@ -109,7 +111,7 @@ struct nx_callback_s
**************************************************************************/
void (*redraw)(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
boolean more, FAR void *arg);
bool more, FAR void *arg);
/**************************************************************************
* Name: position
@ -156,7 +158,7 @@ struct nx_callback_s
#ifdef CONFIG_NX_MOUSE
void (*mousein)(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos,
ubyte buttons, FAR void *arg);
uint8_t buttons, FAR void *arg);
#endif
/**************************************************************************
@ -177,7 +179,7 @@ struct nx_callback_s
**************************************************************************/
#ifdef CONFIG_NX_KBD
void (*kbdin)(NXWINDOW hwnd, ubyte nch, FAR const ubyte *ch, FAR void *arg);
void (*kbdin)(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, FAR void *arg);
#endif
};
@ -685,8 +687,8 @@ EXTERN int nx_bitmap(NXWINDOW hwnd, FAR const struct nxgl_rect_s *dest,
****************************************************************************/
#ifdef CONFIG_NX_KBD
EXTERN int nx_kbdchin(NXHANDLE handle, ubyte ch);
EXTERN int nx_kbdin(NXHANDLE handle, ubyte nch, FAR const ubyte *ch);
EXTERN int nx_kbdchin(NXHANDLE handle, uint8_t ch);
EXTERN int nx_kbdin(NXHANDLE handle, uint8_t nch, FAR const uint8_t *ch);
#endif
/****************************************************************************
@ -700,7 +702,7 @@ EXTERN int nx_kbdin(NXHANDLE handle, ubyte nch, FAR const ubyte *ch);
****************************************************************************/
#ifdef CONFIG_NX_MOUSE
EXTERN int nx_mousein(NXHANDLE handle, nxgl_coord_t x, nxgl_coord_t y, ubyte buttons);
EXTERN int nx_mousein(NXHANDLE handle, nxgl_coord_t x, nxgl_coord_t y, uint8_t buttons);
#endif
#undef EXTERN

View File

@ -41,6 +41,8 @@
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <nxflat.h>
#include <nuttx/sched.h>
@ -63,9 +65,9 @@ struct nxflat_loadinfo_s
* text section instance in the system for each module.
*/
uint32 ispace; /* Address where hdr/text is loaded */
uint32 entryoffs; /* Offset from ispace to entry point */
uint32 isize; /* Size of ispace. */
uint32_t ispace; /* Address where hdr/text is loaded */
uint32_t entryoffs; /* Offset from ispace to entry point */
uint32_t isize; /* Size of ispace. */
/* Data Space (DSpace): This region contains all information that in referenced
* as data (other than the stack which is separately allocated). There will be
@ -73,15 +75,15 @@ struct nxflat_loadinfo_s
*/
struct dspace_s *dspace; /* Allocated D-Space (data/bss/etc) */
uint32 datasize; /* Size of data segment in dspace */
uint32 bsssize; /* Size of bss segment in dspace */
uint32 stacksize; /* Size of stack (not allocated) */
uint32 dsize; /* Size of dspace (may be large than parts) */
uint32_t datasize; /* Size of data segment in dspace */
uint32_t bsssize; /* Size of bss segment in dspace */
uint32_t stacksize; /* Size of stack (not allocated) */
uint32_t dsize; /* Size of dspace (may be large than parts) */
/* This is temporary memory where relocation records will be loaded. */
uint32 relocstart; /* Start of array of struct flat_reloc */
uint16 reloccount; /* Number of elements in reloc array */
uint32_t relocstart; /* Start of array of struct flat_reloc */
uint16_t reloccount; /* Number of elements in reloc array */
/* File descriptors */
@ -137,7 +139,7 @@ EXTERN int nxflat_verifyheader(const struct nxflat_hdr_s *header);
***********************************************************************/
EXTERN int nxflat_init(const char *filename,
struct nxflat_loadinfo_s *loadinfo);
struct nxflat_loadinfo_s *loadinfo);
/***********************************************************************
* Name: nxflat_uninit

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/nxfonts.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,7 +41,8 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <nuttx/nxglib.h>
/****************************************************************************
@ -56,12 +57,12 @@
struct nx_fontmetic_s
{
uint32 stride : 2; /* Width of one font row in bytes */
uint32 width : 6; /* Width of the font in bits */
uint32 height : 6; /* Height of the font in rows */
uint32 xoffset : 6; /* Top, left-hand corner X-offset in pixels */
uint32 yoffset : 6; /* Top, left-hand corner y-offset in pixels */
uint32 unused : 6;
uint32_t stride : 2; /* Width of one font row in bytes */
uint32_t width : 6; /* Width of the font in bits */
uint32_t height : 6; /* Height of the font in rows */
uint32_t xoffset : 6; /* Top, left-hand corner X-offset in pixels */
uint32_t yoffset : 6; /* Top, left-hand corner y-offset in pixels */
uint32_t unused : 6;
};
/* This structure binds the glyph metrics to the glyph bitmap */
@ -69,7 +70,7 @@ struct nx_fontmetic_s
struct nx_fontbitmap_s
{
struct nx_fontmetic_s metric; /* Character metrics */
FAR const ubyte *bitmap; /* Pointer to the character bitmap */
FAR const uint8_t *bitmap; /* Pointer to the character bitmap */
};
/* This structure describes one contiguous grouping of glyphs that
@ -79,8 +80,8 @@ struct nx_fontbitmap_s
struct nx_fontset_s
{
ubyte first; /* First bitmap character code */
ubyte nchars; /* Number of bitmap character codes */
uint8_t first; /* First bitmap character code */
uint8_t nchars; /* Number of bitmap character codes */
FAR const struct nx_fontbitmap_s *bitmap;
};
@ -88,10 +89,10 @@ struct nx_fontset_s
struct nx_font_s
{
ubyte mxheight; /* Max height of one glyph in rows */
ubyte mxwidth; /* Max width of any glyph in pixels */
ubyte mxbits; /* Max number of bits per character code */
ubyte spwidth; /* The width of a space in pixels */
uint8_t mxheight; /* Max height of one glyph in rows */
uint8_t mxwidth; /* Max width of any glyph in pixels */
uint8_t mxbits; /* Max number of bits per character code */
uint8_t spwidth; /* The width of a space in pixels */
};
/****************************************************************************
@ -137,7 +138,7 @@ EXTERN FAR const struct nx_font_s *nxf_getfontset(void);
*
****************************************************************************/
EXTERN FAR const struct nx_fontbitmap_s *nxf_getbitmap(uint16 ch);
EXTERN FAR const struct nx_fontbitmap_s *nxf_getbitmap(uint16_t ch);
/****************************************************************************
* Name: nxf_convert_*bpp
@ -160,28 +161,28 @@ EXTERN FAR const struct nx_fontbitmap_s *nxf_getbitmap(uint16 ch);
*
****************************************************************************/
EXTERN int nxf_convert_2bpp(FAR ubyte *dest, uint16 height,
uint16 width, uint16 stride,
EXTERN int nxf_convert_2bpp(FAR uint8_t *dest, uint16_t height,
uint16_t width, uint16_t stride,
FAR const struct nx_fontbitmap_s *bm,
nxgl_mxpixel_t color);
EXTERN int nxf_convert_4bpp(FAR ubyte *dest, uint16 height,
uint16 width, uint16 stride,
EXTERN int nxf_convert_4bpp(FAR uint8_t *dest, uint16_t height,
uint16_t width, uint16_t stride,
FAR const struct nx_fontbitmap_s *bm,
nxgl_mxpixel_t color);
EXTERN int nxf_convert_8bpp(FAR ubyte *dest, uint16 height,
uint16 width, uint16 stride,
EXTERN int nxf_convert_8bpp(FAR uint8_t *dest, uint16_t height,
uint16_t width, uint16_t stride,
FAR const struct nx_fontbitmap_s *bm,
nxgl_mxpixel_t color);
EXTERN int nxf_convert_16bpp(FAR uint16 *dest, uint16 height,
uint16 width, uint16 stride,
EXTERN int nxf_convert_16bpp(FAR uint16_t *dest, uint16_t height,
uint16_t width, uint16_t stride,
FAR const struct nx_fontbitmap_s *bm,
nxgl_mxpixel_t color);
EXTERN int nxf_convert_24bpp(FAR uint32 *dest, uint16 height,
uint16 width, uint16 stride,
EXTERN int nxf_convert_24bpp(FAR uint32_t *dest, uint16_t height,
uint16_t width, uint16_t stride,
FAR const struct nx_fontbitmap_s *bm,
nxgl_mxpixel_t color);
EXTERN int nxf_convert_32bpp(FAR uint32 *dest, uint16 height,
uint16 width, uint16 stride,
EXTERN int nxf_convert_32bpp(FAR uint32_t *dest, uint16_t height,
uint16_t width, uint16_t stride,
FAR const struct nx_fontbitmap_s *bm,
nxgl_mxpixel_t color);

View File

@ -41,7 +41,9 @@
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <fixedmath.h>
#include <nuttx/fb.h>
@ -97,7 +99,7 @@ typedef uint8_t nxgl_mxpixel_t;
* to change:
*/
typedef sint16 nxgl_coord_t;
typedef int16_t nxgl_coord_t;
/* Describes a point on the display */
@ -171,7 +173,8 @@ extern "C" {
*
****************************************************************************/
EXTERN void nxgl_rgb2yuv(ubyte r, ubyte g, ubyte b, ubyte *y, ubyte *u, ubyte *v);
EXTERN void nxgl_rgb2yuv(uint8_t r, uint8_t g, uint8_t b,
uint8_t *y, uint8_t *u, uint8_t *v);
/****************************************************************************
* Name: nxgl_yuv2rgb
@ -181,7 +184,8 @@ EXTERN void nxgl_rgb2yuv(ubyte r, ubyte g, ubyte b, ubyte *y, ubyte *u, ubyte *v
*
****************************************************************************/
EXTERN void nxgl_yuv2rgb(ubyte y, ubyte u, ubyte v, ubyte *r, ubyte *g, ubyte *b);
EXTERN void nxgl_yuv2rgb(uint8_t y, uint8_t u, uint8_t v,
uint8_t *r, uint8_t *g, uint8_t *b);
/* Rasterizers **************************************************************/
@ -421,23 +425,23 @@ EXTERN void nxgl_nonintersecting(FAR struct nxgl_rect_s result[4],
* Name: nxgl_rectoverlap
*
* Description:
* Return TRUE if the two rectangles overlap
* Return true if the two rectangles overlap
*
****************************************************************************/
EXTERN boolean nxgl_rectoverlap(FAR struct nxgl_rect_s *rect1,
FAR struct nxgl_rect_s *rect2);
EXTERN bool nxgl_rectoverlap(FAR struct nxgl_rect_s *rect1,
FAR struct nxgl_rect_s *rect2);
/****************************************************************************
* Name: nxgl_rectinside
*
* Description:
* Return TRUE if the point pt lies within rect.
* Return true if the point pt lies within rect.
*
****************************************************************************/
EXTERN boolean nxgl_rectinside(FAR const struct nxgl_rect_s *rect,
FAR const struct nxgl_point_s *pt);
EXTERN bool nxgl_rectinside(FAR const struct nxgl_rect_s *rect,
FAR const struct nxgl_point_s *pt);
/****************************************************************************
* Name: nxgl_rectsize
@ -454,11 +458,11 @@ EXTERN void nxgl_rectsize(FAR struct nxgl_size_s *size,
* Name: nxgl_nullrect
*
* Description:
* Return TRUE if the area of the retangle is <= 0.
* Return true if the area of the retangle is <= 0.
*
****************************************************************************/
EXTERN boolean nxgl_nullrect(FAR const struct nxgl_rect_s *rect);
EXTERN bool nxgl_nullrect(FAR const struct nxgl_rect_s *rect);
/****************************************************************************
* Name: nxgl_runoffset

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/nxtk.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,7 +41,6 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/nx.h>

View File

@ -1,7 +1,7 @@
/****************************************************************************
* nuttx/ramdisk.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,13 +41,14 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
/****************************************************************************
* Type Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Type Definitions
****************************************************************************/
@ -68,17 +69,17 @@ extern "C" {
* minor: Selects suffix of device named /dev/ramN, N={1,2,3...}
* nsectors: Number of sectors on device
* sectize: The size of one sector
* writeenabled: TRUE: can write to ram disk
* writeenabled: true: can write to ram disk
* buffer: RAM disk backup memory
*/
#ifdef CONFIG_FS_WRITABLE
EXTERN int ramdisk_register(int minor, ubyte *buffer, uint32 nsectors,
uint16 sectize, boolean writeenabled);
EXTERN int ramdisk_register(int minor, uint8_t *buffer, uint32_t nsectors,
uint16_t sectize, bool writeenabled);
#define romdisk_register(m,b,n,s) ramdisk_register(m,b,n,s,0)
#else
EXTERN int romdisk_register(int minor, ubyte *buffer, uint32 nsectors,
uint16 sectize);
EXTERN int romdisk_register(int minor, uint8_t *buffer, uint32_t nsectors,
uint16_t sectize);
#endif
#undef EXTERN

View File

@ -45,8 +45,9 @@
**********************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <sys/types.h>
#include <stdint.h>
#include <semaphore.h>
#include <nuttx/wqueue.h>
@ -65,9 +66,9 @@
* reload the read-ahead buffer, when appropriate.
*/
typedef ssize_t (*rwbreload_t)(FAR void *dev, FAR ubyte *buffer,
typedef ssize_t (*rwbreload_t)(FAR void *dev, FAR uint8_t *buffer,
off_t startblock, size_t nblocks);
typedef ssize_t (*rwbflush_t)(FAR void *dev, FAR const ubyte *buffer,
typedef ssize_t (*rwbflush_t)(FAR void *dev, FAR const uint8_t *buffer,
off_t startblock, size_t nblocks);
/* This structure holds the state of the buffers. In typical usage,
@ -104,7 +105,7 @@ struct rwbuffer_s
/* Supported geometry */
uint16 blocksize; /* The size of one block */
uint16_t blocksize; /* The size of one block */
size_t nblocks; /* The total number blocks supported */
FAR void *dev; /* Device state passed to callout functions */
@ -114,7 +115,7 @@ struct rwbuffer_s
*/
#ifdef CONFIG_FS_WRITEBUFFER
uint16 wrmaxblocks; /* The number of blocks to buffer in memory */
uint16_t wrmaxblocks; /* The number of blocks to buffer in memory */
rwbflush_t wrflush; /* Callout to flush the write buffer */
#endif
@ -124,7 +125,7 @@ struct rwbuffer_s
*/
#ifdef CONFIG_FS_READAHEAD
uint16 rhmaxblocks; /* The number of blocks to buffer in memory */
uint16_t rhmaxblocks; /* The number of blocks to buffer in memory */
rwbreload_t rhreload; /* Callout to reload the read-ahead buffer */
#endif
@ -136,8 +137,8 @@ struct rwbuffer_s
#ifdef CONFIG_FS_WRITEBUFFER
sem_t wrsem; /* Enforces exclusive access to the write buffer */
struct work_s work; /* Delayed work to flush buffer after adelay with no activity */
ubyte *wrbuffer; /* Allocated write buffer */
uint16 wrnblocks; /* Number of blocks in write buffer */
uint8_t *wrbuffer; /* Allocated write buffer */
uint16_t wrnblocks; /* Number of blocks in write buffer */
off_t wrblockstart; /* First block in write buffer */
off_t wrexpectedblock; /* Next block expected */
#endif
@ -146,8 +147,8 @@ struct rwbuffer_s
#ifdef CONFIG_FS_READAHEAD
sem_t rhsem; /* Enforces exclusive access to the write buffer */
ubyte *rhbuffer; /* Allocated read-ahead buffer */
uint16 rhnblocks; /* Number of blocks in read-ahead buffer */
uint8_t *rhbuffer; /* Allocated read-ahead buffer */
uint16_t rhnblocks; /* Number of blocks in read-ahead buffer */
off_t rhblockstart; /* First block in read-ahead buffer */
#endif
};
@ -176,10 +177,10 @@ EXTERN void rwb_uninitialize(FAR struct rwbuffer_s *rwb);
/* Buffer transfers */
EXTERN ssize_t rwb_read(FAR struct rwbuffer_s *rwb, off_t startblock,
size_t blockcount, FAR ubyte *rdbuffer);
size_t blockcount, FAR uint8_t *rdbuffer);
EXTERN ssize_t rwb_write(FAR struct rwbuffer_s *rwb,
off_t startblock, size_t blockcount,
FAR const ubyte *wrbuffer);
FAR const uint8_t *wrbuffer);
EXTERN int rwb_mediaremoved(FAR struct rwbuffer_s *rwb);
#undef EXTERN

View File

@ -41,17 +41,21 @@
********************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <queue.h>
#include <signal.h>
#include <semaphore.h>
#include <pthread.h>
#include <mqueue.h>
#include <time.h>
#include <nuttx/irq.h>
#include <nuttx/net.h>
/********************************************************************************
* Definitions
* Pre-processor Definitions
********************************************************************************/
/* Task Management Definitins ***************************************************/
@ -77,7 +81,7 @@
/* This is the type of the task_state field of the TCB. NOTE: the order and
* content of this enumeration is critical since there are some OS tables indexed
* by these values. The range of values is assumed to fit into a ubyte in _TCB.
* by these values. The range of values is assumed to fit into a uint8_t in _TCB.
*/
enum tstate_e
@ -165,10 +169,9 @@ typedef struct environ_s environ_t;
struct dspace_s
{
uint32 crefs; /* This is the number of pthreads that shared the
* the same D-Space.
*/
ubyte region[1]; /* Beginning of the allocated region */
uint32_t crefs; /* This is the number of pthreads that shared the
* the same D-Space */
uint8_t region[1]; /* Beginning of the allocated region */
};
#define SIZEOF_DSPACE_S(n) (sizeof(struct dspace_s) - 1 + (n))
@ -188,17 +191,17 @@ struct _TCB
start_t start; /* Thread start function */
entry_t entry; /* Entry Point into the thread */
exitfunc_t exitfunc; /* Called if exit is called. */
ubyte sched_priority; /* Current priority of the thread */
uint8_t sched_priority; /* Current priority of the thread */
#ifdef CONFIG_PRIORITY_INHERITANCE
# if CONFIG_SEM_NNESTPRIO > 0
ubyte npend_reprio; /* Number of nested reprioritizations */
ubyte pend_reprios[CONFIG_SEM_NNESTPRIO];
uint8_t npend_reprio; /* Number of nested reprioritizations */
uint8_t pend_reprios[CONFIG_SEM_NNESTPRIO];
# endif
ubyte base_priority; /* "Normal" priority of the thread */
uint8_t base_priority; /* "Normal" priority of the thread */
#endif
ubyte task_state; /* Current state of the thread */
uint16 flags; /* Misc. general status flags */
sint16 lockcount; /* 0=preemptable (not-locked) */
uint8_t task_state; /* Current state of the thread */
uint16_t flags; /* Misc. general status flags */
int16_t lockcount; /* 0=preemptable (not-locked) */
#ifndef CONFIG_DISABLE_PTHREAD
FAR void *joininfo; /* Detach-able info to support join */
#endif
@ -208,7 +211,7 @@ struct _TCB
/* Values needed to restart a task ********************************************/
ubyte init_priority; /* Initial priority of the task */
uint8_t init_priority; /* Initial priority of the task */
char *argv[CONFIG_MAX_TASK_ARGS+1]; /* Name+start-up parameters */
#ifndef CONFIG_DISABLE_ENVIRON
FAR environ_t *envp; /* Environment variables */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/scsi.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* References:
@ -54,7 +54,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
/****************************************************************************
* Pre-Processor Definitions
@ -638,38 +638,38 @@
struct scsicmd_requestsense_s
{
ubyte opcode; /* 0: 0x03 */
ubyte flags; /* 1: See SCSICMD_REQUESTSENSE_FLAGS_* */
ubyte reserved[2]; /* 2-3: Reserved */
ubyte alloclen; /* 4: Allocation length */
ubyte control; /* 5: Control */
uint8_t opcode; /* 0: 0x03 */
uint8_t flags; /* 1: See SCSICMD_REQUESTSENSE_FLAGS_* */
uint8_t reserved[2]; /* 2-3: Reserved */
uint8_t alloclen; /* 4: Allocation length */
uint8_t control; /* 5: Control */
};
#define SCSICMD_REQUESTSENSE_SIZEOF 6
#define SCSICMD_REQUESTSENSE_MSSIZEOF 12 /* MS-Windows REQUEST SENSE with cbw->cdblen == 12 */
struct scsiresp_fixedsensedata_s
{
ubyte code; /* 0: Response code See SCSIRESP_SENSEDATA_*FIXED defns */
ubyte obsolete; /* 1: */
ubyte flags; /* 2: See SCSIRESP_SENSEDATA_* definitions */
ubyte info[4]; /* 3-6: Information */
ubyte len; /* 7: Additional length */
ubyte cmdinfo[4]; /* 8-11: Command-specific information */
ubyte code2; /* 12: Additional sense code */
ubyte qual2; /* 13: Additional sense code qualifier */
ubyte fru; /* 14: Field replacement unit code */
ubyte key[3]; /* 15-17: Sense key specific */
/* 18-: Additional bytes may follow */
uint8_t code; /* 0: Response code See SCSIRESP_SENSEDATA_*FIXED defns */
uint8_t obsolete; /* 1: */
uint8_t flags; /* 2: See SCSIRESP_SENSEDATA_* definitions */
uint8_t info[4]; /* 3-6: Information */
uint8_t len; /* 7: Additional length */
uint8_t cmdinfo[4]; /* 8-11: Command-specific information */
uint8_t code2; /* 12: Additional sense code */
uint8_t qual2; /* 13: Additional sense code qualifier */
uint8_t fru; /* 14: Field replacement unit code */
uint8_t key[3]; /* 15-17: Sense key specific */
/* 18-: Additional bytes may follow */
};
#define SCSIRESP_FIXEDSENSEDATA_SIZEOF 18 /* Minimum size */
struct scscicmd_inquiry_s
{
ubyte opcode; /* 0: 0x12 */
ubyte flags; /* 1: See SCSICMD_INQUIRY_FLAGS_* */
ubyte pagecode; /* 2: Page code */
ubyte alloclen[2]; /* 3-4: Allocation length */
ubyte control; /* 5: Control */
uint8_t opcode; /* 0: 0x12 */
uint8_t flags; /* 1: See SCSICMD_INQUIRY_FLAGS_* */
uint8_t pagecode; /* 2: Page code */
uint8_t alloclen[2]; /* 3-4: Allocation length */
uint8_t control; /* 5: Control */
};
#define SCSICMD_INQUIRY_SIZEOF 6
@ -677,155 +677,155 @@ struct scsiresp_inquiry_s
{
/* Mandatory */
ubyte qualtype; /* 0: Bits 5-7: Peripheral qualifier; Bits 0-4: Peripheral device type */
ubyte flags1; /* 1: See SCSIRESP_INQUIRY_FLAGS1_* */
ubyte version; /* 2: Version */
ubyte flags2; /* 3: See SCSIRESP_INQUIRY_FLAGS2_* */
ubyte len; /* 4: Additional length */
ubyte flags3; /* 5: See SCSIRESP_INQUIRY_FLAGS3_* */
ubyte flags4; /* 6: See SCSIRESP_INQUIRY_FLAGS4_* */
ubyte flags5; /* 7: See SCSIRESP_INQUIRY_FLAGS5_* */
ubyte vendorid[8]; /* 8-15: T10 Vendor Identification */
ubyte productid[16]; /* 16-31: Product Identification */
ubyte revision[4]; /* 32-35: Product Revision Level */
uint8_t qualtype; /* 0: Bits 5-7: Peripheral qualifier; Bits 0-4: Peripheral device type */
uint8_t flags1; /* 1: See SCSIRESP_INQUIRY_FLAGS1_* */
uint8_t version; /* 2: Version */
uint8_t flags2; /* 3: See SCSIRESP_INQUIRY_FLAGS2_* */
uint8_t len; /* 4: Additional length */
uint8_t flags3; /* 5: See SCSIRESP_INQUIRY_FLAGS3_* */
uint8_t flags4; /* 6: See SCSIRESP_INQUIRY_FLAGS4_* */
uint8_t flags5; /* 7: See SCSIRESP_INQUIRY_FLAGS5_* */
uint8_t vendorid[8]; /* 8-15: T10 Vendor Identification */
uint8_t productid[16]; /* 16-31: Product Identification */
uint8_t revision[4]; /* 32-35: Product Revision Level */
/* Optional */
ubyte vendor[20]; /* 36-55: Vendor specific */
ubyte flags6; /* 56: See SCSIRESP_INQUIRY_FLAGS6_* */
ubyte reserved1; /* 57: Reserved */
ubyte version1[2]; /* 58-59: Version Descriptor 1 */
ubyte version2[2]; /* 60-61: Version Descriptor 2 */
ubyte version3[2]; /* 62-63: Version Descriptor 3 */
ubyte version4[2]; /* 64-65: Version Descriptor 4 */
ubyte version5[2]; /* 66-67: Version Descriptor 5 */
ubyte version6[2]; /* 68-69: Version Descriptor 6 */
ubyte version7[2]; /* 70-71: Version Descriptor 7 */
ubyte version8[2]; /* 72-73: Version Descriptor 8 */
ubyte reserved2[22]; /* 74-95: Reserved */
uint8_t vendor[20]; /* 36-55: Vendor specific */
uint8_t flags6; /* 56: See SCSIRESP_INQUIRY_FLAGS6_* */
uint8_t reserved1; /* 57: Reserved */
uint8_t version1[2]; /* 58-59: Version Descriptor 1 */
uint8_t version2[2]; /* 60-61: Version Descriptor 2 */
uint8_t version3[2]; /* 62-63: Version Descriptor 3 */
uint8_t version4[2]; /* 64-65: Version Descriptor 4 */
uint8_t version5[2]; /* 66-67: Version Descriptor 5 */
uint8_t version6[2]; /* 68-69: Version Descriptor 6 */
uint8_t version7[2]; /* 70-71: Version Descriptor 7 */
uint8_t version8[2]; /* 72-73: Version Descriptor 8 */
uint8_t reserved2[22]; /* 74-95: Reserved */
/* 96-: Vendor-specific parameters may follow */
};
#define SCSIRESP_INQUIRY_SIZEOF 36 /* Minimum size */
struct scsicmd_modeselect6_s
{
ubyte opcode; /* 0x15 */
ubyte flags; /* 1: See SCSICMD_MODESELECT6_FLAGS_* */
ubyte reserved[2]; /* 2-3: Reserved */
ubyte plen; /* 4: Parameter list length */
ubyte control; /* 5: Control */
uint8_t opcode; /* 0x15 */
uint8_t flags; /* 1: See SCSICMD_MODESELECT6_FLAGS_* */
uint8_t reserved[2]; /* 2-3: Reserved */
uint8_t plen; /* 4: Parameter list length */
uint8_t control; /* 5: Control */
};
#define SCSICMD_MODESELECT6_SIZEOF 6
struct scsicmd_modesense6_s
{
ubyte opcode; /* 0x1a */
ubyte flags; /* 1: See SCSICMD_MODESENSE6_FLAGS_* */
ubyte pcpgcode; /* 2: Bits 6-7: PC, bits 0-5: page code */
ubyte subpgcode; /* 3: subpage code */
ubyte alloclen; /* 4: Allocation length */
ubyte control; /* 5: Control */
uint8_t opcode; /* 0x1a */
uint8_t flags; /* 1: See SCSICMD_MODESENSE6_FLAGS_* */
uint8_t pcpgcode; /* 2: Bits 6-7: PC, bits 0-5: page code */
uint8_t subpgcode; /* 3: subpage code */
uint8_t alloclen; /* 4: Allocation length */
uint8_t control; /* 5: Control */
};
#define SCSICMD_MODESENSE6_SIZEOF 6
struct scsiresp_modeparameterhdr6_s
{
ubyte mdlen; /* 0: Mode data length */
ubyte type; /* 1: Medium type */
ubyte param; /* 2: Device-specific parameter */
ubyte bdlen; /* 3: Block descriptor length */
uint8_t mdlen; /* 0: Mode data length */
uint8_t type; /* 1: Medium type */
uint8_t param; /* 2: Device-specific parameter */
uint8_t bdlen; /* 3: Block descriptor length */
};
#define SCSIREP_MODEPARAMETERHDR6_SIZEOF 4
struct scsiresp_blockdesc_s
{
ubyte density; /* 0: density code */
ubyte nblocks[3]; /* 1-3: Number of blocks */
ubyte reserved; /* 4: reserved */
ubyte blklen[3]; /* 5-7: Block len */
uint8_t density; /* 0: density code */
uint8_t nblocks[3]; /* 1-3: Number of blocks */
uint8_t reserved; /* 4: reserved */
uint8_t blklen[3]; /* 5-7: Block len */
};
#define SCSIREP_BLOCKDESC_SIZEOF 8
struct scsiresp_pageformat_s
{
ubyte pgcode; /* 0: See SCSIRESP_PAGEFMT_* definitions */
ubyte pglen; /* 1: Page length (n-1) */
ubyte parms[1]; /* 2-n: Mode parameters */
uint8_t pgcode; /* 0: See SCSIRESP_PAGEFMT_* definitions */
uint8_t pglen; /* 1: Page length (n-1) */
uint8_t parms[1]; /* 2-n: Mode parameters */
};
struct scsiresp_subpageformat_s
{
ubyte pgcode; /* 0: See SCSIRESP_PAGEFMT_* definitions */
ubyte subpgcode; /* 1: sub-page code */
ubyte pglen[2]; /* 2-3: Page length (n-3) */
ubyte parms[1]; /* 4-n: Mode parameters */
uint8_t pgcode; /* 0: See SCSIRESP_PAGEFMT_* definitions */
uint8_t subpgcode; /* 1: sub-page code */
uint8_t pglen[2]; /* 2-3: Page length (n-3) */
uint8_t parms[1]; /* 4-n: Mode parameters */
};
struct scsiresp_cachingmodepage_s
{
ubyte pgcode; /* 0: Bit 7: PS; Bit 6: SPF, Bits 0-5: page code == 8 */
ubyte len; /* 1: Page length (18) */
ubyte flags1; /* 2: See SCSIRESP_CACHINGMODEPG_* definitions */
ubyte priority; /* 3: Bits 4-7: Demand read retention priority; Bits 0-3: Write retention priority */
ubyte dpflen[2]; /* 4-5: Disable prefetch transfer length */
ubyte minpf[2]; /* 6-7: Minimum pre-fetch */
ubyte maxpf[2]; /* 8-9: Maximum pre-fetch */
ubyte maxpfc[2]; /* 10-11: Maximum pref-fetch ceiling */
ubyte flags2; /* 12: See SCSIRESP_CACHINGMODEPG_* definitions */
ubyte nsegments; /* 13: Number of cache segments */
ubyte segsize[2]; /* 14-15: Cache segment size */
ubyte reserved; /* 16: Reserved */
ubyte obsolete[3]; /* 17-19: Obsolete */
uint8_t pgcode; /* 0: Bit 7: PS; Bit 6: SPF, Bits 0-5: page code == 8 */
uint8_t len; /* 1: Page length (18) */
uint8_t flags1; /* 2: See SCSIRESP_CACHINGMODEPG_* definitions */
uint8_t priority; /* 3: Bits 4-7: Demand read retention priority; Bits 0-3: Write retention priority */
uint8_t dpflen[2]; /* 4-5: Disable prefetch transfer length */
uint8_t minpf[2]; /* 6-7: Minimum pre-fetch */
uint8_t maxpf[2]; /* 8-9: Maximum pre-fetch */
uint8_t maxpfc[2]; /* 10-11: Maximum pref-fetch ceiling */
uint8_t flags2; /* 12: See SCSIRESP_CACHINGMODEPG_* definitions */
uint8_t nsegments; /* 13: Number of cache segments */
uint8_t segsize[2]; /* 14-15: Cache segment size */
uint8_t reserved; /* 16: Reserved */
uint8_t obsolete[3]; /* 17-19: Obsolete */
};
/* Format structures for selected SCSI block commands */
struct scsicmd_read6_s
{
ubyte opcode; /* 0: 0x08 */
ubyte mslba; /* 1: Bits 5-7: reserved; Bits 0-6: MS Logical Block Address (LBA) */
ubyte lslba[2]; /* 2-3: LS Logical Block Address (LBA) */
ubyte xfrlen; /* 4: Transfer length (in contiguous logical blocks)*/
ubyte control; /* 5: Control */
uint8_t opcode; /* 0: 0x08 */
uint8_t mslba; /* 1: Bits 5-7: reserved; Bits 0-6: MS Logical Block Address (LBA) */
uint8_t lslba[2]; /* 2-3: LS Logical Block Address (LBA) */
uint8_t xfrlen; /* 4: Transfer length (in contiguous logical blocks)*/
uint8_t control; /* 5: Control */
};
#define SCSICMD_READ6_SIZEOF 6
struct scsicmd_write6_s
{
ubyte opcode; /* 0: 0x0a */
ubyte mslba; /* 1: Bits 5-7: reserved; Bits 0-6: MS Logical Block Address (LBA) */
ubyte lslba[2]; /* 2-3: LS Logical Block Address (LBA) */
ubyte xfrlen; /* 4: Transfer length (in contiguous logical blocks) */
ubyte control; /* 5: Control */
uint8_t opcode; /* 0: 0x0a */
uint8_t mslba; /* 1: Bits 5-7: reserved; Bits 0-6: MS Logical Block Address (LBA) */
uint8_t lslba[2]; /* 2-3: LS Logical Block Address (LBA) */
uint8_t xfrlen; /* 4: Transfer length (in contiguous logical blocks) */
uint8_t control; /* 5: Control */
};
#define SCSICMD_WRITE6_SIZEOF 6
struct scsicmd_startstopunit_s
{
ubyte opcode; /* 0: 0x1b */
ubyte immed; /* 1: Bits 2-7: Reserved, Bit 0: Immed */
ubyte reserved; /* 2: reserved */
ubyte pcm; /* 3: Bits 4-7: Reserved, Bits 0-3: Power condition modifier */
ubyte pc; /* 4: Bits 4-7: Power condition, Bit 2: NO_FLUSH, Bit 1: LOEJ, Bit 0: START */
ubyte control; /* 5: Control */
uint8_t opcode; /* 0: 0x1b */
uint8_t immed; /* 1: Bits 2-7: Reserved, Bit 0: Immed */
uint8_t reserved; /* 2: reserved */
uint8_t pcm; /* 3: Bits 4-7: Reserved, Bits 0-3: Power condition modifier */
uint8_t pc; /* 4: Bits 4-7: Power condition, Bit 2: NO_FLUSH, Bit 1: LOEJ, Bit 0: START */
uint8_t control; /* 5: Control */
};
#define SCSICMD_STARTSTOPUNIT_SIZEOF 6
struct scsicmd_preventmediumremoval_s
{
ubyte opcode; /* 0: 0x1e */
ubyte reserved[3]; /* 1-3: Reserved */
ubyte prevent; /* 4: Bits 2-7: Reserved, Bits 0:1: prevent */
ubyte control; /* 5: Control */
uint8_t opcode; /* 0: 0x1e */
uint8_t reserved[3]; /* 1-3: Reserved */
uint8_t prevent; /* 4: Bits 2-7: Reserved, Bits 0:1: prevent */
uint8_t control; /* 5: Control */
};
#define SCSICMD_PREVENTMEDIUMREMOVAL_SIZEOF 6
struct scsicmd_readformatcapcacities_s
{
ubyte opcode; /* 0: 0x23 */
ubyte reserved[6]; /* 1-6: Reserved */
ubyte alloclen[2]; /* 7-8: Allocation length */
ubyte control; /* 9: Control */
uint8_t opcode; /* 0: 0x23 */
uint8_t reserved[6]; /* 1-6: Reserved */
uint8_t alloclen[2]; /* 7-8: Allocation length */
uint8_t control; /* 9: Control */
};
#define SCSICMD_READFORMATCAPACITIES_SIZEOF 10
@ -833,161 +833,161 @@ struct scsiresp_readformatcapacities_s
{
/* Current capacity header */
ubyte reserved[3]; /* 0-2: Reserved */
ubyte listlen; /* 3: Capacity list length */
uint8_t reserved[3]; /* 0-2: Reserved */
uint8_t listlen; /* 3: Capacity list length */
/* Current/Maximum Capacity Descriptor (actually a separate structure) */
ubyte nblocks[4]; /* 4-7: Number of blocks */
ubyte type; /* 8: Bits 2-7: Reserved, Bits 0-1: Descriptor type */
ubyte blocklen[3]; /* 9-11: Block length */
uint8_t nblocks[4]; /* 4-7: Number of blocks */
uint8_t type; /* 8: Bits 2-7: Reserved, Bits 0-1: Descriptor type */
uint8_t blocklen[3]; /* 9-11: Block length */
};
#define SCSIRESP_READFORMATCAPACITIES_SIZEOF 12
#define SCSIRESP_CURRCAPACITYDESC_SIZEOF 8
struct scsiresp_formattedcapacitydesc_s
{
ubyte nblocks[4]; /* 0-3: Number of blocks */
ubyte type; /* 4: Bits 2-7: Type, bits 0-1, reserved */
ubyte param[3]; /* 5-7: Type dependent parameter */
uint8_t nblocks[4]; /* 0-3: Number of blocks */
uint8_t type; /* 4: Bits 2-7: Type, bits 0-1, reserved */
uint8_t param[3]; /* 5-7: Type dependent parameter */
};
#define SCSIRESP_FORMATTEDCAPACITYDESC_SIZEOF 8
struct scsicmd_readcapacity10_s
{
ubyte opcode; /* 0: 0x25 */
ubyte reserved1; /* 1: Bits 1-7: Reserved, Bit 0: Obsolete */
ubyte lba[4]; /* 2-5: Logical block address (LBA) */
ubyte reserved2[2]; /* 6-7: Reserved */
ubyte pmi; /* 8: Bits 1-7 Reserved; Bit 0: PMI */
ubyte control; /* 9: Control */
uint8_t opcode; /* 0: 0x25 */
uint8_t reserved1; /* 1: Bits 1-7: Reserved, Bit 0: Obsolete */
uint8_t lba[4]; /* 2-5: Logical block address (LBA) */
uint8_t reserved2[2]; /* 6-7: Reserved */
uint8_t pmi; /* 8: Bits 1-7 Reserved; Bit 0: PMI */
uint8_t control; /* 9: Control */
};
#define SCSICMD_READCAPACITY10_SIZEOF 10
struct scsiresp_readcapacity10_s
{
ubyte lba[4]; /* 0-3: Returned logical block address (LBA) */
ubyte blklen[4]; /* 4-7: Logical block length (in bytes) */
uint8_t lba[4]; /* 0-3: Returned logical block address (LBA) */
uint8_t blklen[4]; /* 4-7: Logical block length (in bytes) */
};
#define SCSIRESP_READCAPACITY10_SIZEOF 8
struct scsicmd_read10_s
{
ubyte opcode; /* 0: 0x28 */
ubyte flags; /* 1: See SCSICMD_READ10FLAGS_* */
ubyte lba[4]; /* 2-5: Logical Block Address (LBA) */
ubyte groupno; /* 6: Bits 5-7: reserved; Bits 0-6: group number */
ubyte xfrlen[2]; /* 7-8: Transfer length (in contiguous logical blocks) */
ubyte control; /* 9: Control */
uint8_t opcode; /* 0: 0x28 */
uint8_t flags; /* 1: See SCSICMD_READ10FLAGS_* */
uint8_t lba[4]; /* 2-5: Logical Block Address (LBA) */
uint8_t groupno; /* 6: Bits 5-7: reserved; Bits 0-6: group number */
uint8_t xfrlen[2]; /* 7-8: Transfer length (in contiguous logical blocks) */
uint8_t control; /* 9: Control */
};
#define SCSICMD_READ10_SIZEOF 10
struct scsicmd_write10_s
{
ubyte opcode; /* 0: 0x2a */
ubyte flags; /* 1: See SCSICMD_WRITE10FLAGS_* */
ubyte lba[4]; /* 2-5: Logical Block Address (LBA) */
ubyte groupno; /* 6: Bits 5-7: reserved; Bits 0-6: group number */
ubyte xfrlen[2]; /* 7-8: Transfer length (in contiguous logical blocks) */
ubyte control; /* 9: Control */
uint8_t opcode; /* 0: 0x2a */
uint8_t flags; /* 1: See SCSICMD_WRITE10FLAGS_* */
uint8_t lba[4]; /* 2-5: Logical Block Address (LBA) */
uint8_t groupno; /* 6: Bits 5-7: reserved; Bits 0-6: group number */
uint8_t xfrlen[2]; /* 7-8: Transfer length (in contiguous logical blocks) */
uint8_t control; /* 9: Control */
};
#define SCSICMD_WRITE10_SIZEOF 10
struct scsicmd_verify10_s
{
ubyte opcode; /* 0: 0x2f */
ubyte flags; /* 1: See SCSICMD_VERIFY10_* definitions */
ubyte lba[4]; /* 2-5: Logical block address (LBA) */
ubyte groupno; /* 6: Bit 7: restricted; Bits 5-6: Reserved, Bits 0-4: Group number */
ubyte len[2]; /* 7-8: Verification length (in blocks) */
ubyte control; /* 9: Control */
uint8_t opcode; /* 0: 0x2f */
uint8_t flags; /* 1: See SCSICMD_VERIFY10_* definitions */
uint8_t lba[4]; /* 2-5: Logical block address (LBA) */
uint8_t groupno; /* 6: Bit 7: restricted; Bits 5-6: Reserved, Bits 0-4: Group number */
uint8_t len[2]; /* 7-8: Verification length (in blocks) */
uint8_t control; /* 9: Control */
};
#define SCSICMD_VERIFY10_SIZEOF 10
struct scsicmd_synchronizecache10_s
{
ubyte opcode; /* 0: 0x35 */
ubyte flags; /* 1: See SCSICMD_SYNCHRONIZECACHE10_* definitions */
ubyte lba[4]; /* 2-5: Logical block address (LBA) */
ubyte groupno; /* 6: Bit 7: restricted; Bits 5-6: Reserved, Bits 0-4: Group number */
ubyte len[2]; /* 7-8: Number of logical blocks */
ubyte control; /* 9: Control */
uint8_t opcode; /* 0: 0x35 */
uint8_t flags; /* 1: See SCSICMD_SYNCHRONIZECACHE10_* definitions */
uint8_t lba[4]; /* 2-5: Logical block address (LBA) */
uint8_t groupno; /* 6: Bit 7: restricted; Bits 5-6: Reserved, Bits 0-4: Group number */
uint8_t len[2]; /* 7-8: Number of logical blocks */
uint8_t control; /* 9: Control */
};
#define SCSICMD_SYNCHRONIZECACHE10_SIZEOF 10
struct scsicmd_modeselect10_s
{
ubyte opcode; /* 0: 0x55 */
ubyte flags; /* 1: See SCSICMD_MODESELECT10_FLAGS_* */
ubyte reserved[5]; /* 2-6: Reserved */
ubyte parmlen[2]; /* 7-8: Parameter list length */
ubyte control; /* 9: Control */
uint8_t opcode; /* 0: 0x55 */
uint8_t flags; /* 1: See SCSICMD_MODESELECT10_FLAGS_* */
uint8_t reserved[5]; /* 2-6: Reserved */
uint8_t parmlen[2]; /* 7-8: Parameter list length */
uint8_t control; /* 9: Control */
};
#define SCSICMD_MODESELECT10_SIZEOF 10
struct scsiresp_modeparameterhdr10_s
{
ubyte mdlen[2]; /* 0-1: Mode data length */
ubyte type; /* 2: Medium type */
ubyte param; /* 3: Device-specific parameter */
ubyte reserved[2]; /* 4-5: reserved */
ubyte bdlen[2]; /* 6-7: Block descriptor length */
uint8_t mdlen[2]; /* 0-1: Mode data length */
uint8_t type; /* 2: Medium type */
uint8_t param; /* 3: Device-specific parameter */
uint8_t reserved[2]; /* 4-5: reserved */
uint8_t bdlen[2]; /* 6-7: Block descriptor length */
};
#define SCSIREP_MODEPARAMETERHDR10_SIZEOF 8
struct scsicmd_modesense10_s
{
ubyte opcode; /* O: 0x5a */
ubyte flags; /* 1: See SCSICMD_MODESENSE10_FLAGS_* */
ubyte pcpgcode; /* 2: Bits 6-7: PC, bits 0-5: page code */
ubyte subpgcode; /* 3: subpage code */
ubyte reserved[3]; /* 4-6: reserved */
ubyte alloclen[2]; /* 7-8: Allocation length */
ubyte control; /* 9: Control */
uint8_t opcode; /* O: 0x5a */
uint8_t flags; /* 1: See SCSICMD_MODESENSE10_FLAGS_* */
uint8_t pcpgcode; /* 2: Bits 6-7: PC, bits 0-5: page code */
uint8_t subpgcode; /* 3: subpage code */
uint8_t reserved[3]; /* 4-6: reserved */
uint8_t alloclen[2]; /* 7-8: Allocation length */
uint8_t control; /* 9: Control */
};
#define SCSICMD_MODESENSE10_SIZEOF 10
struct scsicmd_readcapacity16_s
{
ubyte opcode; /* 0: 0x9e */
ubyte action; /* 1: Bits 5-7: Reserved, Bits 0-4: Service action */
ubyte lba[8]; /* 2-9: Logical block address (LBA) */
ubyte len[4]; /* 10-13: Allocation length */
ubyte reserved; /* 14: Reserved */
ubyte control; /* 15: Control */
uint8_t opcode; /* 0: 0x9e */
uint8_t action; /* 1: Bits 5-7: Reserved, Bits 0-4: Service action */
uint8_t lba[8]; /* 2-9: Logical block address (LBA) */
uint8_t len[4]; /* 10-13: Allocation length */
uint8_t reserved; /* 14: Reserved */
uint8_t control; /* 15: Control */
};
#define SCSICMD_READCAPACITY16_SIZEOF 16
struct scsicmd_read12_s
{
ubyte opcode; /* 0: 0xa8 */
ubyte flags; /* 1: See SCSICMD_READ12FLAGS_* */
ubyte lba[4]; /* 2-5: Logical Block Address (LBA) */
ubyte xfrlen[4]; /* 6-9: Transfer length (in contiguous logical blocks) */
ubyte groupno; /* 10: Bit 7: restricted; Bits 5-6: reserved; Bits 0-6: group number */
ubyte control; /* 11: Control */
uint8_t opcode; /* 0: 0xa8 */
uint8_t flags; /* 1: See SCSICMD_READ12FLAGS_* */
uint8_t lba[4]; /* 2-5: Logical Block Address (LBA) */
uint8_t xfrlen[4]; /* 6-9: Transfer length (in contiguous logical blocks) */
uint8_t groupno; /* 10: Bit 7: restricted; Bits 5-6: reserved; Bits 0-6: group number */
uint8_t control; /* 11: Control */
};
#define SCSICMD_READ12_SIZEOF 12
struct scsicmd_write12_s
{
ubyte opcode; /* 0: 0xaa */
ubyte flags; /* 1: See SCSICMD_WRITE12FLAGS_* */
ubyte lba[4]; /* 2-5: Logical Block Address (LBA) */
ubyte xfrlen[4]; /* 6-9: Transfer length (in contiguous logical blocks) */
ubyte groupno; /* 10: Bit 7: restricted; Bits 5-6: reserved; Bits 0-6: group number */
ubyte control; /* 11: Control */
uint8_t opcode; /* 0: 0xaa */
uint8_t flags; /* 1: See SCSICMD_WRITE12FLAGS_* */
uint8_t lba[4]; /* 2-5: Logical Block Address (LBA) */
uint8_t xfrlen[4]; /* 6-9: Transfer length (in contiguous logical blocks) */
uint8_t groupno; /* 10: Bit 7: restricted; Bits 5-6: reserved; Bits 0-6: group number */
uint8_t control; /* 11: Control */
};
#define SCSICMD_WRITE12_SIZEOF 12
struct scsicmd_verify12_s
{
ubyte opcode; /* 0: 0xaf */
ubyte flags; /* 1: See SCSICMD_VERIFY12_* definitions */
ubyte lba[4]; /* 2-5: Logical block address (LBA) */
ubyte len[4]; /* 6-9: Verification length */
ubyte groupno; /* 10: Bit 7: restricted; Bits 5-6: Reserved, Bits 0-4: Group number */
ubyte control; /* 11: Control */
uint8_t opcode; /* 0: 0xaf */
uint8_t flags; /* 1: See SCSICMD_VERIFY12_* definitions */
uint8_t lba[4]; /* 2-5: Logical block address (LBA) */
uint8_t len[4]; /* 6-9: Verification length */
uint8_t groupno; /* 10: Bit 7: restricted; Bits 5-6: Reserved, Bits 0-4: Group number */
uint8_t control; /* 11: Control */
};
#define SCSICMD_VERIFY12_SIZEOF 12

View File

@ -41,7 +41,10 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <nuttx/wqueue.h>
/****************************************************************************
@ -339,7 +342,7 @@
*
* Input Parameters:
* dev - An instance of the SDIO device interface
* wide - TRUE: wide bus (4-bit) bus mode enabled
* wide - true: wide bus (4-bit) bus mode enabled
*
* Returned Value:
* None
@ -611,20 +614,20 @@
* Name: SDIO_DMASUPPORTED
*
* Description:
* Return TRUE if the hardware can support DMA
* Return true if the hardware can support DMA
*
* Input Parameters:
* dev - An instance of the SDIO device interface
*
* Returned Value:
* TRUE if DMA is supported.
* true if DMA is supported.
*
****************************************************************************/
#ifdef CONFIG_SDIO_DMA
# define SDIO_DMASUPPORTED(dev) ((dev)->dmasupported(dev))
#else
# define SDIO_DMASUPPORTED(dev) (FALSE)
# define SDIO_DMASUPPORTED(dev) (false)
#endif
/****************************************************************************
@ -692,11 +695,11 @@ enum sdio_clock_e
CLOCK_SD_TRANSFER_4BIT /* SD normal operation clocking (wide 4-bit mode) */
};
/* Event set. A ubyte is big enough to hold a set of 8-events. If more are
* needed, change this to a uint16.
/* Event set. A uint8_t is big enough to hold a set of 8-events. If more are
* needed, change this to a uint16_t.
*/
typedef ubyte sdio_eventset_t;
typedef uint8_t sdio_eventset_t;
/* This structure defines the interface between the NuttX SDIO
* driver and the chip- or board-specific SDIO interface. This
@ -715,33 +718,33 @@ struct sdio_dev_s
/* Initialization/setup */
void (*reset)(FAR struct sdio_dev_s *dev);
ubyte (*status)(FAR struct sdio_dev_s *dev);
void (*widebus)(FAR struct sdio_dev_s *dev, boolean enable);
uint8_t (*status)(FAR struct sdio_dev_s *dev);
void (*widebus)(FAR struct sdio_dev_s *dev, bool enable);
void (*clock)(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate);
int (*attach)(FAR struct sdio_dev_s *dev);
/* Command/Status/Data Transfer */
void (*sendcmd)(FAR struct sdio_dev_s *dev, uint32 cmd, uint32 arg);
int (*recvsetup)(FAR struct sdio_dev_s *dev, FAR ubyte *buffer,
void (*sendcmd)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t arg);
int (*recvsetup)(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
size_t nbytes);
int (*sendsetup)(FAR struct sdio_dev_s *dev, FAR const ubyte *buffer,
int (*sendsetup)(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer,
size_t nbytes);
int (*cancel)(FAR struct sdio_dev_s *dev);
int (*waitresponse)(FAR struct sdio_dev_s *dev, uint32 cmd);
int (*recvR1)(FAR struct sdio_dev_s *dev, uint32 cmd, uint32 *R1);
int (*recvR2)(FAR struct sdio_dev_s *dev, uint32 cmd, uint32 R2[4]);
int (*recvR3)(FAR struct sdio_dev_s *dev, uint32 cmd, uint32 *R3);
int (*recvR4)(FAR struct sdio_dev_s *dev, uint32 cmd, uint32 *R4);
int (*recvR5)(FAR struct sdio_dev_s *dev, uint32 cmd, uint32 *R5);
int (*recvR6)(FAR struct sdio_dev_s *dev, uint32 cmd, uint32 *R6);
int (*recvR7)(FAR struct sdio_dev_s *dev, uint32 cmd, uint32 *R7);
int (*waitresponse)(FAR struct sdio_dev_s *dev, uint32_t cmd);
int (*recvR1)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R1);
int (*recvR2)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t R2[4]);
int (*recvR3)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R3);
int (*recvR4)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R4);
int (*recvR5)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R5);
int (*recvR6)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R6);
int (*recvR7)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R7);
/* Event/Callback support */
void (*waitenable)(FAR struct sdio_dev_s *dev, sdio_eventset_t eventset);
sdio_eventset_t (*eventwait)(FAR struct sdio_dev_s *dev, uint32 timeout);
sdio_eventset_t (*eventwait)(FAR struct sdio_dev_s *dev, uint32_t timeout);
void (*callbackenable)(FAR struct sdio_dev_s *dev,
sdio_eventset_t eventset);
int (*registercallback)(FAR struct sdio_dev_s *dev,
@ -750,10 +753,10 @@ struct sdio_dev_s
/* DMA */
#ifdef CONFIG_SDIO_DMA
boolean (*dmasupported)(FAR struct sdio_dev_s *dev);
int (*dmarecvsetup)(FAR struct sdio_dev_s *dev, FAR ubyte *buffer,
bool (*dmasupported)(FAR struct sdio_dev_s *dev);
int (*dmarecvsetup)(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
size_t buflen);
int (*dmasendsetup)(FAR struct sdio_dev_s *dev, FAR const ubyte *buffer,
int (*dmasendsetup)(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer,
size_t buflen);
#endif
};

View File

@ -41,7 +41,10 @@
************************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <semaphore.h>
#include <nuttx/fs.h>
@ -61,10 +64,10 @@
#define uart_shutdown(dev) dev->ops->shutdown(dev)
#define uart_attach(dev) dev->ops->attach(dev)
#define uart_detach(dev) dev->ops->detach(dev)
#define uart_enabletxint(dev) dev->ops->txint(dev, TRUE)
#define uart_disabletxint(dev) dev->ops->txint(dev, FALSE)
#define uart_enablerxint(dev) dev->ops->rxint(dev, TRUE)
#define uart_disablerxint(dev) dev->ops->rxint(dev, FALSE)
#define uart_enabletxint(dev) dev->ops->txint(dev, true)
#define uart_disabletxint(dev) dev->ops->txint(dev, false)
#define uart_enablerxint(dev) dev->ops->rxint(dev, true)
#define uart_disablerxint(dev) dev->ops->rxint(dev, false)
#define uart_rxavailable(dev) dev->ops->rxavailable(dev)
#define uart_txready(dev) dev->ops->txready(dev)
#define uart_txempty(dev) dev->ops->txempty(dev)
@ -82,11 +85,11 @@
struct uart_buffer_s
{
sem_t sem; /* Used to control exclusive access to the buffer */
volatile sint16 head; /* Index to the head [IN] index in the buffer */
volatile sint16 tail; /* Index to the tail [OUT] index in the buffer */
sint16 size; /* The allocated size of the buffer */
FAR char *buffer; /* Pointer to the allocated buffer memory */
sem_t sem; /* Used to control exclusive access to the buffer */
volatile int16_t head; /* Index to the head [IN] index in the buffer */
volatile int16_t tail; /* Index to the tail [OUT] index in the buffer */
int16_t size; /* The allocated size of the buffer */
FAR char *buffer; /* Pointer to the allocated buffer memory */
};
/* This structure defines all of the operations providd by the architecture specific
@ -146,11 +149,11 @@ struct uart_ops_s
/* Call to enable or disable RX interrupts */
CODE void (*rxint)(FAR struct uart_dev_s *dev, boolean enable);
CODE void (*rxint)(FAR struct uart_dev_s *dev, bool enable);
/* Return TRUE if the receive data is available */
/* Return true if the receive data is available */
CODE boolean (*rxavailable)(FAR struct uart_dev_s *dev);
CODE bool (*rxavailable)(FAR struct uart_dev_s *dev);
/* This method will send one byte on the UART */
@ -158,21 +161,21 @@ struct uart_ops_s
/* Call to enable or disable TX interrupts */
CODE void (*txint)(FAR struct uart_dev_s *dev, boolean enable);
CODE void (*txint)(FAR struct uart_dev_s *dev, bool enable);
/* Return TRUE if the tranmsit hardware is ready to send another byte. This
/* Return true if the tranmsit hardware is ready to send another byte. This
* is used to determine if send() method can be called.
*/
CODE boolean (*txready)(FAR struct uart_dev_s *dev);
CODE bool (*txready)(FAR struct uart_dev_s *dev);
/* Return TRUE if all characters have been sent. If for example, the UART
/* Return true if all characters have been sent. If for example, the UART
* hardware implements FIFOs, then this would mean the transmit FIFO is
* empty. This method is called when the driver needs to make sure that
* all characters are "drained" from the TX hardware.
*/
CODE boolean (*txempty)(FAR struct uart_dev_s *dev);
CODE bool (*txempty)(FAR struct uart_dev_s *dev);
};
/* This is the device structure used by the driver. The caller of
@ -187,10 +190,10 @@ struct uart_ops_s
struct uart_dev_s
{
ubyte open_count; /* Number of times the device has been opened */
volatile boolean xmitwaiting; /* TRUE: User waiting for space in xmit.buffer */
volatile boolean recvwaiting; /* TRUE: User waiting for data in recv.buffer */
boolean isconsole; /* TRUE: This is the serial console */
uint8_t open_count; /* Number of times the device has been opened */
volatile bool xmitwaiting; /* true: User waiting for space in xmit.buffer */
volatile bool recvwaiting; /* true: User waiting for data in recv.buffer */
bool isconsole; /* true: This is the serial console */
sem_t closesem; /* Locks out new open while close is in progress */
sem_t xmitsem; /* Wakeup user waiting for space in xmit.buffer */
sem_t recvsem; /* Wakeup user waiting for data in recv.buffer */

View File

@ -41,10 +41,13 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/* Access macros */
@ -63,7 +66,7 @@
*
* Input Parameters:
* dev - Device-specific state data
* lock - TRUE: Lock spi bus, FALSE: unlock SPI bus
* lock - true: Lock spi bus, false: unlock SPI bus
*
* Returned Value:
* None
@ -84,7 +87,7 @@
* Input Parameters:
* dev - Device-specific state data
* devid - Identifies the device to select
* selected - TRUE: slave selected, FALSE: slave de-selected
* selected - true: slave selected, false: slave de-selected
*
* Returned Value:
* None
@ -187,7 +190,7 @@
*
****************************************************************************/
#define SPI_SEND(d,wd) ((d)->ops->send(d,(uint16)wd))
#define SPI_SEND(d,wd) ((d)->ops->send(d,(uint16_t)wd))
/****************************************************************************
* Name: SPI_SNDBLOCK
@ -201,7 +204,8 @@
* nwords - the length of data to send from the buffer in number of words.
* The wordsize is determined by the number of bits-per-word
* selected for the SPI interface. If nbits <= 8, the data is
* packed into ubytes; if nbits >8, the data is packed into uint16's
* packed into uint8_t's; if nbits >8, the data is packed into
* uint16_t's
*
* Returned Value:
* None
@ -224,9 +228,10 @@
* dev - Device-specific state data
* buffer - A pointer to the buffer in which to recieve data
* nwords - the length of data that can be received in the buffer in number
* of words. The wordsize is determined by the number of bits-per-word
* selected for the SPI interface. If nbits <= 8, the data is
* packed into ubytes; if nbits >8, the data is packed into uint16's
* of words. The wordsize is determined by the number of bits-
* per-word selected for the SPI interface. If nbits <= 8, the
* data is packed into uint8_t's; if nbits >8, the data is packed
* into uint16_t's
*
* Returned Value:
* None
@ -252,7 +257,8 @@
* nwords - the length of data that to be exchanged in units of words.
* The wordsize is determined by the number of bits-per-word
* selected for the SPI interface. If nbits <= 8, the data is
* packed into ubytes; if nbits >8, the data is packed into uint16's
* packed into uint8_t's; if nbits >8, the data is packed into
* uint16_t's
*
* Returned Value:
* None
@ -319,20 +325,25 @@ enum spi_mode_e
struct spi_dev_s;
struct spi_ops_s
{
int (*lock)(FAR struct spi_dev_s *dev, boolean lock);
void (*select)(FAR struct spi_dev_s *dev, enum spi_dev_e devid, boolean selected);
uint32 (*setfrequency)(FAR struct spi_dev_s *dev, uint32 frequency);
void (*setmode)(FAR struct spi_dev_s *dev, enum spi_mode_e mode);
void (*setbits)(FAR struct spi_dev_s *dev, int nbits);
ubyte (*status)(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
uint16 (*send)(FAR struct spi_dev_s *dev, uint16 wd);
int (*lock)(FAR struct spi_dev_s *dev, bool lock);
void (*select)(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
bool selected);
uint32_t (*setfrequency)(FAR struct spi_dev_s *dev, uint32_t frequency);
void (*setmode)(FAR struct spi_dev_s *dev, enum spi_mode_e mode);
void (*setbits)(FAR struct spi_dev_s *dev, int nbits);
uint8_t (*status)(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
uint16_t (*send)(FAR struct spi_dev_s *dev, uint16_t wd);
#ifdef CONFIG_SPI_EXCHANGE
void (*exchange)(FAR struct spi_dev_s *dev, FAR const void *txbuffer, FAR void *rxbuffer, size_t nwords);
void (*exchange)(FAR struct spi_dev_s *dev, FAR const void *txbuffer,
FAR void *rxbuffer, size_t nwords);
#else
void (*sndblock)(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t nwords);
void (*recvblock)(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nwords);
void (*sndblock)(FAR struct spi_dev_s *dev, FAR const void *buffer,
size_t nwords);
void (*recvblock)(FAR struct spi_dev_s *dev, FAR void *buffer,
size_t nwords);
#endif
int (*registercallback)(FAR struct spi_dev_s *dev, spi_mediachange_t callback, void *arg);
int (*registercallback)(FAR struct spi_dev_s *dev, spi_mediachange_t callback,
void *arg);
};
/* SPI private data. This structure only defines the initial fields of the

View File

@ -41,7 +41,6 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
/****************************************************************************
* Pre-processor Definitions

View File

@ -41,7 +41,8 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <time.h>
/****************************************************************************
@ -96,7 +97,7 @@ EXTERN int clock_isleapyear(int year);
*
****************************************************************************/
EXTERN int clock_daysbeforemonth(int month, boolean leapyear);
EXTERN int clock_daysbeforemonth(int month, bool leapyear);
/****************************************************************************
* Function: clock_calendar2utc

View File

@ -1,7 +1,7 @@
/************************************************************************************
* include/nuttx/usb.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,20 +41,21 @@
************************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
/************************************************************************************
* Definitions
* Preprocessor Definitions
************************************************************************************/
/* All 16-bit values must be little-endian */
#define MSBYTE(u16) ((u16) >> 8) /* Get MS byte from uint16 */
#define LSBYTE(u16) ((u16) & 0xff) /* Get LS byte from uint16 */
#define MSBYTE(u16) ((u16) >> 8) /* Get MS byte from uint16_t */
#define LSBYTE(u16) ((u16) & 0xff) /* Get LS byte from uint16_t */
#define GETUINT16(p) (((uint16)p[1]<<8)|(uint16)p[0])
#define GETUINT32(p) (((uint32)p[3]<<24)|((uint32)p[2]<<16)|\
((uint32)p[1]<<8)|(uint32)p[0])
#define GETUINT16(p) (((uint16_t)p[1]<<8)|(uint16_t)p[0])
#define GETUINT32(p) (((uint32_t)p[3]<<24)|((uint32_t)p[2]<<16)|\
((uint32_t)p[1]<<8)|(uint32_t)p[0])
/* USB directions (in endpoint addresses) */
@ -201,11 +202,11 @@
struct usb_ctrlreq_s
{
ubyte type; /* Matches request type */
ubyte req; /* Matches request field */
ubyte value[2];
ubyte index[2];
ubyte len[2];
uint8_t type; /* Matches request type */
uint8_t req; /* Matches request field */
uint8_t value[2];
uint8_t index[2];
uint8_t len[2];
};
#define USB_SIZEOF_CTRLREQ 8
@ -213,28 +214,28 @@ struct usb_ctrlreq_s
struct usb_desc_s
{
ubyte len; /* Descriptor length */
ubyte type; /* Descriptor type */
uint8_t len; /* Descriptor length */
uint8_t type; /* Descriptor type */
};
/* Device descriptor */
struct usb_devdesc_s
{
ubyte len; /* Descriptor length */
ubyte type; /* Descriptor type */
ubyte usb[2]; /* USB version */
ubyte class; /* Device class */
ubyte subclass; /* Device sub-class */
ubyte protocol; /* Device protocol */
ubyte mxpacketsize; /* Max packet size (ep0) */
ubyte vender[2]; /* Vendor ID */
ubyte product[2]; /* Product ID */
ubyte device[2]; /* Device ID */
ubyte imfgr; /* Manufacturer */
ubyte iproduct; /* Product */
ubyte serno; /* Serial number */
ubyte nconfigs; /* Number of configurations */
uint8_t len; /* Descriptor length */
uint8_t type; /* Descriptor type */
uint8_t usb[2]; /* USB version */
uint8_t class; /* Device class */
uint8_t subclass; /* Device sub-class */
uint8_t protocol; /* Device protocol */
uint8_t mxpacketsize; /* Max packet size (ep0) */
uint8_t vender[2]; /* Vendor ID */
uint8_t product[2]; /* Product ID */
uint8_t device[2]; /* Device ID */
uint8_t imfgr; /* Manufacturer */
uint8_t iproduct; /* Product */
uint8_t serno; /* Serial number */
uint8_t nconfigs; /* Number of configurations */
};
#define USB_SIZEOF_DEVDESC 18
@ -242,27 +243,27 @@ struct usb_devdesc_s
struct usb_cfgdesc_s
{
ubyte len; /* Descriptor length */
ubyte type; /* Descriptor type */
ubyte totallen[2]; /* Total length */
ubyte ninterfaces; /* Number of interfaces */
ubyte cfgvalue; /* Configuration value */
ubyte icfg; /* Configuration */
ubyte attr; /* Attributes */
ubyte mxpower; /* Max power (mA/2) */
uint8_t len; /* Descriptor length */
uint8_t type; /* Descriptor type */
uint8_t totallen[2]; /* Total length */
uint8_t ninterfaces; /* Number of interfaces */
uint8_t cfgvalue; /* Configuration value */
uint8_t icfg; /* Configuration */
uint8_t attr; /* Attributes */
uint8_t mxpower; /* Max power (mA/2) */
};
#define USB_SIZEOF_CFGDESC 9
struct usb_otherspeedconfigdesc_s
{
ubyte len; /* Descriptor length */
ubyte type; /* Descriptor type */
ubyte totallen[2]; /* Total length */
ubyte ninterfaces; /* Number of interfaces */
ubyte cfgvalue; /* Configuration value */
ubyte icfg; /* Configuration */
ubyte attr; /* Attributes */
ubyte mxpower; /* Max power (mA/2) */
uint8_t len; /* Descriptor length */
uint8_t type; /* Descriptor type */
uint8_t totallen[2]; /* Total length */
uint8_t ninterfaces; /* Number of interfaces */
uint8_t cfgvalue; /* Configuration value */
uint8_t icfg; /* Configuration */
uint8_t attr; /* Attributes */
uint8_t mxpower; /* Max power (mA/2) */
};
#define USB_SIZEOF_OTHERSPEEDCONFIGDESC 9
@ -270,24 +271,24 @@ struct usb_otherspeedconfigdesc_s
struct usb_strdesc_s
{
ubyte len; /* Descriptor length */
ubyte type; /* Descriptor type */
ubyte data[2];
uint8_t len; /* Descriptor length */
uint8_t type; /* Descriptor type */
uint8_t data[2];
};
/* Interface descriptor */
struct usb_ifdesc_s
{
ubyte len; /* Descriptor length */
ubyte type; /* Descriptor type */
ubyte ifno; /* Interface number */
ubyte alt; /* Alternate setting */
ubyte neps; /* Number of endpoints */
ubyte class; /* Interface class */
ubyte subclass; /* Interface sub-class */
ubyte protocol; /* Interface protocol */
ubyte iif; /* iInterface */
uint8_t len; /* Descriptor length */
uint8_t type; /* Descriptor type */
uint8_t ifno; /* Interface number */
uint8_t alt; /* Alternate setting */
uint8_t neps; /* Number of endpoints */
uint8_t class; /* Interface class */
uint8_t subclass; /* Interface sub-class */
uint8_t protocol; /* Interface protocol */
uint8_t iif; /* iInterface */
};
#define USB_SIZEOF_IFDESC 9
@ -295,20 +296,20 @@ struct usb_ifdesc_s
struct usb_epdesc_s
{
ubyte len; /* Descriptor length */
ubyte type; /* Descriptor type */
ubyte addr; /* Endpoint address */
ubyte attr; /* Endpoint attributes */
ubyte mxpacketsize[2]; /* Maximum packet size */
ubyte interval; /* Interval */
uint8_t len; /* Descriptor length */
uint8_t type; /* Descriptor type */
uint8_t addr; /* Endpoint address */
uint8_t attr; /* Endpoint attributes */
uint8_t mxpacketsize[2]; /* Maximum packet size */
uint8_t interval; /* Interval */
};
#define USB_SIZEOF_EPDESC 7
struct usb_audioepdesc_s
{
struct usb_epdesc_s ep;
ubyte refresh;
ubyte synchaddr;
uint8_t refresh;
uint8_t synchaddr;
};
#define USB_SIZEOF_AUDIOEPDESC 9
@ -316,15 +317,15 @@ struct usb_audioepdesc_s
struct usb_qualdesc_s
{
ubyte len; /* Descriptor length */
ubyte type; /* Descriptor type */
ubyte usb[2]; /* USB version */
ubyte class; /* Qualifier class */
ubyte subclass; /* Qualifier sub-class */
ubyte protocol; /* Qualifier protocol */
ubyte mxpacketsize; /* Max packet size (ep0) */
ubyte nconfigs; /* Number of configurations */
ubyte reserved;
uint8_t len; /* Descriptor length */
uint8_t type; /* Descriptor type */
uint8_t usb[2]; /* USB version */
uint8_t class; /* Qualifier class */
uint8_t subclass; /* Qualifier sub-class */
uint8_t protocol; /* Qualifier protocol */
uint8_t mxpacketsize; /* Max packet size (ep0) */
uint8_t nconfigs; /* Number of configurations */
uint8_t reserved;
};
#define USB_SIZEOF_QUALDESC 10

View File

@ -1,7 +1,7 @@
/************************************************************************************
* include/nuttx/usb_storage.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* References:
@ -48,10 +48,10 @@
************************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
/************************************************************************************
* Definitions
* Pre-processor Definitions
************************************************************************************/
/* Mass storage requests */
@ -101,23 +101,23 @@
struct usbstrg_cbw_s
{
ubyte signature[4]; /* 'USBC' = 0x43425355 */
ubyte tag[4]; /* Depends on command id */
ubyte datlen[4]; /* Number of bytes that host expects to transfer */
ubyte flags; /* Bit 7: Direction=IN (other obsolete or reserved) */
ubyte lun; /* LUN (normally 0) */
ubyte cdblen; /* len of cdb[] */
ubyte cdb[USBSTRG_MAXCDBLEN]; /* Command Data Block */
uint8_t signature[4]; /* 'USBC' = 0x43425355 */
uint8_t tag[4]; /* Depends on command id */
uint8_t datlen[4]; /* Number of bytes that host expects to transfer */
uint8_t flags; /* Bit 7: Direction=IN (other obsolete or reserved) */
uint8_t lun; /* LUN (normally 0) */
uint8_t cdblen; /* len of cdb[] */
uint8_t cdb[USBSTRG_MAXCDBLEN]; /* Command Data Block */
};
/* Command Status Wrapper (CSW) */
struct usbstrg_csw_s
{
ubyte signature[4]; /* 'USBS' = 0x53425355 */
ubyte tag[4]; /* Same tag as original command */
ubyte residue[4]; /* Amount not transferred */
ubyte status; /* Status of transfer */
uint8_t signature[4]; /* 'USBS' = 0x53425355 */
uint8_t tag[4]; /* Same tag as original command */
uint8_t residue[4]; /* Amount not transferred */
uint8_t status; /* Status of transfer */
};
/************************************************************************************

View File

@ -47,10 +47,13 @@
************************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
/************************************************************************************
* Definitions
* Pre-processor Definitions
************************************************************************************/
/* Endpoint helpers *****************************************************************/
@ -60,7 +63,7 @@
*
* ep - the struct usbdev_ep_s instance obtained from allocep()
* desc - A struct usb_epdesc_s instance describing the endpoint
* last - TRUE if this this last endpoint to be configured. Some hardware needs
* last - true if this this last endpoint to be configured. Some hardware needs
* to take special action when all of the endpoints have been configured.
*/
@ -95,8 +98,8 @@
/* Stall or resume an endpoint */
#define EP_STALL(ep) (ep)->ops->stall(ep,FALSE)
#define EP_RESUME(ep) (ep)->ops->stall(ep,TRUE)
#define EP_STALL(ep) (ep)->ops->stall(ep,false)
#define EP_RESUME(ep) (ep)->ops->stall(ep,true)
/* USB Device Driver Helpers ********************************************************/
@ -105,7 +108,7 @@
* ep - 7-bit logical endpoint number (direction bit ignored). Zero means
* that any endpoint matching the other requirements will suffice. The
* assigned endpoint can be found in the eplog field.
* in - TRUE: IN (device-to-host) endpoint requested
* in - true: IN (device-to-host) endpoint requested
* eptype - Endpoint type. One of {USB_EP_ATTR_XFER_ISOC, USB_EP_ATTR_XFER_BULK,
* USB_EP_ATTR_XFER_INT}
*/
@ -126,19 +129,19 @@
/* Sets the device selfpowered feature */
#define DEV_SETSELFPOWERED(dev) (dev)->ops->selfpowered(dev,TRUE)
#define DEV_SETSELFPOWERED(dev) (dev)->ops->selfpowered(dev,true)
/* Clears the device selfpowered feature */
#define DEV_CLRSELFPOWERED(dev) (dev)->ops->selfpowered(dev, FALSE)
#define DEV_CLRSELFPOWERED(dev) (dev)->ops->selfpowered(dev, false)
/* Software-controlled connect to USB host */
#define DEV_CONNECT(dev) (dev)->ops->pullup ? (dev)->ops->pullup(dev,TRUE) : -EOPNOTSUPP
#define DEV_CONNECT(dev) (dev)->ops->pullup ? (dev)->ops->pullup(dev,true) : -EOPNOTSUPP
/* Software-controlled disconnect from USB host */
#define DEV_DISCONNECT(dev) (dev)->ops->pullup ? (dev)->ops->pullup(dev,FALSE) : -EOPNOTSUPP
#define DEV_DISCONNECT(dev) (dev)->ops->pullup ? (dev)->ops->pullup(dev,false) : -EOPNOTSUPP
/* USB Class Driver Helpers *********************************************************/
/* All may be called from interupt handling logic except bind() and unbind() */
@ -190,16 +193,16 @@
struct usbdev_ep_s;
struct usbdev_req_s
{
ubyte *buf; /* Call: Buffer used for data; Return: Unchanged */
ubyte flags; /* See USBDEV_REQFLAGS_* definitions */
uint16 len; /* Call: Total length of data in buf; Return: Unchanged */
uint16 xfrd; /* Call: zero; Return: Bytes transferred so far */
sint16 result; /* Call: zero; Return: Result of transfer (O or -errno) */
uint8_t *buf; /* Call: Buffer used for data; Return: Unchanged */
uint8_t flags; /* See USBDEV_REQFLAGS_* definitions */
uint16_t len; /* Call: Total length of data in buf; Return: Unchanged */
uint16_t xfrd; /* Call: zero; Return: Bytes transferred so far */
int16_t result; /* Call: zero; Return: Result of transfer (O or -errno) */
/* Callback when the transfer completes */
void (*callback)(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req);
void *priv; /* Used only by callee */
void (*callback)(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *req);
void *priv; /* Used only by callee */
};
/* Endpoint-specific interface to USB controller hardware. */
@ -208,7 +211,8 @@ struct usbdev_epops_s
{
/* Configure/enable and disable endpoint */
int (*configure)(FAR struct usbdev_ep_s *ep, FAR const struct usb_epdesc_s *desc, boolean last);
int (*configure)(FAR struct usbdev_ep_s *ep, FAR const struct usb_epdesc_s *desc,
bool last);
int (*disable)(FAR struct usbdev_ep_s *ep);
/* Allocate and free I/O requests */
@ -219,7 +223,7 @@ struct usbdev_epops_s
/* Allocate and free I/O buffers */
#ifdef CONFIG_ARCH_USBDEV_DMA
FAR void *(*allocbuffer)(FAR struct usbdev_ep_s *ep, uint16 nbytes);
FAR void *(*allocbuffer)(FAR struct usbdev_ep_s *ep, uint16_t nbytes);
void (*freebuffer)(FAR struct usbdev_ep_s *ep, FAR void *buf);
#endif
@ -230,7 +234,7 @@ struct usbdev_epops_s
/* Stall or resume an endpoint */
int (*stall)(FAR struct usbdev_ep_s *ep, boolean resume);
int (*stall)(FAR struct usbdev_ep_s *ep, bool resume);
};
/* Representation of one USB endpoint */
@ -238,9 +242,9 @@ struct usbdev_epops_s
struct usbdev_ep_s
{
const struct usbdev_epops_s *ops; /* Endpoint operations */
ubyte eplog; /* Logical endpoint address */
uint16 maxpacket; /* Maximum packet size for this endpoint */
void *priv; /* For use by class driver */
uint8_t eplog; /* Logical endpoint address */
uint16_t maxpacket; /* Maximum packet size for this endpoint */
void *priv; /* For use by class driver */
};
/* struct usbdev_s represents a usb device */
@ -250,7 +254,7 @@ struct usbdev_ops_s
{
/* Allocate and free endpoints */
FAR struct usbdev_ep_s *(*allocep)(FAR struct usbdev_s *dev, ubyte epphy, boolean in, ubyte eptype);
FAR struct usbdev_ep_s *(*allocep)(FAR struct usbdev_s *dev, uint8_t epphy, bool in, uint8_t eptype);
void (*freeep)(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep);
/* Get the frame number from the last SOF */
@ -260,8 +264,8 @@ struct usbdev_ops_s
/* Hardware specific features */
int (*wakeup)(FAR struct usbdev_s *dev);
int (*selfpowered)(FAR struct usbdev_s *dev, boolean selfpowered);
int (*pullup)(FAR struct usbdev_s *dev, boolean enable);
int (*selfpowered)(FAR struct usbdev_s *dev, bool selfpowered);
int (*pullup)(FAR struct usbdev_s *dev, bool enable);
/* Device-specific I/O command support */
@ -272,8 +276,8 @@ struct usbdev_s
{
const struct usbdev_ops_s *ops; /* Access to hardware specific features */
struct usbdev_ep_s *ep0; /* Endpoint zero */
ubyte speed; /* Current speed of host connection */
ubyte dualspeed:1; /* 1:supports high and full speed operation */
uint8_t speed; /* Current speed of host connection */
uint8_t dualspeed:1; /* 1:supports high and full speed operation */
};
/* USB Device Class Implementations *************************************************/
@ -292,7 +296,7 @@ struct usbdevclass_driverops_s
struct usbdevclass_driver_s
{
const struct usbdevclass_driverops_s *ops;
ubyte speed; /* Highest speed that the driver handles */
uint8_t speed; /* Highest speed that the driver handles */
};
/************************************************************************************
@ -390,7 +394,7 @@ EXTERN int usbstrg_configure(unsigned int nluns, void **handle);
EXTERN int usbstrg_bindlun(FAR void *handle, FAR const char *drvrpath,
unsigned int lunno, off_t startsector, size_t nsectors,
boolean readonly);
bool readonly);
/****************************************************************************
* Name: usbstrg_unbindlun

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/usbdev_trace.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,6 +41,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
/****************************************************************************
@ -380,7 +381,7 @@ struct usbtrace_s
typedef int (*trace_callback_t)(struct usbtrace_s *trace, void *arg);
/* Bit mask input type for usbtrace_enable(). If TRACE_NIDS grows beyond
* 16, then this will have to be changed to uint32
* 16, then this will have to be changed to uint32_t
*/
typedef uint16_t usbtrace_idset_t;

View File

@ -41,7 +41,9 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <signal.h>
#include <queue.h>
@ -69,8 +71,8 @@ struct work_s
struct dq_entry_s dq; /* Implements a doubly linked list */
worker_t worker; /* Work callback */
FAR void *arg; /* Callback argument */
uint32 qtime; /* Time work queued */
uint32 delay; /* Delay until work performed */
uint32_t qtime; /* Time work queued */
uint32_t delay; /* Delay until work performed */
};
/****************************************************************************
@ -120,7 +122,7 @@ EXTERN pid_t g_worker;
*
****************************************************************************/
EXTERN int work_queue(struct work_s *work, worker_t worker, FAR void *arg, uint32 delay);
EXTERN int work_queue(struct work_s *work, worker_t worker, FAR void *arg, uint32_t delay);
/****************************************************************************
* Name: work_cancel

View File

@ -41,7 +41,9 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
/****************************************************************************
* Pre-processor Definitions
@ -95,14 +97,14 @@ struct nxflat_hdr_s
* The bss segment is data_end through bss_end.
*/
uint32 h_entry;
uint32 h_datastart;
uint32 h_dataend;
uint32 h_bssend;
uint32_t h_entry;
uint32_t h_datastart;
uint32_t h_dataend;
uint32_t h_bssend;
/* Size of stack, in bytes */
uint32 h_stacksize;
uint32_t h_stacksize;
/* Relocation entries:
*
@ -111,7 +113,7 @@ struct nxflat_hdr_s
* relative to the start of the file
*/
uint32 h_relocstart; /* Offset of relocation records */
uint32_t h_relocstart; /* Offset of relocation records */
/* Imported symbol table (NOTE no symbols are exported):
*
@ -119,12 +121,12 @@ struct nxflat_hdr_s
* symbol structures (struct nxflat_import_s). The
* h_importsymbols offset is relative to the
* beginning of the file. Each entry of the
* array contains an uint32 offset (again from
* array contains an uint32_t offset (again from
* the beginning of the file) to the name of
* a symbol string. This string is null-terminated.
*/
uint32 h_importsymbols; /* Offset to list of imported symbols */
uint32_t h_importsymbols; /* Offset to list of imported symbols */
/* 16-bit counts
*
@ -132,8 +134,8 @@ struct nxflat_hdr_s
* h_importcount - The number of records in the h_importsymbols array.
*/
uint16 h_reloccount; /* Number of relocation records */
uint16 h_importcount; /* Number of imported symbols */
uint16_t h_reloccount; /* Number of relocation records */
uint16_t h_importcount; /* Number of imported symbols */
};
/****************************************************************************
@ -144,24 +146,24 @@ struct nxflat_hdr_s
struct nxflat_reloc_s
{
uint32 r_info; /* Bit-encoded relocation info */
uint32_t r_info; /* Bit-encoded relocation info */
};
/* Pack the type and the offset into one 32-bit value */
#define NXFLAT_RELOC(t,o) (((u_int32_t)((t) & 3) << 30) | ((o) & 0x3fffffff))
#define NXFLAT_RELOC(t,o) (((uint32_t)((t) & 3) << 30) | ((o) & 0x3fffffff))
/* The top three bits of the relocation info is the relocation type (see the
* NXFLAT_RELOC_TYPE_* definitions below. This is an unsigned value.
*/
#define NXFLAT_RELOC_TYPE(r) ((uint32)(r) >> 30)
#define NXFLAT_RELOC_TYPE(r) ((uint32_t)(r) >> 30)
/* The bottom 28 bits of the relocation info is the (non-negative) offset into
* the D-Space that needs the fixup.
*/
#define NXFLAT_RELOC_OFFSET(r) ((uint32)(r) & 0x3fffffff)
#define NXFLAT_RELOC_OFFSET(r) ((uint32_t)(r) & 0x3fffffff)
/* These are possible values for the relocation type:
*
@ -195,8 +197,8 @@ struct nxflat_reloc_s
struct nxflat_import_s
{
uint32 i_funcname; /* Offset to name of imported function */
uint32 i_funcaddress; /* Resolved address of imported function */
uint32_t i_funcname; /* Offset to name of imported function */
uint32_t i_funcaddress; /* Resolved address of imported function */
};
#endif /* __INCLUDE_NXFLAT_H */

View File

@ -41,11 +41,12 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <semaphore.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/* Poll event definitions:
@ -98,7 +99,7 @@ typedef unsigned int nfds_t;
* poll events.
*/
typedef ubyte pollevent_t;
typedef uint8_t pollevent_t;
/* This is the Nuttx variant of the standard pollfd structure. */

View File

@ -42,7 +42,10 @@
#include <nuttx/config.h> /* Default settings */
#include <nuttx/compiler.h> /* Compiler settings */
#include <sys/types.h> /* Needed for general types */
#include <stdint.h> /* C99 fixed width integer types */
#include <stdbool.h> /* C99 boolean types */
#include <semaphore.h> /* Needed for sem_t */
#include <signal.h> /* Needed for sigset_t */
#include <time.h> /* Needed for struct timespec */
@ -127,7 +130,7 @@
/* Used to initialize a pthread_once_t */
#define PTHREAD_ONCE_INIT (FALSE)
#define PTHREAD_ONCE_INIT (false)
/* This is returned by pthread_wait. It must not match any errno in errno.h */
@ -157,10 +160,10 @@ typedef pthread_startroutine_t pthread_func_t;
struct pthread_attr_s
{
size_t stacksize; /* Size of the stack allocated for the pthead */
sint16 priority; /* Priority of the pthread */
ubyte policy; /* Pthread scheduler policy */
ubyte inheritsched; /* Inherit parent prio/policy? */
size_t stacksize; /* Size of the stack allocated for the pthead */
int16_t priority; /* Priority of the pthread */
uint8_t policy; /* Pthread scheduler policy */
uint8_t nheritsched; /* Inherit parent prio/policy? */
};
typedef struct pthread_attr_s pthread_attr_t;
@ -177,9 +180,9 @@ typedef struct pthread_cond_s pthread_cond_t;
struct pthread_mutexattr_s
{
ubyte pshared; /* PTHREAD_PROCESS_PRIVATE or PTHREAD_PROCESS_SHARED */
uint8_t pshared; /* PTHREAD_PROCESS_PRIVATE or PTHREAD_PROCESS_SHARED */
#ifdef CONFIG_MUTEX_TYPES
ubyte type; /* Type of the mutex. See PTHREAD_MUTEX_* definitions */
uint8_t type; /* Type of the mutex. See PTHREAD_MUTEX_* definitions */
#endif
};
typedef struct pthread_mutexattr_s pthread_mutexattr_t;
@ -189,7 +192,7 @@ struct pthread_mutex_s
int pid; /* ID of the holder of the mutex */
sem_t sem; /* Semaphore underlying the implementation of the mutex */
#ifdef CONFIG_MUTEX_TYPES
ubyte type; /* Type of the mutex. See PTHREAD_MUTEX_* definitions */
uint8_t type; /* Type of the mutex. See PTHREAD_MUTEX_* definitions */
int nlocks; /* The number of recursive locks held */
#endif
};
@ -214,7 +217,7 @@ struct pthread_barrier_s
};
typedef struct pthread_barrier_s pthread_barrier_t;
typedef boolean pthread_once_t;
typedef bool pthread_once_t;
/* Forware references */

View File

@ -1,7 +1,7 @@
/************************************************************************
* queue.h
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -43,7 +43,7 @@
#include <sys/types.h>
/************************************************************************
* Definitions
* Pre-processor Definitions
************************************************************************/
#define sq_init(q) do { (q)->head = NULL; (q)->tail = NULL; } while (0)

View File

@ -41,10 +41,13 @@
********************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <nuttx/sched.h>
/********************************************************************************
* Definitions
* Pre-processor Definitions
********************************************************************************/
/* Task Management Definitins ***************************************************/
@ -88,7 +91,7 @@ extern "C" {
#ifndef CONFIG_CUSTOM_STACK
EXTERN int task_init(FAR _TCB *tcb, const char *name, int priority,
FAR uint32 *stack, uint32 stack_size,
FAR uint32_t *stack, uint32_t stack_size,
main_t entry, const char *argv[]);
#else
EXTERN int task_init(FAR _TCB *tcb, const char *name, int priority,
@ -121,7 +124,7 @@ EXTERN int sched_rr_get_interval(pid_t pid, struct timespec *interval);
EXTERN int sched_lock(void);
EXTERN int sched_unlock(void);
EXTERN sint32 sched_lockcount(void);
EXTERN int32_t sched_lockcount(void);
/* If instrumentation of the scheduler is enabled, then some
* outboard logic must provide the following interfaces.

View File

@ -40,7 +40,9 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
#include <nuttx/config.h>
#include <stdint.h>
#include <limits.h>
#ifdef __cplusplus
@ -51,7 +53,7 @@ extern "C" {
#endif
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
@ -66,8 +68,8 @@ struct semholder_s
#if CONFIG_SEM_PREALLOCHOLDERS > 0
struct semholder_s *flink; /* Implements singly linked list */
#endif
void *holder; /* Holder TCB (actual type is _TCB) */
sint16 counts; /* Number of counts owned by this holder */
void *holder; /* Holder TCB (actual type is _TCB) */
int16_t counts; /* Number of counts owned by this holder */
};
#endif
@ -75,7 +77,7 @@ struct semholder_s
struct sem_s
{
sint16 semcount; /* >0 -> Num counts available */
int16_t semcount; /* >0 -> Num counts available */
/* <0 -> Num tasks waiting for semaphore */
#ifdef CONFIG_PRIORITY_INHERITANCE
struct semholder_s hlist; /* List of holders of semaphore counts */

View File

@ -42,15 +42,12 @@
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <time.h> /* Needed for struct timespec */
#include <sys/types.h>
#include <stdint.h>
#include <time.h>
/********************************************************************************
* Compilations Switches
********************************************************************************/
/********************************************************************************
* Definitions
* Pre-processor Definitions
********************************************************************************/
/* Signal set management definitions and macros. */
@ -164,8 +161,8 @@ union sigval
struct sigevent
{
ubyte sigev_notify; /* Notification method: SIGEV_SIGNAL or SIGEV_NONE */
ubyte sigev_signo; /* Notification signal */
uint8_t sigev_notify; /* Notification method: SIGEV_SIGNAL or SIGEV_NONE */
uint8_t sigev_signo; /* Notification signal */
union sigval sigev_value; /* Data passed with notification */
};
@ -173,8 +170,8 @@ struct sigevent
struct siginfo
{
ubyte si_signo; /* Identifies signal */
ubyte si_code; /* Source: SI_USER, SI_QUEUE, SI_TIMER, SI_ASYNCIO, or SI_MESGQ */
uint8_t si_signo; /* Identifies signal */
uint8_t si_code; /* Source: SI_USER, SI_QUEUE, SI_TIMER, SI_ASYNCIO, or SI_MESGQ */
union sigval si_value; /* Data passed with signal */
};

View File

@ -43,6 +43,8 @@
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <stdint.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@ -62,10 +64,10 @@
****************************************************************************/
/* A byte is the smallest address memory element (at least in architectures
* that do not support bit banding. We select ubyte versus the more standard
* that do not support bit banding. We select uint8_t versus the more standard
* int as the underlying type to minimize the RAM footprint of the executable.
*/
typedef ubyte _Bool;
typedef uint8_t _Bool;
#endif /* __INCLUDE_STDBOOL_H */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/stddef.h
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without

291
include/stdint.h Executable file
View File

@ -0,0 +1,291 @@
/****************************************************************************
* include/stdint.h
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_STDINT_H
#define __INCLUDE_STDINT_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <limits.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Limits of exact-width integer types */
#define INT8_MIN 0x80
#define INT8_MAX 0x7f
#define UINT8_MAX 0xff
#define INT16_MIN 0x8000
#define INT16_MAX 0x7fff
#define UINT16_MAX 0xffff
#ifdef __INT64_DEFINED
# define INT24_MIN 0x800000
# define INT24_MAX 0x7fffff
# define UINT24_MAX 0xffffff
#endif
#define INT32_MIN 0x80000000
#define INT32_MAX 0x7fffffff
#define UINT32_MAX 0xffffffff
#ifdef __INT64_DEFINED
# define INT64_MIN 0x8000000000000000
# define INT64_MAX 0x7fffffffffffffff
# define UINT64_MAX 0xffffffffffffffff
#endif
/* Limits of minimum-width integer types */
#define INT8_LEASTN_MIN 0x80
#define INT8_LEASTN_MAX 0x7f
#define UINT8_LEASTN_MAX 0xff
#define INT16_LEASTN_MIN 0x8000
#define INT16_LEASTN_MAX 0x7fff
#define UINT16_LEASTN_MAX 0xffff
#ifdef __INT64_DEFINED
# define INT24_LEASTN_MIN 0x800000
# define INT24_LEASTN_MAX 0x7fffff
# define UINT24_LEASTN_MAX 0xffffff
#endif
#define INT32_LEASTN_MIN 0x80000000
#define INT32_LEASTN_MAX 0x7fffffff
#define UINT32_LEASTN_MAX 0xffffffff
#ifdef __INT64_DEFINED
# define INT64_LEASTN_MIN 0x8000000000000000
# define INT64_LEASTN_MAX 0x7fffffffffffffff
# define UINT64_LEASTN_MAX 0xffffffffffffffff
#endif
/* Limits of fastest minimum-width integer types */
#define INT8_FASTN_MIN 0x80
#define INT8_FASTN_MAX 0x7f
#define UINT8_FASTN_MAX 0xff
#define INT16_FASTN_MIN 0x8000
#define INT16_FASTN_MAX 0x7fff
#define UINT16_FASTN_MAX 0xffff
#ifdef __INT64_DEFINED
# define INT24_FASTN_MIN 0x800000
# define INT24_FASTN_MAX 0x7fffff
# define UINT24_FASTN_MAX 0xffffff
#endif
#define INT32_FASTN_MIN 0x80000000
#define INT32_FASTN_MAX 0x7fffffff
#define UINT32_FASTN_MAX 0xffffffff
#ifdef __INT64_DEFINED
# define INT64_FASTN_MIN 0x8000000000000000
# define INT64_FASTN_MAX 0x7fffffffffffffff
# define UINT64_FASTN_MAX 0xffffffffffffffff
#endif
/* Limits of integer types capable of holding object pointers */
#define INTPTR_MIN PTR_MIN
#define INTPTR_MAX PTR_MIN
#define UINTPTR_MAX UPTR_MAX
/* Limits of greatest-width integer types */
#ifdef __INT64_DEFINED
# define INTMAX_MIN INT64_MIN
# define INTMAX_MAX INT64_MAX
# define UINTMAX_MIN UINT64_MIN
# define UINTMAX_MAX UINT64_MAX
#else
# define INTMAX_MIN INT32_MIN
# define INTMAX_MAX INT32_MAX
# define UINTMAX_MIN UINT32_MIN
# define UINTMAX_MAX UINT32_MAX
#endif
/* Macros for minimum-width integer constant expressions */
#if 0 /* REVISIT: Depends on architecture specific implementation */
#define INT8_C(x) x
#define INT16_C(x) x
#define INT32_C(x) x ## L
#define INT64_C(x) x ## LL
#define UINT8_C(x) x
#define UINT16_C(x) x
#define UINT32_C(x) x ## UL
#define UINT64_C(x) x ## ULL
#endif
/* Macros for greatest-width integer constant expressions
#ifdef CONFIG_HAVE_LONG_LONG
# define INTMAX_C(x) x ## LL
# define UINTMAX_C(x) x ## ULL
#else
# define INTMAX_C(x) x ## L
# define UINTMAX_C(x) x ## UL
#endif
/* Limits of Other Integer Types */
#if 0
# define PTRDIFF_MIN
# define PTRDIFF_MAX
#endif
#ifdef CONFIG_SMALL_MEMORY
# define SIZE_MAX 0xffff
#else
# define SIZE_MAX 0xffffffff
#endif
#if 0
# define WCHAR_MIN
# define WCHAR_MAX
# define WINT_MIN
# define WINT_MAX
#endif
/****************************************************************************
* Public Types
****************************************************************************/
/* Exact-width integer types. NOTE that these types are defined in
* architecture-specific logic with leading underscore character. This file
* typedef's these to the final name without the underscore character. This
* roundabout way of doings things allows the stdint.h to be removed from the
* include/ directory in the event that the user prefers to use the definitions
* provided by their toolchain header files.
*/
typedef _int8_t int8_t;
typedef _uint8_t uint8_t;
typedef _int16_t int16_t;
typedef _uint16_t uint16_t;
#ifdef __INT24_DEFINED
typedef _int24_t int24_t;
typedef _uint24_t uint24_t;
#endif
typedef _int32_t int32_t;
typedef _uint32_t uint32_t;
#ifdef __INT64_DEFINED
typedef _int64_t int64_t;
typedef _uint64_t uint64_t;
#endif
/* Minimum-width integer types */
typedef _int8_t int_least8_t;
typedef _uint8_t uint_least8_t;
typedef _int16_t int_least16_t;
typedef _uint16_t uint_least16_t;
#ifdef __INT24_DEFINED
typedef _int24_t int_least24_t;
typedef _uint24_t uint_least24_t;
#else
typedef _int32_t int_least24_t;
typedef _uint32_t uint_least24_t;
#endif
typedef _int32_t int_least32_t;
typedef _uint32_t uint_least32_t;
#ifdef __INT64_DEFINED
typedef _int64_t int_least64_t;
typedef _uint64_t uint_least64_t;
#endif
/* Fastest minimum-width integer types */
typedef _int8_t int_fast8_t;
typedef _uint8_t uint_fast8_t;
typedef int int_fast16_t;
typedef unsigned int uint_fast16_t;
#ifdef __INT24_DEFINED
typedef _int24_t int_fast24_t;
typedef _uint24_t uint_fast24_t;
#else
typedef _int32_t int_fast24_t;
typedef _uint32_t uint_fast24_t;
#endif
typedef _int32_t int_fast32_t;
typedef _uint32_t uint_fast32_t;
#ifdef __INT64_DEFINED
typedef _int64_t int_fast64_t;
typedef _uint64_t uint_fast64_t;
#endif
/* Integer types capable of holding object pointers */
typedef _intptr_t intptr_t;
typedef _uintptr_t uintptr_t;
/* Greatest-width integer types */
#ifdef __INT64_DEFINED
typedef _int64_t intmax_t;
typedef _uint64_t uintmax_t;
#else
typedef _int32_t intmax_t;
typedef _uint32_t uintmax_t;
#endif
#endif /* __INCLUDE_STDINT_H */

View File

@ -51,7 +51,7 @@
#include <nuttx/fs.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/* File System Definitions **************************************************/

View File

@ -41,7 +41,8 @@
****************************************************************************/
#include <nuttx/config.h>
#include <stddef.h> /* For size_t */
#include <stddef.h>
/****************************************************************************
* Definitions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/sys/mman.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/sys/mount.h
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -40,8 +40,6 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
@ -57,6 +55,7 @@
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/sys/select.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,6 +41,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <time.h>

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sys/socket.h
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/sys/stat.h
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/sys/statfs.h
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,7 +41,9 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
/****************************************************************************
* Pre-Processor Definitions
@ -100,14 +102,14 @@
struct statfs
{
uint32 f_type; /* Type of filesystem (see definitions above) */
size_t f_bsize; /* Optimal block size for transfers */
size_t f_blocks; /* Total data blocks in the file system of this size */
size_t f_bfree; /* Free blocks in the file system */
size_t f_bavail; /* Free blocks avail to non-superuser */
size_t f_files; /* Total file nodes in the file system */
size_t f_ffree; /* Free file nodes in the file system */
uint32 f_namelen; /* Maximum length of filenames */
uint32_t f_type; /* Type of filesystem (see definitions above) */
size_t f_bsize; /* Optimal block size for transfers */
size_t f_blocks; /* Total data blocks in the file system of this size */
size_t f_bfree; /* Free blocks in the file system */
size_t f_bavail; /* Free blocks avail to non-superuser */
size_t f_files; /* Total file nodes in the file system */
size_t f_ffree; /* Free file nodes in the file system */
uint32_t f_namelen; /* Maximum length of filenames */
};
/****************************************************************************

View File

@ -41,14 +41,13 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <time.h>
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/****************************************************************************
* Public Type Definitions
****************************************************************************/
@ -65,7 +64,7 @@ extern "C" {
#define EXTERN extern
#endif
EXTERN int gettimeofday(struct timeval *tp, void *tzp);
EXTERN int gettimeofday(struct timeval *tp, FAR void *tzp);
#undef EXTERN
#if defined(__cplusplus)

View File

@ -41,11 +41,12 @@
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <nuttx/compiler.h>
#include <stdint.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/* Alternative alues for type bool (for historic reasons) */
@ -84,7 +85,7 @@
#define PRIOR_OTHER_MAX 255
/* Scheduling Priorities. NOTE: Only the idle task can take
* the TRUE minimum priority. */
* the true minimum priority. */
#define SCHED_PRIORITY_MAX 255
#define SCHED_PRIORITY_DEFAULT 100

View File

@ -41,15 +41,12 @@
********************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
/********************************************************************************
* Compilations Switches
********************************************************************************/
/********************************************************************************
* Definitions
* Pre-processor Definitions
********************************************************************************/
/* Clock tick of the system (frequency Hz). The default value is 100Hz, but this
@ -83,7 +80,7 @@
* Global Type Declarations
********************************************************************************/
typedef uint32_ time_t; /* Holds time in seconds */
typedef uint32_t time_t; /* Holds time in seconds */
typedef uint8_t clockid_t; /* Identifies one time base source */
typedef FAR void *timer_t; /* Represents one POSIX timer */

View File

@ -44,7 +44,7 @@
#include <nuttx/compiler.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/* The number of functions that may be registerd to be called

View File

@ -41,15 +41,12 @@
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <sched.h>
/****************************************************************************
* Compilations Switches
****************************************************************************/
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************