···198 return ret;
199}
2000000000000000000000000000000000000201/* returns bus index which can be used as a handle, or <0 on error */
202int i2c_add_node(const struct i2c_interface *iface)
203{
···198 return ret;
199}
200201+int i2c_write_read_data(int bus_index, int bus_address,
202+ const unsigned char* buf_write, int count_write,
203+ unsigned char* buf_read, int count_read)
204+{
205+ int i;
206+ int ret = 0;
207+ const struct i2c_interface *iface = i2c_if[bus_index];
208+209+ i2c_start(iface);
210+ if (!i2c_outb(iface, bus_address))
211+ {
212+ ret = -2;
213+ goto end;
214+ }
215+216+ for(i = 0;i < count_write;i++)
217+ {
218+ if (!i2c_outb(iface, buf_write[i]))
219+ {
220+ ret = -3;
221+ goto end;
222+ }
223+ }
224+225+ for(i = 0;i < count_read-1;i++)
226+ buf_read[i] = i2c_inb(iface, true);
227+228+ buf_read[i] = i2c_inb(iface, false);
229+230+end:
231+ i2c_stop(iface);
232+ return ret;
233+}
234+235/* returns bus index which can be used as a handle, or <0 on error */
236int i2c_add_node(const struct i2c_interface *iface)
237{
+10
firmware/export/generic_i2c.h
···49int i2c_read_data(int bus_index, int bus_address, int address,
50 unsigned char* buf, int count);
51000000000052#endif /* _GEN_I2C_ */
53
···49int i2c_read_data(int bus_index, int bus_address, int address,
50 unsigned char* buf, int count);
5152+/* Special function for devices that can appear on I2C bus but do not
53+ * comply to I2C specification. Such devices include AT88SC6416C crypto
54+ * memory. To read data from AT88SC6416C, a write I2C transaction starts,
55+ * 3 bytes are written and then, in the middle of transaction, the device
56+ * starts sending data.
57+ */
58+int i2c_write_read_data(int bus_index, int bus_address,
59+ const unsigned char* buf_write, int count_write,
60+ unsigned char* buf_read, int count_read);
61+62#endif /* _GEN_I2C_ */
63
···1+/***************************************************************************
2+* __________ __ ___.
3+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7+* \/ \/ \/ \/ \/
8+* $Id: $
9+*
10+* Copyright (C) 2021 by Tomasz Moń
11+*
12+* This program is free software; you can redistribute it and/or
13+* modify it under the terms of the GNU General Public License
14+* as published by the Free Software Foundation; either version 2
15+* of the License, or (at your option) any later version.
16+*
17+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18+* KIND, either express or implied.
19+*
20+****************************************************************************/
21+22+#ifndef _CRYPTOMEM_SANSACONNECT_H_
23+#define _CRYPTOMEM_SANSACONNECT_H_
24+25+int cryptomem_read_deviceid(char deviceid[32]);
26+27+#endif /* _CRYPTOMEM_SANSACONNECT_H_ */
+20
firmware/usbstack/usb_core.c
···62#include "ocotp-imx233.h"
63#endif
64000065#ifndef USB_MAX_CURRENT
66#define USB_MAX_CURRENT 500
67#endif
···326 }
327 }
328 usb_string_iSerial.bLength = 2 + 2 * (1 + IMX233_NUM_OCOTP_OPS * 8);
0000000000000000329}
330#elif (CONFIG_STORAGE & STORAGE_ATA)
331/* If we don't know the device serial number, use the one