Add SMFI console
This commit is contained in:
parent
7c1e0508a9
commit
35462cb7a0
2
ecflash
2
ecflash
@ -1 +1 @@
|
|||||||
Subproject commit 5a9300d804df6b658196f690a10ba8fc7e821a78
|
Subproject commit 945ec8d276edd78f26cd744624344e67549824ad
|
@ -11,10 +11,10 @@ SRC+=$(BOARD_DIR)/keymap/$(KEYMAP).c
|
|||||||
# 3 - INFO
|
# 3 - INFO
|
||||||
# 4 - DEBUG
|
# 4 - DEBUG
|
||||||
# 5 - TRACE
|
# 5 - TRACE
|
||||||
CFLAGS+=-DLEVEL=2
|
CFLAGS+=-DLEVEL=4
|
||||||
|
|
||||||
# Enable I2C debug on 0x76
|
# Enable I2C debug on 0x76
|
||||||
CFLAGS+=-DI2C_DEBUGGER=0x76
|
#CFLAGS+=-DI2C_DEBUGGER=0x76
|
||||||
|
|
||||||
# Set battery I2C bus
|
# Set battery I2C bus
|
||||||
CFLAGS+=-DI2C_SMBUS=I2C_0
|
CFLAGS+=-DI2C_SMBUS=I2C_0
|
||||||
@ -35,6 +35,10 @@ include $(SCRATCH_DIR)/scratch.mk
|
|||||||
CFLAGS+=-I$(BUILD)/include
|
CFLAGS+=-I$(BUILD)/include
|
||||||
INCLUDE+=$(BUILD)/include/scratch.h
|
INCLUDE+=$(BUILD)/include/scratch.h
|
||||||
|
|
||||||
|
console:
|
||||||
|
cargo build --manifest-path ecflash/Cargo.toml --example smfi --release
|
||||||
|
sudo ecflash/target/release/examples/smfi
|
||||||
|
|
||||||
flash: $(BUILD)/ec.rom
|
flash: $(BUILD)/ec.rom
|
||||||
cargo build --manifest-path ecflash/Cargo.toml --example isp --release
|
cargo build --manifest-path ecflash/Cargo.toml --example isp --release
|
||||||
sudo ecflash/target/release/examples/isp --internal $<
|
sudo ecflash/target/release/examples/isp --internal $<
|
||||||
@ -42,7 +46,3 @@ flash: $(BUILD)/ec.rom
|
|||||||
isp: $(BUILD)/ec.rom
|
isp: $(BUILD)/ec.rom
|
||||||
cargo build --manifest-path ecflash/Cargo.toml --example isp --release
|
cargo build --manifest-path ecflash/Cargo.toml --example isp --release
|
||||||
sudo ecflash/target/release/examples/isp $<
|
sudo ecflash/target/release/examples/isp $<
|
||||||
|
|
||||||
version:
|
|
||||||
cargo build --manifest-path ecflash/Cargo.toml --example smfi --release
|
|
||||||
sudo ecflash/target/release/examples/smfi
|
|
||||||
|
@ -3,5 +3,6 @@
|
|||||||
|
|
||||||
void smfi_init(void);
|
void smfi_init(void);
|
||||||
void smfi_event(void);
|
void smfi_event(void);
|
||||||
|
void smfi_debug(unsigned char byte);
|
||||||
|
|
||||||
#endif // _BOARD_SMFI_H
|
#endif // _BOARD_SMFI_H
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <board/smfi.h>
|
||||||
#include <common/macro.h>
|
#include <common/macro.h>
|
||||||
#include <common/version.h>
|
#include <common/version.h>
|
||||||
|
|
||||||
@ -26,6 +27,7 @@ enum SmfiCmd {
|
|||||||
SMFI_CMD_PROBE = 1,
|
SMFI_CMD_PROBE = 1,
|
||||||
SMFI_CMD_BOARD = 2,
|
SMFI_CMD_BOARD = 2,
|
||||||
SMFI_CMD_VERSION = 3,
|
SMFI_CMD_VERSION = 3,
|
||||||
|
SMFI_CMD_DEBUG = 4,
|
||||||
//TODO
|
//TODO
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -62,6 +64,7 @@ void smfi_init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void smfi_event(void) {
|
void smfi_event(void) {
|
||||||
|
int i;
|
||||||
if (smfi_cmd[0]) {
|
if (smfi_cmd[0]) {
|
||||||
// Default to success
|
// Default to success
|
||||||
smfi_cmd[1] = SMFI_RES_OK;
|
smfi_cmd[1] = SMFI_RES_OK;
|
||||||
@ -80,19 +83,29 @@ void smfi_event(void) {
|
|||||||
case SMFI_CMD_VERSION:
|
case SMFI_CMD_VERSION:
|
||||||
strncpy(&smfi_cmd[2], version(), ARRAY_SIZE(smfi_cmd) - 2);
|
strncpy(&smfi_cmd[2], version(), ARRAY_SIZE(smfi_cmd) - 2);
|
||||||
break;
|
break;
|
||||||
|
case SMFI_CMD_DEBUG:
|
||||||
|
for (i = 2; i < ARRAY_SIZE(smfi_cmd) - 2; i++) {
|
||||||
|
uint8_t b = smfi_cmd[i];
|
||||||
|
if (b == 0) break;
|
||||||
|
putchar(b);
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
// Command not found
|
||||||
|
smfi_cmd[1] = SMFI_RES_ERR;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark command as finished
|
// Mark command as finished
|
||||||
smfi_cmd[0] = SMFI_CMD_NONE;
|
smfi_cmd[0] = SMFI_CMD_NONE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (smfi_dbg[0]) {
|
|
||||||
int i;
|
void smfi_debug(unsigned char byte) {
|
||||||
for(i = 1; (i <= (int)smfi_dbg[0]) && (i < ARRAY_SIZE(smfi_dbg)); i++) {
|
int tail = (int)smfi_dbg[0];
|
||||||
putchar(smfi_dbg[i]);
|
tail++;
|
||||||
}
|
if (tail >= ARRAY_SIZE(smfi_dbg)) {
|
||||||
|
tail = 1;
|
||||||
// Mark debug transaction as complete
|
}
|
||||||
smfi_dbg[0] = 0;
|
smfi_dbg[tail] = byte;
|
||||||
}
|
smfi_dbg[0] = (uint8_t)tail;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <board/smfi.h>
|
||||||
|
|
||||||
#ifdef SERIAL_DEBUGGER
|
#ifdef SERIAL_DEBUGGER
|
||||||
#include <mcs51/8051.h>
|
#include <mcs51/8051.h>
|
||||||
#endif
|
#endif
|
||||||
@ -10,6 +12,7 @@
|
|||||||
|
|
||||||
int putchar(int c) {
|
int putchar(int c) {
|
||||||
unsigned char byte = (unsigned char)c;
|
unsigned char byte = (unsigned char)c;
|
||||||
|
smfi_debug(byte);
|
||||||
#ifdef SERIAL_DEBUGGER
|
#ifdef SERIAL_DEBUGGER
|
||||||
SBUF = byte;
|
SBUF = byte;
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,10 +11,10 @@ SRC+=$(BOARD_DIR)/keymap/$(KEYMAP).c
|
|||||||
# 3 - INFO
|
# 3 - INFO
|
||||||
# 4 - DEBUG
|
# 4 - DEBUG
|
||||||
# 5 - TRACE
|
# 5 - TRACE
|
||||||
CFLAGS+=-DLEVEL=2
|
CFLAGS+=-DLEVEL=4
|
||||||
|
|
||||||
# Enable I2C debug on 0x76
|
# Enable I2C debug on 0x76
|
||||||
CFLAGS+=-DI2C_DEBUGGER=0x76
|
#CFLAGS+=-DI2C_DEBUGGER=0x76
|
||||||
|
|
||||||
# Set battery I2C bus
|
# Set battery I2C bus
|
||||||
CFLAGS+=-DI2C_SMBUS=I2C_0
|
CFLAGS+=-DI2C_SMBUS=I2C_0
|
||||||
@ -35,6 +35,10 @@ include $(SCRATCH_DIR)/scratch.mk
|
|||||||
CFLAGS+=-I$(BUILD)/include
|
CFLAGS+=-I$(BUILD)/include
|
||||||
INCLUDE+=$(BUILD)/include/scratch.h
|
INCLUDE+=$(BUILD)/include/scratch.h
|
||||||
|
|
||||||
|
console:
|
||||||
|
cargo build --manifest-path ecflash/Cargo.toml --example smfi --release
|
||||||
|
sudo ecflash/target/release/examples/smfi
|
||||||
|
|
||||||
flash: $(BUILD)/ec.rom
|
flash: $(BUILD)/ec.rom
|
||||||
cargo build --manifest-path ecflash/Cargo.toml --example isp --release
|
cargo build --manifest-path ecflash/Cargo.toml --example isp --release
|
||||||
sudo ecflash/target/release/examples/isp --internal $<
|
sudo ecflash/target/release/examples/isp --internal $<
|
||||||
@ -42,7 +46,3 @@ flash: $(BUILD)/ec.rom
|
|||||||
isp: $(BUILD)/ec.rom
|
isp: $(BUILD)/ec.rom
|
||||||
cargo build --manifest-path ecflash/Cargo.toml --example isp --release
|
cargo build --manifest-path ecflash/Cargo.toml --example isp --release
|
||||||
sudo ecflash/target/release/examples/isp $<
|
sudo ecflash/target/release/examples/isp $<
|
||||||
|
|
||||||
version:
|
|
||||||
cargo build --manifest-path ecflash/Cargo.toml --example smfi --release
|
|
||||||
sudo ecflash/target/release/examples/smfi
|
|
||||||
|
@ -3,5 +3,6 @@
|
|||||||
|
|
||||||
void smfi_init(void);
|
void smfi_init(void);
|
||||||
void smfi_event(void);
|
void smfi_event(void);
|
||||||
|
void smfi_debug(unsigned char byte);
|
||||||
|
|
||||||
#endif // _BOARD_SMFI_H
|
#endif // _BOARD_SMFI_H
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <board/smfi.h>
|
||||||
#include <common/macro.h>
|
#include <common/macro.h>
|
||||||
#include <common/version.h>
|
#include <common/version.h>
|
||||||
|
|
||||||
@ -26,6 +27,7 @@ enum SmfiCmd {
|
|||||||
SMFI_CMD_PROBE = 1,
|
SMFI_CMD_PROBE = 1,
|
||||||
SMFI_CMD_BOARD = 2,
|
SMFI_CMD_BOARD = 2,
|
||||||
SMFI_CMD_VERSION = 3,
|
SMFI_CMD_VERSION = 3,
|
||||||
|
SMFI_CMD_DEBUG = 4,
|
||||||
//TODO
|
//TODO
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -62,6 +64,7 @@ void smfi_init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void smfi_event(void) {
|
void smfi_event(void) {
|
||||||
|
int i;
|
||||||
if (smfi_cmd[0]) {
|
if (smfi_cmd[0]) {
|
||||||
// Default to success
|
// Default to success
|
||||||
smfi_cmd[1] = SMFI_RES_OK;
|
smfi_cmd[1] = SMFI_RES_OK;
|
||||||
@ -80,19 +83,29 @@ void smfi_event(void) {
|
|||||||
case SMFI_CMD_VERSION:
|
case SMFI_CMD_VERSION:
|
||||||
strncpy(&smfi_cmd[2], version(), ARRAY_SIZE(smfi_cmd) - 2);
|
strncpy(&smfi_cmd[2], version(), ARRAY_SIZE(smfi_cmd) - 2);
|
||||||
break;
|
break;
|
||||||
|
case SMFI_CMD_DEBUG:
|
||||||
|
for (i = 2; i < ARRAY_SIZE(smfi_cmd) - 2; i++) {
|
||||||
|
uint8_t b = smfi_cmd[i];
|
||||||
|
if (b == 0) break;
|
||||||
|
putchar(b);
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
// Command not found
|
||||||
|
smfi_cmd[1] = SMFI_RES_ERR;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark command as finished
|
// Mark command as finished
|
||||||
smfi_cmd[0] = SMFI_CMD_NONE;
|
smfi_cmd[0] = SMFI_CMD_NONE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (smfi_dbg[0]) {
|
|
||||||
int i;
|
void smfi_debug(unsigned char byte) {
|
||||||
for(i = 1; (i <= (int)smfi_dbg[0]) && (i < ARRAY_SIZE(smfi_dbg)); i++) {
|
int tail = (int)smfi_dbg[0];
|
||||||
putchar(smfi_dbg[i]);
|
tail++;
|
||||||
}
|
if (tail >= ARRAY_SIZE(smfi_dbg)) {
|
||||||
|
tail = 1;
|
||||||
// Mark debug transaction as complete
|
}
|
||||||
smfi_dbg[0] = 0;
|
smfi_dbg[tail] = byte;
|
||||||
}
|
smfi_dbg[0] = (uint8_t)tail;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <board/smfi.h>
|
||||||
|
|
||||||
#ifdef SERIAL_DEBUGGER
|
#ifdef SERIAL_DEBUGGER
|
||||||
#include <mcs51/8051.h>
|
#include <mcs51/8051.h>
|
||||||
#endif
|
#endif
|
||||||
@ -10,6 +12,7 @@
|
|||||||
|
|
||||||
int putchar(int c) {
|
int putchar(int c) {
|
||||||
unsigned char byte = (unsigned char)c;
|
unsigned char byte = (unsigned char)c;
|
||||||
|
smfi_debug(byte);
|
||||||
#ifdef SERIAL_DEBUGGER
|
#ifdef SERIAL_DEBUGGER
|
||||||
SBUF = byte;
|
SBUF = byte;
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,10 +11,10 @@ SRC+=$(BOARD_DIR)/keymap/$(KEYMAP).c
|
|||||||
# 3 - INFO
|
# 3 - INFO
|
||||||
# 4 - DEBUG
|
# 4 - DEBUG
|
||||||
# 5 - TRACE
|
# 5 - TRACE
|
||||||
CFLAGS+=-DLEVEL=2
|
CFLAGS+=-DLEVEL=4
|
||||||
|
|
||||||
# Enable I2C debug on 0x76
|
# Enable I2C debug on 0x76
|
||||||
CFLAGS+=-DI2C_DEBUGGER=0x76
|
#CFLAGS+=-DI2C_DEBUGGER=0x76
|
||||||
|
|
||||||
# Set battery I2C bus
|
# Set battery I2C bus
|
||||||
CFLAGS+=-DI2C_SMBUS=I2C_4
|
CFLAGS+=-DI2C_SMBUS=I2C_4
|
||||||
@ -38,6 +38,10 @@ include $(SCRATCH_DIR)/scratch.mk
|
|||||||
CFLAGS+=-I$(BUILD)/include
|
CFLAGS+=-I$(BUILD)/include
|
||||||
INCLUDE+=$(BUILD)/include/scratch.h
|
INCLUDE+=$(BUILD)/include/scratch.h
|
||||||
|
|
||||||
|
console:
|
||||||
|
cargo build --manifest-path ecflash/Cargo.toml --example smfi --release
|
||||||
|
sudo ecflash/target/release/examples/smfi
|
||||||
|
|
||||||
flash: $(BUILD)/ec.rom
|
flash: $(BUILD)/ec.rom
|
||||||
cargo build --manifest-path ecflash/Cargo.toml --example isp --release
|
cargo build --manifest-path ecflash/Cargo.toml --example isp --release
|
||||||
sudo ecflash/target/release/examples/isp --internal $<
|
sudo ecflash/target/release/examples/isp --internal $<
|
||||||
@ -45,7 +49,3 @@ flash: $(BUILD)/ec.rom
|
|||||||
isp: $(BUILD)/ec.rom
|
isp: $(BUILD)/ec.rom
|
||||||
cargo build --manifest-path ecflash/Cargo.toml --example isp --release
|
cargo build --manifest-path ecflash/Cargo.toml --example isp --release
|
||||||
sudo ecflash/target/release/examples/isp $<
|
sudo ecflash/target/release/examples/isp $<
|
||||||
|
|
||||||
version:
|
|
||||||
cargo build --manifest-path ecflash/Cargo.toml --example smfi --release
|
|
||||||
sudo ecflash/target/release/examples/smfi
|
|
||||||
|
@ -3,5 +3,6 @@
|
|||||||
|
|
||||||
void smfi_init(void);
|
void smfi_init(void);
|
||||||
void smfi_event(void);
|
void smfi_event(void);
|
||||||
|
void smfi_debug(unsigned char byte);
|
||||||
|
|
||||||
#endif // _BOARD_SMFI_H
|
#endif // _BOARD_SMFI_H
|
||||||
|
@ -27,6 +27,7 @@ enum SmfiCmd {
|
|||||||
SMFI_CMD_PROBE = 1,
|
SMFI_CMD_PROBE = 1,
|
||||||
SMFI_CMD_BOARD = 2,
|
SMFI_CMD_BOARD = 2,
|
||||||
SMFI_CMD_VERSION = 3,
|
SMFI_CMD_VERSION = 3,
|
||||||
|
SMFI_CMD_DEBUG = 4,
|
||||||
//TODO
|
//TODO
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -63,6 +64,7 @@ void smfi_init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void smfi_event(void) {
|
void smfi_event(void) {
|
||||||
|
int i;
|
||||||
if (smfi_cmd[0]) {
|
if (smfi_cmd[0]) {
|
||||||
// Default to success
|
// Default to success
|
||||||
smfi_cmd[1] = SMFI_RES_OK;
|
smfi_cmd[1] = SMFI_RES_OK;
|
||||||
@ -81,19 +83,29 @@ void smfi_event(void) {
|
|||||||
case SMFI_CMD_VERSION:
|
case SMFI_CMD_VERSION:
|
||||||
strncpy(&smfi_cmd[2], version(), ARRAY_SIZE(smfi_cmd) - 2);
|
strncpy(&smfi_cmd[2], version(), ARRAY_SIZE(smfi_cmd) - 2);
|
||||||
break;
|
break;
|
||||||
|
case SMFI_CMD_DEBUG:
|
||||||
|
for (i = 2; i < ARRAY_SIZE(smfi_cmd) - 2; i++) {
|
||||||
|
uint8_t b = smfi_cmd[i];
|
||||||
|
if (b == 0) break;
|
||||||
|
putchar(b);
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
// Command not found
|
||||||
|
smfi_cmd[1] = SMFI_RES_ERR;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark command as finished
|
// Mark command as finished
|
||||||
smfi_cmd[0] = SMFI_CMD_NONE;
|
smfi_cmd[0] = SMFI_CMD_NONE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (smfi_dbg[0]) {
|
|
||||||
int i;
|
void smfi_debug(unsigned char byte) {
|
||||||
for(i = 1; (i <= (int)smfi_dbg[0]) && (i < ARRAY_SIZE(smfi_dbg)); i++) {
|
int tail = (int)smfi_dbg[0];
|
||||||
putchar(smfi_dbg[i]);
|
tail++;
|
||||||
}
|
if (tail >= ARRAY_SIZE(smfi_dbg)) {
|
||||||
|
tail = 1;
|
||||||
// Mark debug transaction as complete
|
}
|
||||||
smfi_dbg[0] = 0;
|
smfi_dbg[tail] = byte;
|
||||||
}
|
smfi_dbg[0] = (uint8_t)tail;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <board/smfi.h>
|
||||||
|
|
||||||
#ifdef SERIAL_DEBUGGER
|
#ifdef SERIAL_DEBUGGER
|
||||||
#include <mcs51/8051.h>
|
#include <mcs51/8051.h>
|
||||||
#endif
|
#endif
|
||||||
@ -10,6 +12,7 @@
|
|||||||
|
|
||||||
int putchar(int c) {
|
int putchar(int c) {
|
||||||
unsigned char byte = (unsigned char)c;
|
unsigned char byte = (unsigned char)c;
|
||||||
|
smfi_debug(byte);
|
||||||
#ifdef SERIAL_DEBUGGER
|
#ifdef SERIAL_DEBUGGER
|
||||||
SBUF = byte;
|
SBUF = byte;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user