mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 20:08:15 +08:00
Eliminate some hcs12 compile errors/warnings
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2329 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/************************************************************
|
||||||
* types.h
|
* arch/types.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>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -58,9 +58,6 @@
|
|||||||
*
|
*
|
||||||
* For SDCC, sizeof(int) is 16 and sizeof(long) is 32.
|
* For SDCC, sizeof(int) is 16 and sizeof(long) is 32.
|
||||||
* long long and double are not supported.
|
* long long and double are not supported.
|
||||||
*
|
|
||||||
* Generic pointers are 3 bytes in length with the
|
|
||||||
* first byte holding data space intformation.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef char sbyte;
|
typedef char sbyte;
|
||||||
@@ -72,6 +69,12 @@ typedef unsigned int uint16;
|
|||||||
typedef long sint32;
|
typedef long sint32;
|
||||||
typedef unsigned long uint32;
|
typedef unsigned long uint32;
|
||||||
|
|
||||||
|
/* For SDCC, a Generic pointer is 3 bytes in length with the
|
||||||
|
* first byte holding data space information.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef unsigned long uintptr;
|
||||||
|
|
||||||
/* This is the size of the interrupt state save returned by
|
/* This is the size of the interrupt state save returned by
|
||||||
* irqsave()
|
* irqsave()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -68,6 +68,10 @@ typedef unsigned long uint32;
|
|||||||
typedef long long sint64;
|
typedef long long sint64;
|
||||||
typedef unsigned long long uint64;
|
typedef unsigned long long uint64;
|
||||||
|
|
||||||
|
/* A pointer is 2 bytes */
|
||||||
|
|
||||||
|
typedef unsigned int uintptr;
|
||||||
|
|
||||||
/* This is the size of the interrupt state save returned by
|
/* This is the size of the interrupt state save returned by
|
||||||
* irqsave()
|
* irqsave()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -67,6 +67,10 @@ typedef unsigned int uint32;
|
|||||||
typedef long long sint64;
|
typedef long long sint64;
|
||||||
typedef unsigned long long uint64;
|
typedef unsigned long long uint64;
|
||||||
|
|
||||||
|
/* A pointer is 4 bytes */
|
||||||
|
|
||||||
|
typedef unsigned int uintptr;
|
||||||
|
|
||||||
/* This is the size of the interrupt state save returned by
|
/* This is the size of the interrupt state save returned by
|
||||||
* irqsave()
|
* irqsave()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/************************************************************
|
||||||
* types.h
|
* types.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>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -67,6 +67,10 @@ typedef unsigned int uint32;
|
|||||||
typedef long long sint64;
|
typedef long long sint64;
|
||||||
typedef unsigned long long uint64;
|
typedef unsigned long long uint64;
|
||||||
|
|
||||||
|
/* A pointer is 4 bytes */
|
||||||
|
|
||||||
|
typedef unsigned int uintptr;
|
||||||
|
|
||||||
/* This is the size of the interrupt state save returned by
|
/* This is the size of the interrupt state save returned by
|
||||||
* irqsave()
|
* irqsave()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/types.h
|
* arch/types.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>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -65,6 +65,10 @@ typedef unsigned short uint16;
|
|||||||
typedef int sint32;
|
typedef int sint32;
|
||||||
typedef unsigned int uint32;
|
typedef unsigned int uint32;
|
||||||
|
|
||||||
|
/* A pointer is 4 bytes */
|
||||||
|
|
||||||
|
typedef unsigned int uintptr;
|
||||||
|
|
||||||
/* This is the size of the interrupt state save returned by
|
/* This is the size of the interrupt state save returned by
|
||||||
* irqsave()
|
* irqsave()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* arch/z80/include/ez80/types.h
|
* arch/z80/include/ez80/types.h
|
||||||
* include/arch/chip/types.h
|
* include/arch/chip/types.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>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -62,11 +62,6 @@
|
|||||||
* long - 32-bits
|
* long - 32-bits
|
||||||
* char - 8-bits
|
* char - 8-bits
|
||||||
* float - 32-bits
|
* float - 32-bits
|
||||||
*
|
|
||||||
* Pointers:
|
|
||||||
*
|
|
||||||
* Z80 mode - 16 bits
|
|
||||||
* ADL mode - 24 bits
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef char sbyte;
|
typedef char sbyte;
|
||||||
@@ -80,6 +75,19 @@ typedef unsigned int uint24;
|
|||||||
typedef long sint32;
|
typedef long sint32;
|
||||||
typedef unsigned long uint32;
|
typedef unsigned long uint32;
|
||||||
|
|
||||||
|
/* A pointer is 2 or 3 bytes, depending upon if the ez80 is in z80
|
||||||
|
* compatibility mode or not
|
||||||
|
*
|
||||||
|
* Z80 mode - 16 bits
|
||||||
|
* ADL mode - 24 bits
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_EZ80_Z80MODE
|
||||||
|
typedef unsigned short uintptr;
|
||||||
|
#else
|
||||||
|
typedef unsigned int uintptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is the size of the interrupt state save returned by irqsave().
|
/* This is the size of the interrupt state save returned by irqsave().
|
||||||
* It holds the AF regiser pair + a zero pad byte
|
* It holds the AF regiser pair + a zero pad byte
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* arch/z80/include/z8/types.h
|
* arch/z80/include/z8/types.h
|
||||||
* include/arch/chip/types.h
|
* include/arch/chip/types.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>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -80,6 +80,10 @@ typedef unsigned int uint16;
|
|||||||
typedef long sint32;
|
typedef long sint32;
|
||||||
typedef unsigned long uint32;
|
typedef unsigned long uint32;
|
||||||
|
|
||||||
|
/* A pointer is 2 bytes */
|
||||||
|
|
||||||
|
typedef unsigned int uintptr;
|
||||||
|
|
||||||
/* This is the size of the interrupt state save returned by irqsave() */
|
/* This is the size of the interrupt state save returned by irqsave() */
|
||||||
|
|
||||||
typedef ubyte irqstate_t;
|
typedef ubyte irqstate_t;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* arch/z80/include/z80/types.h
|
* arch/z80/include/z80/types.h
|
||||||
* include/arch/chip/types.h
|
* include/arch/chip/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>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -73,6 +73,10 @@ typedef unsigned int uint16;
|
|||||||
typedef long sint32;
|
typedef long sint32;
|
||||||
typedef unsigned long uint32;
|
typedef unsigned long uint32;
|
||||||
|
|
||||||
|
/* A pointer is 2 bytes */
|
||||||
|
|
||||||
|
typedef unsigned int uintptr;
|
||||||
|
|
||||||
/* This is the size of the interrupt state save returned by irqsave() */
|
/* This is the size of the interrupt state save returned by irqsave() */
|
||||||
|
|
||||||
typedef uint16 irqstate_t;
|
typedef uint16 irqstate_t;
|
||||||
|
|||||||
+11
-6
@@ -61,6 +61,9 @@
|
|||||||
* Definitions
|
* Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define HALF_SECOND_MSEC 500
|
||||||
|
#define HALF_SECOND_USEC 500000L
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Type Definitions
|
* Private Type Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -214,9 +217,9 @@ static int can_close(FAR struct file *filep)
|
|||||||
while (dev->cd_xmit.cf_head != dev->cd_xmit.cf_tail)
|
while (dev->cd_xmit.cf_head != dev->cd_xmit.cf_tail)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
usleep(500*1000);
|
usleep(HALF_SECOND_USEC);
|
||||||
#else
|
#else
|
||||||
up_mdelay(500);
|
up_mdelay(HALF_SECOND_MSEC);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,9 +228,9 @@ static int can_close(FAR struct file *filep)
|
|||||||
while (!dev_txempty(dev))
|
while (!dev_txempty(dev))
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
usleep(500*1000);
|
usleep(HALF_SECOND_USEC);
|
||||||
#else
|
#else
|
||||||
up_mdelay(500);
|
up_mdelay(HALF_SECOND_MSEC);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -554,11 +557,13 @@ static int can_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
/* CANIOCTL_RTR: Send the remote transmission request and wait for the response.
|
/* CANIOCTL_RTR: Send the remote transmission request and wait for the response.
|
||||||
* Argument is a reference to struct canioctl_rtr_s
|
* Argument is a reference to struct canioctl_rtr_s (casting to uintptr first
|
||||||
|
* eliminates complaints on some architectures where the sizeof long is different
|
||||||
|
* from the size of a pointer).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case CANIOCTL_RTR:
|
case CANIOCTL_RTR:
|
||||||
ret = can_rtrread(dev, (struct canioctl_rtr_s*)arg);
|
ret = can_rtrread(dev, (struct canioctl_rtr_s*)((uintptr)arg));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Not a "built-in" ioctl command.. perhaps it is unique to this device driver */
|
/* Not a "built-in" ioctl command.. perhaps it is unique to this device driver */
|
||||||
|
|||||||
@@ -564,13 +564,13 @@ static void mmcsd_setblklen(FAR struct mmcsd_slot_s *slot, uint32 length)
|
|||||||
|
|
||||||
static uint32 mmcsd_nsac(FAR struct mmcsd_slot_s *slot, ubyte *csd, uint32 frequency)
|
static uint32 mmcsd_nsac(FAR struct mmcsd_slot_s *slot, ubyte *csd, uint32 frequency)
|
||||||
{
|
{
|
||||||
/* NSAC is 8-bits width and is in units of 100 clock cycles. Therefore, the
|
/* NSAC is 8-bits wide and is in units of 100 clock cycles. Therefore, the
|
||||||
* maximum value is 25.5K clock cycles.
|
* maximum value is 25.5K clock cycles.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint32 nsac = MMCSD_CSD_NSAC(csd) * (100*1000); /* 1,000 * NSAC */
|
uint32 nsac = MMCSD_CSD_NSAC(csd) * ((uint32)100*1000); /* 1,000 * NSAC */
|
||||||
uint32 fhkz = (frequency + 500) / 1000; /* frequency / 1,000 */
|
uint32 fhkz = (frequency + 500) / 1000; /* frequency / 1,000 */
|
||||||
return (nsac + (fhkz >> 1)) / fhkz; /* 1,000,000 * NSAC / frequency */
|
return (nsac + (fhkz >> 1)) / fhkz; /* 1,000,000 * NSAC / frequency */
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -1699,7 +1699,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
|
|||||||
* of 1024 or 2048.
|
* of 1024 or 2048.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!IS_SDV2(slot->type) && slot->nsectors <= 4096*12)
|
if (!IS_SDV2(slot->type) && slot->nsectors <= ((uint32)4096*12))
|
||||||
{
|
{
|
||||||
/* Don't set the block len on high capacity cards (ver1.x or ver2.x) */
|
/* Don't set the block len on high capacity cards (ver1.x or ver2.x) */
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -473,9 +473,12 @@ int ftl_initialize(int minor, ubyte *buffer, FAR struct mtd_dev_s *mtd)
|
|||||||
|
|
||||||
dev->mtd = mtd;
|
dev->mtd = mtd;
|
||||||
|
|
||||||
/* Get the device geometry */
|
/* Get the device geometry. (casting to uintptr first eliminates
|
||||||
|
* complaints on some architectures where the sizeof long is different
|
||||||
|
* from the size of a pointer).
|
||||||
|
*/
|
||||||
|
|
||||||
ret = MTD_IOCTL(mtd, MTDIOC_GEOMETRY, (unsigned long)&dev->geo);
|
ret = MTD_IOCTL(mtd, MTDIOC_GEOMETRY, (unsigned long)((uintptr)&dev->geo));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
fdbg("MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret);
|
fdbg("MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret);
|
||||||
|
|||||||
+1
-1
@@ -577,7 +577,7 @@ static int m25p_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
case MTDIOC_GEOMETRY:
|
case MTDIOC_GEOMETRY:
|
||||||
{
|
{
|
||||||
FAR struct mtd_geometry_s *geo = (FAR struct mtd_geometry_s *)arg;
|
FAR struct mtd_geometry_s *geo = (FAR struct mtd_geometry_s *)((uintptr)arg);
|
||||||
if (geo)
|
if (geo)
|
||||||
{
|
{
|
||||||
/* Populate the geometry structure with information need to know
|
/* Populate the geometry structure with information need to know
|
||||||
|
|||||||
@@ -65,6 +65,9 @@
|
|||||||
|
|
||||||
#define uart_putc(ch) up_putc(ch)
|
#define uart_putc(ch) up_putc(ch)
|
||||||
|
|
||||||
|
#define HALF_SECOND_MSEC 500
|
||||||
|
#define HALF_SECOND_USEC 500000L
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
@@ -543,9 +546,9 @@ static int uart_close(FAR struct file *filep)
|
|||||||
while (dev->xmit.head != dev->xmit.tail)
|
while (dev->xmit.head != dev->xmit.tail)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
usleep(500*1000);
|
usleep(HALF_SECOND_USEC);
|
||||||
#else
|
#else
|
||||||
up_mdelay(500);
|
up_mdelay(HALF_SECOND_MSEC);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -554,9 +557,9 @@ static int uart_close(FAR struct file *filep)
|
|||||||
while (!uart_txempty(dev))
|
while (!uart_txempty(dev))
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
usleep(500*1000);
|
usleep(HALF_SECOND_USEC);
|
||||||
#else
|
#else
|
||||||
up_mdelay(500);
|
up_mdelay(HALF_SECOND_MSEC);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* examples/ostest/barrier.c
|
* examples/ostest/barrier.c
|
||||||
*
|
*
|
||||||
* 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>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -48,6 +48,8 @@
|
|||||||
* Definitions
|
* Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define HALF_SECOND 500000L
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -69,7 +71,7 @@ static void *barrier_func(void *parameter)
|
|||||||
|
|
||||||
printf("barrier_func: Thread %d started\n", id);
|
printf("barrier_func: Thread %d started\n", id);
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
usleep(500*1000);
|
usleep(HALF_SECOND);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Wait at the barrier until all threads are synchronized. */
|
/* Wait at the barrier until all threads are synchronized. */
|
||||||
@@ -96,7 +98,7 @@ static void *barrier_func(void *parameter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
usleep(500*1000);
|
usleep(HALF_SECOND);
|
||||||
#endif
|
#endif
|
||||||
printf("barrier_func: Thread %d done\n", id);
|
printf("barrier_func: Thread %d done\n", id);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* ostest/main.c
|
* examples/ostest/main.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
@@ -51,8 +51,9 @@
|
|||||||
* Definitions
|
* Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define PRIORITY 100
|
#define PRIORITY 100
|
||||||
#define NARGS 4
|
#define NARGS 4
|
||||||
|
#define HALF_SECOND_USEC 500000L
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
@@ -133,7 +134,7 @@ static void check_test_memory_usage(void)
|
|||||||
{
|
{
|
||||||
/* Wait a little bit to let any threads terminate */
|
/* Wait a little bit to let any threads terminate */
|
||||||
|
|
||||||
usleep(500*1000);
|
usleep(HALF_SECOND_USEC);
|
||||||
|
|
||||||
/* Get the current memory usage */
|
/* Get the current memory usage */
|
||||||
|
|
||||||
@@ -224,7 +225,7 @@ static int user_main(int argc, char *argv[])
|
|||||||
/* Sample the memory usage now */
|
/* Sample the memory usage now */
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
usleep(500*1000);
|
usleep(HALF_SECOND_USEC);
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
#ifdef CONFIG_CAN_PASS_STRUCTS
|
||||||
g_mmbefore = mallinfo();
|
g_mmbefore = mallinfo();
|
||||||
@@ -405,7 +406,7 @@ static int user_main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
usleep(500*1000);
|
usleep(HALF_SECOND_USEC);
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
#ifdef CONFIG_CAN_PASS_STRUCTS
|
||||||
g_mmafter = mallinfo();
|
g_mmafter = mallinfo();
|
||||||
|
|||||||
@@ -73,6 +73,8 @@
|
|||||||
# define TEST_RECEIVE_NMSGS (10)
|
# define TEST_RECEIVE_NMSGS (10)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define HALF_SECOND_USEC_USEC 500000L
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -370,7 +372,7 @@ void mqueue_test(void)
|
|||||||
|
|
||||||
/* Wait a bit to see if the thread exits on its own */
|
/* Wait a bit to see if the thread exits on its own */
|
||||||
|
|
||||||
usleep(500*1000);
|
usleep(HALF_SECOND_USEC_USEC);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Then cancel the thread and see if it did */
|
/* Then cancel the thread and see if it did */
|
||||||
|
|||||||
+4
-2
@@ -146,10 +146,12 @@ FAR void *mmap(FAR void *start, size_t length, int prot, int flags,
|
|||||||
* only option supported
|
* only option supported
|
||||||
*
|
*
|
||||||
* Perform the ioctl to get the base address of the file in 'mapped'
|
* Perform the ioctl to get the base address of the file in 'mapped'
|
||||||
* in memory.
|
* in memory. (casting to uintptr first eliminates complaints on some
|
||||||
|
* architectures where the sizeof long is different from the size of
|
||||||
|
* a pointer).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = ioctl(fd, FIOC_MMAP, (unsigned long)&addr);
|
ret = ioctl(fd, FIOC_MMAP, (unsigned long)((uintptr)&addr));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
fdbg("ioctl(FIOC_MMAP) failed: %d\n", errno);
|
fdbg("ioctl(FIOC_MMAP) failed: %d\n", errno);
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@
|
|||||||
#define ALL_SIGNAL_SET ((sigset_t)0xffffffff)
|
#define ALL_SIGNAL_SET ((sigset_t)0xffffffff)
|
||||||
#define MIN_SIGNO 0
|
#define MIN_SIGNO 0
|
||||||
#define MAX_SIGNO 31
|
#define MAX_SIGNO 31
|
||||||
#define GOOD_SIGNO(s) (((s)>=MIN_SIGNO)&&((s)<=MAX_SIGNO))
|
#define GOOD_SIGNO(s) ((((unsigned)(s))<=MAX_SIGNO))
|
||||||
#define SIGNO2SET(s) ((sigset_t)1 << (s))
|
#define SIGNO2SET(s) ((sigset_t)1 << (s))
|
||||||
|
|
||||||
/* All signals are "real time" signals */
|
/* All signals are "real time" signals */
|
||||||
|
|||||||
@@ -135,6 +135,15 @@ typedef int STATUS;
|
|||||||
typedef unsigned int socklen_t;
|
typedef unsigned int socklen_t;
|
||||||
typedef uint16 sa_family_t;
|
typedef uint16 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
|
||||||
|
* a signed integer type capable of storing values at least in the range
|
||||||
|
* [-1, 1000000].
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef uint32 useconds_t;
|
||||||
|
typedef sint32 suseconds_t;
|
||||||
|
|
||||||
/* Task entry point */
|
/* Task entry point */
|
||||||
|
|
||||||
typedef int (*main_t)(int argc, char *argv[]);
|
typedef int (*main_t)(int argc, char *argv[]);
|
||||||
|
|||||||
+1
-1
@@ -132,7 +132,7 @@ EXTERN int optopt; /* unrecognized option character */
|
|||||||
EXTERN pid_t getpid(void);
|
EXTERN pid_t getpid(void);
|
||||||
EXTERN void _exit(int status) noreturn_function;
|
EXTERN void _exit(int status) noreturn_function;
|
||||||
EXTERN unsigned int sleep(unsigned int seconds);
|
EXTERN unsigned int sleep(unsigned int seconds);
|
||||||
EXTERN void usleep(unsigned long usec);
|
EXTERN void usleep(useconds_t usec);
|
||||||
|
|
||||||
/* File descriptor operations */
|
/* File descriptor operations */
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************
|
/************************************************************
|
||||||
* mq_notify.c
|
* sched/mq_notify.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -200,7 +200,11 @@ static void timer_timeout(int argc, uint32 itimer)
|
|||||||
timer_restart(u.timer, itimer);
|
timer_restart(u.timer, itimer);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
FAR struct posix_timer_s *timer = (FAR struct posix_timer_s *)itimer;
|
/* (casting to uintptr first eliminates complaints on some architectures
|
||||||
|
* where the sizeof uint32 is different from the size of a pointer).
|
||||||
|
*/
|
||||||
|
|
||||||
|
FAR struct posix_timer_s *timer = (FAR struct posix_timer_s *)((uintptr)itimer);
|
||||||
|
|
||||||
/* Send the specified signal to the specified task. Increment the reference
|
/* Send the specified signal to the specified task. Increment the reference
|
||||||
* count on the timer first so that will not be deleted until after the
|
* count on the timer first so that will not be deleted until after the
|
||||||
@@ -379,7 +383,7 @@ int timer_settime(timer_t timerid, int flags, FAR const struct itimerspec *value
|
|||||||
if (delay > 0)
|
if (delay > 0)
|
||||||
{
|
{
|
||||||
timer->pt_last = delay;
|
timer->pt_last = delay;
|
||||||
ret = wd_start(timer->pt_wdog, timer->pt_delay, (wdentry_t)timer_timeout, 1, (uint32)timer);
|
ret = wd_start(timer->pt_wdog, timer->pt_delay, (wdentry_t)timer_timeout, 1, (uint32)((uintptr)timer));
|
||||||
}
|
}
|
||||||
|
|
||||||
irqrestore(state);
|
irqrestore(state);
|
||||||
|
|||||||
+1
-1
@@ -82,7 +82,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void usleep(unsigned long usec)
|
void usleep(useconds_t usec)
|
||||||
{
|
{
|
||||||
sigset_t set;
|
sigset_t set;
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
|||||||
Reference in New Issue
Block a user