Lines Matching refs:data
62 uchar data[8]; in rtc_dump() local
64 if (i2c_read(CONFIG_SYS_I2C_RTC_ADDR, 0, 1, data, sizeof(data))) { in rtc_dump()
69 label, data[0], data[1], data[2], data[3], in rtc_dump()
70 data[4], data[5], data[6], data[7]); in rtc_dump()
89 static uchar data[8]; in rtc_validate() local
93 if (i2c_read(CONFIG_SYS_I2C_RTC_ADDR, 0, 1, data, sizeof(data))) { in rtc_validate()
101 if (0x00 != (data[RTC_CTRL] & 0x80)) { in rtc_validate()
103 data[RTC_SEC] = 0x80; in rtc_validate()
104 if (i2c_write(CONFIG_SYS_I2C_RTC_ADDR, RTC_SEC, 1, data, 1)) { in rtc_validate()
113 min = data[RTC_MIN] & 0x7F; in rtc_validate()
114 date = data[RTC_DATE]; in rtc_validate()
115 month = data[RTC_MONTH] & 0x3F; in rtc_validate()
116 years = data[RTC_YEAR]; in rtc_validate()
117 if (0x59 < data[RTC_SEC] || 0x09 < (data[RTC_SEC] & 0x0F) || in rtc_validate()
119 0x23 < data[RTC_HOUR] || 0x09 < (data[RTC_HOUR] & 0x0F) || in rtc_validate()
120 0x07 < data[RTC_DAY] || 0x00 == data[RTC_DAY] || in rtc_validate()
126 (0x00 == years && 0x00 != (data[RTC_MONTH] & 0xC0))))) { in rtc_validate()
131 data[RTC_SEC] = 0x00; in rtc_validate()
132 data[RTC_MIN] &= 0x80; /* preserve OFIE bit */ in rtc_validate()
133 data[RTC_HOUR] = 0x00; in rtc_validate()
134 data[RTC_DAY] = 0x02; in rtc_validate()
135 data[RTC_DATE] = 0x01; in rtc_validate()
136 data[RTC_MONTH] = 0xC1; in rtc_validate()
137 data[RTC_YEAR] = 0x00; in rtc_validate()
138 data[RTC_CTRL] &= 0x7F; /* reset OUT bit */ in rtc_validate()
140 if (i2c_write(CONFIG_SYS_I2C_RTC_ADDR, 0, 1, data, sizeof(data))) { in rtc_validate()
145 return data; in rtc_validate()
150 uchar const *const data = rtc_validate(); in rtc_get() local
152 if (!data) in rtc_get()
155 tmp->tm_sec = bcd2bin(data[RTC_SEC] & 0x7F); in rtc_get()
156 tmp->tm_min = bcd2bin(data[RTC_MIN] & 0x7F); in rtc_get()
157 tmp->tm_hour = bcd2bin(data[RTC_HOUR] & 0x3F); in rtc_get()
158 tmp->tm_mday = bcd2bin(data[RTC_DATE] & 0x3F); in rtc_get()
159 tmp->tm_mon = bcd2bin(data[RTC_MONTH] & 0x1F); in rtc_get()
160 tmp->tm_year = cb2year(data[RTC_MONTH] >> 6) + bcd2bin(data[RTC_YEAR]); in rtc_get()
161 tmp->tm_wday = bcd2bin(data[RTC_DAY] & 0x07) - 1; in rtc_get()
174 uchar *const data = rtc_validate(); in rtc_set() local
176 if (!data) in rtc_set()
183 data[RTC_SEC] = (data[RTC_SEC] & 0x80) | (bin2bcd(tmp->tm_sec) & 0x7F); in rtc_set()
184 data[RTC_MIN] = (data[RTC_MIN] & 0X80) | (bin2bcd(tmp->tm_min) & 0X7F); in rtc_set()
185 data[RTC_HOUR] = bin2bcd(tmp->tm_hour) & 0x3F; in rtc_set()
186 data[RTC_DATE] = bin2bcd(tmp->tm_mday) & 0x3F; in rtc_set()
187 data[RTC_MONTH] = bin2bcd(tmp->tm_mon) & 0x1F; in rtc_set()
188 data[RTC_YEAR] = bin2bcd(tmp->tm_year % 100); in rtc_set()
189 data[RTC_MONTH] |= year2cb(tmp->tm_year) << 6; in rtc_set()
190 data[RTC_DAY] = bin2bcd(tmp->tm_wday + 1) & 0x07; in rtc_set()
191 if (i2c_write(CONFIG_SYS_I2C_RTC_ADDR, 0, 1, data, RTC_REG_CNT)) { in rtc_set()
201 uchar *const data = rtc_validate(); in rtc_reset() local
204 if (!data) in rtc_reset()
220 if ((data[RTC_CTRL] & 0x3F) != l) { in rtc_reset()
223 data[RTC_CTRL] &= 0xC0; in rtc_reset()
224 data[RTC_CTRL] |= (uchar) l; in rtc_reset()
233 data[RTC_CTRL] &= 0xBF; in rtc_reset()
234 if (i2c_write(CONFIG_SYS_I2C_RTC_ADDR, RTC_CTRL, 1, data + RTC_CTRL, 1)) { in rtc_reset()