Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
DIOT Monitoring Module
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
DIOT Monitoring Module
Commits
b6407a84
Commit
b6407a84
authored
Apr 05, 2022
by
Adam Wujek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
I2C: add command IC_DEVICE_REV (0xAE) with git commit
Signed-off-by:
Adam Wujek
<
dev_public@wujek.eu
>
parent
ee7df491
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
7 deletions
+33
-7
Makefile
bootloader/build/Makefile
+5
-3
i2c_impl.c
bootloader/src/i2c_impl.c
+5
-1
firmware.rst
doc/source/firmware.rst
+13
-0
Makefile
main_fw/build/Makefile
+5
-1
i2c_impl.c
main_fw/src/i2c_impl.c
+5
-2
No files found.
bootloader/build/Makefile
View file @
b6407a84
...
...
@@ -60,6 +60,8 @@ hal/src/hal_atomic.o \
OBJS_AS_ARGS
+=
$
(
OBJS:%
=
"%"
)
GIT_VER
=
$(
shell
git describe
--always
--dirty
)
# List the dependency files
DEPS
:=
$
(
OBJS:%.o
=
%.d
)
...
...
@@ -133,9 +135,9 @@ flash: all
@
echo
Building file:
$<
@
echo
ARM/GNU C Compiler
$(QUOTE)
arm-none-eabi-gcc
$(QUOTE)
-x
c
-mthumb
-DDEBUG
-Os
-ffunction-sections
-mlong-calls
-g3
-Wall
-c
-std
=
gnu99
\
-D__SAMD21G18A__
-mcpu
=
cortex-m0plus
\
$(GCC_INCS)
\
-MD
-MP
-MF
"
$
(@:%.o=%.d)"
-MT
"
$
(@:%.o=%.d)"
-MT
"
$
(@:%.o=%.o)"
-o
"
$@
"
"
$<
"
-D__SAMD21G18A__
-mcpu
=
cortex-m0plus
-D__GIT_VER__
=
"
\"
$(GIT_VER)
\"
"
\
$(GCC_INCS)
\
-MD
-MP
-MF
"
$
(@:%.o=%.d)"
-MT
"
$
(@:%.o=%.d)"
-MT
"
$
(@:%.o=%.o)"
-o
"
$@
"
"
$<
"
@
echo
Finished building:
$<
...
...
bootloader/src/i2c_impl.c
View file @
b6407a84
...
...
@@ -13,6 +13,7 @@ const char MFR_REV[] = "0.1.0";
const
char
MFR_LOC
[]
=
"Geneva"
;
const
char
MFR_DAT
[]
=
"190801"
;
const
char
MFR_SER
[]
=
"123456789"
;
const
char
IC_DEVICE_REV
[]
=
__GIT_VER__
;
void
query_prp
();
uint8_t
query_r
;
...
...
@@ -36,7 +37,9 @@ static const int8_t cmd_data_lengths[] = {
-
(
int8_t
)
sizeof
(
MFR_REV
),
// 0x9B
-
(
int8_t
)
sizeof
(
MFR_LOC
),
// 0x9C
-
(
int8_t
)
sizeof
(
MFR_DAT
),
// 0x9D
-
(
int8_t
)
sizeof
(
MFR_SER
)};
// 0x9E
-
(
int8_t
)
sizeof
(
MFR_SER
),
// 0x9E
-
(
int8_t
)
sizeof
(
IC_DEVICE_REV
)
//0xAE
};
// for block write-block read process calls, which modify the length
static
int8_t
cmd_data_length_query
=
-
1
;
...
...
@@ -57,6 +60,7 @@ static cmd_t cmds_cmds[] = (cmd_t[]){
{
0x009C
,
(
int8_t
*
)
&
cmd_data_lengths
[
4
],
(
uint8_t
*
)
&
MFR_LOC
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
,
QUERY_RD
|
QUERY_FMT_NAN
,
0
},
{
0x009D
,
(
int8_t
*
)
&
cmd_data_lengths
[
5
],
(
uint8_t
*
)
&
MFR_DAT
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
,
QUERY_RD
|
QUERY_FMT_NAN
,
0
},
{
0x009E
,
(
int8_t
*
)
&
cmd_data_lengths
[
6
],
(
uint8_t
*
)
&
MFR_SER
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
,
QUERY_RD
|
QUERY_FMT_NAN
,
0
},
{
0x00AE
,
(
int8_t
*
)
&
cmd_data_lengths
[
7
],
(
uint8_t
*
)
&
IC_DEVICE_REV
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
,
QUERY_RD
|
QUERY_FMT_NAN
,
0
},
{
0xFF01
,
(
int8_t
*
)
&
ext_cmd_data_lengths
[
0
],
(
uint8_t
*
)
&
fw_len
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
,
0
,
0
},
{
0xFF02
,
(
int8_t
*
)
&
ext_cmd_data_lengths
[
1
],
(
uint8_t
*
)
fw_block
,
(
fp_t
)
NULL
,
(
fp_t
)
&
written_fw_block
,
(
fp_t
)
NULL
,
0
,
1
},
{
0xFF03
,
(
int8_t
*
)
&
ext_cmd_data_lengths
[
2
],
(
uint8_t
*
)
&
fw_checksum
,
(
fp_t
)
NULL
,
(
fp_t
)
&
written_fw_checksum
,
(
fp_t
)
NULL
,
0
,
0
},
...
...
doc/source/firmware.rst
View file @
b6407a84
...
...
@@ -142,6 +142,8 @@ returned by READ_VOUT_.
+--------------+---------------------+------------------------+-------------+----------------------+
| 9E | MFR_SERIAL_ | Block read | var | serial number |
+--------------+---------------------+------------------------+-------------+----------------------+
| AE | IC_DEVICE_REV_ | Block read | var | git commit id |
+--------------+---------------------+------------------------+-------------+----------------------+
| FF | PMBUS_COMMAND_EXT_ | Extended command | var | access extended cmds |
+--------------+---------------------+------------------------+-------------+----------------------+
...
...
@@ -420,6 +422,17 @@ MFR_SERIAL
This returns a manufacturer serial string (currently unused, returns
"123456789").
.. _IC_DEVICE_REV:
IC_DEVICE_REV
~~~~~~~~~~~~~
| Command code: **AE**
| Transaction type: **Block read**
| Data length: **var**
This returns a git commit id of the used firmware.
.. _PMBUS_COMMAND_EXT:
PMBUS_COMMAND_EXT
...
...
main_fw/build/Makefile
View file @
b6407a84
...
...
@@ -31,7 +31,9 @@ else
$(error
need
to
provide
a
legal
value
for
VER)
endif
CFLAGS
=
-mcpu
=
cortex-m0plus
-DDEBUG
-D__SAMD21G18A__
$(MMVER)
-Wall
-c
-std
=
gnu99
-ffunction-sections
-mlong-calls
-fomit-frame-pointer
--sysroot
=
/usr/arm-none-eabi
CFLAGS
=
-mcpu
=
cortex-m0plus
-DDEBUG
-D__SAMD21G18A__
$(MMVER)
-Wall
-c
\
-std
=
gnu99
-ffunction-sections
-mlong-calls
-fomit-frame-pointer
\
--sysroot
=
/usr/arm-none-eabi
-D__GIT_VER__
=
"
\"
$(GIT_VER)
\"
"
GCC_CFLAGS
=
-march
=
armv6-m
-mcpu
=
cortex-m0plus
-mthumb
-Os
-g3
CLANG_CFLAGS
=
-DUSE_CLANG
-I
$(CLANG_NEWLIB_PATH)
/include/
-flto
-Os
-fshort-enums
-ffreestanding
--target
=
arm-none-eabi
-march
=
thumbv6m
-g
EXTRA_OPT_ARGS
=
...
...
@@ -57,6 +59,8 @@ ifdef BE_COMPLIANT_USE_LINEAR16
CLANG_CFLAGS
+=
-DUSE_LINEAR16
endif
GIT_VER
=
$(
shell
git describe
--always
--dirty
)
IRQ_handlers
:=
Reset_Handler
\
Dummy_Handler
\
RTC_Handler
\
...
...
main_fw/src/i2c_impl.c
View file @
b6407a84
...
...
@@ -24,6 +24,7 @@ const char MFR_REV[] = "0.2p-ERRO";
const
char
MFR_LOC
[]
=
"Geneva"
;
const
char
MFR_DAT
[]
=
"211020"
;
const
char
MFR_SER
[]
=
"123456789"
;
const
char
IC_DEVICE_REV
[]
=
__GIT_VER__
;
#ifdef USE_LINEAR16
const
uint8_t
vout_mode
=
0x16
;
// linear mode, fixed 2^10 exponent
...
...
@@ -125,8 +126,9 @@ static const int8_t cmd_data_lengths[] = {
2
,
// 0x3B
2
,
// 0x3C
1
,
// 0x3D
2
};
// 0x3E
2
,
// 0x3E
-
(
int8_t
)
sizeof
(
IC_DEVICE_REV
)
// 0xAE
};
// only block write-block read process calls modify the length
static
int8_t
cmd_data_length_query
=
-
1
;
...
...
@@ -166,6 +168,7 @@ static const cmd_t cmds_cmds[] = (cmd_t[]){
{
0x003C
,
(
int8_t
*
)
&
cmd_data_lengths
[
22
],
(
uint8_t
*
)
&
setfrpms_lin
[
1
],
(
fp_t
)
NULL
,
&
set_frpms
,
(
fp_t
)
NULL
,
QUERY_WR
|
QUERY_FMT_LIN
,
0
},
{
0x003D
,
(
int8_t
*
)
&
cmd_data_lengths
[
23
],
(
uint8_t
*
)
&
fan_config_3_4
,
&
get_fan_configs
,
&
fan_config
,
(
fp_t
)
NULL
,
QUERY_WR
|
QUERY_FMT_NAN
,
0
},
{
0x003E
,
(
int8_t
*
)
&
cmd_data_lengths
[
24
],
(
uint8_t
*
)
&
setfrpms_lin
[
2
],
(
fp_t
)
NULL
,
&
set_frpms
,
(
fp_t
)
NULL
,
QUERY_WR
|
QUERY_FMT_LIN
,
0
},
{
0x00AE
,
(
int8_t
*
)
&
cmd_data_lengths
[
25
],
(
uint8_t
*
)
&
IC_DEVICE_REV
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
,
QUERY_RD
|
QUERY_FMT_NAN
,
0
},
{
0xFF05
,
(
int8_t
*
)
&
ext_cmd_data_lengths
[
0
],
(
uint8_t
*
)
&
dummy_byte
,
(
fp_t
)
NULL
,
&
boot_new_fw
,
(
fp_t
)
NULL
,
0
,
0
},
{
0xFF06
,
(
int8_t
*
)
&
ext_cmd_data_lengths
[
1
],
(
uint8_t
*
)
&
dummy_byte
,
(
fp_t
)
NULL
,
&
uc_reset
,
(
fp_t
)
NULL
,
0
,
0
},
{
0xFF10
,
(
int8_t
*
)
&
ext_cmd_data_lengths
[
2
],
(
uint8_t
*
)
&
seconds_up
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
,
0
,
0
},
...
...
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