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@2355 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-12-16 14:38:33 +00:00
parent 8561ce102a
commit d8f7773edd
26 changed files with 161 additions and 152 deletions

View file

@ -45,6 +45,10 @@
* Included Files
****************************************************************************/
#ifndef __ASSEMBLY__
# include <stdint.h>
#endif
/****************************************************************************
* Definitions
****************************************************************************/
@ -165,7 +169,7 @@
/* This is the type of the register save array */
typedef uint16 chipreg_t;
typedef uint16_t chipreg_t;
/* This struct defines the way the registers are stored. */
@ -173,7 +177,7 @@ struct xcptcontext
{
/* Register save area */
uint16 regs[XCPTCONTEXT_REGS];
uint16_t regs[XCPTCONTEXT_REGS];
/* The following function pointer is non-zero if there
* are pending signals to be processed.
@ -184,8 +188,8 @@ struct xcptcontext
/* The following retains that state during signal execution */
uint32 saved_pc; /* Saved return address */
uint16 saved_i; /* Saved interrupt state */
uint32_t saved_pc; /* Saved return address */
uint16_t saved_i; /* Saved interrupt state */
#endif
};
#endif

View file

@ -1,7 +1,7 @@
/****************************************************************************
* common/up_assert.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 <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 @@
/****************************************************************************
* common/up_blocktask.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 <stdbool.h>
#include <sched.h>
#include <debug.h>
@ -96,7 +96,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

@ -1,7 +1,7 @@
/****************************************************************************
* common/up_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 "os_internal.h"

View file

@ -40,6 +40,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <sched.h>
#include <debug.h>
@ -94,7 +95,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)
@ -109,7 +110,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
@ -117,11 +118,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 @@
/****************************************************************************
* common/up_doirq.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 <assert.h>
#include <nuttx/irq.h>

View file

@ -1,7 +1,7 @@
/****************************************************************************
* common/up_exit.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 @@
/****************************************************************************
* common/up_idle.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 <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 @@
/****************************************************************************
* common/up_initialize.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/arch.h>

View file

@ -1,7 +1,7 @@
/****************************************************************************
* common/up_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>
@ -78,14 +78,14 @@
void up_initial_state(_TCB *tcb)
{
uint32 *reg32 = (uint32*)tcb->xcp.regs;
uint32 *reg32 = (uint32_t*)tcb->xcp.regs;
/* Initialize the initial exception register context structure */
memset(&tcb->xcp, 0, sizeof(struct xcptcontext));
#ifndef CONFIG_SUPPRESS_INTERRUPTS
tcb->xcp.regs[REG_FLAGS] = (uint16)Z16F_CNTRL_FLAGS_IRQE; /* IRQE flag will enable interrupts */
tcb->xcp.regs[REG_FLAGS] = (uint16_t))Z16F_CNTRL_FLAGS_IRQE; /* IRQE flag will enable interrupts */
#endif
reg32[REG_SP/2] = (uint32)tcb->adj_stack_ptr;
reg32[REG_PC/2] = (uint32)tcb->start;
reg32[REG_SP/2] = (uint32_t)tcb->adj_stack_ptr;
reg32[REG_PC/2] = (uint32_t)tcb->start;
}

View file

@ -1,7 +1,7 @@
/****************************************************************************
* common/up_interruptcontext.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,12 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h>
#include "up_internal.h"
/****************************************************************************
@ -58,11 +61,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 current_regs != NULL;
}

View file

@ -1,7 +1,7 @@
/****************************************************************************
* common/up_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>
@ -76,7 +76,7 @@
#ifdef CONFIG_ARCH_STACKDUMP
static void up_registerdump(void)
{
FAR uint32 *regs32 = (FAR uint32*)current_regs;
FAR uint32 *regs32 = (FAR uint32_t*)current_regs;
lldbg("R0 :%08x R1 :%08x R2 :%08x R3 :%08x "
"R4 :%08x R5 :%08x R6 :%08x R7 :%08x\n"
regs32[REG_R0/2], regs32[REG_R1/2], regs32[REG_R2/2], regs32[REG_R3/2],

View file

@ -1,7 +1,7 @@
/****************************************************************************
* common/up_releasepending.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 @@
/************************************************************
* common/up_releasestack.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,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>
@ -85,7 +86,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 */
@ -99,12 +100,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.
*/
@ -112,10 +113,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_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>
@ -104,7 +104,7 @@ void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
{
/* Refuse to handle nested signal actions */
dbg("tcb=0x%p sigdeliver=0x%06x\n", tcb, (uint32)sigdeliver);
dbg("tcb=0x%p sigdeliver=0x%06x\n", tcb, (uint32_t)sigdeliver);
if (!tcb->xcp.sigdeliver)
{
@ -141,7 +141,7 @@ void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
else
{
FAR uint32 *current_pc = (FAR uint32*)&current_regs[REG_PC];
FAR uint32 *current_pc = (FAR uint32_t*)&current_regs[REG_PC];
/* Save the return address and interrupt state. These will be
* restored by the signal trampoline after the signals have
@ -156,7 +156,7 @@ void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
* disabled
*/
*current_pc = (uint32)up_sigdeliver;
*current_pc = (uint32_t)up_sigdeliver;
current_regs[REG_FLAGS] = 0;
/* And make sure that the saved context in the TCB is the
@ -174,7 +174,7 @@ void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
else
{
FAR uint32 *saved_pc = (FAR uint32*)&tcb->xcp.regs[REG_PC];
FAR uint32 *saved_pc = (FAR uint32_t*)&tcb->xcp.regs[REG_PC];
/* Save the return lr and cpsr and one scratch register
* These will be restored by the signal trampoline after
@ -189,7 +189,7 @@ void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
* disabled
*/
*saved_pc = (uint32)up_sigdeliver;
*saved_pc = (uint32_t)up_sigdeliver;
tcb->xcp.regs[REG_FLAGS] = 0;
}

View file

@ -1,7 +1,7 @@
/****************************************************************************
* common/up_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,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <sched.h>
#include <debug.h>
@ -83,7 +83,7 @@ void up_sigdeliver(void)
#ifndef CONFIG_DISABLE_SIGNALS
FAR _TCB *rtcb = (_TCB*)g_readytorun.head;
chipreg_t regs[XCPTCONTEXT_REGS];
FAR uint32 *regs32 = (FAR uint32*)regs;
FAR uint32 *regs32 = (FAR uint32_t*)regs;
sig_deliver_t sigdeliver;
/* Save the errno. This must be preserved throughout the signal handling

View file

@ -1,7 +1,7 @@
/****************************************************************************
* common/up_stackdump.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 "chip/chip.h"

View file

@ -1,7 +1,7 @@
/****************************************************************************
* common/up_unblocktask.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,11 +38,15 @@
************************************************************/
#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 +103,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 +111,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/z16/src/z16f/chip.h
* include/arch/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,9 @@
* Included Files
************************************************************************************/
#ifdef __ASSEMBLY__
# include <stdint.h>
#endif
#include <nuttx/config.h>
#include <arch/irq.h>
#include "common/up_internal.h"
@ -518,12 +521,12 @@
/* Register access macros ***********************************************************/
#ifndef __ASSEMBLY__
# define getreg8(a) (*(ubyte volatile _Near*)(a))
# define putreg8(v,a) (*(ubyte volatile _Near*)(a) = (v))
# define getreg16(a) (*(uint16 volatile _Near*)(a))
# define putreg16(v,a) (*(uint16 volatile _Near*)(a) = (v))
# define getreg32(a) (*(uint32 volatile _Near*)(a))
# define putreg32(v,a) (*(uint32 volatile _Near*)(a) = (v))
# define getreg8(a) (*(uint8_t volatile _Near*)(a))
# define putreg8(v,a) (*(uint8_t volatile _Near*)(a) = (v))
# define getreg16(a) (*(uint16_t volatile _Near*)(a))
# define putreg16(v,a) (*(uint16_t volatile _Near*)(a) = (v))
# define getreg32(a) (*(uint32_t volatile _Near*)(a))
# define putreg32(v,a) (*(uint32_t volatile _Near*)(a) = (v))
#endif /* __ASSEMBLY__ */
/************************************************************************************

View file

@ -1,7 +1,7 @@
/***************************************************************************
* z16f/z16f_clkinit.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>
*
* Based upon sample code included with the Zilog ZDS-II toolchain.
@ -39,7 +39,6 @@
* Included Files
***************************************************************************/
#include <sys/types.h>
#include "chip/chip.h"
/***************************************************************************

View file

@ -1,7 +1,7 @@
/****************************************************************************
* z16f/z16f_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,8 +39,6 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/irq.h>
#include <arch/irq.h>

View file

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z16/src/z16f/z16f_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>
@ -76,36 +78,36 @@ extern _Erom unsigned long SYS_CLK_FREQ;
struct z16f_uart_s
{
uint32 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 */
uint32_t 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 z16f_setup(struct uart_dev_s *dev);
static void z16f_shutdown(struct uart_dev_s *dev);
static int z16f_attach(struct uart_dev_s *dev);
static void z16f_detach(struct uart_dev_s *dev);
static int z16f_rxinterrupt(int irq, void *context);
static int z16f_txinterrupt(int irq, void *context);
static int z16f_ioctl(struct file *filep, int cmd, unsigned long arg);
static int z16f_receive(struct uart_dev_s *dev, uint32 *status);
static void z16f_rxint(struct uart_dev_s *dev, boolean enable);
static boolean z16f_rxavailable(struct uart_dev_s *dev);
static void z16f_send(struct uart_dev_s *dev, int ch);
static void z16f_txint(struct uart_dev_s *dev, boolean enable);
static boolean z16f_txready(struct uart_dev_s *dev);
static boolean z16f_txempty(struct uart_dev_s *dev);
static int z16f_setup(struct uart_dev_s *dev);
static void z16f_shutdown(struct uart_dev_s *dev);
static int z16f_attach(struct uart_dev_s *dev);
static void z16f_detach(struct uart_dev_s *dev);
static int z16f_rxinterrupt(int irq, void *context);
static int z16f_txinterrupt(int irq, void *context);
static int z16f_ioctl(struct file *filep, int cmd, unsigned long arg);
static int z16f_receive(struct uart_dev_s *dev, uint32_t *status);
static void z16f_rxint(struct uart_dev_s *dev, bool enable);
static bool z16f_rxavailable(struct uart_dev_s *dev);
static void z16f_send(struct uart_dev_s *dev, int ch);
static void z16f_txint(struct uart_dev_s *dev, bool enable);
static bool z16f_txready(struct uart_dev_s *dev);
static bool z16f_txempty(struct uart_dev_s *dev);
/****************************************************************************
* Private Variables
@ -140,8 +142,8 @@ static struct z16f_uart_s g_uart0priv =
{
Z16F_UART0_BASE, /* uartbase */
CONFIG_UART0_BAUD, /* baud */
FALSE, /* rxenabled */
FALSE, /* txenabled */
false, /* rxenabled */
false, /* txenabled */
Z16F_IRQ_UART0RX, /* rxirq */
Z16F_IRQ_UART0TX, /* txirq */
CONFIG_UART0_PARITY, /* parity */
@ -151,12 +153,12 @@ static struct z16f_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 */
@ -185,8 +187,8 @@ static struct z16f_uart_s g_uart1priv =
{
Z16F_UART1_BASE, /* uartbase */
CONFIG_UART1_BAUD, /* baud */
FALSE, /* rxenabled */
FALSE, /* txenabled */
false, /* rxenabled */
false, /* txenabled */
Z16F_IRQ_UART1RX, /* rxirq */
Z16F_IRQ_UART1TX, /* txirq */
CONFIG_UART1_PARITY, /* parity */
@ -196,12 +198,12 @@ static struct z16f_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 */
@ -244,15 +246,15 @@ static uart_dev_t g_uart1port =
* Name: z16f_disableuartirq
****************************************************************************/
static ubyte z16f_disableuartirq(struct uart_dev_s *dev)
static uint8_t z16f_disableuartirq(struct uart_dev_s *dev)
{
struct z16f_uart_s *priv = (struct z16f_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;
z16f_txint(dev, FALSE);
z16f_rxint(dev, FALSE);
z16f_txint(dev, false);
z16f_rxint(dev, false);
irqrestore(flags);
return state;
@ -262,13 +264,13 @@ static ubyte z16f_disableuartirq(struct uart_dev_s *dev)
* Name: z16f_restoreuartirq
****************************************************************************/
static void z16f_restoreuartirq(struct uart_dev_s *dev, ubyte state)
static void z16f_restoreuartirq(struct uart_dev_s *dev, uint8_t state)
{
struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
irqstate_t flags = irqsave();
z16f_txint(dev, (state & STATE_TXENABLED) ? TRUE : FALSE);
z16f_rxint(dev, (state & STATE_RXENABLED) ? TRUE : FALSE);
z16f_txint(dev, (state & STATE_TXENABLED) ? true : false);
z16f_rxint(dev, (state & STATE_RXENABLED) ? true : false);
irqrestore(flags);
}
@ -277,7 +279,7 @@ static void z16f_restoreuartirq(struct uart_dev_s *dev, ubyte state)
* Name: z16f_consoleput
****************************************************************************/
static void z16f_consoleput(ubyte ch)
static void z16f_consoleput(uint8_t ch)
{
struct z16f_uart_s *priv = (struct z16f_uart_s*)CONSOLE_DEV.priv;
int tmp;
@ -305,16 +307,16 @@ static int z16f_setup(struct uart_dev_s *dev)
{
#ifndef CONFIG_SUPPRESS_UART_CONFIG
struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
uint32 brg;
ubyte ctl0;
ubyte ctl1;
uint32_t brg;
uint8_t ctl0;
uint8_t ctl1;
/* Calculate and set the baud rate generation register.
* BRG = (freq + baud * 8)/(baud * 16)
*/
brg = (_DEFCLK + (priv->baud << 3))/(priv->baud << 4);
putreg16((uint16)brg, priv->uartbase + Z16F_UART_BR);
putreg16((uint16_t))brg, priv->uartbase + Z16F_UART_BR);
/* Configure STOP bits */
@ -429,7 +431,7 @@ static int z16f_rxinterrupt(int irq, void *context)
{
struct uart_dev_s *dev = NULL;
struct z16f_uart_s *priv;
ubyte status;
uint8_t status;
if (g_uart1priv.rxirq == irq)
{
@ -478,7 +480,7 @@ static int z16f_txinterrupt(int irq, void *context)
{
struct uart_dev_s *dev = NULL;
struct z16f_uart_s *priv;
ubyte status;
uint8_t status;
if (g_uart1priv.txirq == irq)
{
@ -531,15 +533,15 @@ static int z16f_ioctl(struct file *filep, int cmd, unsigned long arg)
*
****************************************************************************/
static int z16f_receive(struct uart_dev_s *dev, uint32 *status)
static int z16f_receive(struct uart_dev_s *dev, uint32_t *status)
{
struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
ubyte rxd;
ubyte stat0;
uint8_t rxd;
uint8_t stat0;
rxd = getreg8(priv->uartbase + Z16F_UART_RXD);
stat0 = getreg8(priv->uartbase + Z16F_UART_STAT0);
*status = (uint32)rxd | (((uint32)stat0) << 8);
*status = (uint32_t)rxd | (((uint32_t)stat0) << 8);
return rxd;
}
@ -551,7 +553,7 @@ static int z16f_receive(struct uart_dev_s *dev, uint32 *status)
*
****************************************************************************/
static void z16f_rxint(struct uart_dev_s *dev, boolean enable)
static void z16f_rxint(struct uart_dev_s *dev, bool enable)
{
struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
irqstate_t flags = irqsave();
@ -575,11 +577,11 @@ static void z16f_rxint(struct uart_dev_s *dev, boolean enable)
* Name: z16f_rxavailable
*
* Description:
* Return TRUE if the receive fifo is not empty
* Return true if the receive fifo is not empty
*
****************************************************************************/
static boolean z16f_rxavailable(struct uart_dev_s *dev)
static bool z16f_rxavailable(struct uart_dev_s *dev)
{
struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
return ((getreg8(priv->uartbase + Z16F_UART_STAT0) & Z16F_UARTSTAT0_RDA) != 0);
@ -607,7 +609,7 @@ static void z16f_send(struct uart_dev_s *dev, int ch)
*
****************************************************************************/
static void z16f_txint(struct uart_dev_s *dev, boolean enable)
static void z16f_txint(struct uart_dev_s *dev, bool enable)
{
struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
irqstate_t flags = irqsave();
@ -631,11 +633,11 @@ static void z16f_txint(struct uart_dev_s *dev, boolean enable)
* Name: z16f_txready
*
* Description:
* Return TRUE if the tranmsit fifo is not full
* Return true if the tranmsit fifo is not full
*
****************************************************************************/
static boolean z16f_txready(struct uart_dev_s *dev)
static bool z16f_txready(struct uart_dev_s *dev)
{
struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
return ((getreg8(priv->uartbase + Z16F_UART_STAT0) & Z16F_UARTSTAT0_TDRE) != 0);
@ -645,11 +647,11 @@ static boolean z16f_txready(struct uart_dev_s *dev)
* Name: z16f_txempty
*
* Description:
* Return TRUE if the transmit fifo is empty
* Return true if the transmit fifo is empty
*
****************************************************************************/
static boolean z16f_txempty(struct uart_dev_s *dev)
static bool z16f_txempty(struct uart_dev_s *dev)
{
struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv;
return ((getreg8(priv->uartbase + Z16F_UART_STAT0) & Z16F_UARTSTAT0_TXE) != 0);
@ -674,7 +676,7 @@ void up_earlyserialinit(void)
(void)z16f_disableuartirq(&TTYS0_DEV);
(void)z16f_disableuartirq(&TTYS1_DEV);
CONSOLE_DEV.isconsole = TRUE;
CONSOLE_DEV.isconsole = true;
z16f_setup(&CONSOLE_DEV);
}
@ -705,7 +707,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
@ -724,7 +726,7 @@ int up_putc(int ch)
/* Output the character */
z16f_consoleput((ubyte)ch);
z16f_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
@ -745,12 +747,12 @@ int up_putc(int ch)
# define z16f_contrde() \
((getreg8(Z16F_UART1_STAT0) & Z16F_UARTSTAT0_TDRE) != 0)
# define z16f_contxd(ch) \
putreg8((ubyte)(ch), Z16F_UART1_TXD)
putreg8((uint8_t)(ch), Z16F_UART1_TXD)
#else
# define z16f_contrde() \
((getreg8(Z16F_UART0_STAT0) & Z16F_UARTSTAT0_TDRE) != 0)
# define z16f_contxd(ch) \
putreg8((ubyte)(ch), Z16F_UART0_TXD)
putreg8((uint8_t)(ch), Z16F_UART0_TXD)
#endif
/****************************************************************************

View file

@ -1,7 +1,7 @@
/***************************************************************************
* z16f/z16f_sysexec.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/arch.h>
@ -81,7 +81,7 @@
void z16f_sysexec(FAR chipreg_t *regs)
{
int errcode = OSERR_ERREXCEPTION;
uint16 excp;
uint16_t excp;
/* Save that register reference so that it can be used for built-in
* diagnostics.

View file

@ -1,7 +1,7 @@
/***************************************************************************
* z16f/z16f_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 <nuttx/arch.h>
@ -78,7 +78,7 @@ extern _Erom unsigned long SYS_CLK_FREQ;
*
***************************************************************************/
int up_timerisr(int irq, uint32 *regs)
int up_timerisr(int irq, uint32_t *regs)
{
/* Process timer interrupt */
@ -119,7 +119,7 @@ void up_timerinit(void)
* this yields 200.
*/
putreg16(((uint32)_DEFCLK / 100000), Z16F_TIMER0_R);
putreg16(((uint32_t)_DEFCLK / 100000), Z16F_TIMER0_R);
/* Enable the timer */