本文整理汇总了C++中rtc_init函数的典型用法代码示例。如果您正苦于以下问题:C++ rtc_init函数的具体用法?C++ rtc_init怎么用?C++ rtc_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rtc_init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: pch_rtc_init
static void pch_rtc_init(pci_dev_t dev)
{
int rtc_failed;
u8 reg8;
reg8 = pci_read_config8(dev, GEN_PMCON_3);
rtc_failed = reg8 & RTC_BATTERY_DEAD;
if (rtc_failed) {
reg8 &= ~RTC_BATTERY_DEAD;
pci_write_config8(dev, GEN_PMCON_3, reg8);
}
debug("rtc_failed = 0x%x\n", rtc_failed);
#if CONFIG_HAVE_ACPI_RESUME
/* Avoid clearing pending interrupts and resetting the RTC control
* register in the resume path because the Linux kernel relies on
* this to know if it should restart the RTC timerqueue if the wake
* was due to the RTC alarm.
*/
if (acpi_get_slp_type() == 3)
return;
#endif
/* TODO: Handle power failure */
if (rtc_failed)
printf("RTC power failed\n");
rtc_init();
}
开发者ID:150balbes,项目名称:Amlogic_S905-u-boot,代码行数:27,代码来源:lpc.c
示例2: init
static void init(void) {
usart1_init(115200, buf_in, ARR_LEN(buf_in), buf_out, ARR_LEN(buf_out));
rtc_init();
sei();
puts_P(PSTR("Init complete\n\n"));
}
开发者ID:UnicornRaceEngineering,项目名称:g5-nodes,代码行数:7,代码来源:main.c
示例3: rtc_get
/* Read the time from the RTC_STAT. time_in_seconds is seconds since Jan 1970 */
int rtc_get(struct rtc_time *tmp)
{
uint32_t cur_rtc_stat;
int time_in_sec;
int tm_sec, tm_min, tm_hr, tm_day;
pr_stamp();
if (tmp == NULL) {
puts("Error getting the date/time\n");
return -1;
}
rtc_init();
wait_for_complete();
/* Read the RTC_STAT register */
cur_rtc_stat = bfin_read_RTC_STAT();
/* Convert our encoded format into actual time values */
tm_sec = (cur_rtc_stat & RTC_SEC) >> RTC_SEC_P;
tm_min = (cur_rtc_stat & RTC_MIN) >> RTC_MIN_P;
tm_hr = (cur_rtc_stat & RTC_HR ) >> RTC_HR_P;
tm_day = (cur_rtc_stat & RTC_DAY) >> RTC_DAY_P;
/* Calculate the total number of seconds since epoch */
time_in_sec = (tm_sec) + MIN_TO_SECS(tm_min) + HRS_TO_SECS(tm_hr) + DAYS_TO_SECS(tm_day);
to_tm(time_in_sec, tmp);
return 0;
}
开发者ID:DeviceSolutions,项目名称:u-boot-opal6,代码行数:32,代码来源:bfin_rtc.c
示例4: main
int main(void)
{
#ifdef MODULE_LTC4150
ltc4150_start();
#endif
#ifdef FEATURE_PERIPH_RTC
rtc_init();
#endif
#ifdef MODULE_NETIF
gnrc_netreg_entry_t dump;
dump.pid = gnrc_pktdump_pid;
dump.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &dump);
#endif
(void) puts("Welcome to RIOT!");
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
return 0;
}
开发者ID:AdamRLukaitis,项目名称:RIOT,代码行数:25,代码来源:main.c
示例5: esp_clk_init
/*
* This function is not exposed as an API at this point,
* because FreeRTOS doesn't yet support dynamic changing of
* CPU frequency. Also we need to implement hooks for
* components which want to be notified of CPU frequency
* changes.
*/
void esp_clk_init(void)
{
rtc_config_t cfg = RTC_CONFIG_DEFAULT();
rtc_init(cfg);
rtc_clk_fast_freq_set(RTC_FAST_FREQ_8M);
#ifdef CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL
select_rtc_slow_clk(RTC_SLOW_FREQ_32K_XTAL);
#else
select_rtc_slow_clk(RTC_SLOW_FREQ_RTC);
#endif
uint32_t freq_mhz = CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ;
rtc_cpu_freq_t freq = RTC_CPU_FREQ_80M;
switch(freq_mhz) {
case 240:
freq = RTC_CPU_FREQ_240M;
break;
case 160:
freq = RTC_CPU_FREQ_160M;
break;
default:
freq_mhz = 80;
/* no break */
case 80:
freq = RTC_CPU_FREQ_80M;
break;
}
// Wait for UART TX to finish, otherwise some UART output will be lost
// when switching APB frequency
uart_tx_wait_idle(CONFIG_CONSOLE_UART_NUM);
rtc_clk_cpu_freq_set(freq);
}
开发者ID:mr-nice,项目名称:esp-idf,代码行数:41,代码来源:clk.c
示例6: main
int main()
{
InitGPIO();
InitBKP();
Set_System();
Set_USBClock();
USB_Interrupts_Config();
USB_Init();
rtc_init();
/*
RTC_t date;
date.year = 2015;
date.month = 10;
date.mday = 24;
date.hour = 23;
date.min = 20;
date.sec = 0;
rtc_settime(&date);
*/
// Start Task //
xTaskCreate(vLcdTask, "vLcdTask", configMINIMAL_STACK_SIZE * 1, NULL, tskIDLE_PRIORITY + 1, &xHandleLcdTask);
xTaskCreate(vDebugTask, "vDebugTask", configMINIMAL_STACK_SIZE * 1, NULL, tskIDLE_PRIORITY + 1, &xHandleDebugTask);
// Start scheduler //
osKernelStart(NULL, NULL);
}
开发者ID:IvanOrfanidi,项目名称:STM32-Tests-Project,代码行数:33,代码来源:main.c
示例7: rtc_write
void rtc_write(time_t t)
{
if (! rtc_inited) {
rtc_init();
}
// Convert timestamp to struct tm
struct tm *timeinfo = localtime(&t);
S_RTC_TIME_DATA_T rtc_datetime;
// Convert S_RTC_TIME_DATA_T to struct tm
rtc_datetime.u32Year = timeinfo->tm_year + YEAR0;
rtc_datetime.u32Month = timeinfo->tm_mon + 1;
rtc_datetime.u32Day = timeinfo->tm_mday;
rtc_datetime.u32DayOfWeek = timeinfo->tm_wday;
rtc_datetime.u32Hour = timeinfo->tm_hour;
rtc_datetime.u32Minute = timeinfo->tm_min;
rtc_datetime.u32Second = timeinfo->tm_sec;
rtc_datetime.u32TimeScale = RTC_CLOCK_24;
// NOTE: Timing issue with write to RTC registers. This delay is empirical, not rational.
RTC_SetDateAndTime(&rtc_datetime);
//nu_nop(6000);
wait_us(100);
}
开发者ID:akselsm,项目名称:mbed,代码行数:26,代码来源:rtc_api.c
示例8: main
/**
* MCU: Atmega328
* Fuses: Oscilador interno a 8 Mhz (sin dividir por 8)
* -U lfuse:w:0xe2:m -U hfuse:w:0xd1:m -U efuse:w:0x07:m
*/
int main(void) {
adc_init();
timer0_init(timer0_callback);
i2c_init();
rtc_init(rtc);
rtc_sqw_rate(rtc, 1);
rtc_sqw_enable(rtc);
rtc_clock_start(rtc);
eMBInit(MB_RTU, 0x03, 0, 9600, MB_PAR_NONE);
eMBSetSlaveID(0x3, TRUE, (UCHAR*) "demeter", 8);
eMBEnable();
blinkenlight(5, 100);
parameters_init();
ports_init();
f_mount(&fs, "", 0);
update_log_filename();
while (1) {
eMBPoll();
update_state();
_delay_ms(100);
}
return (0);
}
开发者ID:szaffarano,项目名称:demeter,代码行数:39,代码来源:demeter.c
示例9: rtc_read
time_t rtc_read(void)
{
// NOTE: After boot, RTC time registers are not synced immediately, about 1 sec latency.
// RTC time got (through RTC_GetDateAndTime()) in this sec would be last-synced and incorrect.
// NUC472/M453: Known issue
// M487: Fixed
if (! rtc_isenabled()) {
rtc_init();
}
S_RTC_TIME_DATA_T rtc_datetime;
RTC_GetDateAndTime(&rtc_datetime);
struct tm timeinfo;
// Convert struct tm to S_RTC_TIME_DATA_T
timeinfo.tm_year = rtc_datetime.u32Year - YEAR0;
timeinfo.tm_mon = rtc_datetime.u32Month - 1;
timeinfo.tm_mday = rtc_datetime.u32Day;
timeinfo.tm_wday = rtc_datetime.u32DayOfWeek;
timeinfo.tm_hour = rtc_datetime.u32Hour;
if (rtc_datetime.u32TimeScale == RTC_CLOCK_12 && rtc_datetime.u32AmPm == RTC_PM) {
timeinfo.tm_hour += 12;
}
timeinfo.tm_min = rtc_datetime.u32Minute;
timeinfo.tm_sec = rtc_datetime.u32Second;
// Convert to timestamp
time_t t;
if (_rtc_maketime(&timeinfo, &t, RTC_FULL_LEAP_YEAR_SUPPORT) == false) {
return 0;
}
return t;
}
开发者ID:Archcady,项目名称:mbed-os,代码行数:35,代码来源:rtc_api.c
示例10: rtc_read
time_t rtc_read(void)
{
if (! rtc_inited) {
rtc_init();
}
S_RTC_TIME_DATA_T rtc_datetime;
RTC_GetDateAndTime(&rtc_datetime);
struct tm timeinfo;
// Convert struct tm to S_RTC_TIME_DATA_T
timeinfo.tm_year = rtc_datetime.u32Year - YEAR0;
timeinfo.tm_mon = rtc_datetime.u32Month - 1;
timeinfo.tm_mday = rtc_datetime.u32Day;
timeinfo.tm_wday = rtc_datetime.u32DayOfWeek;
timeinfo.tm_hour = rtc_datetime.u32Hour;
timeinfo.tm_min = rtc_datetime.u32Minute;
timeinfo.tm_sec = rtc_datetime.u32Second;
// Convert to timestamp
time_t t = mktime(&timeinfo);
return t;
}
开发者ID:akselsm,项目名称:mbed,代码行数:25,代码来源:rtc_api.c
示例11: rtc_write
void rtc_write(time_t t)
{
if (! rtc_isenabled()) {
rtc_init();
}
// Convert timestamp to struct tm
struct tm timeinfo;
if (_rtc_localtime(t, &timeinfo, RTC_FULL_LEAP_YEAR_SUPPORT) == false) {
return;
}
S_RTC_TIME_DATA_T rtc_datetime;
// Convert S_RTC_TIME_DATA_T to struct tm
rtc_datetime.u32Year = timeinfo.tm_year + YEAR0;
rtc_datetime.u32Month = timeinfo.tm_mon + 1;
rtc_datetime.u32Day = timeinfo.tm_mday;
rtc_datetime.u32DayOfWeek = timeinfo.tm_wday;
rtc_datetime.u32Hour = timeinfo.tm_hour;
rtc_datetime.u32Minute = timeinfo.tm_min;
rtc_datetime.u32Second = timeinfo.tm_sec;
rtc_datetime.u32TimeScale = RTC_CLOCK_24;
// NOTE: Timing issue with write to RTC registers. This delay is empirical, not rational.
RTC_SetDateAndTime(&rtc_datetime);
wait_us(100);
}
开发者ID:Archcady,项目名称:mbed-os,代码行数:28,代码来源:rtc_api.c
示例12: WindowGetSuite
CuSuite* WindowGetSuite(void)
{
CuSuite* suite = CuSuiteNew("ui");
rtc_init();
memlcd_DriverInit();
GrContextInit(&context, &g_memlcd_Driver);
window_init(0);
status_process(EVENT_WINDOW_CREATED, 0, NULL);
SUITE_ADD_TEST(suite, TestScriptEngine);
SUITE_ADD_TEST(suite, TestTriagle);
SUITE_ADD_TEST(suite, TestWideFont);
SUITE_ADD_TEST(suite, TestSportWatch);
SUITE_ADD_TEST(suite, TestTestButton);
SUITE_ADD_TEST(suite, TestTestLight);
SUITE_ADD_TEST(suite, TestTestLcd);
SUITE_ADD_TEST(suite, TestPhoneScreen);
SUITE_ADD_TEST(suite, TestNotification);
SUITE_ADD_TEST(suite, TestControl);
SUITE_ADD_TEST(suite, TestWelcome);
SUITE_ADD_TEST(suite, TestBtConfig);
SUITE_ADD_TEST(suite, TestFontConfig);
SUITE_ADD_TEST(suite, TestSleep);
SUITE_ADD_TEST(suite, TestWindows);
SUITE_ADD_TEST(suite, SimluateRun);
return suite;
}
开发者ID:Sowhat2112,项目名称:KreyosFirmware,代码行数:33,代码来源:windowTest.c
示例13: kmain
kmain() {
terminal_init();
setup_IDT_entry (&idt[0x08], 0x08, (dword)&_int_08_hand, ACS_INT, 0);
setup_IDT_entry (&idt[0x09], 0x08, (dword)&_int_09_hand, ACS_INT, 0);
setup_IDT_entry (&idt[0x74], 0x08, (dword)&_int_74_hand, ACS_INT, 0);
setup_IDT_entry (&idt[0x80], 0x08, (dword)&_int_80_hand, ACS_INT, 0);
/* IDTR Setting */
idtr.base = 0;
idtr.base +=(dword) &idt;
idtr.limit = sizeof(idt)-1;
_lidt(&idtr);
/* Interrupt unmasking */
_cli();
_maskPIC1(0xF8); /*0XF8*/
_maskPIC2(0xEF); /*0XEF*/
_sti();
video_init();
timertick_init();
rtc_init();
mouse_init();
shell_run();
}
开发者ID:tcolloca,项目名称:loco-mouseOS,代码行数:32,代码来源:kernel.c
示例14: rtc_get
int
rtc_get(struct rtc_time *tmp)
{
int rel = 0;
struct ds1302_st bbclk;
if(!ds1302_initted) rtc_init();
read_ser_drv(0xbe,(unsigned char *)&bbclk, 8); /* read burst */
if (bbclk.CH) {
printf("ds1302: rtc_get: Clock was halted, clock probably "
"corrupt\n");
rel = -1;
}
tmp->tm_sec=10*bbclk.sec10+bbclk.sec;
tmp->tm_min=10*bbclk.min10+bbclk.min;
tmp->tm_hour=10*bbclk.hr10+bbclk.hr;
tmp->tm_wday=bbclk.day;
tmp->tm_mday=10*bbclk.date10+bbclk.date;
tmp->tm_mon=10*bbclk.month10+bbclk.month;
tmp->tm_year=10*bbclk.year10+bbclk.year + 1900;
tmp->tm_yday = 0;
tmp->tm_isdst= 0;
DPRINTF("Get DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n",
tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
tmp->tm_hour, tmp->tm_min, tmp->tm_sec );
return rel;
}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:33,代码来源:ds1302.c
示例15: setupHardware
static int setupHardware( void )
{
// When using the JTAG debugger the hardware is not always initialised to
// the correct default state. This line just ensures that this does not
// cause all interrupts to be masked at the start.
AT91C_BASE_AIC->AIC_EOICR = 0;
// Enable the peripheral clock.
AT91F_PMC_EnablePeriphClock( AT91C_BASE_PMC, (1 << AT91C_ID_PIOA) | //Enable Clock for PIO
(1 << AT91C_ID_IRQ0) | //Enable Clock for IRQ0
(1 << AT91C_ID_PWMC) | //Enable Clock for the PWM controller
(1 << AT91C_ID_US0) | //USART0
(1 << AT91C_ID_US1) //USART1
);
// Enable reset-button
AT91F_RSTSetMode( AT91C_BASE_RSTC , AT91C_RSTC_URSTEN );
if (!initUsart()) return 0;
if (!vInitUSBInterface()) return 0;
init_serial();
rtc_init();
InitLoggerHardware();
return 1;
}
开发者ID:jrwiebe,项目名称:RaceCapture-Pro_firmware,代码行数:29,代码来源:main.c
示例16: main
void
main(void)
{
twi_master_init();
mpu6500_init();
mpu6500_stop();
disable_i2c();
simble_init("Motion");
motion_ctx.sampling_period = DEFAULT_SAMPLING_PERIOD;
//Set the timer parameters and initialize it.
struct rtc_ctx rtc_ctx = {
.rtc_x[NOTIF_TIMER_ID] = {
.type = PERIODIC,
.period = motion_ctx.sampling_period,
.enabled = false,
.cb = notif_timer_cb,
}
};
batt_serv_init(&rtc_ctx);
rtc_init(&rtc_ctx);
ind_init();
motion_init(&motion_ctx);
simble_adv_start();
simble_process_event_loop();
}
开发者ID:tralamazza,项目名称:relayr-firmware-nrf51-modules,代码行数:29,代码来源:motion.c
示例17: bsp_init
void bsp_init(void)
{
HAL_Init();
/* Configure the system clock */
BSP_SystemClock_Config();
/* Configure LED0 */
BSP_LED_Init(LED0);
/*UART2 init*/
UART_Init();
HAL_Delay(1000);
/*sensor layer init*/
#ifdef SENSOR_FIFO
jsensor_sys_init();
#endif
/* Initialize the BlueNRG SPI driver */
BNRG_SPI_Init();
/* Initialize the BlueNRG HCI */
HCI_Init();
/* Reset BlueNRG hardware */
BlueNRG_RST();
/* Enable Power Clock */
__HAL_RCC_PWR_CLK_ENABLE();
rtc_init();
}
开发者ID:Sleepsleep,项目名称:STM32_Platform,代码行数:25,代码来源:bsp_common.c
示例18: main
int main(void) {
// init clocks
clock_init();
// init GPIO pin states
gpio_init();
// init serial console
console_init();
// wait for RTC to start up
delay_ms(1000);
// init RTC
rtc_init();
// init calibration
cal_init();
// init display (rtc_init(), cal_init() must must be called first!)
display_init();
// call menu
menu();
}
开发者ID:gmarsh,项目名称:thin18,代码行数:26,代码来源:main.c
示例19: rtc_set
/* Set the time. Get the time_in_secs which is the number of seconds since Jan 1970 and set the RTC registers
* based on this value.
*/
int rtc_set(struct rtc_time *tmp)
{
unsigned long remain, days, hrs, mins, secs;
pr_stamp();
if (tmp == NULL) {
puts("Error setting the date/time\n");
return -1;
}
rtc_init();
wait_for_complete();
/* Calculate number of seconds this incoming time represents */
remain = mktime(tmp->tm_year, tmp->tm_mon, tmp->tm_mday,
tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
/* Figure out how many days since epoch */
days = remain / NUM_SECS_IN_DAY;
/* From the remaining secs, compute the hrs(0-23), mins(0-59) and secs(0-59) */
remain = remain % NUM_SECS_IN_DAY;
hrs = remain / NUM_SECS_IN_HR;
remain = remain % NUM_SECS_IN_HR;
mins = remain / NUM_SECS_IN_MIN;
secs = remain % NUM_SECS_IN_MIN;
/* Encode these time values into our RTC_STAT register */
bfin_write_RTC_STAT(SET_ALARM(days, hrs, mins, secs));
return 0;
}
开发者ID:DeviceSolutions,项目名称:u-boot-opal6,代码行数:36,代码来源:bfin_rtc.c
示例20: rtc_attach
static void
rtc_attach(device_t parent, device_t self, void *aux)
{
struct rtc_softc *sc = device_private(self);
struct apb_attach_args *aa = aux;
static int rtc_attached = 0;
sc->sc_dev = self;
sc->sc_iot = aa->aa_iot;
if (rtc_attached) {
aprint_error_dev(sc->sc_dev, "rtc is already attached\n");
return;
}
if (bus_space_map(sc->sc_iot, aa->aa_addr, aa->aa_size, 0,
&sc->sc_hdl))
{
aprint_error_dev(sc->sc_dev, "Unable to map bus space\n");
return;
}
rtc_init(sc);
rtc_reset(sc);
aprint_normal("\n");
rtc_attached = 1;
return;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:32,代码来源:imx23_rtc.c
注:本文中的rtc_init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论