mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-12-28 01:50:22 +00:00
*** EFM32 branch ***
1. Update the copyright information - 2009 => 2011 2. Add external oscillator configuration routine in "rt_hw_board_init()" - Before, it is set by default frequency, 32MHz - Now it can be set by user specified frequency 3. Add ADC and ACMP (analog comparator) drivers 4. Clarify the MCU and target board define in "rtconfig.py" git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1296 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/******************************************************************//**
|
||||
* @file drv_rtc.c
|
||||
* @brief RTC driver of RT-Thread RTOS for EFM32
|
||||
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
||||
* COPYRIGHT (C) 2011, RT-Thread Development Team
|
||||
* @author Bernard, onelife
|
||||
* @version 0.4 beta
|
||||
**********************************************************************
|
||||
@@ -29,8 +29,8 @@
|
||||
/* Private define --------------------------------------------------------------*/
|
||||
/* Private macro --------------------------------------------------------------*/
|
||||
/* Private variables ------------------------------------------------------------*/
|
||||
static rt_uint32_t rtc_time;
|
||||
static struct rt_device rtc;
|
||||
static rt_uint32_t rtc_time;
|
||||
|
||||
/* Private function prototypes ---------------------------------------------------*/
|
||||
static void startLfxoForRtc(void);
|
||||
@@ -117,6 +117,49 @@ void rt_hw_rtc_isr(rt_device_t device)
|
||||
RTC->IFC = _RTC_IFC_MASK;
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
* @brief
|
||||
* Register RTC device
|
||||
*
|
||||
* @details
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* @param[in] device
|
||||
* Pointer to device descriptor
|
||||
*
|
||||
* @param[in] name
|
||||
* Device name
|
||||
*
|
||||
* @param[in] flag
|
||||
* Configuration flags
|
||||
*
|
||||
* @return
|
||||
* Error code
|
||||
*********************************************************************/
|
||||
rt_err_t rt_hw_rtc_register(
|
||||
rt_device_t device,
|
||||
const char *name,
|
||||
rt_uint32_t flag)
|
||||
{
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
|
||||
device->type = RT_Device_Class_RTC;
|
||||
device->rx_indicate = RT_NULL;
|
||||
device->tx_complete = RT_NULL;
|
||||
device->init = RT_NULL;
|
||||
device->open = rt_rtc_open;
|
||||
device->close = RT_NULL;
|
||||
device->read = rt_rtc_read;
|
||||
device->write = RT_NULL;
|
||||
device->control = rt_rtc_control;
|
||||
device->user_data = RT_NULL; /* no private */
|
||||
|
||||
/* register a character device */
|
||||
return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************//**
|
||||
* @brief
|
||||
* Initialize all RTC module related hardware and register RTC device to kernel
|
||||
@@ -129,7 +172,6 @@ void rt_hw_rtc_init(void)
|
||||
{
|
||||
rt_uint32_t reset;
|
||||
|
||||
rtc.type = RT_Device_Class_RTC;
|
||||
reset = RMU_ResetCauseGet();
|
||||
|
||||
if (reset & RMU_RSTCAUSE_PORST || reset & RMU_RSTCAUSE_EXTRST) //TODO
|
||||
@@ -168,14 +210,7 @@ void rt_hw_rtc_init(void)
|
||||
}
|
||||
|
||||
/* register rtc device */
|
||||
rtc.init = RT_NULL;
|
||||
rtc.open = rt_rtc_open;
|
||||
rtc.close = RT_NULL;
|
||||
rtc.read = rt_rtc_read;
|
||||
rtc.write = RT_NULL;
|
||||
rtc.control = rt_rtc_control;
|
||||
rtc.user_data = RT_NULL; /* no private */
|
||||
rt_device_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR);
|
||||
rt_hw_rtc_register(&rtc, RT_RTC_NAME, EFM32_NO_DATA);
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
|
||||
Reference in New Issue
Block a user