| /openbmc/u-boot/drivers/rtc/ |
| H A D | x1205.c | 87 int rtc_get(struct rtc_time *tm) in rtc_get() argument 99 tm->tm_sec = bcd2bin(buf[CCR_SEC]); in rtc_get() 100 tm->tm_min = bcd2bin(buf[CCR_MIN]); in rtc_get() 101 tm->tm_hour = bcd2bin(buf[CCR_HOUR] & 0x3F); /* hr is 0-23 */ in rtc_get() 102 tm->tm_mday = bcd2bin(buf[CCR_MDAY]); in rtc_get() 103 tm->tm_mon = bcd2bin(buf[CCR_MONTH]); /* mon is 0-11 */ in rtc_get() 104 tm->tm_year = bcd2bin(buf[CCR_YEAR]) in rtc_get() 106 tm->tm_wday = buf[CCR_WDAY]; in rtc_get() 111 tm->tm_sec, tm->tm_min, tm->tm_hour, in rtc_get() 112 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); in rtc_get() [all …]
|
| H A D | m41t62.c | 56 static void m41t62_update_rtc_time(struct rtc_time *tm, u8 *buf) in m41t62_update_rtc_time() argument 64 tm->tm_sec = bcd2bin(buf[M41T62_REG_SEC] & 0x7f); in m41t62_update_rtc_time() 65 tm->tm_min = bcd2bin(buf[M41T62_REG_MIN] & 0x7f); in m41t62_update_rtc_time() 66 tm->tm_hour = bcd2bin(buf[M41T62_REG_HOUR] & 0x3f); in m41t62_update_rtc_time() 67 tm->tm_mday = bcd2bin(buf[M41T62_REG_DAY] & 0x3f); in m41t62_update_rtc_time() 68 tm->tm_wday = buf[M41T62_REG_WDAY] & 0x07; in m41t62_update_rtc_time() 69 tm->tm_mon = bcd2bin(buf[M41T62_REG_MON] & 0x1f); in m41t62_update_rtc_time() 73 tm->tm_year = bcd2bin(buf[M41T62_REG_YEAR]) + 100 + 1900; in m41t62_update_rtc_time() 78 tm->tm_sec, tm->tm_min, tm->tm_hour, in m41t62_update_rtc_time() 79 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); in m41t62_update_rtc_time() [all …]
|
| H A D | pcf2127.c | 25 static int pcf2127_rtc_set(struct udevice *dev, const struct rtc_time *tm) in pcf2127_rtc_set() argument 34 buf[i++] = bin2bcd(tm->tm_sec); in pcf2127_rtc_set() 35 buf[i++] = bin2bcd(tm->tm_min); in pcf2127_rtc_set() 36 buf[i++] = bin2bcd(tm->tm_hour); in pcf2127_rtc_set() 37 buf[i++] = bin2bcd(tm->tm_mday); in pcf2127_rtc_set() 38 buf[i++] = tm->tm_wday & 0x07; in pcf2127_rtc_set() 41 buf[i++] = bin2bcd(tm->tm_mon + 1); in pcf2127_rtc_set() 44 buf[i++] = bin2bcd(tm->tm_year % 100); in pcf2127_rtc_set() 52 static int pcf2127_rtc_get(struct udevice *dev, struct rtc_time *tm) in pcf2127_rtc_get() argument 67 tm->tm_sec = bcd2bin(buf[PCF2127_REG_SC] & 0x7F); in pcf2127_rtc_get() [all …]
|
| H A D | s35392a.c | 131 static int validate_time(const struct rtc_time *tm) in validate_time() argument 133 if ((tm->tm_year < 2000) || (tm->tm_year > 2099)) in validate_time() 136 if ((tm->tm_mon < 1) || (tm->tm_mon > 12)) in validate_time() 139 if ((tm->tm_mday < 1) || (tm->tm_mday > 31)) in validate_time() 142 if ((tm->tm_wday < 0) || (tm->tm_wday > 6)) in validate_time() 145 if ((tm->tm_hour < 0) || (tm->tm_hour > 23)) in validate_time() 148 if ((tm->tm_min < 0) || (tm->tm_min > 59)) in validate_time() 151 if ((tm->tm_sec < 0) || (tm->tm_sec > 59)) in validate_time() 193 static int s35392a_rtc_get(DEV_TYPE *dev, struct rtc_time *tm) in s35392a_rtc_get() argument 213 tm->tm_sec = bcd2bin(date[S35390A_BYTE_SECS]); in s35392a_rtc_get() [all …]
|
| H A D | date.c | 30 int rtc_calc_weekday(struct rtc_time *tm) in rtc_calc_weekday() argument 36 if (tm->tm_year < 1753) in rtc_calc_weekday() 38 last_year = tm->tm_year - 1; in rtc_calc_weekday() 49 if (tm->tm_year % 4 == 0 && in rtc_calc_weekday() 50 ((tm->tm_year % 100 != 0) || (tm->tm_year % 400 == 0)) && in rtc_calc_weekday() 51 tm->tm_mon > 2) { in rtc_calc_weekday() 58 day += last_year * 365 + leaps_to_date + month_offset[tm->tm_mon - 1] + in rtc_calc_weekday() 59 tm->tm_mday; in rtc_calc_weekday() 60 tm->tm_wday = day % 7; in rtc_calc_weekday() 81 unsigned long rtc_mktime(const struct rtc_time *tm) in rtc_mktime() argument [all …]
|
| H A D | pl031.c | 63 static int pl031_get(struct udevice *dev, struct rtc_time *tm) in pl031_get() argument 67 if (!tm) in pl031_get() 72 rtc_to_tm(tim, tm); in pl031_get() 75 tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_wday, in pl031_get() 76 tm->tm_hour, tm->tm_min, tm->tm_sec); in pl031_get() 84 static int pl031_set(struct udevice *dev, const struct rtc_time *tm) in pl031_set() argument 88 if (!tm) in pl031_set() 92 tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_wday, in pl031_set() 93 tm->tm_hour, tm->tm_min, tm->tm_sec); in pl031_set() 96 tim = rtc_mktime(tm); in pl031_set()
|
| H A D | m41t94.c | 36 int rtc_set(struct rtc_time *tm) in rtc_set() argument 51 buf[M41T94_REG_SECONDS] = bin2bcd(tm->tm_sec); in rtc_set() 52 buf[M41T94_REG_MINUTES] = bin2bcd(tm->tm_min); in rtc_set() 53 buf[M41T94_REG_HOURS] = bin2bcd(tm->tm_hour); in rtc_set() 54 buf[M41T94_REG_WDAY] = bin2bcd(tm->tm_wday + 1); in rtc_set() 55 buf[M41T94_REG_DAY] = bin2bcd(tm->tm_mday); in rtc_set() 56 buf[M41T94_REG_MONTH] = bin2bcd(tm->tm_mon + 1); in rtc_set() 59 if (tm->tm_year >= 100) in rtc_set() 61 buf[M41T94_REG_YEAR] = bin2bcd(tm->tm_year % 100); in rtc_set() 68 int rtc_get(struct rtc_time *tm) in rtc_get() argument [all …]
|
| H A D | rtc-lib.c | 38 void rtc_to_tm(u64 time, struct rtc_time *tm) in rtc_to_tm() argument 46 tm->tm_wday = (days + 4) % 7; in rtc_to_tm() 56 tm->tm_year = year; /* Not year - 1900 */ in rtc_to_tm() 57 tm->tm_yday = days + 1; in rtc_to_tm() 67 tm->tm_mon = month + 1; /* January = 1 */ in rtc_to_tm() 68 tm->tm_mday = days + 1; in rtc_to_tm() 70 tm->tm_hour = secs / 3600; in rtc_to_tm() 71 secs -= tm->tm_hour * 3600; in rtc_to_tm() 72 tm->tm_min = secs / 60; in rtc_to_tm() 73 tm->tm_sec = secs - tm->tm_min * 60; in rtc_to_tm() [all …]
|
| H A D | ds1307.c | 208 static int ds1307_rtc_set(struct udevice *dev, const struct rtc_time *tm) in ds1307_rtc_set() argument 215 tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_wday, in ds1307_rtc_set() 216 tm->tm_hour, tm->tm_min, tm->tm_sec); in ds1307_rtc_set() 218 if (tm->tm_year < 1970 || tm->tm_year > 2069) in ds1307_rtc_set() 221 buf[RTC_YR_REG_ADDR] = bin2bcd(tm->tm_year % 100); in ds1307_rtc_set() 222 buf[RTC_MON_REG_ADDR] = bin2bcd(tm->tm_mon); in ds1307_rtc_set() 223 buf[RTC_DAY_REG_ADDR] = bin2bcd(tm->tm_wday + 1); in ds1307_rtc_set() 224 buf[RTC_DATE_REG_ADDR] = bin2bcd(tm->tm_mday); in ds1307_rtc_set() 225 buf[RTC_HR_REG_ADDR] = bin2bcd(tm->tm_hour); in ds1307_rtc_set() 226 buf[RTC_MIN_REG_ADDR] = bin2bcd(tm->tm_min); in ds1307_rtc_set() [all …]
|
| H A D | rx8010sj.c | 121 static int validate_time(const struct rtc_time *tm) in validate_time() argument 123 if ((tm->tm_year < 2000) || (tm->tm_year > 2099)) in validate_time() 126 if ((tm->tm_mon < 1) || (tm->tm_mon > 12)) in validate_time() 129 if ((tm->tm_mday < 1) || (tm->tm_mday > 31)) in validate_time() 132 if ((tm->tm_wday < 0) || (tm->tm_wday > 6)) in validate_time() 135 if ((tm->tm_hour < 0) || (tm->tm_hour > 23)) in validate_time() 138 if ((tm->tm_min < 0) || (tm->tm_min > 59)) in validate_time() 141 if ((tm->tm_sec < 0) || (tm->tm_sec > 59)) in validate_time() 249 static int rx8010sj_rtc_set(DEV_TYPE *dev, const struct rtc_time *tm) in rx8010sj_rtc_set() argument 255 ret = validate_time(tm); in rx8010sj_rtc_set() [all …]
|
| H A D | rv3029.c | 75 static int rv3029_rtc_get(struct udevice *dev, struct rtc_time *tm) in rv3029_rtc_get() argument 86 tm->tm_sec = bcd2bin(regs[RV3029_W_SEC - RV3029_W_SEC]); in rv3029_rtc_get() 87 tm->tm_min = bcd2bin(regs[RV3029_W_MINUTES - RV3029_W_SEC]); in rv3029_rtc_get() 95 tm->tm_hour = bcd2bin(_hr & 0x1f); in rv3029_rtc_get() 97 tm->tm_hour += 12; in rv3029_rtc_get() 100 tm->tm_hour = bcd2bin(_hr & 0x3f); in rv3029_rtc_get() 104 tm->tm_mday = bcd2bin(regs[RV3029_W_DATE - RV3029_W_SEC]); in rv3029_rtc_get() 105 tm->tm_mon = bcd2bin(regs[RV3029_W_MONTHS - RV3029_W_SEC]) - 1; in rv3029_rtc_get() 107 tm->tm_year = bcd2bin(regs[RV3029_W_YEARS - RV3029_W_SEC]) + 2000; in rv3029_rtc_get() 108 tm->tm_wday = bcd2bin(regs[RV3029_W_DAYS - RV3029_W_SEC]) - 1; in rv3029_rtc_get() [all …]
|
| /openbmc/qemu/hw/timer/ |
| H A D | pxa2xx_timer.c | 81 PXA2xxTimer0 tm; member 148 timer_del(s->tm4[n].tm.qtimer); in pxa2xx_timer_update4() 156 new_qemu = now_qemu + muldiv64((uint32_t) (s->tm4[n].tm.value - now_vm), in pxa2xx_timer_update4() 158 timer_mod(s->tm4[n].tm.qtimer, new_qemu); in pxa2xx_timer_update4() 165 int tm = 0; in pxa2xx_timer_read() local 168 case OSMR3: tm ++; in pxa2xx_timer_read() 170 case OSMR2: tm ++; in pxa2xx_timer_read() 172 case OSMR1: tm ++; in pxa2xx_timer_read() 175 return s->timer[tm].value; in pxa2xx_timer_read() 176 case OSMR11: tm ++; in pxa2xx_timer_read() [all …]
|
| /openbmc/openbmc/poky/meta/recipes-extended/at/at/ |
| H A D | posixtm.c | 63 year (struct tm *tm, const int *digit_pair, size_t n, unsigned int syntax_bits) in year() argument 68 tm->tm_year = *digit_pair; in year() 76 tm->tm_year += 100; in year() 83 tm->tm_year = digit_pair[0] * 100 + digit_pair[1] - 1900; in year() 89 struct tm *tmp; in year() 96 tm->tm_year = tmp->tm_year; in year() 108 posix_time_parse (struct tm *tm, const char *s, unsigned int syntax_bits) in posix_time_parse() argument 143 if (year (tm, p, len - 4, syntax_bits)) in posix_time_parse() 150 tm->tm_mon = *p++ - 1; in posix_time_parse() 151 tm->tm_mday = *p++; in posix_time_parse() [all …]
|
| /openbmc/u-boot/post/drivers/ |
| H A D | rtc.c | 59 static void rtc_post_restore (struct rtc_time *tm, unsigned int sec) in rtc_post_restore() argument 61 time_t t = rtc_mktime(tm) + sec; in rtc_post_restore() 118 struct rtc_time tm; in rtc_post_test() local 120 tm.tm_year = ynl; in rtc_post_test() 121 tm.tm_mon = i + 1; in rtc_post_test() 122 tm.tm_mday = daysnl[i]; in rtc_post_test() 123 tm.tm_hour = 23; in rtc_post_test() 124 tm.tm_min = 59; in rtc_post_test() 125 tm.tm_sec = 59; in rtc_post_test() 126 t = rtc_mktime(&tm); in rtc_post_test() [all …]
|
| /openbmc/qemu/system/ |
| H A D | rtc.c | 70 void qemu_get_timedate(struct tm *tm, time_t offset) in qemu_get_timedate() argument 79 gmtime_r(&ti, tm); in qemu_get_timedate() 82 localtime_r(&ti, tm); in qemu_get_timedate() 87 time_t qemu_timedate_diff(struct tm *tm) in qemu_timedate_diff() argument 94 seconds = mktimegm(tm); in qemu_timedate_diff() 98 struct tm tmp = *tm; in qemu_timedate_diff() 113 struct tm tm; in configure_rtc_base_datetime() local 115 if (sscanf(startdate, "%d-%d-%dT%d:%d:%d", &tm.tm_year, &tm.tm_mon, in configure_rtc_base_datetime() 116 &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) == 6) { in configure_rtc_base_datetime() 119 &tm.tm_year, &tm.tm_mon, &tm.tm_mday) == 3) { in configure_rtc_base_datetime() [all …]
|
| /openbmc/u-boot/drivers/ddr/marvell/a38x/ |
| H A D | mv_ddr_topology.c | 48 struct mv_ddr_topology_map *tm = mv_ddr_topology_map_get(); in mv_ddr_topology_map_update() local 49 struct if_params *iface_params = &(tm->interface_params[0]); in mv_ddr_topology_map_update() 60 if (tm->cfg_src == MV_DDR_CFG_SPD) { in mv_ddr_topology_map_update() 62 val = mv_ddr_spd_dev_type_get(&tm->spd_data); in mv_ddr_topology_map_update() 69 if (mv_ddr_spd_timing_calc(&tm->spd_data, tm->timing_data) > 0) { in mv_ddr_topology_map_update() 75 iface_params->bus_width = mv_ddr_spd_dev_width_get(&tm->spd_data); in mv_ddr_topology_map_update() 78 iface_params->memory_size = mv_ddr_spd_die_capacity_get(&tm->spd_data); in mv_ddr_topology_map_update() 81 tm->bus_act_mask = mv_ddr_bus_bit_mask_get(); in mv_ddr_topology_map_update() 84 val = mv_ddr_spd_cs_bit_mask_get(&tm->spd_data); in mv_ddr_topology_map_update() 89 val = mv_ddr_spd_module_type_get(&tm->spd_data); in mv_ddr_topology_map_update() [all …]
|
| /openbmc/qemu/hw/ppc/ |
| H A D | spapr_rtc.c | 39 void spapr_rtc_read(SpaprRtcState *rtc, struct tm *tm, uint32_t *ns) in spapr_rtc_read() argument 50 if (tm) { in spapr_rtc_read() 51 gmtime_r(&guest_s, tm); in spapr_rtc_read() 74 struct tm tm; in rtas_get_time_of_day() local 82 spapr_rtc_read(&spapr->rtc, &tm, &ns); in rtas_get_time_of_day() 85 rtas_st(rets, 1, tm.tm_year + 1900); in rtas_get_time_of_day() 86 rtas_st(rets, 2, tm.tm_mon + 1); in rtas_get_time_of_day() 87 rtas_st(rets, 3, tm.tm_mday); in rtas_get_time_of_day() 88 rtas_st(rets, 4, tm.tm_hour); in rtas_get_time_of_day() 89 rtas_st(rets, 5, tm.tm_min); in rtas_get_time_of_day() [all …]
|
| /openbmc/u-boot/board/ge/common/ |
| H A D | ge_common.c | 13 struct rtc_time tm; in check_time() local 25 ret = rtc_get(&tm); in check_time() 33 if (tm.tm_year > 2037) { in check_time() 34 tm.tm_sec = 0; in check_time() 35 tm.tm_min = 0; in check_time() 36 tm.tm_hour = 0; in check_time() 37 tm.tm_mday = 1; in check_time() 38 tm.tm_wday = 2; in check_time() 39 tm.tm_mon = 1; in check_time() 40 tm.tm_year = 2036; in check_time() [all …]
|
| /openbmc/qemu/hw/rtc/ |
| H A D | m48t59.c | 91 struct tm tm; in alarm_cb() local 101 qemu_get_timedate(&tm, NVRAM->time_offset); in alarm_cb() 102 tm.tm_mon++; in alarm_cb() 103 if (tm.tm_mon == 13) { in alarm_cb() 104 tm.tm_mon = 1; in alarm_cb() 105 tm.tm_year++; in alarm_cb() 107 next_time = qemu_timedate_diff(&tm) - NVRAM->time_offset; in alarm_cb() 147 static inline void get_time(M48t59State *NVRAM, struct tm *tm) in get_time() argument 149 qemu_get_timedate(tm, NVRAM->time_offset); in get_time() 152 static void set_time(M48t59State *NVRAM, struct tm *tm) in set_time() argument [all …]
|
| H A D | ls7a_rtc.c | 113 static uint64_t toy_time_to_val_mon(const struct tm *tm) in toy_time_to_val_mon() argument 117 val = FIELD_DP32(val, TOY, MON, tm->tm_mon + 1); in toy_time_to_val_mon() 118 val = FIELD_DP32(val, TOY, DAY, tm->tm_mday); in toy_time_to_val_mon() 119 val = FIELD_DP32(val, TOY, HOUR, tm->tm_hour); in toy_time_to_val_mon() 120 val = FIELD_DP32(val, TOY, MIN, tm->tm_min); in toy_time_to_val_mon() 121 val = FIELD_DP32(val, TOY, SEC, tm->tm_sec); in toy_time_to_val_mon() 125 static void toymatch_val_to_time(LS7ARtcState *s, uint64_t val, struct tm *tm) in toymatch_val_to_time() argument 127 qemu_get_timedate(tm, s->offset_toy); in toymatch_val_to_time() 128 tm->tm_sec = FIELD_EX32(val, TOY_MATCH, SEC); in toymatch_val_to_time() 129 tm->tm_min = FIELD_EX32(val, TOY_MATCH, MIN); in toymatch_val_to_time() [all …]
|
| /openbmc/phosphor-ipmi-flash/bmc/log-handler/test/ |
| H A D | log_read_unittest.cpp | 41 createMockLogConfigs(blobNames, &im, &tm)); in SetUp() 45 std::unordered_map<std::string, TriggerMock*> tm; member in ipmi_flash::LogReadBlobTest 56 EXPECT_CALL(*tm.at("blob0"), trigger()) in TEST_F() 57 .WillOnce(DoAll([&]() { tm.at("blob0")->cb(*tm.at("blob0")); }, in TEST_F() 59 EXPECT_CALL(*tm.at("blob0"), status()) in TEST_F() 78 EXPECT_CALL(*tm.at("blob0"), trigger()).WillOnce(Return(true)); in TEST_F() 82 EXPECT_CALL(*tm.at("blob0"), status()) in TEST_F() 88 tm.at("blob0")->cb(*tm.at("blob0")); in TEST_F() 90 EXPECT_CALL(*tm.at("blob0"), trigger()).WillOnce(Return(true)); in TEST_F() 93 EXPECT_CALL(*tm.at("blob0"), status()) in TEST_F() [all …]
|
| /openbmc/phosphor-ipmi-flash/bmc/version-handler/test/ |
| H A D | version_read_unittest.cpp | 27 createMockVersionConfigs(blobNames, &im, &tm)); in SetUp() 31 std::unordered_map<std::string, TriggerMock*> tm; member in ipmi_flash::VersionReadBlobTest 42 EXPECT_CALL(*tm.at("blob0"), trigger()) in TEST_F() 43 .WillOnce(DoAll([&]() { tm.at("blob0")->cb(*tm.at("blob0")); }, in TEST_F() 45 EXPECT_CALL(*tm.at("blob0"), status()) in TEST_F() 64 EXPECT_CALL(*tm.at("blob0"), trigger()).WillOnce(Return(true)); in TEST_F() 68 EXPECT_CALL(*tm.at("blob0"), status()) in TEST_F() 74 tm.at("blob0")->cb(*tm.at("blob0")); in TEST_F() 76 EXPECT_CALL(*tm.at("blob0"), trigger()).WillOnce(Return(true)); in TEST_F() 79 EXPECT_CALL(*tm.at("blob0"), status()) in TEST_F() [all …]
|
| /openbmc/u-boot/cmd/ |
| H A D | date.c | 34 struct rtc_time tm; in do_date() local 72 rcode = dm_rtc_get(dev, &tm); in do_date() 74 rcode = rtc_get(&tm); in do_date() 78 if (mk_date(argv[1], &tm) != 0) { in do_date() 84 rcode = dm_rtc_set(dev, &tm); in do_date() 86 rcode = rtc_set(&tm); in do_date() 99 rcode = dm_rtc_get(dev, &tm); in do_date() 101 rcode = rtc_get(&tm); in do_date() 109 tm.tm_year, tm.tm_mon, tm.tm_mday, in do_date() 110 (tm.tm_wday<0 || tm.tm_wday>6) ? in do_date() [all …]
|
| /openbmc/u-boot/lib/efi_selftest/ |
| H A D | efi_selftest_rtc.c | 40 struct efi_time tm; in execute() local 43 ret = runtime->get_time(&tm, NULL); in execute() 55 tm.year, tm.month, tm.day, in execute() 56 tm.hour, tm.minute, tm.second); in execute()
|
| /openbmc/u-boot/net/ |
| H A D | sntp.c | 56 struct rtc_time tm; in sntp_handler() local 72 rtc_to_tm(ntohl(seconds) - 2208988800UL + net_ntp_time_offset, &tm); in sntp_handler() 82 dm_rtc_set(dev, &tm); in sntp_handler() 84 rtc_set(&tm); in sntp_handler() 88 tm.tm_year, tm.tm_mon, tm.tm_mday, in sntp_handler() 89 tm.tm_hour, tm.tm_min, tm.tm_sec); in sntp_handler()
|