diff --git a/arch/or1k/include/mor1kx/irq.h b/arch/or1k/include/mor1kx/irq.h index f098a8ef81..e2d116891a 100644 --- a/arch/or1k/include/mor1kx/irq.h +++ b/arch/or1k/include/mor1kx/irq.h @@ -215,6 +215,7 @@ static inline irqstate_t up_irq_save(void) mfspr(SPR_SYS_SR, flags); /* Disable IRQs */ + x = flags & ~(SPR_SR_IEE | SPR_SR_TEE); mtspr(SPR_SYS_SR, x); diff --git a/arch/or1k/src/common/up_allocateheap.c b/arch/or1k/src/common/up_allocateheap.c index b138d92971..17411f4822 100644 --- a/arch/or1k/src/common/up_allocateheap.c +++ b/arch/or1k/src/common/up_allocateheap.c @@ -43,6 +43,7 @@ ****************************************************************************/ /* Configuration ************************************************************/ + /* Terminology. In the flat build (CONFIG_BUILD_FLAT=y), there is only a * single heap access with the standard allocations (malloc/free). This * heap is referred to as the user heap. In the protected build @@ -86,7 +87,8 @@ * * Kernel .data region. Size determined at link time. * Kernel .bss region Size determined at link time. - * Kernel IDLE thread stack. Size determined by CONFIG_IDLETHREAD_STACKSIZE. + * Kernel IDLE thread stack. Size determined by + * CONFIG_IDLETHREAD_STACKSIZE. * Padding for alignment * User .data region. Size determined at link time. * User .bss region Size determined at link time. @@ -107,7 +109,8 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). */ - uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE; + uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + + CONFIG_MM_KERNEL_HEAPSIZE; size_t usize = CONFIG_RAM_END - ubase; DEBUGASSERT(ubase < (uintptr_t)CONFIG_RAM_END); @@ -147,7 +150,8 @@ void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). */ - uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE; + uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + + CONFIG_MM_KERNEL_HEAPSIZE; DEBUGASSERT(ubase < (uintptr_t)CONFIG_RAM_END); /* Return the kernel heap settings (i.e., the part of the heap region diff --git a/arch/or1k/src/common/up_cpuinfo.c b/arch/or1k/src/common/up_cpuinfo.c index a645c11a04..4309955c12 100644 --- a/arch/or1k/src/common/up_cpuinfo.c +++ b/arch/or1k/src/common/up_cpuinfo.c @@ -68,8 +68,10 @@ int or1k_print_cpuinfo(void) if ((vr & SPR_VR_UVRP) != 0) { mfspr(SPR_SYS_VR2, vr2); - syslog(LOG_INFO, " CPUID: %d\n", (vr2 & SPR_VR2_CPUID_MASK) >> SPR_VR2_CPUID_SHIFT); - syslog(LOG_INFO, " V2.VER: 0x%x\n", (vr2 & SPR_VR2_VER_MASK) >> SPR_VR2_VER_SHIFT); + syslog(LOG_INFO, " CPUID: %d\n", + (vr2 & SPR_VR2_CPUID_MASK) >> SPR_VR2_CPUID_SHIFT); + syslog(LOG_INFO, " V2.VER: 0x%x\n", + (vr2 & SPR_VR2_VER_MASK) >> SPR_VR2_VER_SHIFT); } syslog(LOG_INFO, " AVR/VR2: %s\n", diff --git a/arch/or1k/src/common/up_internal.h b/arch/or1k/src/common/up_internal.h index e2e55d071e..11cae13c74 100644 --- a/arch/or1k/src/common/up_internal.h +++ b/arch/or1k/src/common/up_internal.h @@ -148,14 +148,14 @@ EXTERN uint32_t g_intstackalloc; /* Allocated stack base */ EXTERN uint32_t g_intstackbase; /* Initial top of interrupt stack */ #endif -/* These 'addresses' of these values are setup by the linker script. They are - * not actual uint32_t storage locations! They are only used meaningfully in the - * following way: +/* These 'addresses' of these values are setup by the linker script. They + * are not actual uint32_t storage locations! They are only used meaningfully + * in the following way: * * - The linker script defines, for example, the symbol_sdata. * - The declareion extern uint32_t _sdata; makes C happy. C will believe - * that the value _sdata is the address of a uint32_t variable _data (it is - * not!). + * that the value _sdata is the address of a uint32_t variable _data + * (it is not!). * - We can recoved the linker value then by simply taking the address of * of _data. like: uint32_t *pdata = &_sdata; */ @@ -168,9 +168,9 @@ EXTERN uint32_t _edata; /* End+1 of .data */ EXTERN uint32_t _sbss; /* Start of .bss */ EXTERN uint32_t _ebss; /* End+1 of .bss */ -/* Sometimes, functions must be executed from RAM. In this case, the following - * macro may be used (with GCC!) to specify a function that will execute from - * RAM. For example, +/* Sometimes, functions must be executed from RAM. In this case, the + * following macro may be used (with GCC!) to specify a function that will + * execute from RAM. For example, * * int __ramfunc__ foo (void); * int __ramfunc__ foo (void) { return bar; } @@ -210,12 +210,12 @@ EXTERN uint32_t _eramfuncs; /* Copy destination end address in RAM */ ****************************************************************************/ /**************************************************************************** - * Public Functions + * Public Functions Prototypes ****************************************************************************/ #ifndef __ASSEMBLY__ -/* Low level initialization provided by board-level logic ******************/ +/* Low level initialization provided by board-level logic *******************/ void or1k_boot(void); int or1k_print_cpuinfo(void); @@ -308,10 +308,10 @@ void up_wdtinit(void); /* Networking ***************************************************************/ -/* Defined in board/xyz_network.c for board-specific Ethernet implementations, - * or chip/xyx_ethernet.c for chip-specific Ethernet implementations, or - * common/up_etherstub.c for a corner case where the network is enabled yet - * there is no Ethernet driver to be initialized. +/* Defined in board/xyz_network.c for board-specific Ethernet + * implementations, or chip/xyx_ethernet.c for chip-specific Ethernet + * implementations, or common/up_etherstub.c for a corner case where the + * network is enabled yet there is no Ethernet driver to be initialized. * * Use of common/up_etherstub.c is deprecated. The preferred mechanism is to * use CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in diff --git a/arch/or1k/src/common/up_timer.c b/arch/or1k/src/common/up_timer.c index 5411a03c4d..1c1799e7b2 100644 --- a/arch/or1k/src/common/up_timer.c +++ b/arch/or1k/src/common/up_timer.c @@ -73,7 +73,9 @@ static int or1k_timer_isr(int irq, uint32_t *regs, void *arg) { uint32_t ttmr = TTMR_LOAD; + /* Clear the TTMR interrupt */ + mtspr(SPR_TICK_TTMR, ttmr); nxsched_process_timer(); diff --git a/arch/or1k/src/mor1kx/mor1kx_serial.c b/arch/or1k/src/mor1kx/mor1kx_serial.c index 8398002bc2..8312f2284a 100644 --- a/arch/or1k/src/mor1kx/mor1kx_serial.c +++ b/arch/or1k/src/mor1kx/mor1kx_serial.c @@ -88,7 +88,7 @@ void up_earlyserialinit(void) #ifdef HAVE_SERIAL_CONSOLE /* Mark the serial console (if any) */ - //CONSOLE_DEV.isconsole = true; + /* CONSOLE_DEV.isconsole = true; */ #endif } #endif @@ -139,10 +139,11 @@ int up_putc(int ch) { /* Add CR */ - //or1k_lowputc('\r'); + /* or1k_lowputc('\r'); */ } - //or1k_lowputc(ch); + /* or1k_lowputc(ch); */ + leave_critical_section(flags); #endif return ch; diff --git a/arch/or1k/src/mor1kx/mor1kx_start.h b/arch/or1k/src/mor1kx/mor1kx_start.h index e35fdc2177..7ff1ec7097 100644 --- a/arch/or1k/src/mor1kx/mor1kx_start.h +++ b/arch/or1k/src/mor1kx/mor1kx_start.h @@ -28,7 +28,7 @@ #include /**************************************************************************** - * Public Functions + * Public Functions Prototypes ****************************************************************************/ /**************************************************************************** diff --git a/arch/or1k/src/mor1kx/up_irq.c b/arch/or1k/src/mor1kx/up_irq.c index 012add2d89..a3fd837db1 100644 --- a/arch/or1k/src/mor1kx/up_irq.c +++ b/arch/or1k/src/mor1kx/up_irq.c @@ -145,7 +145,8 @@ void up_ack_irq(int irq) { if (irq <= 31) { - //uint32_t sr = (1 << irq); + /* uint32_t sr = (1 << irq); */ + uint32_t sr = 0; mtspr(SPR_PIC_SR, sr); }