diff options
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/arch/z16/include/z16f/irq.h | 8 | ||||
-rw-r--r-- | nuttx/arch/z16/src/common/up_allocateheap.c | 21 | ||||
-rw-r--r-- | nuttx/arch/z16/src/common/up_assert.c | 17 | ||||
-rw-r--r-- | nuttx/arch/z16/src/common/up_initialstate.c | 6 | ||||
-rw-r--r-- | nuttx/arch/z16/src/common/up_internal.h | 2 | ||||
-rw-r--r-- | nuttx/arch/z16/src/common/up_stackdump.c | 2 | ||||
-rw-r--r-- | nuttx/arch/z16/src/z16f/chip.h | 12 | ||||
-rw-r--r-- | nuttx/arch/z16/src/z16f/z16f_irq.c | 25 | ||||
-rw-r--r-- | nuttx/arch/z16/src/z16f/z16f_timerisr.c | 4 | ||||
-rw-r--r-- | nuttx/configs/z16f2800100zcog/src/Makefile | 4 | ||||
-rw-r--r-- | nuttx/configs/z16f2800100zcog/src/z16f_lowinit.c | 19 |
11 files changed, 70 insertions, 50 deletions
diff --git a/nuttx/arch/z16/include/z16f/irq.h b/nuttx/arch/z16/include/z16f/irq.h index 8aa6ff348..613710a52 100644 --- a/nuttx/arch/z16/include/z16f/irq.h +++ b/nuttx/arch/z16/include/z16f/irq.h @@ -188,6 +188,14 @@ extern "C" { #define EXTERN extern #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__ EXTERN irqstate_t irqsave(void); EXTERN void irqrestore(irqstate_t flags); diff --git a/nuttx/arch/z16/src/common/up_allocateheap.c b/nuttx/arch/z16/src/common/up_allocateheap.c index a73515ac2..de4256cbf 100644 --- a/nuttx/arch/z16/src/common/up_allocateheap.c +++ b/nuttx/arch/z16/src/common/up_allocateheap.c @@ -46,12 +46,25 @@ #include "chip/chip.h" #include "up_internal.h" -#include "up_mem.h" /**************************************************************************** * 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 ****************************************************************************/ @@ -76,8 +89,8 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) { - *heap_start = (FAR void*)UP_HEAP1_BASE; - *heap_size = UP_HEAP1_END - UP_HEAP1_BASE; + *heap_start = (FAR void*)CONFIG_HEAP1_BASE; + *heap_size = CONFIG_HEAP1_END - CONFIG_HEAP1_BASE; 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 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 diff --git a/nuttx/arch/z16/src/common/up_assert.c b/nuttx/arch/z16/src/common/up_assert.c index 4f6b900af..3a6d39ed8 100644 --- a/nuttx/arch/z16/src/common/up_assert.c +++ b/nuttx/arch/z16/src/common/up_assert.c @@ -50,7 +50,6 @@ #include "chip/chip.h" #include "os_internal.h" #include "up_internal.h" -#include "up_mem.h" /**************************************************************************** * Definitions @@ -108,7 +107,7 @@ static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */ * Name: up_assert ****************************************************************************/ -void up_assert(const ubyte *filename, int lineno) +void up_assert(void) { #if CONFIG_TASK_NAME_SIZE > 0 _TCB *rtcb = (_TCB*)g_readytorun.head; @@ -117,11 +116,9 @@ void up_assert(const ubyte *filename, int lineno) up_ledon(LED_ASSERTION); #if CONFIG_TASK_NAME_SIZE > 0 - lldbg("Assertion failed at file:%s line: %d task: %s\n", - filename, lineno, rtcb->name); + lldbg("Assertion failed in task: %s\n", rtcb->name); #else - lldbg("Assertion failed at file:%s line: %d\n", - filename, lineno); + lldbg("Assertion failed\n"); #endif up_stackdump(); @@ -133,7 +130,7 @@ void up_assert(const ubyte *filename, int lineno) * 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 _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); #if CONFIG_TASK_NAME_SIZE > 0 - lldbg("Assertion failed at file:%s line: %d task: %s error code: %d\n", - filename, lineno, rtcb->name, errorcode); + lldbg("Assertion failed in task: %s error code: %d\n", rtcb->name, errorcode); #else - lldbg("Assertion failed at file:%s line: %d error code: %d\n", - filename, lineno, errorcode); + lldbg("Assertion failed: %d error code: %d\n", errorcode); #endif up_stackdump(); diff --git a/nuttx/arch/z16/src/common/up_initialstate.c b/nuttx/arch/z16/src/common/up_initialstate.c index d4430f346..acb5c31f1 100644 --- a/nuttx/arch/z16/src/common/up_initialstate.c +++ b/nuttx/arch/z16/src/common/up_initialstate.c @@ -84,8 +84,8 @@ void up_initial_state(_TCB *tcb) memset(&tcb->xcp, 0, sizeof(struct xcptcontext)); #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 - reg32[REG_SP/2] = (uint32)tcb->adj_stack_ptr; - reg32[REG_PC/2] = (uint32)tcb->start; + reg32[REG_SP/2] = (uint32)tcb->adj_stack_ptr; + reg32[REG_PC/2] = (uint32)tcb->start; } diff --git a/nuttx/arch/z16/src/common/up_internal.h b/nuttx/arch/z16/src/common/up_internal.h index a218a5e35..c09226bf0 100644 --- a/nuttx/arch/z16/src/common/up_internal.h +++ b/nuttx/arch/z16/src/common/up_internal.h @@ -98,7 +98,7 @@ extern chipreg_t *current_regs; 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_fullcontextrestore(FAR chipreg_t *regs); +extern void up_restoreusercontext(FAR chipreg_t *regs); extern void up_irqinitialize(void); extern int up_saveusercontext(FAR chipreg_t *regs); extern void up_sigdeliver(void); diff --git a/nuttx/arch/z16/src/common/up_stackdump.c b/nuttx/arch/z16/src/common/up_stackdump.c index 515e3c30b..354f59a9d 100644 --- a/nuttx/arch/z16/src/common/up_stackdump.c +++ b/nuttx/arch/z16/src/common/up_stackdump.c @@ -70,7 +70,7 @@ /**************************************************************************** * Name: up_getsp ****************************************************************************/ -#warning TO BE PROVIDED +/* To be provided */ /**************************************************************************** * Name: up_stackdump diff --git a/nuttx/arch/z16/src/z16f/chip.h b/nuttx/arch/z16/src/z16f/chip.h index 095c09069..2bea4d075 100644 --- a/nuttx/arch/z16/src/z16f/chip.h +++ b/nuttx/arch/z16/src/z16f/chip.h @@ -438,12 +438,12 @@ /* Register access macros ***********************************************************/ #ifndef __ASSEMBLY__ -# define getreg8(a) (*(ubyte volatile near*)((a) & 0xffff)) -# define putreg8(v,a) (*(ubyte volatile near*)((a) & 0xffff) = (v)) -# define getreg16(a) (*(uint16 volatile near*)((a) & 0xffff)) -# define putreg16(v,a) (*(uint16 volatile near*)((a) & 0xffff) = (v)) -# define getreg32(a) (*(uint32 volatile near*)((a) & 0xffff)) -# define putreg32(v,a) (*(uint32 volatile near*)((a) & 0xffff) = (v)) +# define getreg8(a) (*(ubyte volatile _Near*)((a) & 0xffff)) +# define putreg8(v,a) (*(ubyte volatile _Near*)((a) & 0xffff) = (v)) +# define getreg16(a) (*(uint16 volatile _Near*)((a) & 0xffff)) +# define putreg16(v,a) (*(uint16 volatile _Near*)((a) & 0xffff) = (v)) +# define getreg32(a) (*(uint32 volatile _Near*)((a) & 0xffff)) +# define putreg32(v,a) (*(uint32 volatile _Near*)((a) & 0xffff) = (v)) #endif /* __ASSEMBLY__ */ /************************************************************************************ diff --git a/nuttx/arch/z16/src/z16f/z16f_irq.c b/nuttx/arch/z16/src/z16f/z16f_irq.c index f5335af15..485b482fa 100644 --- a/nuttx/arch/z16/src/z16f/z16f_irq.c +++ b/nuttx/arch/z16/src/z16f/z16f_irq.c @@ -41,6 +41,7 @@ #include <sys/types.h> #include <nuttx/irq.h> +#include <arch/irq.h> #include "chip/chip.h" #include "os_internal.h" @@ -113,15 +114,15 @@ void up_disable_irq(int irq) 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - putreg8((getreg8(Z16F_IRQ0_ENH) & ~Z16_IRQ0_BIT(irq)), Z16F_IRQ0_ENH); - putreg8(Z16_IRQ0_BIT(irq), Z16F_IRQ0); + putreg8((getreg8(Z16F_IRQ0_ENH) & ~Z16F_IRQ0_BIT(irq)), Z16F_IRQ0_ENH); + putreg8(Z16F_IRQ0_BIT(irq), Z16F_IRQ0); } else if (irq < Z16F_IRQ_IRQ2) { - putreg8((getreg8(Z16F_IRQ1_ENH) & ~Z16_IRQ1_BIT(irq)), Z16F_IRQ1_ENH); - putreg8(Z16_IRQ1_BIT(irq), Z16F_IRQ2); + putreg8((getreg8(Z16F_IRQ1_ENH) & ~Z16F_IRQ1_BIT(irq)), Z16F_IRQ1_ENH); + putreg8(Z16F_IRQ1_BIT(irq), Z16F_IRQ2); } else if (irq < NR_IRQS) { - putreg8((getreg8(Z16F_IRQ2_ENH) & ~Z16_IRQ2_BIT(irq)), Z16F_IRQ2_ENH); - putreg8(Z16_IRQ2_BIT(irq), Z16F_IRQ2); + putreg8((getreg8(Z16F_IRQ2_ENH) & ~Z16F_IRQ2_BIT(irq)), Z16F_IRQ2_ENH); + putreg8(Z16F_IRQ2_BIT(irq), Z16F_IRQ2); } } } diff --git a/nuttx/arch/z16/src/z16f/z16f_timerisr.c b/nuttx/arch/z16/src/z16f/z16f_timerisr.c index 78d1b51d2..37e834589 100644 --- a/nuttx/arch/z16/src/z16f/z16f_timerisr.c +++ b/nuttx/arch/z16/src/z16f/z16f_timerisr.c @@ -101,7 +101,7 @@ void up_timerinit(void) /* 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 */ @@ -123,7 +123,7 @@ void up_timerinit(void) /* 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 */ diff --git a/nuttx/configs/z16f2800100zcog/src/Makefile b/nuttx/configs/z16f2800100zcog/src/Makefile index fa8b5ac2e..300e47cc4 100644 --- a/nuttx/configs/z16f2800100zcog/src/Makefile +++ b/nuttx/configs/z16f2800100zcog/src/Makefile @@ -37,7 +37,7 @@ ARCHSRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src WARCHSRCDIR = ${shell cygpath -w $(ARCHSRCDIR)} -USRINCLUDES = -usrinc:'.;$(WTOPDIR)\sched;$(WARCHSRCDIR);$(WARCHSRCDIR)/common' +USRINCLUDES = -usrinc:'.;$(WTOPDIR)\sched;$(WARCHSRCDIR);$(WARCHSRCDIR)\common' INCLUDES = $(ARCHSTDINCLUDES) $(USRINCLUDES) CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCHDEFINES) @@ -79,6 +79,6 @@ clean: $(call CLEAN) distclean: clean - rm -f Make.dep .depend + @rm -f Make.dep .depend -include Make.dep diff --git a/nuttx/configs/z16f2800100zcog/src/z16f_lowinit.c b/nuttx/configs/z16f2800100zcog/src/z16f_lowinit.c index 71744134c..02ee9daf6 100644 --- a/nuttx/configs/z16f2800100zcog/src/z16f_lowinit.c +++ b/nuttx/configs/z16f2800100zcog/src/z16f_lowinit.c @@ -39,6 +39,9 @@ * Included Files
***************************************************************************/
+#include <nuttx/config.h>
+#include <sys/types.h>
+
#include "chip/chip.h"
/***************************************************************************
@@ -53,23 +56,23 @@ static void z16f_gpioinit(void) {
/* Configure LEDs and Run/Stop switch port */
- putreg(getreg(Z16F_GPIOA_DD) | 0x87, Z16F_GPIOA_DD);
- putreg(getreg(Z16F_GPIOA_OUT) | 0x07, Z16F_GPIOA_OUT);
- putreg(getreg(Z16F_GPIOA_DD) | 0xF8, Z16F_GPIOA_DD);
+ putreg8(getreg8(Z16F_GPIOA_DD) | 0x87, Z16F_GPIOA_DD);
+ putreg8(getreg8(Z16F_GPIOA_OUT) | 0x07, Z16F_GPIOA_OUT);
+ putreg8(getreg8(Z16F_GPIOA_DD) | 0xF8, Z16F_GPIOA_DD);
/* Configure rate switch port */
- putreg(getreg(Z16F_GPIOB_DD) | 0x20, Z16F_GPIOB_DD);
- putreg(getreg(Z16F_GPIOB_AFL) | 0x20, Z16F_GPIOB_AFL);
+ putreg8(getreg8(Z16F_GPIOB_DD) | 0x20, Z16F_GPIOB_DD);
+ putreg8(getreg8(Z16F_GPIOB_AFL) | 0x20, Z16F_GPIOB_AFL);
#if 0 /* Not yet */
- ADC0MAX = 0x05;
- ADC0CTL = 0xF5;
+ putreg8(0x05, Z16F_ADC0_MAX);
+ putreg8(0xf5, Z16F_ADC0_CTL);
#endif
/* Configure Direction switch port */
- putreg(getreg() | 0x01, Z16F_GPIOC_DD);
+ putreg8(getreg8(Z16F_GPIOC_DD) | 0x01, Z16F_GPIOC_DD);
}
/***************************************************************************
|