Skip to content
Snippets Groups Projects
Commit a8dc0b36 authored by Adam Wujek's avatar Adam Wujek
Browse files

I2C: add command IC_DEVICE_REV (0xAE) with git commit


Signed-off-by: default avatarAdam Wujek <dev_public@wujek.eu>
parent c053dcc1
Branches
Tags
No related merge requests found
...@@ -60,6 +60,8 @@ hal/src/hal_atomic.o \ ...@@ -60,6 +60,8 @@ hal/src/hal_atomic.o \
OBJS_AS_ARGS += $(OBJS:%="%") OBJS_AS_ARGS += $(OBJS:%="%")
GIT_VER = $(shell git describe --always --dirty)
# List the dependency files # List the dependency files
DEPS := $(OBJS:%.o=%.d) DEPS := $(OBJS:%.o=%.d)
...@@ -133,9 +135,9 @@ flash: all ...@@ -133,9 +135,9 @@ flash: all
@echo Building file: $< @echo Building file: $<
@echo ARM/GNU C Compiler @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 \ $(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 \ -D__SAMD21G18A__ -mcpu=cortex-m0plus -D__GIT_VER__="\"$(GIT_VER)\"" \
$(GCC_INCS) \ $(GCC_INCS) \
-MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
@echo Finished building: $< @echo Finished building: $<
......
...@@ -13,6 +13,7 @@ const char MFR_REV[] = "0.1.0"; ...@@ -13,6 +13,7 @@ const char MFR_REV[] = "0.1.0";
const char MFR_LOC[] = "Geneva"; const char MFR_LOC[] = "Geneva";
const char MFR_DAT[] = "190801"; const char MFR_DAT[] = "190801";
const char MFR_SER[] = "123456789"; const char MFR_SER[] = "123456789";
const char IC_DEVICE_REV[] = __GIT_VER__;
void query_prp(); void query_prp();
uint8_t query_r; uint8_t query_r;
...@@ -36,7 +37,9 @@ static const int8_t cmd_data_lengths[] = { ...@@ -36,7 +37,9 @@ static const int8_t cmd_data_lengths[] = {
-(int8_t)sizeof(MFR_REV), // 0x9B -(int8_t)sizeof(MFR_REV), // 0x9B
-(int8_t)sizeof(MFR_LOC), // 0x9C -(int8_t)sizeof(MFR_LOC), // 0x9C
-(int8_t)sizeof(MFR_DAT), // 0x9D -(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 // for block write-block read process calls, which modify the length
static int8_t cmd_data_length_query = -1; static int8_t cmd_data_length_query = -1;
...@@ -57,6 +60,7 @@ static cmd_t cmds_cmds[] = (cmd_t[]){ ...@@ -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}, {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}, {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}, {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}, {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}, {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}, {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},
......
...@@ -142,6 +142,8 @@ returned by READ_VOUT_. ...@@ -142,6 +142,8 @@ returned by READ_VOUT_.
+--------------+---------------------+------------------------+-------------+----------------------+ +--------------+---------------------+------------------------+-------------+----------------------+
| 9E | MFR_SERIAL_ | Block read | var | serial number | | 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 | | FF | PMBUS_COMMAND_EXT_ | Extended command | var | access extended cmds |
+--------------+---------------------+------------------------+-------------+----------------------+ +--------------+---------------------+------------------------+-------------+----------------------+
...@@ -420,6 +422,17 @@ MFR_SERIAL ...@@ -420,6 +422,17 @@ MFR_SERIAL
This returns a manufacturer serial string (currently unused, returns This returns a manufacturer serial string (currently unused, returns
"123456789"). "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:
PMBUS_COMMAND_EXT PMBUS_COMMAND_EXT
......
...@@ -31,7 +31,9 @@ else ...@@ -31,7 +31,9 @@ else
$(error need to provide a legal value for VER) $(error need to provide a legal value for VER)
endif 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 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 CLANG_CFLAGS=-DUSE_CLANG -I$(CLANG_NEWLIB_PATH)/include/ -flto -Os -fshort-enums -ffreestanding --target=arm-none-eabi -march=thumbv6m -g
EXTRA_OPT_ARGS= EXTRA_OPT_ARGS=
...@@ -57,6 +59,8 @@ ifdef BE_COMPLIANT_USE_LINEAR16 ...@@ -57,6 +59,8 @@ ifdef BE_COMPLIANT_USE_LINEAR16
CLANG_CFLAGS += -DUSE_LINEAR16 CLANG_CFLAGS += -DUSE_LINEAR16
endif endif
GIT_VER = $(shell git describe --always --dirty)
IRQ_handlers := Reset_Handler \ IRQ_handlers := Reset_Handler \
Dummy_Handler \ Dummy_Handler \
RTC_Handler \ RTC_Handler \
......
...@@ -24,6 +24,7 @@ const char MFR_REV[] = "0.2p-ERRO"; ...@@ -24,6 +24,7 @@ const char MFR_REV[] = "0.2p-ERRO";
const char MFR_LOC[] = "Geneva"; const char MFR_LOC[] = "Geneva";
const char MFR_DAT[] = "211020"; const char MFR_DAT[] = "211020";
const char MFR_SER[] = "123456789"; const char MFR_SER[] = "123456789";
const char IC_DEVICE_REV[] = __GIT_VER__;
#ifdef USE_LINEAR16 #ifdef USE_LINEAR16
const uint8_t vout_mode = 0x16; // linear mode, fixed 2^10 exponent const uint8_t vout_mode = 0x16; // linear mode, fixed 2^10 exponent
...@@ -125,8 +126,9 @@ static const int8_t cmd_data_lengths[] = { ...@@ -125,8 +126,9 @@ static const int8_t cmd_data_lengths[] = {
2, // 0x3B 2, // 0x3B
2, // 0x3C 2, // 0x3C
1, // 0x3D 1, // 0x3D
2}; // 0x3E 2, // 0x3E
-(int8_t)sizeof(IC_DEVICE_REV)// 0xAE
};
// only block write-block read process calls modify the length // only block write-block read process calls modify the length
static int8_t cmd_data_length_query = -1; static int8_t cmd_data_length_query = -1;
...@@ -166,6 +168,7 @@ static const cmd_t cmds_cmds[] = (cmd_t[]){ ...@@ -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}, {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}, {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}, {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}, {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}, {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}, {0xFF10, (int8_t *)&ext_cmd_data_lengths[2], (uint8_t *)&seconds_up, (fp_t)NULL, (fp_t)NULL, (fp_t)NULL, 0, 0},
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment