From 34a2c02ac29355e370bebf7de843d6f4561b92f9 Mon Sep 17 00:00:00 2001 From: "dzzxzz@gmail.com" Date: Mon, 3 Dec 2012 04:56:53 +0000 Subject: [PATCH] fixed the coding style in alarm.h git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2466 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- components/drivers/include/drivers/alarm.h | 111 +++++++++++---------- 1 file changed, 56 insertions(+), 55 deletions(-) diff --git a/components/drivers/include/drivers/alarm.h b/components/drivers/include/drivers/alarm.h index 627864727a..546b765a60 100644 --- a/components/drivers/include/drivers/alarm.h +++ b/components/drivers/include/drivers/alarm.h @@ -14,62 +14,63 @@ #ifndef __ALARM_H__ #define __ALARM_H__ - -#include - -#define RT_ALARM_TM_NOW -1 /* set the alarm tm_day,tm_mon,tm_sec,etc. to now.we also call it "don't care" value */ - -/* alarm flags */ -#define RT_ALARM_ONESHOT 0x000 /* only alarm onece */ -#define RT_ALARM_DAILY 0x100 /* alarm everyday */ -#define RT_ALARM_WEEKLY 0x200 /* alarm weekly at Monday or Friday etc. */ -#define RT_ALARM_MONTHLY 0x400 /* alarm monthly at someday */ -#define RT_ALARM_YAERLY 0x800 /* alarm yearly at a certain date */ - -/* alarm control cmd */ -#define RT_ALARM_CTRL_MODIFY 1 /* modify alarm time or alarm flag */ - -typedef struct rt_alarm *rt_alarm_t; -typedef void (*rt_alarm_callback_t)(rt_alarm_t alarm, time_t timestamp); - -/* used for low level RTC driver */ -struct rt_rtc_wkalarm -{ - rt_bool_t enable; /* 0 = alarm disabled, 1 = alarm enabled */ - rt_int32_t tm_sec; /* alarm at tm_sec */ - rt_int32_t tm_min; /* alarm at tm_min */ - rt_int32_t tm_hour; /* alarm at tm_hour */ -}; - -struct rt_alarm -{ - rt_list_t list; - rt_uint32_t flag; - rt_alarm_callback_t callback; - struct tm wktime; -}; - -struct rt_alarm_setup -{ - rt_uint32_t flag; /* alarm flag */ - struct tm wktime; /* when will the alarm wake up user */ -}; - -struct rt_alarm_container -{ - rt_list_t head; - struct rt_mutex mutex; - struct rt_event event; - struct rt_alarm *current; -}; -rt_alarm_t rt_alarm_create(rt_alarm_callback_t callback, struct rt_alarm_setup *setup); -rt_err_t rt_alarm_control(rt_alarm_t alarm, rt_uint8_t cmd, void *arg); -void rt_alarm_update(rt_device_t dev, rt_uint32_t event); -rt_err_t rt_alarm_delete(rt_alarm_t alarm); -rt_err_t rt_alarm_start(rt_alarm_t alarm); + +#include + +#define RT_ALARM_TM_NOW -1 /* set the alarm tm_day,tm_mon,tm_sec,etc. + to now.we also call it "don't care" value */ + +/* alarm flags */ +#define RT_ALARM_ONESHOT 0x000 /* only alarm onece */ +#define RT_ALARM_DAILY 0x100 /* alarm everyday */ +#define RT_ALARM_WEEKLY 0x200 /* alarm weekly at Monday or Friday etc. */ +#define RT_ALARM_MONTHLY 0x400 /* alarm monthly at someday */ +#define RT_ALARM_YAERLY 0x800 /* alarm yearly at a certain date */ + +/* alarm control cmd */ +#define RT_ALARM_CTRL_MODIFY 1 /* modify alarm time or alarm flag */ + +typedef struct rt_alarm *rt_alarm_t; +typedef void (*rt_alarm_callback_t)(rt_alarm_t alarm, time_t timestamp); + +/* used for low level RTC driver */ +struct rt_rtc_wkalarm +{ + rt_bool_t enable; /* 0 = alarm disabled, 1 = alarm enabled */ + rt_int32_t tm_sec; /* alarm at tm_sec */ + rt_int32_t tm_min; /* alarm at tm_min */ + rt_int32_t tm_hour; /* alarm at tm_hour */ +}; + +struct rt_alarm +{ + rt_list_t list; + rt_uint32_t flag; + rt_alarm_callback_t callback; + struct tm wktime; +}; + +struct rt_alarm_setup +{ + rt_uint32_t flag; /* alarm flag */ + struct tm wktime; /* when will the alarm wake up user */ +}; + +struct rt_alarm_container +{ + rt_list_t head; + struct rt_mutex mutex; + struct rt_event event; + struct rt_alarm *current; +}; + +rt_alarm_t rt_alarm_create(rt_alarm_callback_t callback, + struct rt_alarm_setup *setup); +rt_err_t rt_alarm_control(rt_alarm_t alarm, rt_uint8_t cmd, void *arg); +void rt_alarm_update(rt_device_t dev, rt_uint32_t event); +rt_err_t rt_alarm_delete(rt_alarm_t alarm); +rt_err_t rt_alarm_start(rt_alarm_t alarm); rt_err_t rt_alarm_stop(rt_alarm_t alarm); void rt_alarm_system_init(void); - - #endif /* __ALARM_H__ */