diff options
Diffstat (limited to 'bsps/arm/shared/clock/clock-nxp-lpc.c')
-rw-r--r-- | bsps/arm/shared/clock/clock-nxp-lpc.c | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/bsps/arm/shared/clock/clock-nxp-lpc.c b/bsps/arm/shared/clock/clock-nxp-lpc.c index 4ba5f83907..77d6d423a2 100644 --- a/bsps/arm/shared/clock/clock-nxp-lpc.c +++ b/bsps/arm/shared/clock/clock-nxp-lpc.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * @@ -7,11 +9,28 @@ */ /* - * Copyright (c) 2009-2015 embedded brains GmbH. All rights reserved. + * Copyright (C) 2009, 2015 embedded brains GmbH & Co. KG + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * 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. */ #include <rtems.h> @@ -22,9 +41,6 @@ #ifdef ARM_MULTILIB_ARCH_V4 -/* This is defined in ../../../shared/dev/clock/clockimpl.h */ -void Clock_isr(rtems_irq_hdl_param arg); - static volatile lpc_timer *const lpc_clock = (volatile lpc_timer *) LPC_CLOCK_TIMER_BASE; @@ -38,12 +54,12 @@ static uint32_t lpc_clock_tc_get_timecount(struct timecounter *tc) return lpc_timecounter->tc; } -static void lpc_clock_at_tick(void) +static void lpc_clock_at_tick(volatile lpc_timer *regs) { - lpc_clock->ir = LPC_TIMER_IR_MR0; + regs->ir = LPC_TIMER_IR_MR0; } -static void lpc_clock_handler_install(void) +static void lpc_clock_handler_install(rtems_interrupt_handler handler) { rtems_status_code sc = RTEMS_SUCCESSFUL; @@ -51,8 +67,8 @@ static void lpc_clock_handler_install(void) LPC_CLOCK_INTERRUPT, "Clock", RTEMS_INTERRUPT_UNIQUE, - (rtems_interrupt_handler) Clock_isr, - NULL + handler, + RTEMS_DEVOLATILE(lpc_timer *, lpc_clock) ); if (sc != RTEMS_SUCCESSFUL) { rtems_fatal_error_occurred(0xdeadbeef); @@ -99,10 +115,10 @@ static void lpc_clock_initialize(void) rtems_timecounter_install(&lpc_clock_tc); } -#define Clock_driver_support_at_tick() lpc_clock_at_tick() +#define Clock_driver_support_at_tick(arg) lpc_clock_at_tick(arg) #define Clock_driver_support_initialize_hardware() lpc_clock_initialize() #define Clock_driver_support_install_isr(isr) \ - lpc_clock_handler_install() + lpc_clock_handler_install(isr) /* Include shared source clock driver code */ #include "../../../shared/dev/clock/clockimpl.h" |