diff --git a/arch/z16/src/common/z16_allocateheap.c b/arch/z16/src/common/z16_allocateheap.c index d45a51ed03d..8ecea3883e4 100644 --- a/arch/z16/src/common/z16_allocateheap.c +++ b/arch/z16/src/common/z16_allocateheap.c @@ -53,14 +53,6 @@ #define CONFIG_HEAP1_END ((unsigned long)&far_heaptop) #endif -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -75,7 +67,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) { - *heap_start = (FAR void*)CONFIG_HEAP1_BASE; + *heap_start = (FAR void *)CONFIG_HEAP1_BASE; *heap_size = CONFIG_HEAP1_END - CONFIG_HEAP1_BASE; board_autoled_on(LED_HEAPALLOCATE); } @@ -92,6 +84,6 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) #if CONFIG_MM_REGIONS > 1 void z16_addregion(void) { - kmm_addregion((FAR void*)CONFIG_HEAP2_BASE, CONFIG_HEAP2_SIZE); + kmm_addregion((FAR void *)CONFIG_HEAP2_BASE, CONFIG_HEAP2_SIZE); } #endif diff --git a/arch/z16/src/common/z16_assert.c b/arch/z16/src/common/z16_assert.c index 8b52ecbb231..6c340751bd8 100644 --- a/arch/z16/src/common/z16_assert.c +++ b/arch/z16/src/common/z16_assert.c @@ -73,19 +73,19 @@ static void _up_assert(int errorcode) /* noreturn_function */ if (up_interrupt_context() || running_task()->flink == NULL) { - up_irq_save(); - for (;;) - { + up_irq_save(); + for (; ; ) + { #if CONFIG_BOARD_RESET_ON_ASSERT >= 1 - board_reset(CONFIG_BOARD_ASSERT_RESET_VALUE); + board_reset(CONFIG_BOARD_ASSERT_RESET_VALUE); #endif #ifdef CONFIG_ARCH_LEDS - board_autoled_on(LED_PANIC); - up_mdelay(250); - board_autoled_off(LED_PANIC); - up_mdelay(250); + board_autoled_on(LED_PANIC); + up_mdelay(250); + board_autoled_off(LED_PANIC); + up_mdelay(250); #endif - } + } } else { diff --git a/arch/z16/src/common/z16_createstack.c b/arch/z16/src/common/z16_createstack.c index 2517f9e0793..6420cb01418 100644 --- a/arch/z16/src/common/z16_createstack.c +++ b/arch/z16/src/common/z16_createstack.c @@ -148,12 +148,12 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) /* Save the adjusted stack values in the struct tcb_s */ - tcb->adj_stack_ptr = (uint32_t*)top_of_stack; + tcb->adj_stack_ptr = (uint32_t *)top_of_stack; tcb->adj_stack_size = size_of_stack; board_autoled_on(LED_STACKCREATED); return OK; } - return ERROR; + return ERROR; } diff --git a/arch/z16/src/common/z16_doirq.c b/arch/z16/src/common/z16_doirq.c index 653f613b843..91f9f623082 100644 --- a/arch/z16/src/common/z16_doirq.c +++ b/arch/z16/src/common/z16_doirq.c @@ -60,12 +60,12 @@ FAR chipreg_t *z16_doirq(int irq, FAR chipreg_t *regs) FAR chipreg_t *savestate; /* Nested interrupts are not supported in this implementation. If - * you want to implement nested interrupts, you would have to (1) change - * the way that g_current_regs is handled and (2) the design associated - * with CONFIG_ARCH_INTERRUPTSTACK. The savestate variable will not - * work for that purpose as implemented here because only the outermost - * nested interrupt can result in a context switch (it can probably be - * deleted). + * you want to implement nested interrupts, you would have to (1) + * change the way that g_current_regs is handled and (2) the design + * ssociated with CONFIG_ARCH_INTERRUPTSTACK. The savestate variable + * will not work for that purpose as implemented here because only + * the outermost nested interrupt can result in a context switch (it + * can probably be deleted). */ /* Current regs non-zero indicates that we are processing @@ -84,9 +84,9 @@ FAR chipreg_t *z16_doirq(int irq, FAR chipreg_t *regs) irq_dispatch(irq, regs); - /* Restore the previous value of g_current_regs. NULL would indicate that - * we are no longer in an interrupt handler. It will be non-NULL if we - * are returning from a nested interrupt. + /* Restore the previous value of g_current_regs. NULL would indicate + * that we are no longer in an interrupt handler. It will be non-NULL + * if we are returning from a nested interrupt. */ ret = g_current_regs; diff --git a/arch/z16/src/common/z16_exit.c b/arch/z16/src/common/z16_exit.c index 61a4e43b33f..17e6fe3aa5e 100644 --- a/arch/z16/src/common/z16_exit.c +++ b/arch/z16/src/common/z16_exit.c @@ -125,7 +125,7 @@ static void _z16_dumponexit(FAR struct tcb_s *tcb, FAR void *arg) void _exit(int status) { - FAR struct tcb_s* tcb = this_task(); + FAR struct tcb_s *tcb = this_task(); /* Make sure that we are in a critical section with local interrupts. * The IRQ state will be restored when the next task is started. diff --git a/arch/z16/src/common/z16_initialstate.c b/arch/z16/src/common/z16_initialstate.c index dd13dc1106c..bff065626d6 100644 --- a/arch/z16/src/common/z16_initialstate.c +++ b/arch/z16/src/common/z16_initialstate.c @@ -51,7 +51,7 @@ void up_initial_state(struct tcb_s *tcb) { - uint32_t *reg32 = (uint32_t*)tcb->xcp.regs; + uint32_t *reg32 = (uint32_t *)tcb->xcp.regs; /* Initialize the initial exception register context structure */ @@ -59,6 +59,6 @@ void up_initial_state(struct tcb_s *tcb) #ifndef CONFIG_SUPPRESS_INTERRUPTS tcb->xcp.regs[REG_FLAGS] = (uint16_t)Z16F_CNTRL_FLAGS_IRQE; /* IRQE flag will enable interrupts */ #endif - reg32[REG_SP/2] = (uint32_t)tcb->adj_stack_ptr; - reg32[REG_PC/2] = (uint32_t)tcb->start; + reg32[REG_SP / 2] = (uint32_t)tcb->adj_stack_ptr; + reg32[REG_PC / 2] = (uint32_t)tcb->start; } diff --git a/arch/z16/src/common/z16_internal.h b/arch/z16/src/common/z16_internal.h index 7165bf02b71..103e0340378 100644 --- a/arch/z16/src/common/z16_internal.h +++ b/arch/z16/src/common/z16_internal.h @@ -101,7 +101,7 @@ extern volatile FAR chipreg_t *g_current_regs; #endif /**************************************************************************** - * Public Functions + * Public Function Prototypes ****************************************************************************/ #ifndef __ASSEMBLY__ diff --git a/arch/z16/src/common/z16_interruptcontext.c b/arch/z16/src/common/z16_interruptcontext.c index 5cd3a3eb311..7965f105b30 100644 --- a/arch/z16/src/common/z16_interruptcontext.c +++ b/arch/z16/src/common/z16_interruptcontext.c @@ -44,5 +44,5 @@ bool up_interrupt_context(void) { - return g_current_regs != NULL; + return g_current_regs != NULL; } diff --git a/arch/z16/src/common/z16_mdelay.c b/arch/z16/src/common/z16_mdelay.c index 9cb20886f40..1d0555ca9a1 100644 --- a/arch/z16/src/common/z16_mdelay.c +++ b/arch/z16/src/common/z16_mdelay.c @@ -50,9 +50,9 @@ void up_mdelay(unsigned int milliseconds) for (i = 0; i < milliseconds; i++) { - for (j = 0; j < CONFIG_BOARD_LOOPSPERMSEC; j++) - { - } + for (j = 0; j < CONFIG_BOARD_LOOPSPERMSEC; j++) + { + } } } #endif /* CONFIG_BOARD_LOOPSPERMSEC */ diff --git a/arch/z16/src/common/z16_registerdump.c b/arch/z16/src/common/z16_registerdump.c index 2b57ed92605..2eab1fb090a 100644 --- a/arch/z16/src/common/z16_registerdump.c +++ b/arch/z16/src/common/z16_registerdump.c @@ -51,7 +51,7 @@ static chipreg_t s_last_regs[XCPTCONTEXT_REGS]; static void z16_registerdump(void) { #ifdef CONFIG_DEBUG_INFO - FAR uint32_t *regs32 = (FAR uint32_t*)g_current_regs; + FAR uint32_t *regs32 = (FAR uint32_t *)g_current_regs; if (regs32 == NULL) { @@ -61,13 +61,14 @@ static void z16_registerdump(void) _alert("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], - regs32[REG_R4/2], regs32[REG_R5/2], regs32[REG_R6/2], regs32[REG_R7/2]); + regs32[REG_R0 / 2], regs32[REG_R1 / 2], regs32[REG_R2 / 2], + regs32[REG_R3 / 2], regs32[REG_R4 / 2], regs32[REG_R5 / 2], + regs32[REG_R6 / 2], regs32[REG_R7 / 2]); _alert("R8 :%08x R9 :%08x R10:%08x R11:%08x R12:%08x R13:%08x\n" - regs32[REG_R8/2], regs32[REG_R9/2], regs32[REG_R10/2], regs3[REG_R11/2], - regs32[REG_R12/2], regs32[REG_R13/2]); + regs32[REG_R8 / 2], regs32[REG_R9 / 2], regs32[REG_R10 / 2], + regs3[REG_R11 / 2], regs32[REG_R12 / 2], regs32[REG_R13 / 2]); _alert("FP :%08x SP :%08x FLG:%04x\n" - regs32[REG_R14/2], regs32[REG_R15/2], regs32[REG_FLAGS]); + regs32[REG_R14 / 2], regs32[REG_R15 / 2], regs32[REG_FLAGS]); #endif } diff --git a/arch/z16/src/common/z16_releasepending.c b/arch/z16/src/common/z16_releasepending.c index 4c1c8171cec..0ebe5c79750 100644 --- a/arch/z16/src/common/z16_releasepending.c +++ b/arch/z16/src/common/z16_releasepending.c @@ -57,7 +57,6 @@ void up_release_pending(void) /* Merge the g_pendingtasks list into the ready-to-run task list */ - /* sched_lock(); */ if (sched_mergepending()) { /* The currently active task has changed! We will need to switch diff --git a/arch/z16/src/common/z16_reprioritizertr.c b/arch/z16/src/common/z16_reprioritizertr.c index 1d76870d450..62fe26694dd 100644 --- a/arch/z16/src/common/z16_reprioritizertr.c +++ b/arch/z16/src/common/z16_reprioritizertr.c @@ -149,9 +149,10 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority) SET_IRQCONTEXT(rtcb); } - /* Copy the exception context into the TCB at the (old) head of the - * ready-to-run Task list. if SAVE_USERCONTEXT returns a non-zero - * value, then this is really the previously running task restarting! + /* Copy the exception context into the TCB at the (old) head of + * the ready-to-run Task list. if SAVE_USERCONTEXT returns a non- + * zero value, then this is really the previously running task + * restarting! */ else if (!SAVE_USERCONTEXT(rtcb)) diff --git a/arch/z16/src/common/z16_schedulesigaction.c b/arch/z16/src/common/z16_schedulesigaction.c index cf0cb61bc9e..c91cdd15503 100644 --- a/arch/z16/src/common/z16_schedulesigaction.c +++ b/arch/z16/src/common/z16_schedulesigaction.c @@ -112,7 +112,8 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver) else { - FAR uint32_t *current_pc = (FAR uint32_t*)&g_current_regs[REG_PC]; + FAR uint32_t *current_pc = + (FAR uint32_t *)&g_current_regs[REG_PC]; /* Save the return address and interrupt state. These will be * restored by the signal trampoline after the signals have @@ -145,7 +146,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver) else { - FAR uint32_t *saved_pc = (FAR uint32_t*)&tcb->xcp.regs[REG_PC]; + FAR uint32_t *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 diff --git a/arch/z16/src/common/z16_sigdeliver.c b/arch/z16/src/common/z16_sigdeliver.c index d562ec14fd3..4ca825470f8 100644 --- a/arch/z16/src/common/z16_sigdeliver.c +++ b/arch/z16/src/common/z16_sigdeliver.c @@ -54,7 +54,7 @@ void z16_sigdeliver(void) { FAR struct tcb_s *rtcb = this_task(); chipreg_t regs[XCPTCONTEXT_REGS]; - FAR uint32_t *regs32 = (FAR uint32_t*)regs; + FAR uint32_t *regs32 = (FAR uint32_t *)regs; /* Save the errno. This must be preserved throughout the signal handling * so that the user code final gets the correct errno value (probably diff --git a/arch/z16/src/common/z16_stackdump.c b/arch/z16/src/common/z16_stackdump.c index 7342614f2fd..73648d035dc 100644 --- a/arch/z16/src/common/z16_stackdump.c +++ b/arch/z16/src/common/z16_stackdump.c @@ -39,6 +39,7 @@ /**************************************************************************** * Name: z16_getsp ****************************************************************************/ + /* To be provided */ /**************************************************************************** @@ -67,9 +68,11 @@ static void z16_stackdump(void) stack = sp; } - for (stack = stack & ~0x0f; stack < stack_base; stack += 8*sizeof(chipreg_t)) + for (stack = stack & ~0x0f; + stack < stack_base; + stack += 8 * sizeof(chipreg_t)) { - chipreg_t *ptr = (chipreg_t*)stack; + chipreg_t *ptr = (chipreg_t *)stack; _alert("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n", stack, ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5], ptr[6], ptr[7]); diff --git a/arch/z16/src/common/z16_stackframe.c b/arch/z16/src/common/z16_stackframe.c index 2c79a28ac9a..0b6a20e1572 100644 --- a/arch/z16/src/common/z16_stackframe.c +++ b/arch/z16/src/common/z16_stackframe.c @@ -37,6 +37,7 @@ /**************************************************************************** * Pre-processor Macros ****************************************************************************/ + /* Align the stack to word (4 byte) boundaries. This is probablya greater * alignment than is required. */ @@ -49,14 +50,6 @@ #define STACK_ALIGN_DOWN(a) ((a) & ~STACK_ALIGN_MASK) #define STACK_ALIGN_UP(a) (((a) + STACK_ALIGN_MASK) & ~STACK_ALIGN_MASK) -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -116,7 +109,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Reset the initial stack pointer */ - tcb->xcp.regs[REG_SP/2] = (uint32_t)tcb->adj_stack_ptr; + tcb->xcp.regs[REG_SP / 2] = (uint32_t)tcb->adj_stack_ptr; /* And return a pointer to the allocated memory */ diff --git a/arch/z16/src/common/z16_udelay.c b/arch/z16/src/common/z16_udelay.c index 5df4a0a90ab..02e078ad150 100644 --- a/arch/z16/src/common/z16_udelay.c +++ b/arch/z16/src/common/z16_udelay.c @@ -36,22 +36,6 @@ #define CONFIG_BOARD_LOOPSPER10USEC ((CONFIG_BOARD_LOOPSPERMSEC+50)/100) #define CONFIG_BOARD_LOOPSPERUSEC ((CONFIG_BOARD_LOOPSPERMSEC+500)/1000) -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -87,6 +71,7 @@ void up_udelay(useconds_t microseconds) for (i = 0; i < CONFIG_BOARD_LOOPSPERMSEC; i++) { } + microseconds -= 1000; } @@ -95,6 +80,7 @@ void up_udelay(useconds_t microseconds) for (i = 0; i < CONFIG_BOARD_LOOPSPER100USEC; i++) { } + microseconds -= 100; } @@ -103,6 +89,7 @@ void up_udelay(useconds_t microseconds) for (i = 0; i < CONFIG_BOARD_LOOPSPER10USEC; i++) { } + microseconds -= 10; } @@ -111,6 +98,7 @@ void up_udelay(useconds_t microseconds) for (i = 0; i < CONFIG_BOARD_LOOPSPERUSEC; i++) { } + microseconds--; } } diff --git a/arch/z16/src/z16f/chip.h b/arch/z16/src/z16f/chip.h index 050f563cd24..64a17940ccb 100644 --- a/arch/z16/src/z16f/chip.h +++ b/arch/z16/src/z16f/chip.h @@ -78,7 +78,7 @@ # error "Z16F chip variant not specified" #endif -/* Flash option settings at address 0x00000000 ************************************/ +/* Flash option settings at address 0x00000000 **************************************/ #define Z16F_FLOPTION0 rom char _flash_option0 _At 0x0 #define Z16F_FLOPTION1 rom char _flash_option1 _At 0x1 @@ -108,7 +108,7 @@ #define Z16F_FLOPTION3_NORMAL _HX8(40) /* Bit 6: 1:Normal 0:Low power mode */ #define Z16F_FLOPTION3_RESVD _HX8(3f) /* Bits 0-5: Reserved */ -/* Memory areas ******************************************************************* +/* Memory areas ********************************************************************* * * Internal non-volatile memory starts at address zero. The size * of the internal non-volatile memory is chip-dependent. @@ -162,8 +162,14 @@ /* CPU control register bits ********************************************************/ - /* Bits 7-2: Reserved, must be zero */ - /* Bits 1-0: DMA bandwidth control */ + /* Bits 7-2: Reserved, must be + * zero + */ + + /* Bits 1-0: DMA bandwidth + * control + */ + #define Z16F_CNTRL_CPUCTL_BWALL _HX8(00) /* DMA can consume 100% bandwidth */ #define Z16F_CNTRL_CPUCTL_BW11 _HX8(01) /* DMA can do 1 transaction per 1 cycle */ #define Z16F_CNTRL_CPUCTL_BW12 _HX8(01) /* DMA can do 1 transaction per 2 cycles */ @@ -363,7 +369,7 @@ # define Z16F_GPIOK_SMRE _HX32(ffffe198) /* 8-bits: Port K Stop Mode Recovery En */ #endif -/* UART Register Offsets *************************************************************/ +/* UART Register Offsets ************************************************************/ #define Z16F_UART_TXD _HX8(00) /* 8-bits: UART Transmit Data */ #define Z16F_UART_RXD _HX8(00) /* 8-bits: UART Receive Data */ @@ -471,9 +477,9 @@ #define Z16F_ESPI_CTL_ESPIEN1 _HX8(40) /* Bit 6: ESPI Enable and Direction Control */ #define Z16F_ESPI_CTL_DIRQE _HX8(80) /* Bit 7: Data Interrupt Request Enable */ -#define Z16F_ESPI_MODE_SSPO _HX8(01) /* Bit 0: Slave Select Polarity */ -#define Z16F_ESPI_MODE_SSIO _HX8(02) /* Bit 1: Slave Select I/O */ -#define Z16F_ESPI_MODE_NUMBITS_SHIFT (2) /* Bits 2-4: Number of Data Bits Per Character */ +#define Z16F_ESPI_MODE_SSPO _HX8(01) /* Bit 0: Slave Select Polarity */ +#define Z16F_ESPI_MODE_SSIO _HX8(02) /* Bit 1: Slave Select I/O */ +#define Z16F_ESPI_MODE_NUMBITS_SHIFT (2) /* Bits 2-4: Number of Data Bits Per Character */ #define Z16F_ESPI_MODE_NUMBITS_MASK (7 << Z16F_ESPI_MODE_NUMBITS_SHIFT) # define Z16F_ESPI_MODE_NUMBITS_8BITS (0 << Z16F_ESPI_MODE_NUMBITS_SHIFT) /* 8 bits */ # define Z16F_ESPI_MODE_NUMBITS_1BIT (1 << Z16F_ESPI_MODE_NUMBITS_SHIFT) /* 1 bit */ @@ -483,11 +489,11 @@ # define Z16F_ESPI_MODE_NUMBITS_5BITS (5 << Z16F_ESPI_MODE_NUMBITS_SHIFT) /* 5 bits */ # define Z16F_ESPI_MODE_NUMBITS_6BITS (6 << Z16F_ESPI_MODE_NUMBITS_SHIFT) /* 6 bits */ # define Z16F_ESPI_MODE_NUMBITS_7BITS (7 << Z16F_ESPI_MODE_NUMBITS_SHIFT) /* 7 bits */ -#define Z16F_ESPI_MODE_SSMD_SHIFT (5) /* Bits 5-7: SLAVE SELECT Mode */ +#define Z16F_ESPI_MODE_SSMD_SHIFT (5) /* Bits 5-7: SLAVE SELECT Mode */ #define Z16F_ESPI_MODE_SSMD_MASK (7 << Z16F_ESPI_MODE_SSMD_SHIFT) -# define Z16F_ESPI_MODE_SSMD_SPI (0 << Z16F_ESPI_MODE_SSMD_SHIFT) /* SPI mode */ -# define Z16F_ESPI_MODE_SSMD_LPBK (1 << Z16F_ESPI_MODE_SSMD_SHIFT) /* LOOPBACK Mode */ -# define Z16F_ESPI_MODE_SSMD_I2S (2 << Z16F_ESPI_MODE_SSMD_SHIFT) /* I2S Mode */ +# define Z16F_ESPI_MODE_SSMD_SPI (0 << Z16F_ESPI_MODE_SSMD_SHIFT) /* SPI mode */ +# define Z16F_ESPI_MODE_SSMD_LPBK (1 << Z16F_ESPI_MODE_SSMD_SHIFT) /* LOOPBACK Mode */ +# define Z16F_ESPI_MODE_SSMD_I2S (2 << Z16F_ESPI_MODE_SSMD_SHIFT) /* I2S Mode */ #define Z16F_ESPI_STAT_SLAS _HX8(01) /* Bit 0: Slave Select */ #define Z16F_ESPI_STAT_TFST _HX8(02) /* Bit 1: Transfer Status */ @@ -498,7 +504,7 @@ #define Z16F_ESPI_STAT_TUND _HX8(40) /* Bit 6: Transmit Underrun */ #define Z16F_ESPI_STAT_TDRE _HX8(80) /* Bit 7: Transmit Data Register Empty */ -#define Z16F_ESPI_STATE_SHIFT (0) /* Bits 0-5: ESPI State Machine */ +#define Z16F_ESPI_STATE_SHIFT (0) /* Bits 0-5: ESPI State Machine */ #define Z16F_ESPI_STATE_MASK (0x3f << Z16F_ESPI_STATE_SHIFT) # define Z16F_ESPI_STATE_IDLE (0x00 << Z16F_ESPI_STATE_SHIFT) /* Idle */ # define Z16F_ESPI_STATE_SWAIT (0x01 << Z16F_ESPI_STATE_SHIFT) /* Slave Wait For SCK */ @@ -523,8 +529,8 @@ # define Z16F_ESPI_STATE_B1XMT (0x23 << Z16F_ESPI_STATE_SHIFT) /* Bit 1 Transmit */ # define Z16F_ESPI_STATE_B0RCV (0x20 << Z16F_ESPI_STATE_SHIFT) /* Bit 0 Receive */ # define Z16F_ESPI_STATE_B0XMT (0x21 << Z16F_ESPI_STATE_SHIFT) /* Bit 0 Transmit */ -#define Z16F_ESPI_STATE_SDI _HX8(40) /* Bit 6: Serial Data Input */ -#define Z16F_ESPI_STATE_SCKI _HX8(80) /* Bit 7: Serial Clock Input */ +#define Z16F_ESPI_STATE_SDI _HX8(40) /* Bit 6: Serial Data Input */ +#define Z16F_ESPI_STATE_SCKI _HX8(80) /* Bit 7: Serial Clock Input */ /* Timer0/1/2 registers *************************************************************/ diff --git a/arch/z16/src/z16f/z16f_espi.c b/arch/z16/src/z16f/z16f_espi.c index 3372cc167e8..4415c4b067f 100644 --- a/arch/z16/src/z16f/z16f_espi.c +++ b/arch/z16/src/z16f/z16f_espi.c @@ -1,35 +1,20 @@ /**************************************************************************** * arch/z16/src/z16f/z16f_espi.c * - * Copyright (C) 2014, 2016-2017 Gregory Nutt. All rights reserved. - * Authors: Gregory Nutt + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: + * http://www.apache.org/licenses/LICENSE-2.0 * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. * ****************************************************************************/ @@ -409,7 +394,9 @@ static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, spiinfo("frequency=%d\n", frequency); - /* Check if the requested frequency is the same as the frequency selection */ + /* Check if the requested frequency is the same as the frequency + * selection. + */ if (priv->frequency == frequency) { @@ -561,7 +548,9 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits) spi_putreg8(priv, regval, Z16F_ESPI_MODE); spiinfo("ESPI MODE: %02x\n", regval); - /* Save the selection so the subsequence re-configurations will be faster */ + /* Save the selection so the subsequence re-configurations will be + * faster. + */ priv->nbits = nbits; } diff --git a/arch/z16/src/z16f/z16f_irq.c b/arch/z16/src/z16f/z16f_irq.c index f41da64b0a5..2266adcf1ab 100644 --- a/arch/z16/src/z16f/z16f_irq.c +++ b/arch/z16/src/z16f/z16f_irq.c @@ -84,15 +84,18 @@ void up_disable_irq(int irq) if (irq < Z16F_IRQ_IRQ1) { - putreg8((getreg8(Z16F_IRQ0_ENH) & ~Z16F_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) & ~Z16F_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) & ~Z16F_IRQ2_BIT(irq)), Z16F_IRQ2_ENH); + putreg8((getreg8(Z16F_IRQ2_ENH) & ~Z16F_IRQ2_BIT(irq)), + Z16F_IRQ2_ENH); } } } @@ -119,15 +122,18 @@ void up_enable_irq(int irq) if (irq < Z16F_IRQ_IRQ1) { - putreg8((getreg8(Z16F_IRQ0_ENH) | Z16F_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) | Z16F_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) | Z16F_IRQ2_BIT(irq)), Z16F_IRQ2_ENH); + putreg8((getreg8(Z16F_IRQ2_ENH) | Z16F_IRQ2_BIT(irq)), + Z16F_IRQ2_ENH); } } } diff --git a/arch/z16/src/z16f/z16f_serial.c b/arch/z16/src/z16f/z16f_serial.c index a0c5535fbcc..d3264dd03cc 100644 --- a/arch/z16/src/z16f/z16f_serial.c +++ b/arch/z16/src/z16f/z16f_serial.c @@ -269,10 +269,12 @@ static uart_dev_t g_uart1port = static uint8_t z16f_disableuartirq(struct uart_dev_s *dev) { - struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv; + struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv; irqstate_t flags = enter_critical_section(); - uint8_t state = priv->rxenabled ? STATE_RXENABLED : STATE_DISABLED | \ - priv->txenabled ? STATE_TXENABLED : 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); @@ -302,7 +304,7 @@ static void z16f_restoreuartirq(struct uart_dev_s *dev, uint8_t state) #ifdef CONSOLE_DEV static void z16f_consoleput(uint8_t ch) { - struct z16f_uart_s *priv = (struct z16f_uart_s*)CONSOLE_DEV.priv; + struct z16f_uart_s *priv = (struct z16f_uart_s *)CONSOLE_DEV.priv; int tmp; for (tmp = 1000 ; tmp > 0 ; tmp--) @@ -329,7 +331,7 @@ static void z16f_consoleput(uint8_t ch) 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; + struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv; uint32_t brg; uint8_t ctl0; uint8_t ctl1; @@ -355,7 +357,7 @@ static int z16f_setup(struct uart_dev_s *dev) if (priv->parity == 1) { - ctl0 |= (Z16F_UARTCTL0_PEN|Z16F_UARTCTL0_PSEL); + ctl0 |= (Z16F_UARTCTL0_PEN | Z16F_UARTCTL0_PSEL); } else if (priv->parity == 2) { @@ -367,7 +369,7 @@ static int z16f_setup(struct uart_dev_s *dev) /* Enable UART receive (REN) and transmit (TEN) */ - ctl0 |= (Z16F_UARTCTL0_TEN|Z16F_UARTCTL0_REN); + ctl0 |= (Z16F_UARTCTL0_TEN | Z16F_UARTCTL0_REN); putreg8(ctl0, priv->uartbase + Z16F_UART_CTL0); #endif @@ -391,20 +393,21 @@ static void z16f_shutdown(struct uart_dev_s *dev) * Name: z16f_attach * * Description: - * Configure the UART to operation in interrupt driven mode. This method is - * called when the serial port is opened. Normally, this is just after the - * the setup() method is called, however, the serial console may operate in - * a non-interrupt driven mode during the boot phase. + * Configure the UART to operation in interrupt driven mode. This method + * is called when the serial port is opened. Normally, this is just after + * the the setup() method is called, however, the serial console may + * operate in a non-interrupt driven mode during the boot phase. * - * RX and TX interrupts are not enabled when by the attach method (unless the - * hardware supports multiple levels of interrupt enabling). The RX and TX - * interrupts are not enabled until the txint() and rxint() methods are called. + * RX and TX interrupts are not enabled when by the attach method (unless + * the hardware supports multiple levels of interrupt enabling). The RX + * and TX interrupts are not enabled until the txint() and rxint() methods + * are called. * ****************************************************************************/ static int z16f_attach(struct uart_dev_s *dev) { - struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv; + struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv; int ret; /* Attach the RX IRQ */ @@ -429,14 +432,14 @@ static int z16f_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. * ****************************************************************************/ static void z16f_detach(struct uart_dev_s *dev) { - struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv; + struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv; up_disable_irq(priv->rxirq); up_disable_irq(priv->txirq); @@ -461,7 +464,7 @@ static int z16f_rxinterrupt(int irq, void *context, void *arg) uint8_t status; DEBUGASSERT(dev != NULL && dev->priv != NULL); - priv = (struct z16f_uart_s*)dev->priv; + priv = (struct z16f_uart_s *)dev->priv; /* Check the LIN-UART status 0 register to determine whether the source of * the interrupt is error, break, or received data @@ -499,7 +502,7 @@ static int z16f_txinterrupt(int irq, void *context, FAR void *arg) uint8_t status; DEBUGASSERT(dev != NULL && dev->priv != NULL); - priv = (struct z16f_uart_s*)dev->priv; + priv = (struct z16f_uart_s *)dev->priv; /* Verify that the transmit data register is empty */ @@ -540,7 +543,7 @@ static int z16f_ioctl(struct file *filep, int cmd, unsigned long arg) static int z16f_receive(struct uart_dev_s *dev, uint32_t *status) { - struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv; + struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv; uint8_t rxd; uint8_t stat0; @@ -561,7 +564,7 @@ static int z16f_receive(struct uart_dev_s *dev, uint32_t *status) static void z16f_rxint(struct uart_dev_s *dev, bool enable) { - struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv; + struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv; irqstate_t flags = enter_critical_section(); if (enable) @@ -589,8 +592,9 @@ static void z16f_rxint(struct uart_dev_s *dev, bool enable) 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); + struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv; + return ((getreg8(priv->uartbase + Z16F_UART_STAT0) & + Z16F_UARTSTAT0_RDA) != 0); } /**************************************************************************** @@ -603,7 +607,7 @@ static bool z16f_rxavailable(struct uart_dev_s *dev) static void z16f_send(struct uart_dev_s *dev, int ch) { - struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv; + struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv; putreg8(ch, priv->uartbase + Z16F_UART_TXD); } @@ -617,7 +621,7 @@ static void z16f_send(struct uart_dev_s *dev, int ch) static void z16f_txint(struct uart_dev_s *dev, bool enable) { - struct z16f_uart_s *priv = (struct z16f_uart_s*)dev->priv; + struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv; irqstate_t flags = enter_critical_section(); if (enable) @@ -651,8 +655,9 @@ static void z16f_txint(struct uart_dev_s *dev, bool enable) 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); + struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv; + return ((getreg8(priv->uartbase + Z16F_UART_STAT0) & + Z16F_UARTSTAT0_TDRE) != 0); } /**************************************************************************** @@ -665,8 +670,9 @@ static bool z16f_txready(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); + struct z16f_uart_s *priv = (struct z16f_uart_s *)dev->priv; + return ((getreg8(priv->uartbase + Z16F_UART_STAT0) & + Z16F_UARTSTAT0_TXE) != 0); } /**************************************************************************** diff --git a/arch/z16/src/z16f/z16f_timerisr.c b/arch/z16/src/z16f/z16f_timerisr.c index 748ec0d0304..b5204f20ff3 100644 --- a/arch/z16/src/z16f/z16f_timerisr.c +++ b/arch/z16/src/z16f/z16f_timerisr.c @@ -1,35 +1,20 @@ /**************************************************************************** * arch/z16/src/z16f/z16f_timerisr.c * - * Copyright (C) 2008-2009, 2017 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: + * http://www.apache.org/licenses/LICENSE-2.0 * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. * ****************************************************************************/ @@ -52,6 +37,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* The desired timer interrupt frequency is provided by the definition * CLOCKS_PER_SEC (see include/time.h). CLOCKS_PER_SEC defines the desired * number of system clock ticks per second. That value is a user diff --git a/boards/z16/z16f/z16f2800100zcog/src/z16f_leds.c b/boards/z16/z16f/z16f2800100zcog/src/z16f_leds.c index f7a99a28354..80823486587 100644 --- a/boards/z16/z16f/z16f2800100zcog/src/z16f_leds.c +++ b/boards/z16/z16f/z16f2800100zcog/src/z16f_leds.c @@ -1,35 +1,20 @@ /**************************************************************************** * boards/z16/z16f/z16f2800100zcog/z16f_leds.c * - * Copyright (C) 2008, 2015 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: + * http://www.apache.org/licenses/LICENSE-2.0 * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. * ****************************************************************************/ @@ -101,7 +86,7 @@ void board_autoled_off(int led) { if (led >= 1) { - board_autoled_on(led-1); + board_autoled_on(led - 1); } } #endif /* CONFIG_ARCH_LEDS */