Lines Matching refs:data

60 	uchar data[8];  in rtc_dump()  local
62 if (i2c_read(CONFIG_SYS_I2C_RTC_ADDR, 0, 1, data, sizeof(data))) { in rtc_dump()
67 label, data[0], data[1], data[2], data[3], in rtc_dump()
68 data[4], data[5], data[6], data[7]); in rtc_dump()
87 static uchar data[8]; in rtc_validate() local
91 if (i2c_read(CONFIG_SYS_I2C_RTC_ADDR, 0, 1, data, sizeof(data))) { in rtc_validate()
99 if (0x00 != (data[RTC_CTRL] & 0x80)) { in rtc_validate()
101 data[RTC_SEC] = 0x80; in rtc_validate()
102 if (i2c_write(CONFIG_SYS_I2C_RTC_ADDR, RTC_SEC, 1, data, 1)) { in rtc_validate()
111 min = data[RTC_MIN] & 0x7F; in rtc_validate()
112 date = data[RTC_DATE]; in rtc_validate()
113 month = data[RTC_MONTH] & 0x3F; in rtc_validate()
114 years = data[RTC_YEAR]; in rtc_validate()
115 if (0x59 < data[RTC_SEC] || 0x09 < (data[RTC_SEC] & 0x0F) || in rtc_validate()
117 0x23 < data[RTC_HOUR] || 0x09 < (data[RTC_HOUR] & 0x0F) || in rtc_validate()
118 0x07 < data[RTC_DAY] || 0x00 == data[RTC_DAY] || in rtc_validate()
124 (0x00 == years && 0x00 != (data[RTC_MONTH] & 0xC0))))) { in rtc_validate()
129 data[RTC_SEC] = 0x00; in rtc_validate()
130 data[RTC_MIN] &= 0x80; /* preserve OFIE bit */ in rtc_validate()
131 data[RTC_HOUR] = 0x00; in rtc_validate()
132 data[RTC_DAY] = 0x02; in rtc_validate()
133 data[RTC_DATE] = 0x01; in rtc_validate()
134 data[RTC_MONTH] = 0xC1; in rtc_validate()
135 data[RTC_YEAR] = 0x00; in rtc_validate()
136 data[RTC_CTRL] &= 0x7F; /* reset OUT bit */ in rtc_validate()
138 if (i2c_write(CONFIG_SYS_I2C_RTC_ADDR, 0, 1, data, sizeof(data))) { in rtc_validate()
143 return data; in rtc_validate()
148 uchar const *const data = rtc_validate(); in rtc_get() local
150 if (!data) in rtc_get()
153 tmp->tm_sec = bcd2bin(data[RTC_SEC] & 0x7F); in rtc_get()
154 tmp->tm_min = bcd2bin(data[RTC_MIN] & 0x7F); in rtc_get()
155 tmp->tm_hour = bcd2bin(data[RTC_HOUR] & 0x3F); in rtc_get()
156 tmp->tm_mday = bcd2bin(data[RTC_DATE] & 0x3F); in rtc_get()
157 tmp->tm_mon = bcd2bin(data[RTC_MONTH] & 0x1F); in rtc_get()
158 tmp->tm_year = cb2year(data[RTC_MONTH] >> 6) + bcd2bin(data[RTC_YEAR]); in rtc_get()
159 tmp->tm_wday = bcd2bin(data[RTC_DAY] & 0x07) - 1; in rtc_get()
172 uchar *const data = rtc_validate(); in rtc_set() local
174 if (!data) in rtc_set()
181 data[RTC_SEC] = (data[RTC_SEC] & 0x80) | (bin2bcd(tmp->tm_sec) & 0x7F); in rtc_set()
182 data[RTC_MIN] = (data[RTC_MIN] & 0X80) | (bin2bcd(tmp->tm_min) & 0X7F); in rtc_set()
183 data[RTC_HOUR] = bin2bcd(tmp->tm_hour) & 0x3F; in rtc_set()
184 data[RTC_DATE] = bin2bcd(tmp->tm_mday) & 0x3F; in rtc_set()
185 data[RTC_MONTH] = bin2bcd(tmp->tm_mon) & 0x1F; in rtc_set()
186 data[RTC_YEAR] = bin2bcd(tmp->tm_year % 100); in rtc_set()
187 data[RTC_MONTH] |= year2cb(tmp->tm_year) << 6; in rtc_set()
188 data[RTC_DAY] = bin2bcd(tmp->tm_wday + 1) & 0x07; in rtc_set()
189 if (i2c_write(CONFIG_SYS_I2C_RTC_ADDR, 0, 1, data, RTC_REG_CNT)) { in rtc_set()
199 uchar *const data = rtc_validate(); in rtc_reset() local
202 if (!data) in rtc_reset()
218 if ((data[RTC_CTRL] & 0x3F) != l) { in rtc_reset()
221 data[RTC_CTRL] &= 0xC0; in rtc_reset()
222 data[RTC_CTRL] |= (uchar) l; in rtc_reset()
231 data[RTC_CTRL] &= 0xBF; in rtc_reset()
232 if (i2c_write(CONFIG_SYS_I2C_RTC_ADDR, RTC_CTRL, 1, data + RTC_CTRL, 1)) { in rtc_reset()