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@2354 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-12-16 14:15:34 +00:00
parent 3ff1175885
commit 8561ce102a
65 changed files with 2048 additions and 2011 deletions

View File

@ -2,7 +2,7 @@
* arch/z80/include/ez80/io.h
* arch/chip/io.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -45,7 +45,7 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
#include <stdint.h>
/****************************************************************************
* Definitions
@ -75,8 +75,8 @@ extern "C" {
#define EXTERN extern
#endif
EXTERN void outp(uint16 p, ubyte c);
EXTERN ubyte inp(uint16 p);
EXTERN void outp(uint16_t p, uint8_t c);
EXTERN uint8_t inp(uint16_t p);
#undef EXTERN
#ifdef __cplusplus

View File

@ -2,7 +2,7 @@
* arch/ez80/include/ez80/irq.h
* arch/chip/irq.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -49,6 +49,10 @@
* Included Files
****************************************************************************/
#ifndef __ASSEMBLY__
# include <stdint.h>
#endif
/****************************************************************************
* Definitions
****************************************************************************/

View File

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

View File

@ -2,7 +2,7 @@
* arch/z8/include/z8/irq.h
* arch/chip/irq.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -45,6 +45,10 @@
* Included Files
****************************************************************************/
#ifndef __ASSEMBLY__
# include <stdint.h>
#endif
/****************************************************************************
* Definitions
****************************************************************************/
@ -321,12 +325,12 @@ struct xcptcontext
*/
#ifndef CONFIG_DISABLE_SIGNALS
CODE void *sigdeliver; /* Actual type is sig_deliver_t */
CODE void *sigdeliver; /* Actual type is sig_deliver_t */
/* The following retains that state during signal execution */
uint16 saved_pc; /* Saved return address */
uint16 saved_irqctl; /* Saved interrupt state */
uint16_t saved_pc; /* Saved return address */
uint16_t saved_irqctl; /* Saved interrupt state */
#endif
};
#endif

View File

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

View File

@ -2,7 +2,7 @@
* arch/z80/include/z80/irq.h
* arch/chip/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
@ -45,6 +45,10 @@
* Included Files
****************************************************************************/
#ifndef __ASSEMBLY__
# include <stdint.h>
#endif
/****************************************************************************
* Definitions
****************************************************************************/
@ -109,8 +113,8 @@ struct xcptcontext
/* The following retains that state during signal execution */
uint16 saved_pc; /* Saved return address */
uint16 saved_i; /* Saved interrupt state */
uint16_t saved_pc; /* Saved return address */
uint16_t saved_i; /* Saved interrupt state */
#endif
};
#endif

View File

@ -1,7 +1,7 @@
/************************************************************************************
* common/up_arch.h
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* 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
* without specific prior written permission.
*
@ -41,9 +41,6 @@
************************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
# include <sys/types.h>
#endif
#include <arch/board/board.h>
#include "chip/chip.h"

View File

@ -1,7 +1,7 @@
/****************************************************************************
* common/up_assert.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>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdlib.h>
#include <assert.h>
#include <debug.h>
@ -109,7 +109,7 @@ static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */
****************************************************************************/
#ifdef CONFIG_HAVE_FILENAME
void up_assert(const ubyte *filename, int lineno)
void up_assert(const uint8_t *filename, int lineno)
#else
void up_assert(void)
#endif
@ -146,7 +146,7 @@ void up_assert(void)
****************************************************************************/
#ifdef CONFIG_HAVE_FILENAME
void up_assert_code(const ubyte *filename, int lineno, int errorcode)
void up_assert_code(const uint8_t *filename, int lineno, int errorcode)
#else
void up_assert_code(int errorcode)
#endif

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/common/up_blocktask.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>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <sched.h>
#include <debug.h>
@ -97,7 +97,7 @@ void up_block_task(FAR _TCB *tcb, tstate_t task_state)
else
{
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
boolean switch_needed;
bool switch_needed;
/* dbg("Blocking TCB=%p\n", tcb); */

View File

@ -38,11 +38,14 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/arch.h>
#include "up_arch.h"
#include "up_internal.h"
@ -90,7 +93,7 @@ int up_create_stack(_TCB *tcb, size_t stack_size)
if (!tcb->stack_alloc_ptr)
{
tcb->stack_alloc_ptr = (uint32 *)kzmalloc(stack_size);
tcb->stack_alloc_ptr = (uint32_t*)kzmalloc(stack_size);
}
if (tcb->stack_alloc_ptr)
@ -105,7 +108,7 @@ int up_create_stack(_TCB *tcb, size_t stack_size)
* referenced as positive word offsets from sp.
*/
top_of_stack = (uint32)tcb->stack_alloc_ptr + stack_size - 4;
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
/* The Arm7Tdmi stack must be aligned at word (4 byte)
* boundaries. If necessary top_of_stack must be rounded
@ -113,11 +116,11 @@ int up_create_stack(_TCB *tcb, size_t stack_size)
*/
top_of_stack &= ~3;
size_of_stack = top_of_stack - (uint32)tcb->stack_alloc_ptr + 4;
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
/* Save the adjusted stack values in the _TCB */
tcb->adj_stack_ptr = (uint32*)top_of_stack;
tcb->adj_stack_ptr = (uint32_t*)top_of_stack;
tcb->adj_stack_size = size_of_stack;
up_ledon(LED_STACKCREATED);

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/common/up_doirq.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>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <assert.h>
#include "up_arch.h"
@ -70,7 +70,7 @@
* Public Functions
****************************************************************************/
FAR chipreg_t *up_doirq(ubyte irq, FAR chipreg_t *regs)
FAR chipreg_t *up_doirq(uint8_t irq, FAR chipreg_t *regs)
{
up_ledon(LED_INIRQ);

View File

@ -1,7 +1,7 @@
/****************************************************************************
* common/up_exit.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>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <sched.h>
#include <debug.h>

View File

@ -1,7 +1,7 @@
/****************************************************************************
* common/up_idle.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>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <nuttx/arch.h>
#include <arch/board/board.h>
@ -55,7 +55,7 @@
****************************************************************************/
#if defined(CONFIG_ARCH_LEDS) && defined(CONFIG_ARCH_BRINGUP)
static ubyte g_ledtoggle = 0;
static uint8_t g_ledtoggle = 0;
#endif
/****************************************************************************

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/common/up_initialize.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>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,6 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <debug.h>
#include <nuttx/arch.h>

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/common/up_internal.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
@ -55,6 +55,9 @@
* Included Files
****************************************************************************/
#include <stdint.h>
#include <stdbool.h>
#include <arch/irq.h>
#include "chip/chip.h"
#include "chip/switch.h"
@ -108,7 +111,7 @@ EXTERN void up_lowuartinit(void);
/* Defined in up_doirq.c */
EXTERN FAR chipreg_t *up_doirq(ubyte irq, FAR chipreg_t *regs);
EXTERN FAR chipreg_t *up_doirq(uint8_t irq, FAR chipreg_t *regs);
/* Define in up_sigdeliver */
@ -168,7 +171,7 @@ EXTERN void up_timerhook(void);
EXTERN int up_netinitialize(void);
EXTERN void up_netuninitialize(void);
# ifdef CONFIG_ARCH_MCFILTER
EXTERN int up_multicastfilter(FAR struct uip_driver_s *dev, FAR ubyte *mac, boolean enable);
EXTERN int up_multicastfilter(FAR struct uip_driver_s *dev, FAR uint8_t *mac, bool enable);
# else
# define up_multicastfilter(dev, mac, enable)
# endif
@ -180,7 +183,7 @@ EXTERN int up_multicastfilter(FAR struct uip_driver_s *dev, FAR ubyte *mac, bool
/* Return the current value of the stack pointer (used in stack dump logic) */
EXTERN uint16 up_getsp(void);
EXTERN uint16_t up_getsp(void);
/* Dump stack and registers */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/common/up_interruptcontext.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>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h>
@ -62,11 +62,11 @@
/****************************************************************************
* Name: up_interrupt_context
*
* Description: Return TRUE is we are currently executing in
* Description: Return true is we are currently executing in
* the interrupt handler context.
****************************************************************************/
boolean up_interrupt_context(void)
bool up_interrupt_context(void)
{
return IN_INTERRUPT();
}

View File

@ -38,7 +38,6 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/arch.h>
#include "up_internal.h"

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/common/up_releasepending.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>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,6 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <debug.h>

View File

@ -1,7 +1,7 @@
/************************************************************
* common/up_releasestack.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>
*
* Redistribution and use in source and binary forms, with or without
@ -38,10 +38,11 @@
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include "os_internal.h"
#include "up_internal.h"

View File

@ -39,7 +39,8 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <sched.h>
#include <debug.h>
@ -86,7 +87,7 @@
*
****************************************************************************/
void up_reprioritize_rtr(FAR _TCB *tcb, ubyte priority)
void up_reprioritize_rtr(FAR _TCB *tcb, uint8_t priority)
{
/* Verify that the caller is sane */
@ -100,12 +101,12 @@ void up_reprioritize_rtr(FAR _TCB *tcb, ubyte priority)
else
{
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
boolean switch_needed;
bool switch_needed;
slldbg("TCB=%p PRI=%d\n", tcb, priority);
/* Remove the tcb task from the ready-to-run list.
* sched_removereadytorun will return TRUE if we just
* sched_removereadytorun will return true if we just
* remove the head of the ready to run list.
*/
@ -113,10 +114,10 @@ void up_reprioritize_rtr(FAR _TCB *tcb, ubyte priority)
/* Setup up the new task priority */
tcb->sched_priority = (ubyte)priority;
tcb->sched_priority = (uint8_t)priority;
/* Return the task to the specified blocked task list.
* sched_addreadytorun will return TRUE if the task was
* sched_addreadytorun will return true if the task was
* added to the new list. We will need to perform a context
* switch only if the EXCLUSIVE or of the two calls is non-zero
* (i.e., one and only one the calls changes the head of the

View File

@ -1,7 +1,7 @@
/****************************************************************************
* common/up_stackdump.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>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <debug.h>
#include "up_arch.h"
@ -80,9 +80,9 @@
static void up_stackdump(void)
{
_TCB *rtcb = (_TCB*)g_readytorun.head;
uint16 sp = up_getsp();
uint16 stack_base = (uint16)rtcb->adj_stack_ptr;
uint16 stack_size = (uint16)rtcb->adj_stack_size;
uint16_t) sp = up_getsp();
uint16_t) stack_base = (uint16_t))rtcb->adj_stack_ptr;
uint16_t) stack_size = (uint16_t))rtcb->adj_stack_size;
lldbg("stack_base: %04x\n", stack_base);
lldbg("stack_size: %04x\n", stack_size);
@ -95,11 +95,11 @@ static void up_stackdump(void)
}
else
{
uint16 stack = sp & ~0x0f;
uint16_t) stack = sp & ~0x0f;
for (stack = sp & ~0x0f; stack < stack_base; stack += 8*sizeof(uint16))
for (stack = sp & ~0x0f; stack < stack_base; stack += 8*sizeof(uint16_t)))
{
uint16 *ptr = (uint16*)stack;
uint16_t) *ptr = (uint16_t)*)stack;
lldbg("%04x: %04x %04x %04x %04x %04x %04x %04x %04x\n",
stack, ptr[0], ptr[1], ptr[2], ptr[3],
ptr[4], ptr[5], ptr[6], ptr[7]);

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/common/up_unblocktask.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>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,6 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <debug.h>

View File

@ -38,11 +38,14 @@
************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/arch.h>
#include "up_internal.h"
/************************************************************
@ -99,7 +102,7 @@ int up_use_stack(_TCB *tcb, void *stack, size_t stack_size)
* referenced as positive word offsets from sp.
*/
top_of_stack = (uint32)tcb->stack_alloc_ptr + stack_size - 4;
top_of_stack = (uint32_t)tcb->stack_alloc_ptr + stack_size - 4;
/* The Arm7Tdmi stack must be aligned at word (4 byte)
* boundaries. If necessary top_of_stack must be rounded
@ -107,7 +110,7 @@ int up_use_stack(_TCB *tcb, void *stack, size_t stack_size)
*/
top_of_stack &= ~3;
size_of_stack = top_of_stack - (uint32)tcb->stack_alloc_ptr + 4;
size_of_stack = top_of_stack - (uint32_t)tcb->stack_alloc_ptr + 4;
/* Save the adjusted stack values in the _TCB */

View File

@ -2,7 +2,7 @@
* arch/z80/src/ez80/chip.h
* arch/z80/src/chip/chip.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,6 +41,10 @@
* Included Files
************************************************************************************/
#ifndef __ASSEMBLY__
# include <stdint.h>
#endif
/************************************************************************************
* Definitions
************************************************************************************/
@ -78,7 +82,7 @@ extern "C" {
#define EXTERN extern
#endif
EXTERN uint32 ez80_systemclock;
EXTERN uint32_t ez80_systemclock;
/************************************************************************************
* Public Function Prototypes

View File

@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include "arch/board/board.h"
@ -54,7 +54,7 @@
* Private Data
****************************************************************************/
uint32 ez80_systemclock = EZ80_SYS_CLK_FREQ;
uint32_t ez80_systemclock = EZ80_SYS_CLK_FREQ;
/****************************************************************************
* Private Functions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/ez80/ez80_copystate.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,6 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <arch/irq.h>
#include "chip/switch.h"

View File

@ -43,6 +43,8 @@
#include <nuttx/config.h>
#if defined(CONFIG_NET) && defined(CONFIG_EZ80_EMAC)
#include <stdint.h>
#include <stdbool.h>
#include <time.h>
#include <string.h>
#include <debug.h>
@ -242,21 +244,21 @@
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
struct ez80mac_statistics_s
{
uint32 rx_int; /* Number of Rx interrupts received */
uint32 rx_packets; /* Number of packets received (sum of the following): */
uint32 rx_ip; /* Number of Rx IP packets received */
uint32 rx_arp; /* Number of Rx ARP packets received */
uint32 rx_dropped; /* Number of dropped, unsupported Rx packets */
uint32 rx_nok; /* Number of Rx packets received without OK bit */
uint32 rx_errors; /* Number of Rx errors (rx_overerrors + rx_nok) */
uint32 rx_ovrerrors; /* Number of FIFO overrun errors */
uint32 tx_int; /* Number of Tx interrupts received */
uint32 tx_packets; /* Number of Tx descriptors queued */
uint32 tx_errors; /* Number of Tx errors (sum of the following) */
uint32 tx_abterrors; /* Number of aborted Tx descriptors */
uint32 tx_fsmerrors; /* Number of Tx state machine errors */
uint32 tx_timeouts; /* Number of Tx timeout errors */
uint32 sys_int; /* Number of system interrupts received */
uint32_t rx_int; /* Number of Rx interrupts received */
uint32_t rx_packets; /* Number of packets received (sum of the following): */
uint32_t rx_ip; /* Number of Rx IP packets received */
uint32_t rx_arp; /* Number of Rx ARP packets received */
uint32_t rx_dropped; /* Number of dropped, unsupported Rx packets */
uint32_t rx_nok; /* Number of Rx packets received without OK bit */
uint32_t rx_errors; /* Number of Rx errors (rx_overerrors + rx_nok) */
uint32_t rx_ovrerrors; /* Number of FIFO overrun errors */
uint32_t tx_int; /* Number of Tx interrupts received */
uint32_t tx_packets; /* Number of Tx descriptors queued */
uint32_t tx_errors; /* Number of Tx errors (sum of the following) */
uint32_t tx_abterrors; /* Number of aborted Tx descriptors */
uint32_t tx_fsmerrors; /* Number of Tx state machine errors */
uint32_t tx_timeouts; /* Number of Tx timeout errors */
uint32_t sys_int; /* Number of system interrupts received */
};
# define _MKFIELD(a,b,c) a->b##c
# define EMAC_STAT(priv,name) _MKFIELD(priv,stat.,name)++
@ -303,10 +305,10 @@ struct ez80emac_driver_s
FAR struct ez80emac_desc_s *rxnext;
FAR struct ez80emac_desc_s *rxendp1;
boolean bifup; /* TRUE:ifup FALSE:ifdown */
boolean blinkok; /* TRUE:successful MII autonegotiation */
boolean bfullduplex; /* TRUE:full duplex */
boolean b100mbs; /* TRUE:100Mbp */
bool bifup; /* true:ifup false:ifdown */
bool blinkok; /* true:successful MII autonegotiation */
bool bfullduplex; /* true:full duplex */
bool b100mbs; /* true:100Mbp */
WDOG_ID txpoll; /* TX poll timer */
WDOG_ID txtimeout; /* TX timeout timer */
@ -336,49 +338,49 @@ static struct ez80emac_driver_s g_emac;
/* MII logic */
static void ez80emac_waitmiibusy(void);
static void ez80emac_miiwrite(FAR struct ez80emac_driver_s *priv, ubyte offset,
uint16 value);
static uint16 ez80emac_miiread(FAR struct ez80emac_driver_s *priv, uint32 offset);
static boolean ez80emac_miipoll(FAR struct ez80emac_driver_s *priv, uint32 offset,
uint16 bits, boolean bclear);
static int ez80emac_miiconfigure(FAR struct ez80emac_driver_s *priv);
static void ez80emac_waitmiibusy(void);
static void ez80emac_miiwrite(FAR struct ez80emac_driver_s *priv, uint8_t offset,
uint16_t value);
static uint16_t ez80emac_miiread(FAR struct ez80emac_driver_s *priv, uint32_t offset);
static bool ez80emac_miipoll(FAR struct ez80emac_driver_s *priv, uint32_t offset,
uint16_t bits, bool bclear);
static int ez80emac_miiconfigure(FAR struct ez80emac_driver_s *priv);
/* Multi-cast filtering */
#ifdef CONFIG_EZ80_MCFILTER
static void ez80emac_machash(FAR ubyte *mac, int *ndx, int *bitno)
static void ez80emac_machash(FAR uint8_t *mac, int *ndx, int *bitno)
#endif
/* TX/RX logic */
static int ez80emac_transmit(struct ez80emac_driver_s *priv);
static int ez80emac_uiptxpoll(struct uip_driver_s *dev);
static int ez80emac_transmit(struct ez80emac_driver_s *priv);
static int ez80emac_uiptxpoll(struct uip_driver_s *dev);
static inline FAR struct ez80emac_desc_s *ez80emac_rwp(void);
static inline FAR struct ez80emac_desc_s *ez80emac_rrp(void);
static int ez80emac_receive(struct ez80emac_driver_s *priv);
static int ez80emac_receive(struct ez80emac_driver_s *priv);
/* Interrupt handling */
static int ez80emac_txinterrupt(int irq, FAR void *context);
static int ez80emac_rxinterrupt(int irq, FAR void *context);
static int ez80emac_sysinterrupt(int irq, FAR void *context);
static int ez80emac_txinterrupt(int irq, FAR void *context);
static int ez80emac_rxinterrupt(int irq, FAR void *context);
static int ez80emac_sysinterrupt(int irq, FAR void *context);
/* Watchdog timer expirations */
static void ez80emac_polltimer(int argc, uint32 arg, ...);
static void ez80emac_txtimeout(int argc, uint32 arg, ...);
static void ez80emac_polltimer(int argc, uint32_t arg, ...);
static void ez80emac_txtimeout(int argc, uint32_t arg, ...);
/* NuttX callback functions */
static int ez80emac_ifup(struct uip_driver_s *dev);
static int ez80emac_ifdown(struct uip_driver_s *dev);
static int ez80emac_txavail(struct uip_driver_s *dev);
static int ez80emac_ifup(struct uip_driver_s *dev);
static int ez80emac_ifdown(struct uip_driver_s *dev);
static int ez80emac_txavail(struct uip_driver_s *dev);
/* Initialization */
static int ez80_emacinitialize(void);
static int ez80_emacinitialize(void);
/****************************************************************************
* Private Functions
@ -421,9 +423,9 @@ static void ez80emac_waitmiibusy(void)
*
****************************************************************************/
static void ez80emac_miiwrite(FAR struct ez80emac_driver_s *priv, ubyte offset, uint16 value)
static void ez80emac_miiwrite(FAR struct ez80emac_driver_s *priv, uint8_t offset, uint16_t value)
{
ubyte regval;
uint8_t regval;
/* Wait for any preceding MII management operation to complete */
@ -461,9 +463,9 @@ static void ez80emac_miiwrite(FAR struct ez80emac_driver_s *priv, ubyte offset,
*
****************************************************************************/
static uint16 ez80emac_miiread(FAR struct ez80emac_driver_s *priv, uint32 offset)
static uint16_t ez80emac_miiread(FAR struct ez80emac_driver_s *priv, uint32_t offset)
{
ubyte regval;
uint8_t regval;
/* Wait for any preceding MII management operation to complete */
@ -483,7 +485,7 @@ static uint16 ez80emac_miiread(FAR struct ez80emac_driver_s *priv, uint32 offset
/* Wait for MII management operation to complete */
ez80emac_waitmiibusy();
return ((uint16)inp(EZ80_EMAC_PRSD_H) << 8 | inp(EZ80_EMAC_PRSD_L));
return ((uint16_t)inp(EZ80_EMAC_PRSD_H) << 8 | inp(EZ80_EMAC_PRSD_L));
}
/****************************************************************************
@ -497,18 +499,18 @@ static uint16 ez80emac_miiread(FAR struct ez80emac_driver_s *priv, uint32 offset
* priv - Reference to the driver state structure
* offset - Register offset in PMD
* bits - Selects set of bits to wait for
* bclear - TRUE:Return true when all bits in 'bits' are 0
* FALSE:Return true when one or more bits in 'bits' are 1
* bclear - true:Return true when all bits in 'bits' are 0
* false:Return true when one or more bits in 'bits' are 1
*
* Returned Value:
* TRUE:Bit has requested polarity; FALSE: EMAC_MXPOLLLOOPS exceeded
* true:Bit has requested polarity; false: EMAC_MXPOLLLOOPS exceeded
*
****************************************************************************/
static boolean ez80emac_miipoll(FAR struct ez80emac_driver_s *priv, uint32 offset,
uint16 bits, boolean bclear)
static bool ez80emac_miipoll(FAR struct ez80emac_driver_s *priv, uint32_t offset,
uint16_t bits, bool bclear)
{
uint16 value;
uint16_t value;
int i;
for (i = 0; i < EMAC_MXPOLLLOOPS; i++)
@ -518,18 +520,18 @@ static boolean ez80emac_miipoll(FAR struct ez80emac_driver_s *priv, uint32 offse
{
if ((value & bits) == 0)
{
return TRUE;
return true;
}
}
else
{
if ((value & bits) != 0)
{
return TRUE;
return true;
}
}
}
return FALSE;
return false;
}
/****************************************************************************
@ -542,19 +544,19 @@ static boolean ez80emac_miipoll(FAR struct ez80emac_driver_s *priv, uint32 offse
* priv - Reference to the driver state structure
* offset - Register offset in PMD
* bits - Selects set of bits to wait for
* bclear - TRUE:Return true when all bits in 'bits' are 0
* FALSE:Return true when one or more bits in 'bits' are 1
* bclear - true:Return true when all bits in 'bits' are 0
* false:Return true when one or more bits in 'bits' are 1
*
* Returned Value:
* TRUE:Bit has requested polarity; FALSE: EMAC_MXPOLLLOOPS exceeded
* true:Bit has requested polarity; false: EMAC_MXPOLLLOOPS exceeded
*
****************************************************************************/
#ifdef CONFIG_EZ80_PHYAM79C874
static int ez80emac_miiconfigure(FAR struct ez80emac_driver_s *priv)
{
uint16 phyval;
boolean bauto;
uint16_t phyval;
bool bauto;
int ret = OK;
int i;
@ -584,12 +586,12 @@ static int ez80emac_miiconfigure(FAR struct ez80emac_driver_s *priv)
if (phyval & MII_MSR_ANEGABLE)
{
phyval = MII_MCR_ANRESTART | MII_MCR_ANENABLE;
bauto = TRUE;
bauto = true;
}
else
{
phyval = 0;
bauto = FALSE;
bauto = false;
/* PADEN - EMAC pads all short frames by adding zeroes to the end of
* the data field. This bit is used in conjunction with ADPADN
@ -701,10 +703,10 @@ dumpregs:
#else
static int ez80emac_miiconfigure(FAR struct ez80emac_driver_s *priv)
{
uint16 advertise;
uint16 lpa;
uint16 mcr;
ubyte regval;
uint16_t advertise;
uint16_t lpa;
uint16_t mcr;
uint8_t regval;
/* Start auto-negotiation */
@ -715,28 +717,28 @@ static int ez80emac_miiconfigure(FAR struct ez80emac_driver_s *priv)
/* Wait for auto-negotiation to start */
if (!ez80emac_miipoll(priv, MII_MCR, MII_MCR_ANRESTART, FALSE))
if (!ez80emac_miipoll(priv, MII_MCR, MII_MCR_ANRESTART, false))
{
ndbg("Autonegotiation didn't start.\n");
}
/* Wait for auto-negotiation to complete */
if (!ez80emac_miipoll(priv, MII_MSR, MII_MSR_ANEGCOMPLETE, TRUE))
if (!ez80emac_miipoll(priv, MII_MSR, MII_MSR_ANEGCOMPLETE, true))
{
ndbg("Autonegotiation didn't complete.\n");
}
/* Wait link */
if (!ez80emac_miipoll(priv, MII_MSR, MII_MSR_LINKSTATUS, TRUE))
if (!ez80emac_miipoll(priv, MII_MSR, MII_MSR_LINKSTATUS, true))
{
ndbg("Link is down!\n");
priv->blinkok = FALSE;
priv->blinkok = false;
}
else
{
priv->blinkok = TRUE;
priv->blinkok = true;
}
/* Read capable media type */
@ -753,8 +755,8 @@ static int ez80emac_miiconfigure(FAR struct ez80emac_driver_s *priv)
regval = inp(EZ80_EMAC_CFG1);
regval |= EMAC_CFG1_FULLHD; /* Enable full duplex mode */
outp(EZ80_EMAC_CFG1, regval);
priv->b100mbs = TRUE;
priv->bfullduplex = TRUE;
priv->b100mbs = true;
priv->bfullduplex = true;
}
/* Check for 100BASETX half duplex */
@ -765,8 +767,8 @@ static int ez80emac_miiconfigure(FAR struct ez80emac_driver_s *priv)
regval = inp(EZ80_EMAC_CFG1);
regval &= ~EMAC_CFG1_FULLHD; /* Disable full duplex mode */
outp(EZ80_EMAC_CFG1, regval);
priv->b100mbs = TRUE;
priv->bfullduplex = FALSE;
priv->b100mbs = true;
priv->bfullduplex = false;
}
/* Check for 10BASETX full duplex */
@ -777,8 +779,8 @@ static int ez80emac_miiconfigure(FAR struct ez80emac_driver_s *priv)
regval = inp(EZ80_EMAC_CFG1);
regval |= EMAC_CFG1_FULLHD; /* Enable full duplex mode */
outp(EZ80_EMAC_CFG1, regval);
priv->b100mbs = FALSE;
priv->bfullduplex = TRUE;
priv->b100mbs = false;
priv->bfullduplex = true;
}
/* Check for 10BASETX half duplex */
@ -789,8 +791,8 @@ static int ez80emac_miiconfigure(FAR struct ez80emac_driver_s *priv)
regval = inp(EZ80_EMAC_CFG1);
regval &= ~EMAC_CFG1_FULLHD; /* Disable full duplex mode */
outp(EZ80_EMAC_CFG1, regval);
priv->b100mbs = FALSE;
priv->bfullduplex = FALSE;
priv->b100mbs = false;
priv->bfullduplex = false;
}
else
{
@ -798,8 +800,8 @@ static int ez80emac_miiconfigure(FAR struct ez80emac_driver_s *priv)
regval = inp(EZ80_EMAC_CFG1);
regval &= ~EMAC_CFG1_FULLHD; /* Disable full duplex mode */
outp(EZ80_EMAC_CFG1, regval);
priv->b100mbs = FALSE;
priv->bfullduplex = FALSE;
priv->b100mbs = false;
priv->bfullduplex = false;
}
/* Set MII control */
@ -847,7 +849,7 @@ static int ez80emac_miiconfigure(FAR struct ez80emac_driver_s *priv)
* Parameters:
* priv - Reference to the driver state structure
* mac - The MAC address to add
* enable - TRUE: Enable filtering on this address; FALSE: disable
* enable - true: Enable filtering on this address; false: disable
*
* Returned Value:
* None
@ -855,10 +857,10 @@ static int ez80emac_miiconfigure(FAR struct ez80emac_driver_s *priv)
****************************************************************************/
#ifdef CONFIG_EZ80_MCFILTER
static void ez80emac_machash(FAR ubyte *mac, int *ndx, int *bitno)
static void ez80emac_machash(FAR uint8_t *mac, int *ndx, int *bitno)
{
uint32 hash;
uint32 crc32;
uint32_t hash;
uint32_t crc32;
int i;
int j;
@ -867,7 +869,7 @@ static void ez80emac_machash(FAR ubyte *mac, int *ndx, int *bitno)
crc32 = 0xffffffff;
for (i = 0; i < 6; i++)
{
crc32 ^= (uint32)mac[i] & 0x0f;
crc32 ^= (uint32_t)mac[i] & 0x0f;
for (j = 0; j < 4; j++)
{
if (crc32 & 1)
@ -880,7 +882,7 @@ static void ez80emac_machash(FAR ubyte *mac, int *ndx, int *bitno)
}
}
crc32 ^= (uint32)mac[i] >> 4;
crc32 ^= (uint32_t)mac[i] >> 4;
for (j = 0; j < 4; j++)
{
if (crc32 & 1)
@ -936,11 +938,11 @@ static int ez80emac_transmit(struct ez80emac_driver_s *priv)
{
FAR struct ez80emac_desc_s *txdesc;
FAR struct ez80emac_desc_s *txnext;
ubyte *psrc;
ubyte *pdest;
uint24 len;
uint8_t *psrc;
uint8_t *pdest;
uint24_t len;
irqstate_t flags;
ubyte regval;
uint8_t regval;
/* Careful: This function can be called from outside of the interrupt
* handler and, therefore, may be suspended when debug output is generated!
@ -969,14 +971,14 @@ static int ez80emac_transmit(struct ez80emac_driver_s *priv)
txdesc = priv->txnext;
len = EMAC_PKTBUF_ALIGN(priv->dev.d_len + SIZEOF_EMACSDESC);
txnext = (FAR struct ez80emac_desc_s *)((ubyte*)txdesc + len);
txnext = (FAR struct ez80emac_desc_s *)((uint8_t*)txdesc + len);
/* Handle wraparound to the beginning of the TX region */
if ((ubyte*)txnext + SIZEOF_EMACSDESC >= (ubyte*)priv->rxstart)
if ((uint8_t*)txnext + SIZEOF_EMACSDESC >= (uint8_t*)priv->rxstart)
{
txnext = (FAR struct ez80emac_desc_s *)
((ubyte*)priv->txstart + ((ubyte*)txnext - (ubyte*)priv->rxstart));
((uint8_t*)priv->txstart + ((uint8_t*)txnext - (uint8_t*)priv->rxstart));
}
priv->txnext = txnext;
@ -987,8 +989,8 @@ static int ez80emac_transmit(struct ez80emac_driver_s *priv)
/* Copy the data to the next packet in the Tx buffer (handling wraparound) */
psrc = priv->dev.d_buf;
pdest = (ubyte*)txdesc + SIZEOF_EMACSDESC;
len = (ubyte*)priv->rxstart - pdest;
pdest = (uint8_t*)txdesc + SIZEOF_EMACSDESC;
len = (uint8_t*)priv->rxstart - pdest;
if (len >= priv->dev.d_len)
{
/* The entire packet will fit into the EMAC SRAM without wrapping */
@ -1014,7 +1016,7 @@ static int ez80emac_transmit(struct ez80emac_driver_s *priv)
* perform the transmission on its next polling cycle.
*/
txdesc->np = (uint24)priv->txnext;
txdesc->np = (uint24_t)priv->txnext;
txdesc->pktsize = priv->dev.d_len;
txdesc->stat = EMAC_TXDESC_OWNER;
@ -1033,7 +1035,7 @@ static int ez80emac_transmit(struct ez80emac_driver_s *priv)
/* Setup the TX timeout watchdog (perhaps restarting the timer) */
(void)wd_start(priv->txtimeout, EMAC_TXTIMEOUT, ez80emac_txtimeout, 1, (uint32)priv);
(void)wd_start(priv->txtimeout, EMAC_TXTIMEOUT, ez80emac_txtimeout, 1, (uint32_t)priv);
return OK;
}
@ -1102,7 +1104,7 @@ static int ez80emac_uiptxpoll(struct uip_driver_s *dev)
static inline FAR struct ez80emac_desc_s *ez80emac_rwp(void)
{
return (FAR struct ez80emac_desc_s *)
(CONFIG_EZ80_RAMADDR + ((uint24)inp(EZ80_EMAC_RWP_H) << 8) + (uint24)inp(EZ80_EMAC_RWP_L));
(CONFIG_EZ80_RAMADDR + ((uint24_t)inp(EZ80_EMAC_RWP_H) << 8) + (uint24_t)inp(EZ80_EMAC_RWP_L));
}
/****************************************************************************
@ -1122,7 +1124,7 @@ static inline FAR struct ez80emac_desc_s *ez80emac_rwp(void)
static inline FAR struct ez80emac_desc_s *ez80emac_rrp(void)
{
return (FAR struct ez80emac_desc_s *)
(CONFIG_EZ80_RAMADDR + ((uint24)inp(EZ80_EMAC_RRP_H) << 8) + (uint24)inp(EZ80_EMAC_RRP_L));
(CONFIG_EZ80_RAMADDR + ((uint24_t)inp(EZ80_EMAC_RRP_H) << 8) + (uint24_t)inp(EZ80_EMAC_RRP_L));
}
/****************************************************************************
@ -1148,8 +1150,8 @@ static int ez80emac_receive(struct ez80emac_driver_s *priv)
{
FAR struct ez80emac_desc_s *rxdesc = priv->rxnext;
FAR struct ez80emac_desc_s *rwp;
ubyte *psrc;
ubyte *pdest;
uint8_t *psrc;
uint8_t *pdest;
int pktlen;
int npackets;
@ -1208,14 +1210,14 @@ static int ez80emac_receive(struct ez80emac_driver_s *priv)
/* Copy the data data from the hardware to priv->dev.d_buf */
psrc = (FAR ubyte*)priv->rxnext + SIZEOF_EMACSDESC;
psrc = (FAR uint8_t*)priv->rxnext + SIZEOF_EMACSDESC;
pdest = priv->dev.d_buf;
/* Check for wraparound */
if ((FAR ubyte*)(psrc + pktlen) > (FAR ubyte*)priv->rxendp1)
if ((FAR uint8_t*)(psrc + pktlen) > (FAR uint8_t*)priv->rxendp1)
{
int nbytes = (int)((FAR ubyte*)priv->rxendp1 - (FAR ubyte*)psrc);
int nbytes = (int)((FAR uint8_t*)priv->rxendp1 - (FAR uint8_t*)psrc);
nvdbg("RX wraps after %d bytes\n", nbytes + SIZEOF_EMACSDESC);
memcpy(pdest, psrc, nbytes);
@ -1249,8 +1251,8 @@ static int ez80emac_receive(struct ez80emac_driver_s *priv)
* and the RRP to determine how many packets remain in the Rx buffer.
*/
outp(EZ80_EMAC_RRP_L, (ubyte)((uint24)rxdesc & 0xff));
outp(EZ80_EMAC_RRP_H, (ubyte)(((uint24)rxdesc >> 8) & 0xff));
outp(EZ80_EMAC_RRP_L, (uint8_t)((uint24_t)rxdesc & 0xff));
outp(EZ80_EMAC_RRP_H, (uint8_t)(((uint24_t)rxdesc >> 8) & 0xff));
nvdbg("rxnext=%p {%06x, %u, %04x} rrp=%06x rwp=%06x blkslft=%02x\n",
rxdesc, rxdesc->np, rxdesc->pktsize, rxdesc->stat,
@ -1328,8 +1330,8 @@ static int ez80emac_txinterrupt(int irq, FAR void *context)
{
FAR struct ez80emac_driver_s *priv = &g_emac;
FAR struct ez80emac_desc_s *txhead = priv->txhead;
ubyte regval;
ubyte istat;
uint8_t regval;
uint8_t istat;
/* EMAC Tx interrupts:
*
@ -1432,7 +1434,7 @@ static int ez80emac_txinterrupt(int irq, FAR void *context)
static int ez80emac_rxinterrupt(int irq, FAR void *context)
{
FAR struct ez80emac_driver_s *priv = &g_emac;
ubyte istat;
uint8_t istat;
/* EMAC Rx interrupts:
*
@ -1477,8 +1479,8 @@ static int ez80emac_rxinterrupt(int irq, FAR void *context)
static int ez80emac_sysinterrupt(int irq, FAR void *context)
{
FAR struct ez80emac_driver_s *priv = &g_emac;
ubyte events;
ubyte istat;
uint8_t events;
uint8_t istat;
/* EMAC system interrupts :
*
@ -1553,7 +1555,7 @@ static int ez80emac_sysinterrupt(int irq, FAR void *context)
*
****************************************************************************/
static void ez80emac_txtimeout(int argc, uint32 arg, ...)
static void ez80emac_txtimeout(int argc, uint32_t arg, ...)
{
FAR struct ez80emac_driver_s *priv = (FAR struct ez80emac_driver_s *)arg;
irqstate_t flags;
@ -1592,7 +1594,7 @@ static void ez80emac_txtimeout(int argc, uint32 arg, ...)
*
****************************************************************************/
static void ez80emac_polltimer(int argc, uint32 arg, ...)
static void ez80emac_polltimer(int argc, uint32_t arg, ...)
{
struct ez80emac_driver_s *priv = (struct ez80emac_driver_s *)arg;
@ -1625,7 +1627,7 @@ static void ez80emac_polltimer(int argc, uint32 arg, ...)
static int ez80emac_ifup(FAR struct uip_driver_s *dev)
{
FAR struct ez80emac_driver_s *priv = (FAR struct ez80emac_driver_s *)dev->d_private;
ubyte regval;
uint8_t regval;
int ret;
ndbg("Bringing up: MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
@ -1688,11 +1690,11 @@ static int ez80emac_ifup(FAR struct uip_driver_s *dev)
/* Set and activate a timer process */
(void)wd_start(priv->txpoll, EMAC_WDDELAY, ez80emac_polltimer, 1, (uint32)priv);
(void)wd_start(priv->txpoll, EMAC_WDDELAY, ez80emac_polltimer, 1, (uint32_t)priv);
/* Enable the Ethernet interrupts */
priv->bifup = TRUE;
priv->bifup = true;
up_enable_irq(EZ80_EMACRX_IRQ);
up_enable_irq(EZ80_EMACTX_IRQ);
up_enable_irq(EZ80_EMACSYS_IRQ);
@ -1721,7 +1723,7 @@ static int ez80emac_ifdown(struct uip_driver_s *dev)
{
struct ez80emac_driver_s *priv = (struct ez80emac_driver_s *)dev->d_private;
irqstate_t flags;
ubyte regval;
uint8_t regval;
/* Disable the Ethernet interrupt */
@ -1745,7 +1747,7 @@ static int ez80emac_ifdown(struct uip_driver_s *dev)
outp(EZ80_EMAC_PTMR, 0);
priv->bifup = FALSE;
priv->bifup = false;
irqrestore(flags);
return OK;
}
@ -1809,8 +1811,8 @@ static int ez80emac_txavail(struct uip_driver_s *dev)
static int ez80_emacinitialize(void)
{
struct ez80emac_driver_s *priv = &g_emac;
uint24 addr;
ubyte regval;
uint24_t addr;
uint8_t regval;
int ret;
/* Reset the EMAC hardware */
@ -1838,8 +1840,8 @@ static int ez80_emacinitialize(void)
*/
addr = CONFIG_EZ80_RAMADDR;
outp(EZ80_EMAC_TLBP_L, (ubyte)(addr & 0xff));
outp(EZ80_EMAC_TLBP_H, (ubyte)((addr >> 8) & 0xff));
outp(EZ80_EMAC_TLBP_L, (uint8_t)(addr & 0xff));
outp(EZ80_EMAC_TLBP_H, (uint8_t)((addr >> 8) & 0xff));
priv->txstart = (FAR struct ez80emac_desc_s *)(addr);
priv->txnext = priv->txstart;
@ -1860,8 +1862,8 @@ static int ez80_emacinitialize(void)
*/
addr += EMAC_TXBUFSIZE;
outp(EZ80_EMAC_BP_L, (ubyte)(addr & 0xff));
outp(EZ80_EMAC_BP_H, (ubyte)((addr >> 8) & 0xff));
outp(EZ80_EMAC_BP_L, (uint8_t)(addr & 0xff));
outp(EZ80_EMAC_BP_H, (uint8_t)((addr >> 8) & 0xff));
priv->rxstart = (FAR struct ez80emac_desc_s *)(addr);
priv->rxnext = priv->rxstart;
@ -1887,8 +1889,8 @@ static int ez80_emacinitialize(void)
* is limited to a minimum of 32 bytes, the last five bits are always zero.
*/
outp(EZ80_EMAC_RRP_L, (ubyte)(addr & 0xff));
outp(EZ80_EMAC_RRP_H, (ubyte)((addr >> 8) & 0xff));
outp(EZ80_EMAC_RRP_L, (uint8_t)(addr & 0xff));
outp(EZ80_EMAC_RRP_H, (uint8_t)((addr >> 8) & 0xff));
nvdbg("rrp=%02x%02x rwp=%02x%02x\n",
inp(EZ80_EMAC_RRP_H), inp(EZ80_EMAC_RRP_L),
@ -1899,8 +1901,8 @@ static int ez80_emacinitialize(void)
*/
addr += EMAC_RXBUFSIZE;
outp(EZ80_EMAC_RHBP_L, (ubyte)(addr & 0xff));
outp(EZ80_EMAC_RHBP_H, (ubyte)((addr >> 8) & 0xff));
outp(EZ80_EMAC_RHBP_L, (uint8_t)(addr & 0xff));
outp(EZ80_EMAC_RHBP_H, (uint8_t)((addr >> 8) & 0xff));
priv->rxendp1 = (FAR struct ez80emac_desc_s *)addr;
nvdbg("rxendp1=%p rhbp=%02x%02x\n",
@ -1932,7 +1934,7 @@ static int ez80_emacinitialize(void)
up_udelay(500);
ez80emac_miiwrite(priv, MII_MCR, MII_MCR_RESET);
if (!ez80emac_miipoll(priv, MII_MCR, MII_MCR_RESET, FALSE))
if (!ez80emac_miipoll(priv, MII_MCR, MII_MCR_RESET, false))
{
ndbg("PHY reset error.\n");
}
@ -1987,7 +1989,7 @@ static int ez80_emacinitialize(void)
/* PHY reset */
ez80emac_miiwrite(priv, MII_MCR, MII_MCR_RESET);
if (!ez80emac_miipoll(priv, MII_MCR, MII_MCR_RESET, FALSE))
if (!ez80emac_miipoll(priv, MII_MCR, MII_MCR_RESET, false))
{
ndbg("PHY reset error.\n");
ret = -EIO;
@ -2095,7 +2097,7 @@ errout:
* Parameters:
* dev - Reference to the uIP driver state structure
* mac - The MAC address to add
* enable - TRUE: Enable filtering on this address; FALSE: disable
* enable - true: Enable filtering on this address; false: disable
*
* Returned Value:
* OK on success; Negated errno on failure.
@ -2103,10 +2105,10 @@ errout:
****************************************************************************/
#ifdef CONFIG_ARCH_MCFILTER
int up_multicastfilter(FAR struct uip_driver_s *dev, FAR ubyte *mac, boolean enable)
int up_multicastfilter(FAR struct uip_driver_s *dev, FAR uint8_t *mac, bool enable)
{
FAR struct ez80emac_driver_s *priv = (FAR struct ez80emac_driver_s *)dev->priv;
ubyte regval;
uint8_t regval;
int ndx;
int bit;
int i;

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/ez80/ez80_initialstate.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <string.h>
#include <nuttx/arch.h>
@ -85,7 +85,7 @@ void up_initial_state(_TCB *tcb)
memset(xcp, 0, sizeof(struct xcptcontext));
#ifndef CONFIG_SUPPRESS_INTERRUPTS
((ubyte*)xcp->regs)[XCPT_IF_OFFSET] = EZ80_PV_FLAG; /* Parity/Overflow flag will enable interrupts */
((uint8_t*)xcp->regs)[XCPT_IF_OFFSET] = EZ80_PV_FLAG; /* Parity/Overflow flag will enable interrupts */
#endif
xcp->regs[XCPT_SP] = (chipreg_t)tcb->adj_stack_ptr;
xcp->regs[XCPT_PC] = (chipreg_t)tcb->start;

View File

@ -1,7 +1,7 @@
;**************************************************************************
; arch/z80/src/ze80/ez80_io.c
;
; Copyright (C) 2008 Gregory Nutt. All rights reserved.
; Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
; Author: Gregory Nutt <spudmonkey@racsa.co.cr>
;
; Redistribution and use in source and binary forms, with or without
@ -58,7 +58,7 @@
.assume ADL=1
;**************************************************************************
; Name: void outp(uint16 p, ubyte c)
; Name: void outp(uint16_t p, uint8_t c)
;
; Description:
; Output byte c on port p
@ -108,7 +108,7 @@ _outp:
ret
;**************************************************************************
; Name: ubyte inp(uint16 p)
; Name: uint8_t inp(uint16_t p)
;
; Description:
; Input byte from port p

View File

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

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/ez80/ez80_loweruart.c
*
* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <string.h>
#include <arch/io.h>
@ -140,8 +140,8 @@
#if defined(HAVE_SERIALCONSOLE) && !defined(CONFIG_SUPPRESS_UART_CONFIG)
static void ez80_setbaud(void)
{
uint32 brg_divisor;
ubyte lctl;
uint32_t brg_divisor;
uint8_t lctl;
/* The resulting BAUD and depends on the system clock frequency and the
* BRG divisor as follows:
@ -163,8 +163,8 @@ static void ez80_setbaud(void)
lctl |= EZ80_UARTLCTL_DLAB;
ez80_outp(EZ80_UART_LCTL, lctl);
ez80_outp(EZ80_UART_BRGL, (ubyte)(brg_divisor & 0xff));
ez80_outp(EZ80_UART_BRGH, (ubyte)(brg_divisor >> 8));
ez80_outp(EZ80_UART_BRGL, (uint8_t)(brg_divisor & 0xff));
ez80_outp(EZ80_UART_BRGH, (uint8_t)(brg_divisor >> 8));
lctl &= ~EZ80_UARTLCTL_DLAB;
ez80_outp(EZ80_UART_LCTL, lctl);
@ -182,7 +182,7 @@ static void ez80_setbaud(void)
void up_lowuartinit(void)
{
#ifdef HAVE_SERIAL
ubyte regval;
uint8_t regval;
/* Configure pins for usage of UARTs (whether or not we have a console) */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/ez80/ez80_registerdump.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,6 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <debug.h>
#include <nuttx/irq.h>

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/ez80/ez80_schedulesigaction.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <sched.h>
#include <debug.h>
@ -123,7 +123,7 @@ static void ez80_sigsetup(FAR _TCB *tcb, sig_deliver_t sigdeliver, FAR chipreg_t
void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
{
sdbg("tcb=0x%p sigdeliver=0x%04x\n", tcb, (uint16)sigdeliver);
sdbg("tcb=0x%p sigdeliver=0x%04x\n", tcb, (uint16_t))sigdeliver);
/* Refuse to handle nested signal actions */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/ez08/ez80_serial.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -40,6 +40,8 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
#include <semaphore.h>
#include <string.h>
@ -68,31 +70,31 @@
struct ez80_dev_s
{
uint16 uartbase; /* Base address of UART registers */
unsigned int baud; /* Configured baud */
ubyte irq; /* IRQ associated with this UART */
ubyte parity; /* 0=none, 1=odd, 2=even */
ubyte bits; /* Number of bits (7 or 8) */
boolean stopbits2; /* TRUE: Configure with 2 (vs 1) */
uint16_t uartbase; /* Base address of UART registers */
unsigned int baud; /* Configured baud */
uint8_t irq; /* IRQ associated with this UART */
uint8_t parity; /* 0=none, 1=odd, 2=even */
uint8_t bits; /* Number of bits (7 or 8) */
bool stopbits2; /* true: Configure with 2 (vs 1) */
};
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static int ez80_setup(struct uart_dev_s *dev);
static void ez80_shutdown(struct uart_dev_s *dev);
static int ez80_attach(struct uart_dev_s *dev);
static void ez80_detach(struct uart_dev_s *dev);
static int ez80_interrrupt(int irq, void *context);
static int ez80_ioctl(struct file *filep, int cmd, unsigned long arg);
static int ez80_receive(struct uart_dev_s *dev, unsigned int *status);
static void ez80_rxint(struct uart_dev_s *dev, boolean enable);
static boolean ez80_rxavailable(struct uart_dev_s *dev);
static void ez80_send(struct uart_dev_s *dev, int ch);
static void ez80_txint(struct uart_dev_s *dev, boolean enable);
static boolean ez80_txready(struct uart_dev_s *dev);
static boolean ez80_txempty(struct uart_dev_s *dev);
static int ez80_setup(struct uart_dev_s *dev);
static void ez80_shutdown(struct uart_dev_s *dev);
static int ez80_attach(struct uart_dev_s *dev);
static void ez80_detach(struct uart_dev_s *dev);
static int ez80_interrrupt(int irq, void *context);
static int ez80_ioctl(struct file *filep, int cmd, unsigned long arg);
static int ez80_receive(struct uart_dev_s *dev, unsigned int *status);
static void ez80_rxint(struct uart_dev_s *dev, bool enable);
static bool ez80_rxavailable(struct uart_dev_s *dev);
static void ez80_send(struct uart_dev_s *dev, int ch);
static void ez80_txint(struct uart_dev_s *dev, bool enable);
static bool ez80_txready(struct uart_dev_s *dev);
static bool ez80_txempty(struct uart_dev_s *dev);
/****************************************************************************
* Private Variables
@ -141,12 +143,12 @@ static struct ez80_dev_s g_uart0priv =
static uart_dev_t g_uart0port =
{
0, /* open_count */
FALSE, /* xmitwaiting */
FALSE, /* recvwaiting */
false, /* xmitwaiting */
false, /* recvwaiting */
#ifdef CONFIG_UART0_SERIAL_CONSOLE
TRUE, /* isconsole */
true, /* isconsole */
#else
FALSE, /* isconsole */
false, /* isconsole */
#endif
{ 0 }, /* closesem */
{ 0 }, /* xmitsem */
@ -186,12 +188,12 @@ static struct ez80_dev_s g_uart1priv =
static uart_dev_t g_uart1port =
{
0, /* open_count */
FALSE, /* xmitwaiting */
FALSE, /* recvwaiting */
false, /* xmitwaiting */
false, /* recvwaiting */
#ifdef CONFIG_UART1_SERIAL_CONSOLE
TRUE, /* isconsole */
true, /* isconsole */
#else
FALSE, /* isconsole */
false, /* isconsole */
#endif
{ 0 }, /* closesem */
{ 0 }, /* xmitsem */
@ -246,7 +248,7 @@ static uart_dev_t g_uart1port =
* Name: ez80_serialin
****************************************************************************/
static inline ubyte ez80_serialin(struct ez80_dev_s *priv, ubyte offset)
static inline uint8_t ez80_serialin(struct ez80_dev_s *priv, uint8_t offset)
{
return inp(priv->uartbase + offset);
}
@ -255,7 +257,8 @@ static inline ubyte ez80_serialin(struct ez80_dev_s *priv, ubyte offset)
* Name: ez80_serialout
****************************************************************************/
static inline void ez80_serialout(struct ez80_dev_s *priv, ubyte offset, ubyte value)
static inline void ez80_serialout(struct ez80_dev_s *priv, uint8_t offset,
uint8_t value)
{
outp(priv->uartbase + offset, value);
}
@ -266,7 +269,7 @@ static inline void ez80_serialout(struct ez80_dev_s *priv, ubyte offset, ubyte v
static inline void ez80_disableuartint(struct ez80_dev_s *priv)
{
ubyte ier = ez80_serialin(priv, EZ80_UART_IER);
uint8_t ier = ez80_serialin(priv, EZ80_UART_IER);
ier &= ~EZ80_UARTEIR_INTMASK;
ez80_serialout(priv, EZ80_UART_IER, ier);
}
@ -275,9 +278,9 @@ static inline void ez80_disableuartint(struct ez80_dev_s *priv)
* Name: ez80_restoreuartint
****************************************************************************/
static inline void ez80_restoreuartint(struct ez80_dev_s *priv, ubyte bits)
static inline void ez80_restoreuartint(struct ez80_dev_s *priv, uint8_t bits)
{
ubyte ier = ez80_serialin(priv, EZ80_UART_IER);
uint8_t ier = ez80_serialin(priv, EZ80_UART_IER);
ier |= bits & (EZ80_UARTEIR_TIE|EZ80_UARTEIR_RIE);
ez80_serialout(priv, EZ80_UART_IER, ier);
}
@ -303,10 +306,10 @@ static inline void ez80_waittxready(struct ez80_dev_s *priv)
* Name: ez80_setbaud
****************************************************************************/
static inline void ez80_setbaud(struct ez80_dev_s *priv, uint24 baud)
static inline void ez80_setbaud(struct ez80_dev_s *priv, uint24_t baud)
{
uint32 brg_divisor;
ubyte lctl;
uint32_t brg_divisor;
uint8_t lctl;
/* The resulting BAUD and depends on the system clock frequency and the
* BRG divisor as follows:
@ -326,8 +329,8 @@ static inline void ez80_setbaud(struct ez80_dev_s *priv, uint24 baud)
lctl |= EZ80_UARTLCTL_DLAB;
ez80_serialout(priv, EZ80_UART_LCTL, lctl);
ez80_serialout(priv, EZ80_UART_BRGL, (ubyte)(brg_divisor & 0xff));
ez80_serialout(priv, EZ80_UART_BRGH, (ubyte)(brg_divisor >> 8));
ez80_serialout(priv, EZ80_UART_BRGL, (uint8_t)(brg_divisor & 0xff));
ez80_serialout(priv, EZ80_UART_BRGH, (uint8_t)(brg_divisor >> 8));
lctl &= ~EZ80_UARTLCTL_DLAB;
ez80_serialout(priv, EZ80_UART_LCTL, lctl);
@ -346,8 +349,8 @@ static int ez80_setup(struct uart_dev_s *dev)
{
#ifndef CONFIG_SUPPRESS_UART_CONFIG
struct ez80_dev_s *priv = dev->priv;
ubyte reg;
ubyte cval;
uint8_t reg;
uint8_t cval;
if (priv->bits == 7)
{
@ -441,8 +444,8 @@ static int ez80_attach(struct uart_dev_s *dev)
*
* Description:
* Detach UART interrupts. This method is called when the serial port is
* closed normally just before the shutdown method is called. The exception is
* the serial console which is never shutdown.
* closed normally just before the shutdown method is called. The exception
* is the serial console which is never shutdown.
*
****************************************************************************/
@ -470,7 +473,7 @@ static int ez80_interrrupt(int irq, void *context)
{
struct uart_dev_s *dev = NULL;
struct ez80_dev_s *priv;
volatile uint32 cause;
volatile uint32_t cause;
#ifndef CONFIG_UART0_DISABLE
if (g_uart0priv.irq == irq)
@ -539,8 +542,8 @@ static int ez80_ioctl(struct file *filep, int cmd, unsigned long arg)
static int ez80_receive(struct uart_dev_s *dev, unsigned int *status)
{
struct ez80_dev_s *priv = (struct ez80_dev_s*)dev->priv;
ubyte rbr = ez80_serialin(priv, EZ80_UART_RBR);
ubyte lsr = ez80_serialin(priv, EZ80_UART_LSR);
uint8_t rbr = ez80_serialin(priv, EZ80_UART_RBR);
uint8_t lsr = ez80_serialin(priv, EZ80_UART_LSR);
*status = (unsigned int)lsr;
return rbr;
@ -554,10 +557,10 @@ static int ez80_receive(struct uart_dev_s *dev, unsigned int *status)
*
****************************************************************************/
static void ez80_rxint(struct uart_dev_s *dev, boolean enable)
static void ez80_rxint(struct uart_dev_s *dev, bool enable)
{
struct ez80_dev_s *priv = (struct ez80_dev_s*)dev->priv;
ubyte ier = ez80_serialin(priv, EZ80_UART_IER);
uint8_t ier = ez80_serialin(priv, EZ80_UART_IER);
if (enable)
{
@ -577,11 +580,11 @@ static void ez80_rxint(struct uart_dev_s *dev, boolean enable)
* Name: ez80_rxavailable
*
* Description:
* Return TRUE if the receive fifo is not empty
* Return true if the receive fifo is not empty
*
****************************************************************************/
static boolean ez80_rxavailable(struct uart_dev_s *dev)
static bool ez80_rxavailable(struct uart_dev_s *dev)
{
struct ez80_dev_s *priv = (struct ez80_dev_s*)dev->priv;
return (ez80_serialin(priv, EZ80_UART_LSR) & EZ80_UARTLSR_DR) != 0;
@ -598,7 +601,7 @@ static boolean ez80_rxavailable(struct uart_dev_s *dev)
static void ez80_send(struct uart_dev_s *dev, int ch)
{
struct ez80_dev_s *priv = (struct ez80_dev_s*)dev->priv;
ez80_serialout(priv, EZ80_UART_THR, (ubyte)ch);
ez80_serialout(priv, EZ80_UART_THR, (uint8_t)ch);
}
/****************************************************************************
@ -609,10 +612,10 @@ static void ez80_send(struct uart_dev_s *dev, int ch)
*
****************************************************************************/
static void ez80_txint(struct uart_dev_s *dev, boolean enable)
static void ez80_txint(struct uart_dev_s *dev, bool enable)
{
struct ez80_dev_s *priv = (struct ez80_dev_s*)dev->priv;
ubyte ier = ez80_serialin(priv, EZ80_UART_IER);
uint8_t ier = ez80_serialin(priv, EZ80_UART_IER);
if (enable)
{
@ -632,11 +635,11 @@ static void ez80_txint(struct uart_dev_s *dev, boolean enable)
* Name: ez80_txready
*
* Description:
* Return TRUE if the tranmsit fifo is not full
* Return true if the tranmsit fifo is not full
*
****************************************************************************/
static boolean ez80_txready(struct uart_dev_s *dev)
static bool ez80_txready(struct uart_dev_s *dev)
{
struct ez80_dev_s *priv = (struct ez80_dev_s*)dev->priv;
return (ez80_serialin(priv, EZ80_UART_LSR) & EZ80_UARTLSR_THRE) != 0;
@ -646,11 +649,11 @@ static boolean ez80_txready(struct uart_dev_s *dev)
* Name: ez80_txempty
*
* Description:
* Return TRUE if the transmit fifo is empty
* Return true if the transmit fifo is empty
*
****************************************************************************/
static boolean ez80_txempty(struct uart_dev_s *dev)
static bool ez80_txempty(struct uart_dev_s *dev)
{
struct ez80_dev_s *priv = (struct ez80_dev_s*)dev->priv;
return (ez80_serialin(priv, EZ80_UART_LSR) & EZ80_UARTLSR_TEMT) != 0;
@ -670,7 +673,7 @@ static boolean ez80_txempty(struct uart_dev_s *dev)
void up_serialinit(void)
{
ubyte regval;
uint8_t regval;
/* Make sure that all UART interrupts are disabled */
@ -716,7 +719,7 @@ void up_serialinit(void)
/* If there is a console, then configure the console now */
#ifdef CONSOLE_DEV
CONSOLE_DEV.isconsole = TRUE;
CONSOLE_DEV.isconsole = true;
ez80_setup(&CONSOLE_DEV);
#endif
@ -744,7 +747,7 @@ int up_putc(int ch)
{
#ifdef CONSOLE_DEV
struct ez80_dev_s *priv = (struct ez80_dev_s*)CONSOLE_DEV.priv;
ubyte ier = ez80_serialin(priv, EZ80_UART_IER);
uint8_t ier = ez80_serialin(priv, EZ80_UART_IER);
ez80_disableuartint(priv);
@ -761,7 +764,7 @@ int up_putc(int ch)
/* Output the character */
ez80_waittxready(priv);
ez80_serialout(priv, EZ80_UART_THR, (ubyte)ch);
ez80_serialout(priv, EZ80_UART_THR, (uint8_t)ch);
/* Wait for the character to be sent before re-enabling interrupts */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/ez80/ez80_sigdeliver.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,6 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <debug.h>

View File

@ -38,7 +38,9 @@
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/spi.h>
#include <sys/types.h>
#include <stdint.h>
#include <arch/board/board.h>
#include <nuttx/arch.h>
@ -65,11 +67,14 @@
* Private Function Prototypes
****************************************************************************/
static uint32 spi_setfrequency(FAR struct spi_dev_s *dev, uint32 frequency);
static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev,
uint32_t frequency);
static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode);
static uint16 spi_send(FAR struct spi_dev_s *dev, uint16 wd);
static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const ubyte *buffer, size_t buflen);
static void spi_recvblock(FAR struct spi_dev_s *dev, FAR ubyte *buffer, size_t buflen);
static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd);
static void spi_sndblock(FAR struct spi_dev_s *dev,
FAR const uint8_t *buffer, size_t buflen);
static void spi_recvblock(FAR struct spi_dev_s *dev, FAR uint8_t *buffer,
size_t buflen);
/****************************************************************************
* Private Data
@ -119,7 +124,7 @@ static struct spi_dev_s g_spidev = { &g_spiops };
*
****************************************************************************/
static uint32 spi_setfrequency(FAR struct spi_dev_s *dev, uint32 frequency)
static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency)
{
/* We want select divisor to provide the highest frequency (SPIR) that does NOT
* exceed the requested frequency.:
@ -131,7 +136,7 @@ static uint32 spi_setfrequency(FAR struct spi_dev_s *dev, uint32 frequency)
* BRG >= System Clock Frequency / (2 * SPIR)
*/
uint32 brg = ((EZ80_SYS_CLK_FREQ+1)/2 + frequency - 1) / frequency;
uint32_t brg = ((EZ80_SYS_CLK_FREQ+1)/2 + frequency - 1) / frequency;
/* "When configured as a Master, the 16-bit divisor value must be between
* 0003h and FFFFh, inclusive. When configured as a Slave, the 16-bit
@ -170,8 +175,8 @@ static uint32 spi_setfrequency(FAR struct spi_dev_s *dev, uint32 frequency)
static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode)
{
ubyte modebits;
ubyte regval;
uint8_t modebits;
uint8_t regval;
/* Select the CTL register bits based on the selected mode */
@ -220,9 +225,9 @@ static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode)
*
****************************************************************************/
static ubyte spi_waitspif(void)
static uint8_t spi_waitspif(void)
{
ubyte status;
uint8_t status;
/* Wait for the device to be ready to accept another byte (or for an error
* to be reported
@ -250,9 +255,9 @@ static ubyte spi_waitspif(void)
*
****************************************************************************/
static ubyte spi_transfer(ubyte ch)
static uint8_t spi_transfer(uint8_t ch)
{
ubyte status;
uint8_t status;
/* Send the byte, repeating if some error occurs */
@ -286,9 +291,9 @@ static ubyte spi_transfer(ubyte ch)
*
****************************************************************************/
static uint16 spi_send(FAR struct spi_dev_s *dev, uint16 wd)
static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd)
{
return spi_transfer((ubyte)wd);
return spi_transfer((uint8_t)wd);
}
/*************************************************************************
@ -303,17 +308,19 @@ static uint16 spi_send(FAR struct spi_dev_s *dev, uint16 wd)
* buflen - the length of data to send from the buffer in number of words.
* The wordsize is determined by the number of bits-per-word
* selected for the SPI interface. If nbits <= 8, the data is
* packed into ubytes; if nbits >8, the data is packed into uint16's
* packed into uint8_t's; if nbits >8, the data is packed into
* uint16_t's
*
* Returned Value:
* None
*
****************************************************************************/
static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t buflen)
static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer,
size_t buflen)
{
FAR const ubyte *ptr = (FAR const ubyte*)buffer;
ubyte response;
FAR const uint8_t *ptr = (FAR const uint8_t*)buffer;
uint8_t response;
/* Loop while thre are bytes remaining to be sent */
@ -335,7 +342,8 @@ static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size
* buflen - the length of data that can be received in the buffer in number
* of words. The wordsize is determined by the number of bits-per-word
* selected for the SPI interface. If nbits <= 8, the data is
* packed into ubytes; if nbits >8, the data is packed into uint16's
* packed into uint8_t's; if nbits >8, the data is packed into
* uint16_t's
*
* Returned Value:
* None
@ -344,8 +352,8 @@ static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size
static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t buflen)
{
FAR ubyte *ptr = (FAR ubyte*)buffer;
ubyte response;
FAR uint8_t *ptr = (FAR uint8_t*)buffer;
uint8_t response;
/* Loop while thre are bytes remaining to be sent */
@ -383,7 +391,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t bu
FAR struct spi_dev_s *up_spiinitialize(int port)
{
ubyte regval;
uint8_t regval;
/* Only the SPI1 interface is supported */

View File

@ -1,7 +1,7 @@
/***************************************************************************
* arch/z80/src/ez80/ez80_timerisr.c
*
* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <debug.h>
#include <arch/io.h>
@ -76,7 +76,7 @@
int up_timerisr(int irq, chipreg_t *regs)
{
volatile ubyte reg;
volatile uint8_t reg;
/* Read the appropropriate timer0 registr to clear the interrupt */
@ -112,8 +112,8 @@ int up_timerisr(int irq, chipreg_t *regs)
void up_timerinit(void)
{
uint16 reload;
ubyte reg;
uint16_t) reload;
uint8_t reg;
/* Disable the timer */
@ -142,9 +142,9 @@ void up_timerinit(void)
* NOTE: The system clock frequency value is defined in the board.h file
*/
reload = (uint16)(ez80_systemclock / 1600);
outp(EZ80_TMR0_RRH, (ubyte)(reload >> 8));
outp(EZ80_TMR0_RRL, (ubyte)(reload));
reload = (uint16_t))(ez80_systemclock / 1600);
outp(EZ80_TMR0_RRH, (uint8_t)(reload >> 8));
outp(EZ80_TMR0_RRL, (uint8_t)(reload));
/* Clear any pending timer interrupts */

View File

@ -2,7 +2,7 @@
* arch/z80/src/ez80/ez80f91_emac.h
* arch/z80/src/chip/ez80f91_emac.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,6 +41,10 @@
* Included Files
************************************************************************************/
#ifndef __ASSEMBLY__
# include <stdint.h>
#endif
/************************************************************************************
* Definitions
************************************************************************************/
@ -249,11 +253,11 @@
#ifndef __ASSEMBLY__
struct ez80emac_desc_s
{
uint24 np; /* Pointer to the start of the next packet */
uint16 pktsize; /* Number of bytes in the packet, including the 4 CRC
* bytes, but excluding the 7 descriptor table bytes. */
uint16 stat; /* Status of the packet. Differs for TX and RX packets
* (see EMAC_RX/TXDESC_* definitions) */
uint24_t np; /* Pointer to the start of the next packet */
uint16_t pktsize; /* Number of bytes in the packet, including the 4 CRC
* bytes, but excluding the 7 descriptor table bytes. */
uint16_t stat; /* Status of the packet. Differs for TX and RX packets
* (see EMAC_RX/TXDESC_* definitions) */
};
#endif

View File

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

View File

@ -42,7 +42,8 @@
************************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <nuttx/spi.h>
/************************************************************************************
@ -113,8 +114,8 @@ extern "C" {
* for example, will bind the SPI driver to the SPI MMC/SD driver).
*/
EXTERN void ez80_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, boolean selected);
EXTERN ubyte ez80_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
EXTERN void ez80_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
EXTERN uint8_t ez80_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
#undef EXTERN
#ifdef __cplusplus

View File

@ -2,7 +2,7 @@
* arch/z80/src/ez80/switch.h
* arch/z80/src/chip/switch.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,7 +41,6 @@
* Included Files
************************************************************************************/
#include <sys/types.h>
#ifndef __ASSEMBLY__
# include <nuttx/sched.h>
# include <nuttx/arch.h>
@ -62,7 +61,7 @@
#define INIT_IRQCONTEXT() current_regs = NULL
/* IN_INTERRUPT returns TRUE if the system is current operating in the interrupt
/* IN_INTERRUPT returns true if the system is current operating in the interrupt
* context. IN_INTERRUPT is the inline equivalent of up_interrupt_context().
*/

View File

@ -2,7 +2,7 @@
* arch/z80/src/ez80/up_mem.h
* arch/z80/src/chip/up_mem.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,6 +41,8 @@
* Included Files
************************************************************************************/
#include <stdint.h>
/************************************************************************************
* Definitions
************************************************************************************/
@ -57,12 +59,12 @@
#ifndef CONFIG_HEAP1_BASE
extern unsigned long _heapbot;
# define CONFIG_HEAP1_BASE ((uint24)&_heapbot)
# define CONFIG_HEAP1_BASE ((uint24_t)&_heapbot)
#endif
#ifndef CONFIG_HEAP1_END
extern unsigned long _stack;
# define CONFIG_HEAP1_END (((uint24)&_stack) - CONFIG_IDLETHREAD_STACKSIZE)
# define CONFIG_HEAP1_END (((uint24_t)&_stack) - CONFIG_IDLETHREAD_STACKSIZE)
#endif
/************************************************************************************

View File

@ -41,6 +41,10 @@
* Included Files
************************************************************************************/
#ifndef __ASSEMBLY__
# include <stdint.h>
#endif
/************************************************************************************
* Definitions
************************************************************************************/
@ -118,11 +122,11 @@
/* UART0/1 Base Register Addresses **************************************************/
#ifdef EZ8_UART0
# define Z8_UART0_BASE ((ubyte volatile far*)0xf40)
# define Z8_UART0_BASE ((uint8_t volatile far*)0xf40)
#endif
#ifdef EZ8_UART1
# define Z8_UART1_BASE ((ubyte volatile far*)0xf48)
# define Z8_UART1_BASE ((uint8_t volatile far*)0xf48)
#endif
/* UART0/1 Status 0 Register Bit Definitions ****************************************/

View File

@ -2,7 +2,7 @@
* arch/z80/src/z8/switch.h
* arch/z80/src/chip/switch.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,8 +41,8 @@
* Included Files
************************************************************************************/
#include <sys/types.h>
#ifndef __ASSEMBLY__
# include <stdint.h>
# include <nuttx/sched.h>
# include <nuttx/arch.h>
#endif
@ -63,7 +63,7 @@
#define Z8_IRQSTATE_SAVED 2 /* In interrupt, context has been saved */
/* The information saved on interrupt entry can be retained in a array of two
* uint16 values. These are
* uint24_t values. These are
*
* value[0] = RP (MS byte) and Flags (LS) byte
* value[1] = PC
@ -105,7 +105,7 @@
g_z8irqstate.state = Z8_IRQSTATE_NONE; \
} while (0)
/* IN_INTERRUPT returns TRUE if the system is current operating in the interrupt
/* IN_INTERRUPT returns true if the system is current operating in the interrupt
* context. IN_INTERRUPT is the inline equivalent of up_interrupt_context().
*/
@ -189,7 +189,7 @@
#ifndef __ASSEMBLY__
struct z8_irqstate_s
{
ubyte state; /* See Z8_IRQSTATE_* definitions above */
uint8_t state; /* See Z8_IRQSTATE_* definitions above */
chipreg_t *regs; /* Saved register information */
};
#endif

View File

@ -2,7 +2,7 @@
* arch/z80/src/z8/up_mem.h
* arch/z80/src/chip/up_mem.h
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,6 +41,8 @@
* Included Files
************************************************************************************/
#include <stdint.h>
/************************************************************************************
* Definitions
************************************************************************************/
@ -57,12 +59,12 @@
#ifndef CONFIG_HEAP1_BASE
extern far unsigned long far_heapbot;
# define CONFIG_HEAP1_BASE ((uint16)&far_heapbot)
# define CONFIG_HEAP1_BASE ((uint16_t))&far_heapbot)
#endif
#ifndef CONFIG_HEAP1_END
extern far unsigned long far_stacktop;
# define CONFIG_HEAP1_END (((uint16)&far_stacktop) - CONFIG_IDLETHREAD_STACKSIZE + 1)
# define CONFIG_HEAP1_END (((uint16_t))&far_stacktop) - CONFIG_IDLETHREAD_STACKSIZE + 1)
#endif
/************************************************************************************

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/z8/z8_loweruart.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <string.h>
#include <ez8.h>
@ -51,7 +51,7 @@
#ifdef CONFIG_USE_LOWUARTINIT
extern uint32 get_freq(void);
extern uint32_t get_freq(void);
/****************************************************************************
* Private Definitions
@ -75,13 +75,13 @@ extern uint32 get_freq(void);
void up_lowuartinit(void)
{
uint32 freq = get_freq();
uint16 brg;
ubyte val;
uint32_t freq = get_freq();
uint16_t brg;
uint8_t val;
#ifdef CONFIG_UART0_SERIAL_CONSOLE
brg = (freq +(uint32)CONFIG_UART0_BAUD * 8) /((uint32)CONFIG_UART0_BAUD * 16) ;
brg = (freq +(uint32_t)CONFIG_UART0_BAUD * 8) /((uint32_t)CONFIG_UART0_BAUD * 16) ;
/* Set the baudrate */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/z8/z8_registerdump.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <debug.h>
#include <nuttx/irq.h>
@ -78,7 +78,8 @@ static inline void z8_dumpregs(FAR chipret_t *regs)
regs[XCPT_RR8], regs[XCPT_RR10], regs[XCPT_RR12], regs[XCPT_RR14]);
}
static inline void z8_dumpstate(chipreg_t sp, chipreg_t pc, ubyte irqctl, chipreg_t rpflags)
static inline void z8_dumpstate(chipreg_t sp, chipreg_t pc, uint8_t irqctl,
chipreg_t rpflags)
{
lldbg("SP: %04x PC: %04x IRQCTL: %02x RP: %02x FLAGS: %02x\n",
sp, pc, irqctl & 0xff, rpflags >> 8, rpflags & 0xff);
@ -100,7 +101,7 @@ void z8_registerdump(void)
FAR chipret_t *regs;
FAR chipret_t *state;
chipreg_t sp;
uint16 rp;
uint16_t rp;
switch (g_z8irqstate.state)
{
@ -108,7 +109,7 @@ void z8_registerdump(void)
/* Calculate the source address based on the saved RP value */
rp = g_z8irqstate.regs[Z8_IRQSAVE_RPFLAGS] >> 8;
regs = (FAR uint16*)(rp & 0xf0);
regs = (FAR uint16_t*)(rp & 0xf0);
/* Then dump the register values */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/z8/z8_saveirqcontext.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <arch/irq.h>
#include "chip/switch.h"
@ -93,8 +93,8 @@ void z8_saveirqcontext(FAR chipreg_t *regs)
{
/* Calculate the source address based on the saved RP value */
uint16 rp = g_z8irqstate.regs[Z8_IRQSAVE_RPFLAGS] >> 8;
FAR chipreg_t *src = (FAR uint16*)(rp & 0xf0);
uint16_t rp = g_z8irqstate.regs[Z8_IRQSAVE_RPFLAGS] >> 8;
FAR chipreg_t *src = (FAR uint16_t*)(rp & 0xf0);
FAR chipreg_t *dest = &regs[XCPT_RR0];
/* Copy the interrupted tasks register into the TCB register save area. */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/z8/z8_schedulesigaction.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <sched.h>
#include <debug.h>
@ -123,7 +123,7 @@ static void z8_sigsetup(FAR _TCB *tcb, sig_deliver_t sigdeliver, FAR chipreg_t *
void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
{
dbg("tcb=0x%p sigdeliver=0x%04x\n", tcb, (uint16)sigdeliver);
dbg("tcb=0x%p sigdeliver=0x%04x\n", tcb, (uint16_t)sigdeliver);
/* Refuse to handle nested signal actions */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/z8/z8_serial.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -40,6 +40,8 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
#include <semaphore.h>
#include <string.h>
@ -58,7 +60,7 @@
#ifdef CONFIG_USE_SERIALDRIVER
extern uint32 get_freq(void);
extern uint32_t get_freq(void);
/****************************************************************************
* Definitions
@ -76,35 +78,35 @@ extern uint32 get_freq(void);
struct z8_uart_s
{
ubyte volatile far* uartbase; /* Base address of UART registers */
uint32 baud; /* Configured baud */
boolean rxenabled; /* RX interrupt enabled */
boolean txenabled; /* TX interrupt enabled */
ubyte rxirq; /* RX IRQ associated with this UART */
ubyte txirq; /* RX IRQ associated with this UART */
ubyte parity; /* 0=none, 1=odd, 2=even */
boolean stopbits2; /* TRUE: Configure with 2 stop bits
* (instead of 1) */
uint8_t volatile far* uartbase; /* Base address of UART registers */
uint32_t baud; /* Configured baud */
bool rxenabled; /* RX interrupt enabled */
bool txenabled; /* TX interrupt enabled */
uint8_t rxirq; /* RX IRQ associated with this UART */
uint8_t txirq; /* RX IRQ associated with this UART */
uint8_t parity; /* 0=none, 1=odd, 2=even */
bool stopbits2; /* true: Configure with 2 stop bits
* (instead of 1) */
};
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static int z8_setup(FAR struct uart_dev_s *dev);
static void z8_shutdown(FAR struct uart_dev_s *dev);
static int z8_attach(FAR struct uart_dev_s *dev);
static void z8_detach(FAR struct uart_dev_s *dev);
static int z8_rxinterrupt(int irq, FAR void *context);
static int z8_txinterrupt(int irq, FAR void *context);
static int z8_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
static int z8_receive(FAR struct uart_dev_s *dev, FAR uint32 *status);
static void z8_rxint(FAR struct uart_dev_s *dev, boolean enable);
static boolean z8_rxavailable(FAR struct uart_dev_s *dev);
static void z8_send(FAR struct uart_dev_s *dev, int ch);
static void z8_txint(FAR struct uart_dev_s *dev, boolean enable);
static boolean z8_txready(FAR struct uart_dev_s *dev);
static boolean z8_txempty(FAR struct uart_dev_s *dev);
static int z8_setup(FAR struct uart_dev_s *dev);
static void z8_shutdown(FAR struct uart_dev_s *dev);
static int z8_attach(FAR struct uart_dev_s *dev);
static void z8_detach(FAR struct uart_dev_s *dev);
static int z8_rxinterrupt(int irq, FAR void *context);
static int z8_txinterrupt(int irq, FAR void *context);
static int z8_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
static int z8_receive(FAR struct uart_dev_s *dev, FAR uint32_t *status);
static void z8_rxint(FAR struct uart_dev_s *dev, bool enable);
static bool z8_rxavailable(FAR struct uart_dev_s *dev);
static void z8_send(FAR struct uart_dev_s *dev, int ch);
static void z8_txint(FAR struct uart_dev_s *dev, bool enable);
static bool z8_txready(FAR struct uart_dev_s *dev);
static bool z8_txempty(FAR struct uart_dev_s *dev);
/****************************************************************************
* Private Variables
@ -139,8 +141,8 @@ static struct z8_uart_s g_uart0priv =
{
Z8_UART0_BASE, /* uartbase */
CONFIG_UART0_BAUD, /* baud */
FALSE, /* rxenabled */
FALSE, /* txenabled */
false, /* rxenabled */
false, /* txenabled */
Z8_UART0_RX_IRQ, /* rxirq */
Z8_UART0_TX_IRQ, /* txirq */
CONFIG_UART0_PARITY, /* parity */
@ -150,12 +152,12 @@ static struct z8_uart_s g_uart0priv =
static uart_dev_t g_uart0port =
{
0, /* open_count */
FALSE, /* xmitwaiting */
FALSE, /* recvwaiting */
false, /* xmitwaiting */
false, /* recvwaiting */
#ifdef CONFIG_UART0_SERIAL_CONSOLE
TRUE, /* isconsole */
true, /* isconsole */
#else
FALSE, /* isconsole */
false, /* isconsole */
#endif
{ 0 }, /* closesem */
{ 0 }, /* xmitsem */
@ -184,8 +186,8 @@ static struct z8_uart_s g_uart1priv =
{
Z8_UART1_BASE, /* uartbase */
CONFIG_UART1_BAUD, /* baud */
FALSE, /* rxenabled */
FALSE, /* txenabled */
false, /* rxenabled */
false, /* txenabled */
Z8_UART1_RX_IRQ, /* rxirq */
Z8_UART1_TX_IRQ, /* txirq */
CONFIG_UART1_PARITY, /* parity */
@ -195,12 +197,12 @@ static struct z8_uart_s g_uart1priv =
static uart_dev_t g_uart1port =
{
0, /* open_count */
FALSE, /* xmitwaiting */
FALSE, /* recvwaiting */
false, /* xmitwaiting */
false, /* recvwaiting */
#ifdef CONFIG_UART1_SERIAL_CONSOLE
TRUE, /* isconsole */
true, /* isconsole */
#else
FALSE, /* isconsole */
false, /* isconsole */
#endif
{ 0 }, /* closesem */
{ 0 }, /* xmitsem */
@ -243,7 +245,8 @@ static uart_dev_t g_uart1port =
* Name: z8_putuart
****************************************************************************/
static inline void z8_putuart(FAR struct z8_uart_s *priv, ubyte value, ubyte offset)
static inline void z8_putuart(FAR struct z8_uart_s *priv, uint8_t value,
uint8_t offset)
{
putreg8(value, *(priv->uartbase + offset));
}
@ -252,7 +255,7 @@ static inline void z8_putuart(FAR struct z8_uart_s *priv, ubyte value, ubyte off
* Name: z8_getuart
****************************************************************************/
static inline ubyte z8_getuart(FAR struct z8_uart_s *priv, ubyte offset)
static inline uint8_t z8_getuart(FAR struct z8_uart_s *priv, uint8_t offset)
{
return getreg8(*(priv->uartbase + offset));
}
@ -261,15 +264,15 @@ static inline ubyte z8_getuart(FAR struct z8_uart_s *priv, ubyte offset)
* Name: z8_disableuartirq
****************************************************************************/
static ubyte z8_disableuartirq(FAR struct uart_dev_s *dev)
static uint8_t z8_disableuartirq(FAR struct uart_dev_s *dev)
{
struct z8_uart_s *priv = (struct z8_uart_s*)dev->priv;
irqstate_t flags = irqsave();
ubyte state = priv->rxenabled ? STATE_RXENABLED : STATE_DISABLED | \
uint8_t state = priv->rxenabled ? STATE_RXENABLED : STATE_DISABLED | \
priv->txenabled ? STATE_TXENABLED : STATE_DISABLED;
z8_txint(dev, FALSE);
z8_rxint(dev, FALSE);
z8_txint(dev, false);
z8_rxint(dev, false);
irqrestore(flags);
return state;
@ -279,13 +282,13 @@ static ubyte z8_disableuartirq(FAR struct uart_dev_s *dev)
* Name: z8_restoreuartirq
****************************************************************************/
static void z8_restoreuartirq(FAR struct uart_dev_s *dev, ubyte state)
static void z8_restoreuartirq(FAR struct uart_dev_s *dev, uint8_t state)
{
struct z8_uart_s *priv = (struct z8_uart_s*)dev->priv;
irqstate_t flags = irqsave();
z8_txint(dev, (state & STATE_TXENABLED) ? TRUE : FALSE);
z8_rxint(dev, (state & STATE_RXENABLED) ? TRUE : FALSE);
z8_txint(dev, (state & STATE_TXENABLED) ? true : false);
z8_rxint(dev, (state & STATE_RXENABLED) ? true : false);
irqrestore(flags);
}
@ -294,7 +297,7 @@ static void z8_restoreuartirq(FAR struct uart_dev_s *dev, ubyte state)
* Name: z8_consoleput
****************************************************************************/
static void z8_consoleput(ubyte ch)
static void z8_consoleput(uint8_t ch)
{
struct z8_uart_s *priv = (struct z8_uart_s*)CONSOLE_DEV.priv;
int tmp;
@ -319,8 +322,8 @@ static void z8_consoleput(ubyte ch)
void z8_uartconfigure(void)
{
uint16 brg;
ubyte val;
uint16_t brg;
uint8_t val;
/* Configure GPIO Port A pins 4 & 5 for alternate function */
@ -364,10 +367,10 @@ static int z8_setup(FAR struct uart_dev_s *dev)
{
#ifndef CONFIG_SUPPRESS_UART_CONFIG
struct z8_uart_s *priv = (struct z8_uart_s*)dev->priv;
uint32 freq = get_freq();
uint16 brg;
ubyte ctl0;
ubyte ctl1;
uint32_t freq = get_freq();
uint16_t brg;
uint8_t ctl0;
uint8_t ctl1;
/* Calculate and set the baud rate generation register.
* BRG = (freq + baud * 8)/(baud * 16)
@ -490,7 +493,7 @@ static int z8_rxinterrupt(int irq, FAR void *context)
{
struct uart_dev_s *dev = NULL;
struct z8_uart_s *priv;
ubyte status;
uint8_t status;
if (g_uart1priv.rxirq == irq)
{
@ -539,7 +542,7 @@ static int z8_txinterrupt(int irq, FAR void *context)
{
struct uart_dev_s *dev = NULL;
struct z8_uart_s *priv;
ubyte status;
uint8_t status;
if (g_uart1priv.txirq == irq)
{
@ -592,15 +595,15 @@ static int z8_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
*
****************************************************************************/
static int z8_receive(FAR struct uart_dev_s *dev, FAR uint32 *status)
static int z8_receive(FAR struct uart_dev_s *dev, FAR uint32_t *status)
{
struct z8_uart_s *priv = (struct z8_uart_s*)dev->priv;
ubyte rxd;
ubyte stat0;
uint8_t rxd;
uint8_t stat0;
rxd = z8_getuart(priv, Z8_UART_RXD);
stat0 = z8_getuart(priv, Z8_UART_STAT0);
*status = (uint32)rxd | (((uint32)stat0) << 8);
*status = (uint32_t)rxd | (((uint32_t)stat0) << 8);
return rxd;
}
@ -612,7 +615,7 @@ static int z8_receive(FAR struct uart_dev_s *dev, FAR uint32 *status)
*
****************************************************************************/
static void z8_rxint(FAR struct uart_dev_s *dev, boolean enable)
static void z8_rxint(FAR struct uart_dev_s *dev, bool enable)
{
struct z8_uart_s *priv = (struct z8_uart_s*)dev->priv;
irqstate_t flags = irqsave();
@ -636,11 +639,11 @@ static void z8_rxint(FAR struct uart_dev_s *dev, boolean enable)
* Name: z8_rxavailable
*
* Description:
* Return TRUE if the receive fifo is not empty
* Return true if the receive fifo is not empty
*
****************************************************************************/
static boolean z8_rxavailable(FAR struct uart_dev_s *dev)
static bool z8_rxavailable(FAR struct uart_dev_s *dev)
{
struct z8_uart_s *priv = (struct z8_uart_s*)dev->priv;
return ((z8_getuart(priv, Z8_UART_STAT0) & Z8_UARTSTAT0_RDA) != 0);
@ -668,7 +671,7 @@ static void z8_send(FAR struct uart_dev_s *dev, int ch)
*
****************************************************************************/
static void z8_txint(FAR struct uart_dev_s *dev, boolean enable)
static void z8_txint(FAR struct uart_dev_s *dev, bool enable)
{
struct z8_uart_s *priv = (struct z8_uart_s*)dev->priv;
irqstate_t flags = irqsave();
@ -692,11 +695,11 @@ static void z8_txint(FAR struct uart_dev_s *dev, boolean enable)
* Name: z8_txready
*
* Description:
* Return TRUE if the tranmsit fifo is not full
* Return true if the tranmsit fifo is not full
*
****************************************************************************/
static boolean z8_txready(FAR struct uart_dev_s *dev)
static bool z8_txready(FAR struct uart_dev_s *dev)
{
struct z8_uart_s *priv = (struct z8_uart_s*)dev->priv;
return ((z8_getuart(priv, Z8_UART_STAT0) & Z8_UARTSTAT0_TDRE) != 0);
@ -706,11 +709,11 @@ static boolean z8_txready(FAR struct uart_dev_s *dev)
* Name: z8_txempty
*
* Description:
* Return TRUE if the transmit fifo is empty
* Return true if the transmit fifo is empty
*
****************************************************************************/
static boolean z8_txempty(FAR struct uart_dev_s *dev)
static bool z8_txempty(FAR struct uart_dev_s *dev)
{
struct z8_uart_s *priv = (struct z8_uart_s*)dev->priv;
return ((z8_getuart(priv, Z8_UART_STAT0) & Z8_UARTSTAT0_TXE) != 0);
@ -736,7 +739,7 @@ void up_serialinit(void)
(void)z8_disableuartirq(&TTYS1_DEV);
/* Initialize the console for early use */
CONSOLE_DEV.isconsole = TRUE;
CONSOLE_DEV.isconsole = true;
z8_setup(&CONSOLE_DEV);
/* Reigster console and tty devices */
@ -757,7 +760,7 @@ void up_serialinit(void)
int up_putc(int ch)
{
ubyte state;
uint8_t state;
/* Keep interrupts disabled so that we do not interfere with normal
* driver operation
@ -776,7 +779,7 @@ int up_putc(int ch)
/* Output the character */
z8_consoleput((ubyte)ch);
z8_consoleput((uint8_t)ch);
/* It is important to restore the TX interrupt while the send is pending.
* otherwise, TRDE interrupts can be lost since they do not pend after the
@ -797,12 +800,12 @@ int up_putc(int ch)
# define z8_contrde() \
((getreg8(*(Z8_UART1_BASE+Z8_UART_STAT0)) & Z8_UARTSTAT0_TDRE) != 0)
# define z8_contxd(ch) \
putreg8((ubyte)(ch), *(Z8_UART1_BASE+Z8_UART_TXD))
putreg8((uint8_t)(ch), *(Z8_UART1_BASE+Z8_UART_TXD))
#else
# define z8_contrde() \
((getreg8(*(Z8_UART0_BASE+Z8_UART_STAT0)) & Z8_UARTSTAT0_TDRE) != 0)
# define z8_contxd(ch) \
putreg8((ubyte)(ch), *(Z8_UART0_BASE+Z8_UART_TXD))
putreg8((uint8_t)(ch), *(Z8_UART0_BASE+Z8_UART_TXD))
#endif
/****************************************************************************

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/z8/z8_sigdeliver.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,6 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <debug.h>

View File

@ -1,7 +1,7 @@
/***************************************************************************
* arch/z80/src/z8/z8_timerisr.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <debug.h>
#include <ez8.h>
@ -67,7 +67,7 @@
/* This function is normally prototyped int the ZiLOG header file sio.h */
extern uint32 get_freq(void);
extern uint32_t get_freq(void);
/***************************************************************************
* Function: up_timerisr
@ -78,7 +78,7 @@ extern uint32 get_freq(void);
*
***************************************************************************/
int up_timerisr(int irq, uint32 *regs)
int up_timerisr(int irq, uint32_t *regs)
{
/* Process timer interrupt */
@ -97,7 +97,7 @@ int up_timerisr(int irq, uint32 *regs)
void up_timerinit(void)
{
uint32 reload;
uint32_t reload;
up_disable_irq(Z8_IRQ_SYSTIMER);
@ -129,7 +129,7 @@ void up_timerinit(void)
*/
reload = get_freq() / 400;
putreg16((uint16)reload, T0R);
putreg16((uint16_t)reload, T0R);
/* Write to the timer control register to enable the timer and to
* initiate counting

View File

@ -2,7 +2,7 @@
* z80/chip.h
* chip/chip.h
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,6 +41,10 @@
* Included Files
************************************************************************************/
#ifndef __ASSEMBLY__
# include <stdint.h>
#endif
/************************************************************************************
* Definitions
************************************************************************************/
@ -58,12 +62,12 @@
#ifndef __ASSEMBLY__
# define getreg8(a) (*(volatile ubyte *)(a))
# define putreg8(v,a) (*(volatile ubyte *)(a) = (v))
# define getreg16(a) (*(volatile uint16 *)(a))
# define putreg16(v,a) (*(volatile uint16 *)(a) = (v))
# define getreg32(a) (*(volatile uint32 *)(a))
# define putreg32(v,a) (*(volatile uint32 *)(a) = (v))
# define getreg8(a) (*(volatile uint8_t *)(a))
# define putreg8(v,a) (*(volatile uint8_t *)(a) = (v))
# define getreg16(a) (*(volatile uint16_t *)(a))
# define putreg16(v,a) (*(volatile uint16_t *)(a) = (v))
# define getreg32(a) (*(volatile uint32_t *)(a))
# define putreg32(v,a) (*(volatile uint32_t *)(a) = (v))
#endif

View File

@ -41,9 +41,9 @@
* Included Files
************************************************************************************/
#include <sys/types.h>
#include <nuttx/sched.h>
#include <nuttx/arch.h>
#include "up_internal.h"
/************************************************************************************
@ -60,7 +60,7 @@
#define INIT_IRQCONTEXT() current_regs = NULL
/* IN_INTERRUPT returns TRUE if the system is currently operating in the interrupt
/* IN_INTERRUPT returns true if the system is currently operating in the interrupt
* context. IN_INTERRUPT is the inline equivalent of up_interrupt_context().
*/

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/z80/z80_copystate.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>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,6 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <arch/irq.h>
#include "chip/switch.h"

View File

@ -39,7 +39,6 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <string.h>
#include <nuttx/arch.h>

View File

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

View File

@ -38,9 +38,6 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h>

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/z80/z80_registerdump.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>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,6 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <debug.h>
#include <nuttx/irq.h>

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/z80/z80_schedulesigaction.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>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <sched.h>
#include <debug.h>
@ -123,7 +123,7 @@ static void z80_sigsetup(FAR _TCB *tcb, sig_deliver_t sigdeliver, FAR chipreg_t
void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
{
dbg("tcb=0x%p sigdeliver=0x%04x\n", tcb, (uint16)sigdeliver);
dbg("tcb=0x%p sigdeliver=0x%04x\n", tcb, (uint16_t)sigdeliver);
/* Refuse to handle nested signal actions */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/z80/z80_sigdeliver.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>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,6 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <debug.h>