From 92b110e0e2a4c2989e287415c17fa091ed17150d Mon Sep 17 00:00:00 2001 From: patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> Date: Mon, 14 Dec 2009 15:46:55 +0000 Subject: [PATCH] Changing NuttX fixed size type names to C99 standard names -- things will be broken for awhile git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2335 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog | 2 + Documentation/NuttX.html | 2 + README.txt | 25 +++++--- arch/arm/include/types.h | 36 +++++++---- arch/hc/include/hc12/types.h | 37 ++++++----- arch/hc/include/hcs12/types.h | 38 +++++++----- arch/pjrc-8051/include/types.h | 50 ++++++++------- arch/sh/include/m16c/types.h | 45 +++++++++----- arch/sh/include/sh1/types.h | 38 +++++++----- arch/sim/include/types.h | 64 +++++++++++-------- arch/z16/include/types.h | 36 ++++++----- arch/z80/include/ez80/irq.h | 10 +-- arch/z80/include/ez80/types.h | 46 +++++++++----- arch/z80/include/irq.h | 10 +-- arch/z80/include/z8/irq.h | 2 +- arch/z80/include/z8/types.h | 37 ++++++----- arch/z80/include/z80/irq.h | 8 +-- arch/z80/include/z80/types.h | 37 ++++++----- drivers/pipes/pipe_common.h | 16 ++--- include/fixedmath.h | 14 ++--- include/net/uip/uip.h | 66 ++++++++++---------- include/net/uip/uipopt.h | 4 +- include/netinet/in.h | 12 ++-- include/nuttx/fb.h | 28 ++++----- include/nuttx/net.h | 11 ++-- include/nuttx/nxglib.h | 8 +-- include/nuttx/usbdev_trace.h | 14 ++--- include/signal.h | 2 +- include/sys/select.h | 11 ++-- include/sys/types.h | 44 ++++++------- include/time.h | 5 +- include/wdog.h | 25 ++++---- netutils/dhcpd/dhcpd.c | 110 ++++++++++++++++----------------- 33 files changed, 505 insertions(+), 388 deletions(-) diff --git a/ChangeLog b/ChangeLog index 290942b12b..3b9367f36e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -995,4 +995,6 @@ between uint32 (32-bits) and an mc68hc12 pointer (16-bits). * sys/types: Size of off_t and blkcnt_t should not depend on size of int in the architecture; Removed non-standard type STATUS + * include/ - Added header files stdint.h, stdbool.h, cxx/cstdint, and + cxx/cstdbool diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index bbe8fb6b51..6774545144 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -1621,6 +1621,8 @@ nuttx-2010.1 2010-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> between uint32 (32-bits) and an mc68hc12 pointer (16-bits). * sys/types: Size of off_t and blkcnt_t should not depend on size of int in the architecture; Removed non-standard type STATUS + * include/ - Added header files stdint.h, stdbool.h, cxx/cstdint, and + cxx/cstdbool pascal-2010.1 2010-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/README.txt b/README.txt index 56f6e5b739..a32dde24aa 100755 --- a/README.txt +++ b/README.txt @@ -29,16 +29,21 @@ Download and Unpack: A Note about Header Files: - NuttX compiles without using the standard header files that are - distributed with your toolchain. That is correct behavior in most - cases because the header files bundled with your toolchain (such as - stdio.h) are probably not correct for use with NuttX. Certain - header files, such as setjmp.h, may be needed from your toolchain. - In that case, one solution is to copy that file from your toolchain - into the NuttX include directory. If you prefer to use the stdint.h - and stdbool.h header files from your toolchain, those could be copied - too. Using most other header files from your toolchain would probably - cause errors. + Some toolchains are built with header files extracted from a C-library + distribution (such as newlib). For those toolchains, NuttX must be + compiled without using the standard header files that are distributed + with your toolchain. This prevents including conflicting, incompatible + header files (such as stdio.h). + + Certain header files, such as setjmp.h and varargs.h, may still be + needed from your toolchain, however. If that is the case, one solution + is to copy those header file from your toolchain into the NuttX include + directory. + + Also, if you prefer to use the stdint.h and stdbool.h header files from + your toolchain, those could be copied into the include/ directory too. + Using most other header files from your toolchain would probably cause + errors. CONFIGURING NUTTX ^^^^^^^^^^^^^^^^^ diff --git a/arch/arm/include/types.h b/arch/arm/include/types.h index f2dbc5a067..9a45fcb754 100644 --- a/arch/arm/include/types.h +++ b/arch/arm/include/types.h @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/include/types.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 @@ -54,22 +54,32 @@ #ifndef __ASSEMBLY__ -/* These are the sizes of the standard GNU types */ +/* These are the sizes of the standard integer types. NOTE that these type + * names have a leading underscore character. This file will be included + * (indirectly) by include/stdint.h and typedef'ed 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 char _int8_t; +typedef unsigned char _uint8_t; + +typedef short _int16_t; +typedef unsigned short _uint16_t; + +typedef int _int32_t; +typedef unsigned int _uint32_t; -typedef char sbyte; -typedef unsigned char ubyte; -typedef unsigned char uint8; -typedef unsigned char boolean; -typedef short sint16; -typedef unsigned short uint16; -typedef int sint32; -typedef unsigned int uint32; -typedef long long sint64; -typedef unsigned long long uint64; +typedef long long _int64_t; +typedef unsigned long long _uint64_t; +#define __INT64_DEFINED /* A pointer is 4 bytes */ -typedef unsigned int uintptr; +typedef int _intptr_t; +typedef unsigned int _uintptr_t; /* This is the size of the interrupt state save returned by irqsave(). For * ARM, a 32 register value is returned, for the thumb2, Cortex-M3, the 16-bit diff --git a/arch/hc/include/hc12/types.h b/arch/hc/include/hc12/types.h index 4eb006c3c1..f29be63940 100755 --- a/arch/hc/include/hc12/types.h +++ b/arch/hc/include/hc12/types.h @@ -54,14 +54,19 @@ #ifndef __ASSEMBLY__ -/* These are the sizes of the standard GNU types */ +/* These are the sizes of the standard integer types. NOTE that these type + * names have a leading underscore character. This file will be included + * (indirectly) by include/stdint.h and typedef'ed 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 char sbyte; -typedef unsigned char ubyte; -typedef unsigned char uint8; -typedef unsigned char boolean; -typedef short sint16; -typedef unsigned short uint16; +typedef char _int8_t; +typedef unsigned char _uint8_t; +typedef short _int16_t; +typedef unsigned short _uint16_t; /* Normally, mc68hc1x code is compiled with the -mshort option * which results in a 16-bit integer. If -mnoshort is defined @@ -69,23 +74,25 @@ typedef unsigned short uint16; */ # if __INT__ == 16 -typedef long sint32; -typedef unsigned long uint32; +typedef long _int32_t; +typedef unsigned long _uint32_t; #else -typedef int sint32; -typedef unsigned int uint32; +typedef int _int32_t; +typedef unsigned int _uint32_t; #endif -typedef long long sint64; -typedef unsigned long long uint64; +typedef long long _int64_t; +typedef unsigned long long _uint64_t; +#define __INT64_DEFINED /* A pointer is two bytes */ -typedef unsigned short uintptr; +typedef short _intptr_t; +typedef unsigned short _uintptr_t; /* This is the size of the interrupt state save returned by irqsave()*/ -typedef unsigned int irqstate_t; +typedef unsigned int irqstate_t; #endif /* __ASSEMBLY__ */ diff --git a/arch/hc/include/hcs12/types.h b/arch/hc/include/hcs12/types.h index 1341377e45..33008793a6 100755 --- a/arch/hc/include/hcs12/types.h +++ b/arch/hc/include/hcs12/types.h @@ -54,14 +54,20 @@ #ifndef __ASSEMBLY__ -/* These are the sizes of the standard GNU types */ +/* These are the sizes of the standard integer types. NOTE that these type + * names have a leading underscore character. This file will be included + * (indirectly) by include/stdint.h and typedef'ed 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 char _int8_t; +typedef unsigned char _uint8_t; -typedef char sbyte; -typedef unsigned char ubyte; -typedef unsigned char uint8; -typedef unsigned char boolean; -typedef short sint16; -typedef unsigned short uint16; +typedef short _int16_t; +typedef unsigned short _uint16_t; /* Normally, mc68hc1x code is compiled with the -mshort option * which results in a 16-bit integer. If -mnoshort is defined @@ -69,23 +75,25 @@ typedef unsigned short uint16; */ # if __INT__ == 16 -typedef long sint32; -typedef unsigned long uint32; +typedef long _int32_t; +typedef unsigned long _uint32_t; #else -typedef int sint32; -typedef unsigned int uint32; +typedef int _int32_t; +typedef unsigned int _uint32_t; #endif -typedef long long sint64; -typedef unsigned long long uint64; +typedef long long _int64_t; +typedef unsigned long long _uint64_t; +#define __INT64_DEFINED /* A pointer is two bytes */ -typedef unsigned short uintptr; +typedef short _intptr_t; +typedef unsigned short _uintptr_t; /* This is the size of the interrupt state save returned by irqsave()*/ -typedef unsigned int irqstate_t; +typedef unsigned int irqstate_t; #endif /* __ASSEMBLY__ */ diff --git a/arch/pjrc-8051/include/types.h b/arch/pjrc-8051/include/types.h index e8fa77a392..45141634c1 100644 --- a/arch/pjrc-8051/include/types.h +++ b/arch/pjrc-8051/include/types.h @@ -1,4 +1,4 @@ -/************************************************************ +/************************************************************************ * arch/pjrc-8051/include/types.h * * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ************************************************************************/ /* This file should never be included directed but, rather, * only indirectly through sys/types.h @@ -40,51 +40,59 @@ #ifndef __ARCH_PJRC8051_INCLUDE_TYPES_H #define __ARCH_PJRC8051_INCLUDE_TYPES_H -/************************************************************ +/************************************************************************ * Included Files - ************************************************************/ + ************************************************************************/ -/************************************************************ +/************************************************************************ * Definitions - ************************************************************/ + ************************************************************************/ -/************************************************************ +/************************************************************************ * Type Declarations - ************************************************************/ + ************************************************************************/ #ifndef __ASSEMBLY__ -/* These are the sizes of the standard SDCC types +/* These are the sizes of the standard integer types. NOTE that these type + * names have a leading underscore character. This file will be included + * (indirectly) by include/stdint.h and typedef'ed 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 + * * * For SDCC, sizeof(int) is 16 and sizeof(long) is 32. * long long and double are not supported. */ -typedef char sbyte; -typedef unsigned char ubyte; -typedef unsigned char uint8; -typedef unsigned char boolean; -typedef int sint16; -typedef unsigned int uint16; -typedef long sint32; -typedef unsigned long uint32; +typedef char _int8_t; +typedef unsigned char _uint8_t; + +typedef int _int16_t; +typedef unsigned int _uint16_t; + +typedef long _int32_t; +typedef unsigned long _uint32_t; /* For SDCC, a Generic pointer is 3 bytes in length with the * first byte holding data space information. */ -typedef unsigned long uintptr; +typedef long _intptr_t; +typedef unsigned long _uintptr_t; /* This is the size of the interrupt state save returned by * irqsave() */ -typedef unsigned char irqstate_t; +typedef unsigned char irqstate_t; #endif /* __ASSEMBLY__ */ -/************************************************************ +/************************************************************************ * Global Function Prototypes - ************************************************************/ + ************************************************************************/ #endif /* __ARCH_PJRC8051_INCLUDE_TYPES_H */ diff --git a/arch/sh/include/m16c/types.h b/arch/sh/include/m16c/types.h index 8037a4617b..d148128600 100644 --- a/arch/sh/include/m16c/types.h +++ b/arch/sh/include/m16c/types.h @@ -37,8 +37,8 @@ * through sys/types.h */ -#ifndef __ARCH_SH_INCLUDE_SH1_TYPES_H -#define __ARCH_SH_INCLUDE_SH1_TYPES_H +#ifndef __ARCH_SH_INCLUDE_M16C_TYPES_H +#define __ARCH_SH_INCLUDE_M16C_TYPES_H /**************************************************************************** * Included Files @@ -54,29 +54,40 @@ #ifndef __ASSEMBLY__ -/* These are the sizes of the standard GNU types. int is 16-bits and - * long is 32-bits */ +/* These are the sizes of the standard integer types. NOTE that these type + * names have a leading underscore character. This file will be included + * (indirectly) by include/stdint.h and typedef'ed 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 + * + * int is 16-bits and long is 32-bits + */ + +typedef char _int8_t; +typedef unsigned char _uint8_t; + +typedef int _int16_t; +typedef unsigned int _uint16_t; + +typedef long _int32_t; +typedef unsigned long _uint32_t; -typedef char sbyte; -typedef unsigned char ubyte; -typedef unsigned char uint8; -typedef unsigned char boolean; -typedef int sint16; -typedef unsigned int uint16; -typedef long sint32; -typedef unsigned long uint32; -typedef long long sint64; -typedef unsigned long long uint64; +typedef long long _int64_t; +typedef unsigned long long _uint64_t; +#define __INT64_DEFINED /* A pointer is 2 bytes */ -typedef unsigned int uintptr; +typedef unsigned int _intptr_t; +typedef unsigned int _uintptr_t; /* This is the size of the interrupt state save returned by * irqsave() */ -typedef uint16 irqstate_t; +typedef _uint16_t irqstate_t; #endif /* __ASSEMBLY__ */ @@ -84,4 +95,4 @@ typedef uint16 irqstate_t; * Global Function Prototypes ****************************************************************************/ -#endif /* __ARCH_SH_INCLUDE_SH1_TYPES_H */ +#endif /* __ARCH_SH_INCLUDE_M16C_TYPES_H */ diff --git a/arch/sh/include/sh1/types.h b/arch/sh/include/sh1/types.h index 7b8876c936..79ed1a1819 100644 --- a/arch/sh/include/sh1/types.h +++ b/arch/sh/include/sh1/types.h @@ -54,28 +54,38 @@ #ifndef __ASSEMBLY__ -/* These are the sizes of the standard GNU types */ - -typedef char sbyte; -typedef unsigned char ubyte; -typedef unsigned char uint8; -typedef unsigned char boolean; -typedef short sint16; -typedef unsigned short uint16; -typedef int sint32; -typedef unsigned int uint32; -typedef long long sint64; -typedef unsigned long long uint64; +/* These are the sizes of the standard integer types. NOTE that these type + * names have a leading underscore character. This file will be included + * (indirectly) by include/stdint.h and typedef'ed 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 char _int8_t; +typedef unsigned char _uint8_t; + +typedef short _int16_t; +typedef unsigned short _uint16_t; + +typedef int _int32_t; +typedef unsigned int _uint32_t; + +typedef long long _int64_t; +typedef unsigned long long _uint64_t; +#define __INT64_DEFINED /* A pointer is 4 bytes */ -typedef unsigned int uintptr; +typedef int _intptr_t; +typedef unsigned int _uintptr_t; /* This is the size of the interrupt state save returned by * irqsave() */ -typedef unsigned long irqstate_t; +typedef unsigned long irqstate_t; #endif /* __ASSEMBLY__ */ diff --git a/arch/sim/include/types.h b/arch/sim/include/types.h index 9648b12aea..9c265bc6db 100644 --- a/arch/sim/include/types.h +++ b/arch/sim/include/types.h @@ -1,5 +1,5 @@ -/************************************************************ - * types.h +/************************************************************************ + * arch/sim/include/types.h * * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> @@ -31,56 +31,66 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ************************************************************************/ /* This file should never be included directed but, rather, * only indirectly through sys/types.h */ -#ifndef __ARCH_TYPES_H -#define __ARCH_TYPES_H +#ifndef __ARCH_SIM_INCLUDE_TYPES_H +#define __ARCH_SIM_INCLUDE_TYPES_H -/************************************************************ +/************************************************************************ * Included Files - ************************************************************/ + ************************************************************************/ -/************************************************************ +/************************************************************************ * Definitions - ************************************************************/ + ************************************************************************/ -/************************************************************ +/************************************************************************ * Type Declarations - ************************************************************/ + ************************************************************************/ #ifndef __ASSEMBLY__ -/* These are the sizes of the standard GNU types */ +/* These are the sizes of the standard integer types. NOTE that these type + * names have a leading underscore character. This file will be included + * (indirectly) by include/stdint.h and typedef'ed 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 char _int8_t; +typedef unsigned char _uint8_t; + +typedef short _int16_t; +typedef unsigned short _uint16_t; + +typedef int _int32_t; +typedef unsigned int _uint32_t; -typedef char sbyte; -typedef unsigned char ubyte; -typedef unsigned char uint8; -typedef unsigned char boolean; -typedef short sint16; -typedef unsigned short uint16; -typedef int sint32; -typedef unsigned int uint32; -typedef long long sint64; -typedef unsigned long long uint64; +typedef long long _int64_t; +typedef unsigned long long _uint64_t; +#define __INT64_DEFINED /* A pointer is 4 bytes */ -typedef unsigned int uintptr; +typedef unsigned int _intptr_t; +typedef unsigned int _uintptr_t; /* This is the size of the interrupt state save returned by * irqsave() */ -typedef unsigned int irqstate_t; +typedef unsigned int irqstate_t; #endif /* __ASSEMBLY__ */ -/************************************************************ +/************************************************************************ * Global Function Prototypes - ************************************************************/ + ************************************************************************/ -#endif /* __ARCH_TYPES_H */ +#endif /* __ARCH_SIM_INCLUDE_TYPES_H */ diff --git a/arch/z16/include/types.h b/arch/z16/include/types.h index 34a6541841..b83a6070de 100644 --- a/arch/z16/include/types.h +++ b/arch/z16/include/types.h @@ -37,8 +37,8 @@ * only indirectly through sys/types.h */ -#ifndef __ARCH_Z16_INCLUDE_TYPE_H -#define __ARCH_Z16_INCLUDE_TYPE_H +#ifndef __ARCH_Z16_INCLUDE_TYPES_H +#define __ARCH_Z16_INCLUDE_TYPES_H /**************************************************************************** * Included Files @@ -54,26 +54,34 @@ #ifndef __ASSEMBLY__ -/* These are the sizes of the standard GNU types */ +/* These are the sizes of the standard integer types. NOTE that these type + * names have a leading underscore character. This file will be included + * (indirectly) by include/stdint.h and typedef'ed 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 char _int8_t; +typedef unsigned char _uint8_t; + +typedef short _int16_t; +typedef unsigned short _uint16_t; -typedef char sbyte; -typedef unsigned char ubyte; -typedef unsigned char uint8; -typedef unsigned char boolean; -typedef short sint16; -typedef unsigned short uint16; -typedef int sint32; -typedef unsigned int uint32; +typedef int _int32_t; +typedef unsigned int _uint32_t; /* A pointer is 4 bytes */ -typedef unsigned int uintptr; +typedef int _intptr_t; +typedef unsigned int _uintptr_t; /* This is the size of the interrupt state save returned by * irqsave() */ -typedef unsigned short irqstate_t; +typedef unsigned short irqstate_t; #endif /* __ASSEMBLY__ */ @@ -81,4 +89,4 @@ typedef unsigned short irqstate_t; * Global Function Prototypes ****************************************************************************/ -#endif /* __ARCH_Z16_INCLUDE_TYPE_H */ +#endif /* __ARCH_Z16_INCLUDE_TYPES_H */ diff --git a/arch/z80/include/ez80/irq.h b/arch/z80/include/ez80/irq.h index 2cbd376f0e..dd478d5034 100644 --- a/arch/z80/include/ez80/irq.h +++ b/arch/z80/include/ez80/irq.h @@ -38,8 +38,8 @@ * only indirectly through nuttx/irq.h (via arch/irq.h) */ -#ifndef __ARCH_EZ80_IRQ_H -#define __ARCH_EZ80_IRQ_H +#ifndef __ARCH_Z80_INCLUDE_EZ80_IRQ_H +#define __ARCH_Z80_INCLUDE_EZ80_IRQ_H #ifndef _EZ80F91 # error "Only the EZ80F91 is currently supported" @@ -197,9 +197,9 @@ /* This is the type of the register save array */ #ifdef CONFIG_EZ80_Z80MODE -typedef uint16 chipreg_t; +typedef uint16_t chipreg_t; #else -typedef uint24 chipreg_t; +typedef uint24_t chipreg_t; #endif /* This struct defines the way the registers are stored. */ @@ -254,5 +254,5 @@ EXTERN void irqrestore(irqstate_t flags); #endif #endif -#endif /* __ARCH_EZ80_IRQ_H */ +#endif /* __ARCH_Z80_INCLUDE_EZ80_IRQ_H */ diff --git a/arch/z80/include/ez80/types.h b/arch/z80/include/ez80/types.h index 52c95ac6bd..4ca48e6973 100644 --- a/arch/z80/include/ez80/types.h +++ b/arch/z80/include/ez80/types.h @@ -38,8 +38,8 @@ * through sys/types.h */ -#ifndef __ARCH_CHIP_TYPES_H -#define __ARCH_CHIP_TYPES_H +#ifndef __ARCH_Z80_INCLUDE_EZ80_TYPES_H +#define __ARCH_Z80_INCLUDE_EZ80_TYPES_H /**************************************************************************** * Included Files @@ -55,7 +55,15 @@ #ifndef __ASSEMBLY__ -/* These are the sizes of the types supported by the ZiLOG Z8Encore! compiler: +/* These are the sizes of the standard integer types. NOTE that these type + * names have a leading underscore character. This file will be included + * (indirectly) by include/stdint.h and typedef'ed 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 + * + * These are the sizes of the types supported by the ZiLOG compiler: * * int - 24-bits * short - 16-bits @@ -64,16 +72,18 @@ * float - 32-bits */ -typedef char sbyte; -typedef unsigned char ubyte; -typedef unsigned char uint8; -typedef unsigned char boolean; -typedef short sint16; -typedef unsigned short uint16; -typedef int sint24; -typedef unsigned int uint24; -typedef long sint32; -typedef unsigned long uint32; +typedef char _int8_t; +typedef unsigned char _uint8_t; + +typedef short _int16_t; +typedef unsigned short _uint16_t; + +typedef int _int24_t; +typedef unsigned int _uint24_t; +#define __INT24_DEFINED + +typedef long _int32_t; +typedef unsigned long _uint32_t; /* A pointer is 2 or 3 bytes, depending upon if the ez80 is in z80 * compatibility mode or not @@ -83,16 +93,18 @@ typedef unsigned long uint32; */ #ifdef CONFIG_EZ80_Z80MODE -typedef unsigned short uintptr; +typedef short _intptr_t; +typedef unsigned short _uintptr_t; #else -typedef unsigned int uintptr; +typedef int _intptr_t; +typedef unsigned int _uintptr_t; #endif /* This is the size of the interrupt state save returned by irqsave(). * It holds the AF regiser pair + a zero pad byte */ -typedef uint24 irqstate_t; +typedef _uint24_t irqstate_t; #endif /* __ASSEMBLY__ */ @@ -100,4 +112,4 @@ typedef uint24 irqstate_t; * Global Function Prototypes ****************************************************************************/ -#endif /* __ARCH_CHIP_TYPES_H */ +#endif /* __ARCH_Z80_INCLUDE_EZ80_TYPES_H */ diff --git a/arch/z80/include/irq.h b/arch/z80/include/irq.h index 6ef0188ac5..62957914f2 100644 --- a/arch/z80/include/irq.h +++ b/arch/z80/include/irq.h @@ -1,7 +1,7 @@ /**************************************************************************** - * arch/irq.h + * arch/z80/include/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 @@ -37,8 +37,8 @@ * only indirectly through nuttx/irq.h */ -#ifndef __ARCH_IRQ_H -#define __ARCH_IRQ_H +#ifndef __ARCH_Z80_INCLUDE_IRQ_H +#define __ARCH_Z80_INCLUDE_IRQ_H /**************************************************************************** * Included Files @@ -77,5 +77,5 @@ extern "C" { #endif #endif -#endif /* __ARCH_IRQ_H */ +#endif /* __ARCH_Z80_INCLUDE_IRQ_H */ diff --git a/arch/z80/include/z8/irq.h b/arch/z80/include/z8/irq.h index 25c80e009e..764ace3383 100644 --- a/arch/z80/include/z8/irq.h +++ b/arch/z80/include/z8/irq.h @@ -306,7 +306,7 @@ /* This is the type of the register save array */ -typedef uint16 chipreg_t; +typedef uint16_t chipreg_t; /* This struct defines the way the registers are stored. */ diff --git a/arch/z80/include/z8/types.h b/arch/z80/include/z8/types.h index 79f2682f6c..0e269a5de3 100644 --- a/arch/z80/include/z8/types.h +++ b/arch/z80/include/z8/types.h @@ -38,8 +38,8 @@ * through sys/types.h */ -#ifndef __ARCH_CHIP_TYPES_H -#define __ARCH_CHIP_TYPES_H +#ifndef __ARCH_Z80_INCLUDE_Z8_IRQ_H +#define __ARCH_Z80_INCLUDE_Z8_IRQ_H /**************************************************************************** * Included Files @@ -55,7 +55,15 @@ #ifndef __ASSEMBLY__ -/* These are the sizes of the types supported by the ZiLOG Z8Encore! compiler: +/* These are the sizes of the standard integer types. NOTE that these type + * names have a leading underscore character. This file will be included + * (indirectly) by include/stdint.h and typedef'ed 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 + * + * These are the sizes of the types supported by the ZiLOG Z8Encore! compiler: * * int - 16-bits * short - 16-bits @@ -71,22 +79,23 @@ * rom pointer - 16-bits */ -typedef char sbyte; -typedef unsigned char ubyte; -typedef unsigned char uint8; -typedef unsigned char boolean; -typedef int sint16; -typedef unsigned int uint16; -typedef long sint32; -typedef unsigned long uint32; +typedef char _int8_t; +typedef unsigned char _uint8_t; + +typedef int _int16_t; +typedef unsigned int _uint16_t; + +typedef long _int32_t; +typedef unsigned long _uint32_t; /* A pointer is 2 bytes */ -typedef unsigned int uintptr; +typedef unsigned int _intptr_t; +typedef unsigned int _uintptr_t; /* This is the size of the interrupt state save returned by irqsave() */ -typedef ubyte irqstate_t; +typedef _uint8_t irqstate_t; #endif /* __ASSEMBLY__ */ @@ -94,4 +103,4 @@ typedef ubyte irqstate_t; * Global Function Prototypes ****************************************************************************/ -#endif /* __ARCH_CHIP_TYPES_H */ +#endif /* __ARCH_Z80_INCLUDE_Z8_IRQ_H */ diff --git a/arch/z80/include/z80/irq.h b/arch/z80/include/z80/irq.h index 042e44e17e..05e62a0194 100644 --- a/arch/z80/include/z80/irq.h +++ b/arch/z80/include/z80/irq.h @@ -38,8 +38,8 @@ * only indirectly through nuttx/irq.h (via arch/irq.h) */ -#ifndef __ARCH_Z80_IRQ_H -#define __ARCH_Z80_IRQ_H +#ifndef __ARCH_Z80_INCLUDE_Z80_IRQ_H +#define __ARCH_Z80_INCLUDE_Z80_IRQ_H /**************************************************************************** * Included Files @@ -90,7 +90,7 @@ /* This is the type of the register save array */ -typedef uint16 chipreg_t; +typedef uint16_t chipreg_t; /* This struct defines the way the registers are stored. */ @@ -144,5 +144,5 @@ EXTERN void irqrestore(irqstate_t flags) __naked; #endif #endif -#endif /* __ARCH_Z80_IRQ_H */ +#endif /* __ARCH_Z80_INCLUDE_Z80_IRQ_H */ diff --git a/arch/z80/include/z80/types.h b/arch/z80/include/z80/types.h index d482725bc7..652ea5adf3 100644 --- a/arch/z80/include/z80/types.h +++ b/arch/z80/include/z80/types.h @@ -38,8 +38,8 @@ * through sys/types.h */ -#ifndef __ARCH_CHIP_TYPES_H -#define __ARCH_CHIP_TYPES_H +#ifndef __ARC_Z80_INCLUDE_Z80_TYPES_H +#define __ARC_Z80_INCLUDE_Z80_TYPES_H /**************************************************************************** * Included Files @@ -55,7 +55,15 @@ #ifndef __ASSEMBLY__ -/* These are the sizes of the standard SDCC types +/* These are the sizes of the standard integer types. NOTE that these type + * names have a leading underscore character. This file will be included + * (indirectly) by include/stdint.h and typedef'ed 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 + * + * These are the sizes of the standard SDCC types * * For SDCC, sizeof(int) is 16 and sizeof(long) is 32. long long and double * are not supported. @@ -64,22 +72,23 @@ * space information. */ -typedef char sbyte; -typedef unsigned char ubyte; -typedef unsigned char uint8; -typedef unsigned char boolean; -typedef int sint16; -typedef unsigned int uint16; -typedef long sint32; -typedef unsigned long uint32; +typedef char _int8_t; +typedef unsigned char _uint8_t; + +typedef int _int16_t; +typedef unsigned int _uint16_t; + +typedef long _int32_t; +typedef unsigned long _uint32_t; /* A pointer is 2 bytes */ -typedef unsigned int uintptr; +typedef int _intptr_t; +typedef unsigned int _uintptr_t; /* This is the size of the interrupt state save returned by irqsave() */ -typedef uint16 irqstate_t; +typedef _uint16_t irqstate_t; #endif /* __ASSEMBLY__ */ @@ -87,4 +96,4 @@ typedef uint16 irqstate_t; * Global Function Prototypes ****************************************************************************/ -#endif /* __ARCH_CHIP_TYPES_H */ +#endif /* __ARC_Z80_INCLUDE_Z80_TYPES_H */ diff --git a/drivers/pipes/pipe_common.h b/drivers/pipes/pipe_common.h index 9e9f27fc1f..cf0d927420 100644 --- a/drivers/pipes/pipe_common.h +++ b/drivers/pipes/pipe_common.h @@ -42,6 +42,8 @@ #include <nuttx/config.h> #include <sys/types.h> + +#include <stdint.h> #include <poll.h> #ifndef CONFIG_DEV_PIPE_SIZE @@ -71,11 +73,11 @@ /* Make the buffer index as small as possible for the configured pipe size */ #if CONFIG_DEV_PIPE_SIZE > 65535 -typedef uint32 pipe_ndx_t; /* 32-bit index */ +typedef uint32_t pipe_ndx_t; /* 32-bit index */ #elif CONFIG_DEV_PIPE_SIZE > 255 -typedef uint16 pipe_ndx_t; /* 16-bit index */ +typedef uint16_t pipe_ndx_t; /* 16-bit index */ #else -typedef ubyte pipe_ndx_t; /* 8-bit index */ +typedef uint8_t pipe_ndx_t; /* 8-bit index */ #endif /* This structure represents the state of one pipe. A reference to this @@ -90,10 +92,10 @@ struct pipe_dev_s sem_t d_wrsem; /* Full buffer - Writer waits for data read */ pipe_ndx_t d_wrndx; /* Index in d_buffer to save next byte written */ pipe_ndx_t d_rdndx; /* Index in d_buffer to return the next byte read */ - ubyte d_refs; /* References counts on pipe (limited to 255) */ - ubyte d_nwriters; /* Number of reference counts for write access */ - ubyte d_pipeno; /* Pipe minor number */ - ubyte *d_buffer; /* Buffer allocated when device opened */ + uint8_t d_refs; /* References counts on pipe (limited to 255) */ + uint8_t d_nwriters; /* Number of reference counts for write access */ + uint8_t d_pipeno; /* Pipe minor number */ + uint8_t *d_buffer; /* Buffer allocated when device opened */ /* The following is a list if poll structures of threads waiting for * driver events. The 'struct pollfd' reference for each open is also diff --git a/include/fixedmath.h b/include/fixedmath.h index 1c42537547..b139acf5b8 100644 --- a/include/fixedmath.h +++ b/include/fixedmath.h @@ -40,7 +40,7 @@ * Included Files ****************************************************************************/ -#include <sys/types.h> +#include <stdint.h> /************************************************************************** * Definitions @@ -185,13 +185,13 @@ * Public Types **************************************************************************/ -typedef sint16 b8_t; -typedef uint16 ub8_t; -typedef sint32 b16_t; -typedef uint32 ub16_t; +typedef int16_t b8_t; +typedef uint16_t ub8_t; +typedef int32_t b16_t; +typedef uint32_t ub16_t; #ifdef CONFIG_HAVE_LONG_LONG -typedef sint64 b32_t; -typedef uint64 ub32_t; +typedef int64_t b32_t; +typedef uint64_t ub32_t; #endif /************************************************************************** diff --git a/include/net/uip/uip.h b/include/net/uip/uip.h index 0482b90998..af3b75adb3 100644 --- a/include/net/uip/uip.h +++ b/include/net/uip/uip.h @@ -155,7 +155,7 @@ /* Representation of an IP address */ typedef in_addr_t uip_ip4addr_t; -typedef uint16 uip_ip6addr_t[8]; +typedef uint16_t uip_ip6addr_t[8]; #ifdef CONFIG_NET_IPv6 typedef uip_ip6addr_t uip_ipaddr_t; @@ -171,12 +171,12 @@ struct uip_ip_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 */ @@ -184,16 +184,16 @@ struct uip_ip_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 */ }; @@ -213,9 +213,9 @@ struct uip_driver_s; /* Forward reference */ struct uip_callback_s { FAR struct uip_callback_s *flink; - uint16 (*event)(struct uip_driver_s *dev, void *pvconn, void *pvpriv, uint16 flags); + uint16_t (*event)(struct uip_driver_s *dev, void *pvconn, void *pvpriv, uint1_t flags); void *priv; - uint16 flags; + uint16_t flags; }; /* Protocol-specific support */ @@ -292,7 +292,7 @@ extern void uip_initialize(void); /* This function may be used at boot time to set the initial ip_id.*/ -extern void uip_setipid(uint16 id); +extern void uip_setipid(uint16_t id); /* uIP application functions * @@ -347,12 +347,12 @@ extern void uip_send(struct uip_driver_s *dev, const void *buf, int len); addr = HTONL((addr0) << 24 | (addr1) << 16 | (addr2) << 8 | (addr3)); \ } while(0) -/* Convert an IPv4 address of the form uint16[2] to an in_addr_t */ +/* 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*)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*)addr)[1]) #else -# define uip_ip4addr_conv(addr) (((in_addr_t)((uint16*)addr)[1] << 16) | (in_addr_t)((uint16*)addr)[0]) +# define uip_ip4addr_conv(addr) (((in_addr_t)((uint16*)addr)[1] << 16) | (in_addr_t)((uint16_t*)addr)[0]) #endif /* Construct an IPv6 address from eight 16-bit words. @@ -362,14 +362,14 @@ extern void uip_send(struct uip_driver_s *dev, const void *buf, int len); #define uip_ip6addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) \ do { \ - ((uint16*)(addr))[0] = HTONS((addr0)); \ - ((uint16*)(addr))[1] = HTONS((addr1)); \ - ((uint16*)(addr))[2] = HTONS((addr2)); \ - ((uint16*)(addr))[3] = HTONS((addr3)); \ - ((uint16*)(addr))[4] = HTONS((addr4)); \ - ((uint16*)(addr))[5] = HTONS((addr5)); \ - ((uint16*)(addr))[6] = HTONS((addr6)); \ - ((uint16*)(addr))[7] = HTONS((addr7)); \ + ((uint16_t*)(addr))[0] = HTONS((addr0)); \ + ((uint16_t*)(addr))[1] = HTONS((addr1)); \ + ((uint16_t*)(addr))[2] = HTONS((addr2)); \ + ((uint16_t*)(addr))[3] = HTONS((addr3)); \ + ((uint16_t*)(addr))[4] = HTONS((addr4)); \ + ((uint16_t*)(addr))[5] = HTONS((addr5)); \ + ((uint16_t*)(addr))[6] = HTONS((addr6)); \ + ((uint16_t*)(addr))[7] = HTONS((addr7)); \ } while(0) /* Copy an IP address to another IP address. @@ -394,8 +394,8 @@ extern void uip_send(struct uip_driver_s *dev, const void *buf, int len); } while(0) # define uiphdr_ipaddr_copy(dest, src) \ do { \ - ((uint16*)(dest))[0] = ((uint16*)(src))[0]; \ - ((uint16*)(dest))[1] = ((uint16*)(src))[1]; \ + ((uint16_t*)(dest))[0] = ((uint16_t*)(src))[0]; \ + ((uint16_t*)(dest))[1] = ((uint16_t*)(src))[1]; \ } while(0) #else /* !CONFIG_NET_IPv6 */ # define uip_ipaddr_copy(dest, src) memcpy(&dest, &src, sizeof(uip_ip6addr_t)) diff --git a/include/net/uip/uipopt.h b/include/net/uip/uipopt.h index f0eb21707b..be62d1a6ed 100644 --- a/include/net/uip/uipopt.h +++ b/include/net/uip/uipopt.h @@ -58,7 +58,7 @@ * Included Files ****************************************************************************/ -#include <sys/types.h> +#include <stdint.h> #include <nuttx/config.h> /**************************************************************************** @@ -274,6 +274,6 @@ * uIP. */ -typedef uint16 uip_stats_t; +typedef uint16_t uip_stats_t; #endif /* __UIPOPT_H__ */ diff --git a/include/netinet/in.h b/include/netinet/in.h index ef2b09a071..21765f7b58 100644 --- a/include/netinet/in.h +++ b/include/netinet/in.h @@ -40,7 +40,7 @@ * Included Files ****************************************************************************/ -#include <sys/types.h> +#include <stdint.h> /**************************************************************************** * Public Macro Definitions @@ -88,7 +88,7 @@ struct in_addr struct sockaddr_in { sa_family_t sin_family; /* Address family: AF_INET */ - uint16 sin_port; /* Port in network byte order */ + uint16_t sin_port; /* Port in network byte order */ struct in_addr sin_addr; /* Internet address */ }; @@ -98,16 +98,16 @@ struct in6_addr { union { - uint8 u6_addr8[16]; - uint16 u6_addr16[8]; - uint32 u6_addr32[4]; + uint8_t u6_addr8[16]; + uint16_t u6_addr16[8]; + uint32_t u6_addr32[4]; } in6_u; }; struct sockaddr_in6 { sa_family_t sin_family; /* Address family: AF_INET */ - uint16 sin_port; /* Port in network byte order */ + uint16_t sin_port; /* Port in network byte order */ struct in6_addr sin6_addr; /* IPv6 internet address */ }; diff --git a/include/nuttx/fb.h b/include/nuttx/fb.h index abbef7ded0..fddec2cdd5 100644 --- a/include/nuttx/fb.h +++ b/include/nuttx/fb.h @@ -41,7 +41,7 @@ ****************************************************************************/ #include <nuttx/config.h> -#include <sys/types.h> +#include <stdint.h> /**************************************************************************** * Pre-processor definitions @@ -177,16 +177,16 @@ * type will need to change: */ -typedef uint16 fb_coord_t; +typedef uint16_t fb_coord_t; /* This structure describes the overall video controller */ struct fb_videoinfo_s { - ubyte fmt; /* see FB_FMT_* */ + uint8_t fmt; /* see FB_FMT_* */ fb_coord_t xres; /* Resolution in pixels */ fb_coord_t yres; - ubyte nplanes; /* Number of color planes supported */ + uint8_t nplanes; /* Number of color planes supported */ }; /* This structure describes one color plane. Some YUV formats may support @@ -198,7 +198,7 @@ struct fb_planeinfo_s FAR void *fbmem; /* Start of frame buffer memory */ uint32 fblen; /* Length of frame buffer memory in bytes */ fb_coord_t stride; /* Length of a line in bytes */ - ubyte bpp; /* Bits per pixel */ + uint8_t bpp; /* Bits per pixel */ }; /* On video controllers that support mapping of a pixel palette value @@ -209,16 +209,16 @@ struct fb_planeinfo_s #ifdef CONFIG_FB_CMAP struct fb_cmap_s { - uint16 first; /* Offset offset first color entry in tables */ - uint16 len; /* Number of color entries in tables */ + uint16_t first; /* Offset offset first color entry in tables */ + uint16_t len; /* Number of color entries in tables */ /* Tables of color component. Any may be NULL if not used */ - ubyte *red; /* Table of 8-bit red values */ - ubyte *green; /* Table of 8-bit green values */ - ubyte *blue; /* Table of 8-bit blue values */ + uint8_t *red; /* Table of 8-bit red values */ + uint8_t *green; /* Table of 8-bit green values */ + uint8_t *blue; /* Table of 8-bit blue values */ #ifdef CONFIG_FB_TRANSPARENCY - ubyte *transp; /* Table of 8-bit transparency */ + uint8_t *transp; /* Table of 8-bit transparency */ #endif }; #endif @@ -234,7 +234,7 @@ struct fb_cursorimage_s { fb_coord_t width; /* Width of the cursor image in pixels */ fb_coord_t height /* Height of the curor image in pixels */ - const ubyte *image; /* Pointer to image data */ + const uint8_t *image; /* Pointer to image data */ }; #endif @@ -263,7 +263,7 @@ struct fb_cursorsize_s struct fb_cursorattrib_s { #ifdef CONFIG_FB_HWCURSORIMAGE - ubyte fmt; /* Video format of cursor */ + uint8_t fmt; /* Video format of cursor */ #endif struct fb_cursorpos_s pos; /* Current cursor position */ #ifdef CONFIG_FB_HWCURSORSIZE @@ -274,7 +274,7 @@ struct fb_cursorattrib_s struct fb_setcursor_s { - ubyte flags; /* See FB_CUR_* definitions */ + uint8_t flags; /* See FB_CUR_* definitions */ struct fb_cursorpos_s pos; /* Cursor position */ #ifdef CONFIG_FB_HWCURSORSIZE struct fb_cursorsize_s size; /* Cursor size */ diff --git a/include/nuttx/net.h b/include/nuttx/net.h index db29524b66..861dab7812 100644 --- a/include/nuttx/net.h +++ b/include/nuttx/net.h @@ -43,6 +43,7 @@ #include <nuttx/config.h> #ifdef CONFIG_NET +#include <stdint.h> #include <stdarg.h> #include <semaphore.h> @@ -69,7 +70,7 @@ /* This defines a bitmap big enough for one bit for each socket option */ -typedef uint16 sockopt_t; +typedef uint16_t sockopt_t; /* This defines the storage size of a timeout value. This effects only * range of supported timeout values. With an LSB in seciseconds, the @@ -77,7 +78,7 @@ typedef uint16 sockopt_t; * resolution. */ -typedef uint16 socktimeo_t; +typedef uint16_t socktimeo_t; /* This is the internal representation of a socket reference by a file * descriptor. @@ -86,8 +87,8 @@ typedef uint16 socktimeo_t; struct socket { int s_crefs; /* Reference count on the socket */ - uint8 s_type; /* Protocol type: Only SOCK_STREAM or SOCK_DGRAM */ - uint8 s_flags; /* See _SF_* definitions */ + uint8_t s_type; /* Protocol type: Only SOCK_STREAM or SOCK_DGRAM */ + uint8_t s_flags; /* See _SF_* definitions */ #ifdef CONFIG_NET_SOCKOPTS sockopt_t s_options; /* Selected socket options */ #ifndef CONFIG_DISABLE_CLOCK @@ -111,7 +112,7 @@ struct socketlist /* This defines a bitmap big enough for one bit for each socket option */ -typedef uint16 sockopt_t; +typedef uint16_t sockopt_t; /* Callback from netdev_foreach() */ diff --git a/include/nuttx/nxglib.h b/include/nuttx/nxglib.h index 97e58f0333..719ceee956 100644 --- a/include/nuttx/nxglib.h +++ b/include/nuttx/nxglib.h @@ -41,7 +41,7 @@ ****************************************************************************/ #include <nuttx/config.h> -#include <sys/types.h> +#include <stdint.h> #include <fixedmath.h> #include <nuttx/fb.h> @@ -83,11 +83,11 @@ */ #if !defined(CONFIG_NX_DISABLE_32BPP) || !defined(CONFIG_NX_DISABLE_24BPP) -typedef uint32 nxgl_mxpixel_t; +typedef uint32_t nxgl_mxpixel_t; #elif !defined(CONFIG_NX_DISABLE_16BPP) -typedef uint16 nxgl_mxpixel_t; +typedef uint16_t nxgl_mxpixel_t; #else -typedef ubyte nxgl_mxpixel_t; +typedef uint8_t nxgl_mxpixel_t; #endif /* Graphics structures ******************************************************/ diff --git a/include/nuttx/usbdev_trace.h b/include/nuttx/usbdev_trace.h index 7beb08d34e..798aa94cf4 100644 --- a/include/nuttx/usbdev_trace.h +++ b/include/nuttx/usbdev_trace.h @@ -41,7 +41,7 @@ ****************************************************************************/ #include <nuttx/config.h> -#include <sys/types.h> +#include <stdint.h> /**************************************************************************** * Preprocessor definitions @@ -49,7 +49,7 @@ /* Event encoding/decoding macros *******************************************/ -#define TRACE_EVENT(id,data) ((uint16)(id)|(data)) +#define TRACE_EVENT(id,data) ((uint16_t)(id)|(data)) #define TRACE_ID(event) ((event)&0xff00) #define TRACE_DATA(event) ((event)&0x00ff) @@ -371,8 +371,8 @@ struct usbtrace_s { - uint16 event; - uint16 value; + uint16_t event; + uint16_t value; }; /* Enumeration callback function signature */ @@ -383,7 +383,7 @@ typedef int (*trace_callback_t)(struct usbtrace_s *trace, void *arg); * 16, then this will have to be changed to uint32 */ -typedef uint16 usbtrace_idset_t; +typedef uint16_t usbtrace_idset_t; /* Print routine to use for usbdev_trprint() output */ @@ -437,7 +437,7 @@ EXTERN usbtrace_idset_t usbtrace_enable(usbtrace_idset_t idset); *******************************************************************************/ #if defined(CONFIG_USBDEV_TRACE) || (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_USB)) -EXTERN void usbtrace(uint16 event, uint16 value); +EXTERN void usbtrace(uint16_t event, uint16_t value); #else # define usbtrace(event, value) #endif @@ -467,7 +467,7 @@ EXTERN int usbtrace_enumerate(trace_callback_t callback, void *arg); * *******************************************************************************/ -EXTERN void usbtrace_trprintf(trprintf_t trprintf, uint16 event, uint16 value); +EXTERN void usbtrace_trprintf(trprintf_t trprintf, uint16_t event, uint16_t value); #undef EXTERN #if defined(__cplusplus) diff --git a/include/signal.h b/include/signal.h index baa1e2ad3e..07b80edf48 100644 --- a/include/signal.h +++ b/include/signal.h @@ -147,7 +147,7 @@ /* This defines a set of 32 signals (numbered 0 through 31). */ -typedef uint32 sigset_t; /* Bit set of 32 signals */ +typedef uint32_t sigset_t; /* Bit set of 32 signals */ /* This defines the type of the siginfo si_value field */ diff --git a/include/sys/select.h b/include/sys/select.h index a665a58823..a38bb2b774 100644 --- a/include/sys/select.h +++ b/include/sys/select.h @@ -41,6 +41,7 @@ ****************************************************************************/ #include <nuttx/config.h> +#include <stdint.h> #include <time.h> #if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0 @@ -54,7 +55,7 @@ #define __SELECT_NDESCRIPTORS (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS) /* We will use a 32-bit bitsets to represent the set of descriptors. How - * many uint32's do we need to span all descriptors? + * many uint32_t's do we need to span all descriptors? */ #if __SELECT_NDESCRIPTORS <= 32 @@ -84,16 +85,16 @@ /* Standard helper macros */ -#define FD_CLR(fd,set) (((uint32*)(set))[_FD_NDX(fd)] &= ~(1 << _FD_BIT(fd))) -#define FD_SET(fd,set) (((uint32*)(set))[_FD_NDX(fd)] |= (1 << _FD_BIT(fd))) -#define FD_ISSET(fd,set) ((((uint32*)(set))[_FD_NDX(fd)] & (1 << _FD_BIT(fd))) != 0) +#define FD_CLR(fd,set) (((uint32_t*)(set))[_FD_NDX(fd)] &= ~(1 << _FD_BIT(fd))) +#define FD_SET(fd,set) (((uint32_t*)(set))[_FD_NDX(fd)] |= (1 << _FD_BIT(fd))) +#define FD_ISSET(fd,set) ((((uint32_t*)(set))[_FD_NDX(fd)] & (1 << _FD_BIT(fd))) != 0) #define FD_ZERO(set) memset(set, 0, sizeof(fd_set)) /**************************************************************************** * Type Definitions ****************************************************************************/ -typedef uint32 fd_set[__SELECT_NUINT32]; +typedef uint32_t fd_set[__SELECT_NUINT32]; /**************************************************************************** * Public Function Prototypes diff --git a/include/sys/types.h b/include/sys/types.h index a8baa9a588..71108e653b 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -1,7 +1,7 @@ /**************************************************************************** - * sys/types.h + * include/sys/types.h * - * Copyright (C) 2007, 2008, 2009 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 @@ -33,24 +33,24 @@ * ****************************************************************************/ -#ifndef __SYS_TYPES_H -#define __SYS_TYPES_H +#ifndef __INCLUDE_SYS_TYPES_H +#define __INCLUDE_SYS_TYPES_H /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> -#include <arch/types.h> +#include <stdint.h> #include <nuttx/compiler.h> /**************************************************************************** * Definitions ****************************************************************************/ -/* Values for type boolean */ +/* Alternative alues for type bool (for historic reasons) */ -#define TRUE 1 +#define TRUE 1 #define FALSE 0 /* NULL is usually defined in stddef.h (which includes this file) */ @@ -119,27 +119,27 @@ typedef unsigned int mode_t; */ #ifdef CONFIG_SMALL_MEMORY -typedef uint16 size_t; -typedef sint16 ssize_t; +typedef uint16_t size_t; +typedef int16_t ssize_t; #else -typedef uint32 size_t; -typedef sint32 ssize_t; +typedef uint32_t size_t; +typedef int32_t ssize_t; #endif /* uid_t is used for user IDs * gid_t is used for group IDs. */ -typedef sint16 uid_t; -typedef sint16 gid_t; +typedef int16_t uid_t; +typedef int16_t gid_t; /* dev_t is used for device IDs */ -typedef uint16 dev_t; +typedef uint16_t dev_t; /* ino_t is used for file serial numbers */ -typedef uint16 ino_t; +typedef uint16_t ino_t; /* pid_t is used for process IDs and process group IDs */ @@ -153,18 +153,18 @@ typedef int pid_t; * Hence, both should be independent of processor architecture. */ -typedef uint32 blkcnt_t; -typedef sint32 off_t; +typedef uint32_t blkcnt_t; +typedef int32_t off_t; typedef off_t fpos_t; /* blksize_t is a signed integer value used for file block sizes */ -typedef sint16 blksize_t; +typedef int16_t blksize_t; /* Network related */ typedef unsigned int socklen_t; -typedef uint16 sa_family_t; +typedef uint16_t sa_family_t; /* The type useconds_t shall be an unsigned integer type capable of storing * values at least in the range [0, 1000000]. The type suseconds_t shall be @@ -172,8 +172,8 @@ typedef uint16 sa_family_t; * [-1, 1000000]. */ -typedef uint32 useconds_t; -typedef sint32 suseconds_t; +typedef uint32_t useconds_t; +typedef int32_t suseconds_t; /* Task entry point */ @@ -185,4 +185,4 @@ typedef int (*main_t)(int argc, char *argv[]); * Global Function Prototypes ****************************************************************************/ -#endif /* __SYS_TYPES_H */ +#endif /* __INCLUDE_SYS_TYPES_H */ diff --git a/include/time.h b/include/time.h index bffde1041a..f2605f3a2b 100644 --- a/include/time.h +++ b/include/time.h @@ -42,6 +42,7 @@ #include <nuttx/config.h> #include <sys/types.h> +#include <stdint.h> /******************************************************************************** * Compilations Switches @@ -82,8 +83,8 @@ * Global Type Declarations ********************************************************************************/ -typedef uint32 time_t; /* Holds time in seconds */ -typedef ubyte clockid_t; /* Identifies one time base source */ +typedef uint32_ 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 */ struct timespec diff --git a/include/wdog.h b/include/wdog.h index 69fb59f0f7..1d570759aa 100644 --- a/include/wdog.h +++ b/include/wdog.h @@ -1,7 +1,7 @@ /**************************************************************************** - * wdog.h + * include/wdog.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 @@ -33,14 +33,15 @@ * ****************************************************************************/ -#ifndef __WDOG_H -#define __WDOG_H +#ifndef __INCLUDE_WDOG_H +#define __INCLUDE_WDOG_H /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> +#include <stdint.h> #include <sched.h> /**************************************************************************** @@ -55,20 +56,20 @@ * Global Type Declarations ****************************************************************************/ -/* The arguments are passed as uint32 values. For systems - * where the sizeof(pointer) < sizeof(uint32), the following +/* The arguments are passed as uint32_t values. For systems + * where the sizeof(pointer) < sizeof(uint32_t), the following * union defines the alignment of the pointer within the - * uint32. For example, the SDCC MCS51 general pointer is - * 24-bits, but uint32 is 32-bits (of course). + * uint32_t. For example, the SDCC MCS51 general pointer is + * 24-bits, but uint32_t is 32-bits (of course). * - * For systems where sizeof(pointer) > sizeof(uint32), we will + * For systems where sizeof(pointer) > sizeof(uint32_t), we will * have to do some redesign. */ union wdparm_u { - FAR void *pvarg; - FAR uint32 *dwarg; + FAR void *pvarg; + FAR uint32_t *dwarg; }; typedef union wdparm_u wdparm_t; @@ -76,7 +77,7 @@ typedef union wdparm_u wdparm_t; * watchdog function expires. Up to four parameters may be passed. */ -typedef CODE void (*wdentry_t)(int argc, uint32 arg1, ...); +typedef CODE void (*wdentry_t)(int argc, uint32_t arg1, ...); /* Watchdog 'handle' */ diff --git a/netutils/dhcpd/dhcpd.c b/netutils/dhcpd/dhcpd.c index be7a5c3afe..4ae10bcd79 100644 --- a/netutils/dhcpd/dhcpd.c +++ b/netutils/dhcpd/dhcpd.c @@ -39,10 +39,10 @@ #ifdef CONFIG_NETUTILS_DHCPD_HOST # include <stdio.h> -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; -typedef unsigned char boolean; +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned char bool; # define HTONS(a) htons(a) # define HTONL(a) htonl(a) @@ -66,10 +66,10 @@ typedef unsigned char boolean; # include <net/uip/dhcpd.h> /* Advertised DHCPD APIs */ #endif -#include <sys/types.h> #include <sys/socket.h> #include <sys/ioctl.h> +#include <stdint.h> #include <string.h> #include <unistd.h> #include <time.h> @@ -201,8 +201,8 @@ typedef unsigned char boolean; struct lease_s { - uint8 mac[DHCP_HLEN_ETHERNET]; /* MAC address (network order) -- could be larger! */ - boolean allocated; /* true: IP address is allocated */ + uint8_t mac[DHCP_HLEN_ETHERNET]; /* MAC address (network order) -- could be larger! */ + bool allocated; /* true: IP address is allocated */ #ifdef HAVE_LEASE_TIME time_t expiry; /* Lease expiration time (seconds past Epoch) */ #endif @@ -210,46 +210,46 @@ struct lease_s struct dhcpmsg_s { - uint8 op; - uint8 htype; - uint8 hlen; - uint8 hops; - uint8 xid[4]; - uint16 secs; - uint16 flags; - uint8 ciaddr[4]; - uint8 yiaddr[4]; - uint8 siaddr[4]; - uint8 giaddr[4]; - uint8 chaddr[16]; + uint8_t op; + uint8_t htype; + uint8_t hlen; + uint8_t hops; + uint8_t xid[4]; + uint16_t secs; + uint16_t flags; + uint8_t ciaddr[4]; + uint8_t yiaddr[4]; + uint8_t siaddr[4]; + uint8_t giaddr[4]; + uint8_t chaddr[16]; #ifndef CONFIG_NET_DHCP_LIGHT - uint8 sname[64]; - uint8 file[128]; + uint8_t sname[64]; + uint8_t file[128]; #endif - uint8 options[312]; + uint8_t options[312]; }; struct dhcpd_state_s { /* Server configuration */ - in_addr_t ds_serverip; /* The server IP address */ + in_addr_t ds_serverip; /* The server IP address */ /* Message buffers */ - struct dhcpmsg_s ds_inpacket; /* Holds the incoming DHCP client message */ - struct dhcpmsg_s ds_outpacket; /* Holds the outgoing DHCP server message */ + struct dhcpmsg_s ds_inpacket; /* Holds the incoming DHCP client message */ + struct dhcpmsg_s ds_outpacket; /* Holds the outgoing DHCP server message */ /* Parsed options from the incoming DHCP client message */ - uint8 ds_optmsgtype; /* Incoming DHCP message type */ + uint8_t ds_optmsgtype; /* Incoming DHCP message type */ in_addr_t ds_optreqip; /* Requested IP address (host order) */ in_addr_t ds_optserverip; /* Serverip IP address (host order) */ time_t ds_optleasetime; /* Requested lease time (host order) */ /* End option pointer for outgoing DHCP server message */ - uint8 *ds_optend; + uint8_t *ds_optend; /* Leases */ @@ -260,8 +260,8 @@ struct dhcpd_state_s * Private Data ****************************************************************************/ -static const uint8 g_magiccookie[4] = {99, 130, 83, 99}; -static const uint8 g_anyipaddr[4] = {0, 0, 0, 0}; +static const uint8_t g_magiccookie[4] = {99, 130, 83, 99}; +static const uint8_t g_anyipaddr[4] = {0, 0, 0, 0}; static struct dhcpd_state_s g_state; /**************************************************************************** @@ -273,7 +273,7 @@ static struct dhcpd_state_s g_state; ****************************************************************************/ #ifndef CONFIG_NETUTILS_DHCPD_HOST -static inline void dhcpd_arpupdate(uint16 *pipaddr, uint8 *phwaddr) +static inline void dhcpd_arpupdate(uint16_t *pipaddr, uint8_t *phwaddr) { irqstate_t flags; @@ -316,7 +316,7 @@ static time_t dhcpd_time(void) ****************************************************************************/ #ifdef HAVE_LEASE_TIME -static inline boolean dhcpd_leaseexpired(struct lease_s *lease) +static inline bool dhcpd_leaseexpired(struct lease_s *lease) { if (lease->expiry < dhcpd_time()) { @@ -336,7 +336,7 @@ static inline boolean dhcpd_leaseexpired(struct lease_s *lease) * Name: dhcpd_setlease ****************************************************************************/ -struct lease_s *dhcpd_setlease(const uint8 *mac, in_addr_t ipaddr, time_t expiry) +struct lease_s *dhcpd_setlease(const uint8_t *mac, in_addr_t ipaddr, time_t expiry) { int ndx = ntohl(ipaddr) - CONFIG_NETUTILS_DHCPD_STARTIP; struct lease_s *ret = NULL; @@ -366,7 +366,7 @@ static inline in_addr_t dhcp_leaseipaddr( struct lease_s *lease) * Name: dhcpd_findbymac ****************************************************************************/ -static struct lease_s *dhcpd_findbymac(const uint8 *mac) +static struct lease_s *dhcpd_findbymac(const uint8_t *mac) { int i; @@ -438,12 +438,12 @@ in_addr_t dhcpd_allocipaddr(void) * Name: dhcpd_parseoptions ****************************************************************************/ -static inline boolean dhcpd_parseoptions(void) +static inline bool dhcpd_parseoptions(void) { - uint32 tmp; - uint8 *ptr; - uint8 overloaded; - uint8 currfield; + uint32_t tmp; + uint8_t *ptr; + uint8_t overloaded; + uint8_t currfield; int optlen = 0; int remaining; @@ -594,7 +594,7 @@ static inline boolean dhcpd_parseoptions(void) * Name: dhcpd_verifyreqip ****************************************************************************/ -static inline boolean dhcpd_verifyreqip(void) +static inline bool dhcpd_verifyreqip(void) { struct lease_s *lease; @@ -621,9 +621,9 @@ static inline boolean dhcpd_verifyreqip(void) * Name: dhcpd_verifyreqleasetime ****************************************************************************/ -static inline boolean dhcpd_verifyreqleasetime(uint32 *leasetime) +static inline bool dhcpd_verifyreqleasetime(uint32_t *leasetime) { - uint32 tmp = g_state.ds_optleasetime; + uint32_t tmp = g_state.ds_optleasetime; /* Did the client request a specific lease time? */ @@ -652,7 +652,7 @@ static inline boolean dhcpd_verifyreqleasetime(uint32 *leasetime) * Name: dhcpd_addoption ****************************************************************************/ -static int dhcpd_addoption(uint8 *option) +static int dhcpd_addoption(uint8_t *option) { int offset; int len = 4; @@ -680,9 +680,9 @@ static int dhcpd_addoption(uint8 *option) * Name: dhcpd_addoption8 ****************************************************************************/ -static int dhcpd_addoption8(uint8 code, uint8 value) +static int dhcpd_addoption8(uint8_t code, uint8_t value) { - uint8 option[3]; + uint8_t option[3]; /* Construct the option sequence */ @@ -699,9 +699,9 @@ static int dhcpd_addoption8(uint8 code, uint8 value) * Name: dhcpd_addoption32 ****************************************************************************/ -static int dhcpd_addoption32(uint8 code, uint32 value) +static int dhcpd_addoption32(uint8_t code, uint32_t value) { - uint8 option[6]; + uint8_t option[6]; /* Construct the option sequence */ @@ -806,9 +806,9 @@ static inline int dhcpd_openresponder(void) * Name: dhcpd_initpacket ****************************************************************************/ -static void dhcpd_initpacket(uint8 mtype) +static void dhcpd_initpacket(uint8_t mtype) { - uint32 nulladdr = 0; + uint32_t nulladdr = 0; /* Set up the generic parts of the DHCP server message */ @@ -882,7 +882,7 @@ static int dhcpd_sendpacket(int bbroadcast) } else if (memcmp(g_state.ds_outpacket.ciaddr, g_anyipaddr, 4) != 0) { - dhcpd_arpupdate((uint16*)g_state.ds_outpacket.ciaddr, g_state.ds_outpacket.chaddr); + dhcpd_arpupdate((uint16_t*)g_state.ds_outpacket.ciaddr, g_state.ds_outpacket.chaddr); memcpy(&ipaddr, g_state.ds_outpacket.ciaddr, 4); } else if (g_state.ds_outpacket.flags & HTONS(BOOTP_BROADCAST)) @@ -891,7 +891,7 @@ static int dhcpd_sendpacket(int bbroadcast) } else { - dhcpd_arpupdate((uint16*)g_state.ds_outpacket.yiaddr, g_state.ds_outpacket.chaddr); + dhcpd_arpupdate((uint16_t*)g_state.ds_outpacket.yiaddr, g_state.ds_outpacket.chaddr); memcpy(&ipaddr, g_state.ds_outpacket.yiaddr, 4); } #endif @@ -912,7 +912,7 @@ static int dhcpd_sendpacket(int bbroadcast) /* Send the minimum sized packet that includes the END option */ - len = (g_state.ds_optend - (uint8*)&g_state.ds_outpacket) + 1; + len = (g_state.ds_optend - (uint8_t*)&g_state.ds_outpacket) + 1; nvdbg("sendto %08lx:%04x len=%d\n", (long)addr.sin_addr.s_addr, addr.sin_port, len); @@ -927,7 +927,7 @@ static int dhcpd_sendpacket(int bbroadcast) * Name: dhcpd_sendoffer ****************************************************************************/ -static inline int dhcpd_sendoffer(in_addr_t ipaddr, uint32 leasetime) +static inline int dhcpd_sendoffer(in_addr_t ipaddr, uint32_t leasetime) { nvdbg("Sending offer: %08lx\n", (long)ipaddr); @@ -971,7 +971,7 @@ static int dhcpd_sendnak(void) int dhcpd_sendack(in_addr_t ipaddr) { - uint32 leasetime = CONFIG_NETUTILS_DHCPD_LEASETIME; + uint32_t leasetime = CONFIG_NETUTILS_DHCPD_LEASETIME; /* Initialize the ACK response */ @@ -1011,7 +1011,7 @@ static inline int dhcpd_discover(void) { struct lease_s *lease; in_addr_t ipaddr; - uint32 leasetime = CONFIG_NETUTILS_DHCPD_LEASETIME; + uint32_t leasetime = CONFIG_NETUTILS_DHCPD_LEASETIME; /* Check if the client is aleady in the lease table */ @@ -1088,7 +1088,7 @@ static inline int dhcpd_request(void) { struct lease_s *lease; in_addr_t ipaddr; - uint8 response = 0; + uint8_t response = 0; /* Check if this client already holds a lease. This can happen when the client (1) * the IP is reserved for the client from a previous offer, or (2) the client is -- GitLab