summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/lpc176x
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-23 09:55:15 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-23 15:18:44 +0200
commit4fb1b79a804ca8de866be0ef718e54e1f62fa3ec (patch)
tree11b85c98244db22c927e7f1323ed222c43a589b0 /c/src/lib/libbsp/arm/lpc176x
parentbsps: Move legacy network drivers to bsps (diff)
downloadrtems-4fb1b79a804ca8de866be0ef718e54e1f62fa3ec.tar.bz2
bsps: Move RTC drivers to bsps
This patch is a part of the BSP source reorganization. Update #3285.
Diffstat (limited to 'c/src/lib/libbsp/arm/lpc176x')
-rw-r--r--c/src/lib/libbsp/arm/lpc176x/Makefile.am2
-rw-r--r--c/src/lib/libbsp/arm/lpc176x/rtc/rtc-config.c125
2 files changed, 1 insertions, 126 deletions
diff --git a/c/src/lib/libbsp/arm/lpc176x/Makefile.am b/c/src/lib/libbsp/arm/lpc176x/Makefile.am
index 383bbfd51d..98ba911e49 100644
--- a/c/src/lib/libbsp/arm/lpc176x/Makefile.am
+++ b/c/src/lib/libbsp/arm/lpc176x/Makefile.am
@@ -69,7 +69,7 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/clock/clock-armv7m.c
# RTC
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/rtc/rtc-support.c
-librtemsbsp_a_SOURCES += rtc/rtc-config.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/lpc176x/rtc/rtc-config.c
# GPIO
librtemsbsp_a_SOURCES += gpio/lpc-gpio.c
diff --git a/c/src/lib/libbsp/arm/lpc176x/rtc/rtc-config.c b/c/src/lib/libbsp/arm/lpc176x/rtc/rtc-config.c
deleted file mode 100644
index 7d1512c01a..0000000000
--- a/c/src/lib/libbsp/arm/lpc176x/rtc/rtc-config.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * @file
- *
- * @ingroup lpc176x
- *
- * @brief RTC configuration.
- */
-
-/*
- * Copyright (c) 2008
- * Embedded Brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * rtems@embedded-brains.de
- *
- * 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.
- */
-
-#include <libchip/rtc.h>
-#include <bsp/io.h>
-
-#define LPC176X_RTC_NUMBER 1U
-
-void bsp_rtc_initialize( void );
-int bsp_rtc_get_time( rtems_time_of_day *tod );
-int bsp_rtc_set_time( const rtems_time_of_day *tod );
-bool bsp_rtc_probe( void );
-
-/**
- * @brief Initialize the rtc device.
- */
-void bsp_rtc_initialize( void )
-{
- /* Enable module power */
- lpc176x_module_enable( LPC176X_MODULE_RTC, LPC176X_MODULE_PCLK_DEFAULT );
-
- /* Enable the RTC and use external clock */
- RTC_CCR = RTC_CCR_CLKEN | RTC_CCR_CLKSRC;
-
- /* Disable interrupts */
- RTC_CIIR = 0U;
- RTC_CISS = 0U;
- RTC_AMR = 0xFFU;
-
- /* Clear interrupts */
- RTC_ILR = RTC_ILR_RTCCIF | RTC_ILR_RTCALF | RTC_ILR_RTSSF;
-}
-
-/**
- * @brief Gets the information according to the current time.
- *
- * @param tod Value to be modified.
- * @return 0
- */
-int bsp_rtc_get_time( rtems_time_of_day *tod )
-{
- tod->ticks = 0;
- tod->second = RTC_SEC;
- tod->minute = RTC_MIN;
- tod->hour = RTC_HOUR;
- tod->day = RTC_DOM;
- tod->month = RTC_MONTH;
- tod->year = RTC_YEAR;
-
- return 0;
-}
-
-/**
- * @brief Sets the information according to the current time.
- *
- * @param tod Value to get the new information.
- * @return 0
- */
-int bsp_rtc_set_time( const rtems_time_of_day *tod )
-{
- RTC_SEC = tod->second;
- RTC_MIN = tod->minute;
- RTC_HOUR = tod->hour;
- RTC_DOM = tod->day;
- RTC_MONTH = tod->month;
- RTC_YEAR = tod->year;
-
- return 0;
-}
-
-/**
- * @brief Used to probe. At the moment is not used.
- *
- * @return true.
- */
-bool bsp_rtc_probe( void )
-{
- return true;
-}
-
-/**
- * @brief Represents the real time clock options.
- */
-const rtc_fns lpc176x_rtc_ops = {
- .deviceInitialize = (void *) bsp_rtc_initialize,
- .deviceGetTime = (void *) bsp_rtc_get_time,
- .deviceSetTime = (void *) bsp_rtc_set_time
-};
-
-size_t RTC_Count = LPC176X_RTC_NUMBER;
-
-/**
- * @brief Table to describes the rtc device.
- */
-rtc_tbl RTC_Table[ LPC176X_RTC_NUMBER ] = {
- {
- .sDeviceName = "/dev/rtc",
- .deviceType = RTC_CUSTOM,
- .pDeviceFns = &lpc176x_rtc_ops,
- .deviceProbe = (void *) bsp_rtc_probe,
- .pDeviceParams = NULL,
- .ulCtrlPort1 = 0,
- .ulDataPort = 0,
- .getRegister = NULL,
- .setRegister = NULL
- }
-};