Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
eeprog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Raptor Engineering Public Development
eeprog
Commits
1436895b
Commit
1436895b
authored
Mar 17, 2021
by
Raptor Engineering Development Team
Committed by
Timothy Pearson
Mar 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable full 64-byte page writes with direct I2C access
parent
0127f233
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
24cXX.c
24cXX.c
+13
-5
24cXX.h
24cXX.h
+1
-3
No files found.
24cXX.c
View file @
1436895b
...
...
@@ -52,12 +52,20 @@ static int i2c_write_2b(struct eeprom *e, __u8 buf[2])
static
int
i2c_write_arbitrary
(
struct
eeprom
*
e
,
__u8
*
buf
,
int
len
)
{
int
r
;
// we must simulate a plain I2C byte write with SMBus functions
r
=
i2c_smbus_write_i2c_block_data
(
e
->
fd
,
buf
[
0
],
len
-
1
,
buf
+
1
);
if
(
r
<
0
)
if
(
ioctl
(
e
->
fd
,
I2C_SLAVE
,
e
->
addr
)
<
0
)
{
fprintf
(
stderr
,
"Error i2c_write_arbitrary: %s
\n
"
,
strerror
(
errno
));
usleep
(
10
);
return
r
;
return
-
1
;
}
r
=
write
(
e
->
fd
,
buf
,
len
);
if
(
r
<
0
)
{
fprintf
(
stderr
,
"Error i2c_write_arbitrary: %s
\n
"
,
strerror
(
errno
));
return
r
;
}
if
(
r
!=
len
)
{
fprintf
(
stderr
,
"Error i2c_write_arbitrary: short write (%d of %d expected)
\n
"
,
r
,
len
);
return
-
1
;
}
return
0
;
}
...
...
24cXX.h
View file @
1436895b
...
...
@@ -23,9 +23,7 @@
#define EEPROM_TYPE_8BIT_ADDR 1
#define EEPROM_TYPE_16BIT_ADDR 2
// SMBus is limited to 32 bytes
// Unfortunately, the 16-bit addressing on the EEPROM chews up one of those bytes, and further downgrades the max transfer size to 16 bytes of data (since we have to stay power of 2 aligned)
#define MAX_PAGE_SIZE 16
#define MAX_PAGE_SIZE 64
struct
eeprom
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment