Fixes for clean(er) compilation

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@558 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-01-23 15:48:26 +00:00
parent 939b9b4bd1
commit d1142ca09c
9 changed files with 57 additions and 40 deletions

View File

@ -188,6 +188,14 @@ extern "C" {
#define EXTERN extern #define EXTERN extern
#endif #endif
/* ZDS-II intrinsic functions (normally declared in zneo.h) */
EXTERN intrinsic void EI(void);
EXTERN intrinsic void DI(void);
EXTERN intrinsic void RI(unsigned short);
EXTERN intrinsic SET_VECTOR(int,void (* func) (void));
EXTERN intrinsic unsigned short TDI(void);
#ifndef __ZILOG__ #ifndef __ZILOG__
EXTERN irqstate_t irqsave(void); EXTERN irqstate_t irqsave(void);
EXTERN void irqrestore(irqstate_t flags); EXTERN void irqrestore(irqstate_t flags);

View File

@ -46,12 +46,25 @@
#include "chip/chip.h" #include "chip/chip.h"
#include "up_internal.h" #include "up_internal.h"
#include "up_mem.h"
/**************************************************************************** /****************************************************************************
* Private Definitions * Private Definitions
****************************************************************************/ ****************************************************************************/
/* Use ZDS-II linker settings to get the unused external RAM and use this
* for the NuttX heap.
*/
#ifndef CONFIG_HEAP1_BASE
extern _Far unsigned long far_heaptop;
#define CONFIG_HEAP1_BASE ((unsigned long)&far_heaptop)
#endif
#ifndef CONFIG_HEAP1_END
extern _Far unsigned long far_heapbot;
#define CONFIG_HEAP1_END ((unsigned long)&far_heapbot)
#endif
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
@ -76,8 +89,8 @@
void up_allocate_heap(FAR void **heap_start, size_t *heap_size) void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
{ {
*heap_start = (FAR void*)UP_HEAP1_BASE; *heap_start = (FAR void*)CONFIG_HEAP1_BASE;
*heap_size = UP_HEAP1_END - UP_HEAP1_BASE; *heap_size = CONFIG_HEAP1_END - CONFIG_HEAP1_BASE;
up_ledon(LED_HEAPALLOCATE); up_ledon(LED_HEAPALLOCATE);
} }
@ -93,6 +106,6 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
#if CONFIG_MM_REGIONS > 1 #if CONFIG_MM_REGIONS > 1
void up_addregion(void) void up_addregion(void)
{ {
mm_addregion((FAR void*)UP_HEAP2_BASE, UP_HEAP2_END - UP_HEAP2_BASE); mm_addregion((FAR void*)CONFIG_HEAP2_BASE, CONFIG_HEAP2_END - CONFIG_HEAP2_BASE);
} }
#endif #endif

View File

@ -50,7 +50,6 @@
#include "chip/chip.h" #include "chip/chip.h"
#include "os_internal.h" #include "os_internal.h"
#include "up_internal.h" #include "up_internal.h"
#include "up_mem.h"
/**************************************************************************** /****************************************************************************
* Definitions * Definitions
@ -108,7 +107,7 @@ static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */
* Name: up_assert * Name: up_assert
****************************************************************************/ ****************************************************************************/
void up_assert(const ubyte *filename, int lineno) void up_assert(void)
{ {
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_TCB *rtcb = (_TCB*)g_readytorun.head; _TCB *rtcb = (_TCB*)g_readytorun.head;
@ -117,11 +116,9 @@ void up_assert(const ubyte *filename, int lineno)
up_ledon(LED_ASSERTION); up_ledon(LED_ASSERTION);
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
lldbg("Assertion failed at file:%s line: %d task: %s\n", lldbg("Assertion failed in task: %s\n", rtcb->name);
filename, lineno, rtcb->name);
#else #else
lldbg("Assertion failed at file:%s line: %d\n", lldbg("Assertion failed\n");
filename, lineno);
#endif #endif
up_stackdump(); up_stackdump();
@ -133,7 +130,7 @@ void up_assert(const ubyte *filename, int lineno)
* Name: up_assert_code * Name: up_assert_code
****************************************************************************/ ****************************************************************************/
void up_assert_code(const ubyte *filename, int lineno, int errorcode) void up_assert_code(int errorcode)
{ {
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
_TCB *rtcb = (_TCB*)g_readytorun.head; _TCB *rtcb = (_TCB*)g_readytorun.head;
@ -142,11 +139,9 @@ void up_assert_code(const ubyte *filename, int lineno, int errorcode)
up_ledon(LED_ASSERTION); up_ledon(LED_ASSERTION);
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
lldbg("Assertion failed at file:%s line: %d task: %s error code: %d\n", lldbg("Assertion failed in task: %s error code: %d\n", rtcb->name, errorcode);
filename, lineno, rtcb->name, errorcode);
#else #else
lldbg("Assertion failed at file:%s line: %d error code: %d\n", lldbg("Assertion failed: %d error code: %d\n", errorcode);
filename, lineno, errorcode);
#endif #endif
up_stackdump(); up_stackdump();

View File

@ -84,8 +84,8 @@ void up_initial_state(_TCB *tcb)
memset(&tcb->xcp, 0, sizeof(struct xcptcontext)); memset(&tcb->xcp, 0, sizeof(struct xcptcontext));
#ifndef CONFIG_SUPPRESS_INTERRUPTS #ifndef CONFIG_SUPPRESS_INTERRUPTS
xcp->regs[REG_FLAGS] = Z16F_CNTRL_FLAGS_IRQE << 8; /* IRQE flag will enable interrupts */ tcb->xcp.regs[REG_FLAGS] = (uint16)(Z16F_CNTRL_FLAGS_IRQE << 8); /* IRQE flag will enable interrupts */
#endif #endif
reg32[REG_SP/2] = (uint32)tcb->adj_stack_ptr; reg32[REG_SP/2] = (uint32)tcb->adj_stack_ptr;
reg32[REG_PC/2] = (uint32)tcb->start; reg32[REG_PC/2] = (uint32)tcb->start;
} }

View File

@ -98,7 +98,7 @@ extern chipreg_t *current_regs;
extern void up_copystate(FAR chipreg_t *dest, FAR chipreg_t *src); extern void up_copystate(FAR chipreg_t *dest, FAR chipreg_t *src);
extern void up_doirq(int irq, FAR chipreg_t *regs); extern void up_doirq(int irq, FAR chipreg_t *regs);
extern void up_fullcontextrestore(FAR chipreg_t *regs); extern void up_restoreusercontext(FAR chipreg_t *regs);
extern void up_irqinitialize(void); extern void up_irqinitialize(void);
extern int up_saveusercontext(FAR chipreg_t *regs); extern int up_saveusercontext(FAR chipreg_t *regs);
extern void up_sigdeliver(void); extern void up_sigdeliver(void);

View File

@ -70,7 +70,7 @@
/**************************************************************************** /****************************************************************************
* Name: up_getsp * Name: up_getsp
****************************************************************************/ ****************************************************************************/
#warning TO BE PROVIDED /* To be provided */
/**************************************************************************** /****************************************************************************
* Name: up_stackdump * Name: up_stackdump

View File

@ -438,12 +438,12 @@
/* Register access macros ***********************************************************/ /* Register access macros ***********************************************************/
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
# define getreg8(a) (*(ubyte volatile near*)((a) & 0xffff)) # define getreg8(a) (*(ubyte volatile _Near*)((a) & 0xffff))
# define putreg8(v,a) (*(ubyte volatile near*)((a) & 0xffff) = (v)) # define putreg8(v,a) (*(ubyte volatile _Near*)((a) & 0xffff) = (v))
# define getreg16(a) (*(uint16 volatile near*)((a) & 0xffff)) # define getreg16(a) (*(uint16 volatile _Near*)((a) & 0xffff))
# define putreg16(v,a) (*(uint16 volatile near*)((a) & 0xffff) = (v)) # define putreg16(v,a) (*(uint16 volatile _Near*)((a) & 0xffff) = (v))
# define getreg32(a) (*(uint32 volatile near*)((a) & 0xffff)) # define getreg32(a) (*(uint32 volatile _Near*)((a) & 0xffff))
# define putreg32(v,a) (*(uint32 volatile near*)((a) & 0xffff) = (v)) # define putreg32(v,a) (*(uint32 volatile _Near*)((a) & 0xffff) = (v))
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
/************************************************************************************ /************************************************************************************

View File

@ -41,6 +41,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h>
#include "chip/chip.h" #include "chip/chip.h"
#include "os_internal.h" #include "os_internal.h"
@ -113,15 +114,15 @@ void up_disable_irq(int irq)
if (irq < Z16F_IRQ_IRQ1) if (irq < Z16F_IRQ_IRQ1)
{ {
putreg8((getreg8(Z16F_IRQ0_ENH) & ~Z16_IRQ0_BIT(irq)), Z16F_IRQ0_ENH); putreg8((getreg8(Z16F_IRQ0_ENH) & ~Z16F_IRQ0_BIT(irq)), Z16F_IRQ0_ENH);
} }
else if (irq < Z16F_IRQ_IRQ2) else if (irq < Z16F_IRQ_IRQ2)
{ {
putreg8((getreg8(Z16F_IRQ1_ENH) & ~Z16_IRQ1_BIT(irq)), Z16F_IRQ1_ENH); putreg8((getreg8(Z16F_IRQ1_ENH) & ~Z16F_IRQ1_BIT(irq)), Z16F_IRQ1_ENH);
} }
else if (irq < NR_IRQS) else if (irq < NR_IRQS)
{ {
putreg8((getreg8(Z16F_IRQ2_ENH) & ~Z16_IRQ2_BIT(irq)), Z16F_IRQ2_ENH); putreg8((getreg8(Z16F_IRQ2_ENH) & ~Z16F_IRQ2_BIT(irq)), Z16F_IRQ2_ENH);
} }
} }
} }
@ -146,15 +147,15 @@ void up_enable_irq(int irq)
if (irq < Z16F_IRQ_IRQ1) if (irq < Z16F_IRQ_IRQ1)
{ {
putreg8((getreg8(Z16F_IRQ0_ENH) | Z16_IRQ0_BIT(irq)), Z16F_IRQ0_ENH); putreg8((getreg8(Z16F_IRQ0_ENH) | Z16F_IRQ0_BIT(irq)), Z16F_IRQ0_ENH);
} }
else if (irq < Z16F_IRQ_IRQ2) else if (irq < Z16F_IRQ_IRQ2)
{ {
putreg8((getreg8(Z16F_IRQ1_ENH) | Z16_IRQ1_BIT(irq)), Z16F_IRQ1_ENH); putreg8((getreg8(Z16F_IRQ1_ENH) | Z16F_IRQ1_BIT(irq)), Z16F_IRQ1_ENH);
} }
else if (irq < NR_IRQS) else if (irq < NR_IRQS)
{ {
putreg8((getreg8(Z16F_IRQ2_ENH) | Z16_IRQ2_BIT(irq)), Z16F_IRQ2_ENH); putreg8((getreg8(Z16F_IRQ2_ENH) | Z16F_IRQ2_BIT(irq)), Z16F_IRQ2_ENH);
} }
} }
} }
@ -180,18 +181,18 @@ void up_maskack_irq(int irq)
if (irq < Z16F_IRQ_IRQ1) if (irq < Z16F_IRQ_IRQ1)
{ {
putreg8((getreg8(Z16F_IRQ0_ENH) & ~Z16_IRQ0_BIT(irq)), Z16F_IRQ0_ENH); putreg8((getreg8(Z16F_IRQ0_ENH) & ~Z16F_IRQ0_BIT(irq)), Z16F_IRQ0_ENH);
putreg8(Z16_IRQ0_BIT(irq), Z16F_IRQ0); putreg8(Z16F_IRQ0_BIT(irq), Z16F_IRQ0);
} }
else if (irq < Z16F_IRQ_IRQ2) else if (irq < Z16F_IRQ_IRQ2)
{ {
putreg8((getreg8(Z16F_IRQ1_ENH) & ~Z16_IRQ1_BIT(irq)), Z16F_IRQ1_ENH); putreg8((getreg8(Z16F_IRQ1_ENH) & ~Z16F_IRQ1_BIT(irq)), Z16F_IRQ1_ENH);
putreg8(Z16_IRQ1_BIT(irq), Z16F_IRQ2); putreg8(Z16F_IRQ1_BIT(irq), Z16F_IRQ2);
} }
else if (irq < NR_IRQS) else if (irq < NR_IRQS)
{ {
putreg8((getreg8(Z16F_IRQ2_ENH) & ~Z16_IRQ2_BIT(irq)), Z16F_IRQ2_ENH); putreg8((getreg8(Z16F_IRQ2_ENH) & ~Z16F_IRQ2_BIT(irq)), Z16F_IRQ2_ENH);
putreg8(Z16_IRQ2_BIT(irq), Z16F_IRQ2); putreg8(Z16F_IRQ2_BIT(irq), Z16F_IRQ2);
} }
} }
} }

View File

@ -101,7 +101,7 @@ void up_timerinit(void)
/* Disable the timer and configure for divide by 1 and continuous mode. */ /* Disable the timer and configure for divide by 1 and continuous mode. */
putreg16( Z16F_TIMERSCTL1_DIV1 | Z16F_TIMERSCTL1_CONT); putreg8( Z16F_TIMERSCTL1_DIV1 | Z16F_TIMERSCTL1_CONT, Z16F_TIMER0_CTL1);
/* Assign an intial timer value */ /* Assign an intial timer value */
@ -123,7 +123,7 @@ void up_timerinit(void)
/* Enable the timer */ /* Enable the timer */
putreg8((getret8(Z16F_TIMER0_CTL1) |= Z16F_TIMERCTL1_TEN), Z16F_TIMER0_CTL1); putreg8((getreg8(Z16F_TIMER0_CTL1) | Z16F_TIMERCTL1_TEN), Z16F_TIMER0_CTL1);
/* Set the timer priority */ /* Set the timer priority */