From e5afb927b83b28efbd044cb2939ca8c8273b518f Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Fri, 6 Mar 2020 10:57:26 -0700 Subject: [PATCH] system76/*: Add parport logging Add a build-time option to configure the parallel port for logging instead of using it as a keyboard. --- src/board/system76/darp5/board.mk | 3 +++ src/board/system76/darp5/main.c | 10 ++++++++++ src/board/system76/darp5/stdio.c | 7 +++++++ src/board/system76/galp3-c/board.mk | 3 +++ src/board/system76/galp3-c/main.c | 10 ++++++++++ src/board/system76/galp3-c/stdio.c | 7 +++++++ src/board/system76/lemp9/board.mk | 3 +++ src/board/system76/lemp9/main.c | 10 ++++++++++ src/board/system76/lemp9/stdio.c | 7 +++++++ 9 files changed, 60 insertions(+) diff --git a/src/board/system76/darp5/board.mk b/src/board/system76/darp5/board.mk index 2032260..5b8f47c 100644 --- a/src/board/system76/darp5/board.mk +++ b/src/board/system76/darp5/board.mk @@ -22,6 +22,9 @@ CFLAGS+=-DI2C_SMBUS=I2C_0 # Set keyboard LED I2C bus CFLAGS+=-DI2C_KBLED=I2C_1 +# Enable debug logging over keyboard parallel port +#CFLAGS+=-DPARPORT_DEBUG + # Set scratch ROM parameters SCRATCH_OFFSET=1024 SCRATCH_SIZE=1024 diff --git a/src/board/system76/darp5/main.c b/src/board/system76/darp5/main.c index 291fb86..3596b12 100644 --- a/src/board/system76/darp5/main.c +++ b/src/board/system76/darp5/main.c @@ -23,6 +23,10 @@ #include #include +#ifdef PARPORT_DEBUG + #include +#endif + void external_0(void) __interrupt(0) {} // timer_0 is in time.c void timer_0(void) __interrupt(1); @@ -43,7 +47,11 @@ void init(void) { ecpm_init(); kbc_init(); kbled_init(); +#ifdef PARPORT_DEBUG + parport_init(); +#else kbscan_init(); +#endif peci_init(); pmc_init(); pwm_init(); @@ -105,8 +113,10 @@ void main(void) { power_event(); break; case 1: +#ifndef PARPORT_DEBUG // Scans keyboard and sends keyboard packets kbscan_event(); +#endif break; case 2: // Passes through touchpad packets diff --git a/src/board/system76/darp5/stdio.c b/src/board/system76/darp5/stdio.c index 6cb8951..97faa0f 100644 --- a/src/board/system76/darp5/stdio.c +++ b/src/board/system76/darp5/stdio.c @@ -10,6 +10,10 @@ #include #endif +#ifdef PARPORT_DEBUG + #include +#endif + int putchar(int c) { unsigned char byte = (unsigned char)c; smfi_debug(byte); @@ -18,6 +22,9 @@ int putchar(int c) { #endif #ifdef I2C_DEBUGGER i2c_send(&I2C_SMBUS, I2C_DEBUGGER, &byte, 1); +#endif +#ifdef PARPORT_DEBUG + parport_write(&byte, 1); #endif return (int)byte; } diff --git a/src/board/system76/galp3-c/board.mk b/src/board/system76/galp3-c/board.mk index 81dc07e..da4daa9 100644 --- a/src/board/system76/galp3-c/board.mk +++ b/src/board/system76/galp3-c/board.mk @@ -19,6 +19,9 @@ CFLAGS+=-DLEVEL=4 # Set battery I2C bus CFLAGS+=-DI2C_SMBUS=I2C_0 +# Enable debug logging over keyboard parallel port +#CFLAGS+=-DPARPORT_DEBUG + # Set scratch ROM parameters SCRATCH_OFFSET=1024 SCRATCH_SIZE=1024 diff --git a/src/board/system76/galp3-c/main.c b/src/board/system76/galp3-c/main.c index 291fb86..3596b12 100644 --- a/src/board/system76/galp3-c/main.c +++ b/src/board/system76/galp3-c/main.c @@ -23,6 +23,10 @@ #include #include +#ifdef PARPORT_DEBUG + #include +#endif + void external_0(void) __interrupt(0) {} // timer_0 is in time.c void timer_0(void) __interrupt(1); @@ -43,7 +47,11 @@ void init(void) { ecpm_init(); kbc_init(); kbled_init(); +#ifdef PARPORT_DEBUG + parport_init(); +#else kbscan_init(); +#endif peci_init(); pmc_init(); pwm_init(); @@ -105,8 +113,10 @@ void main(void) { power_event(); break; case 1: +#ifndef PARPORT_DEBUG // Scans keyboard and sends keyboard packets kbscan_event(); +#endif break; case 2: // Passes through touchpad packets diff --git a/src/board/system76/galp3-c/stdio.c b/src/board/system76/galp3-c/stdio.c index 6cb8951..97faa0f 100644 --- a/src/board/system76/galp3-c/stdio.c +++ b/src/board/system76/galp3-c/stdio.c @@ -10,6 +10,10 @@ #include #endif +#ifdef PARPORT_DEBUG + #include +#endif + int putchar(int c) { unsigned char byte = (unsigned char)c; smfi_debug(byte); @@ -18,6 +22,9 @@ int putchar(int c) { #endif #ifdef I2C_DEBUGGER i2c_send(&I2C_SMBUS, I2C_DEBUGGER, &byte, 1); +#endif +#ifdef PARPORT_DEBUG + parport_write(&byte, 1); #endif return (int)byte; } diff --git a/src/board/system76/lemp9/board.mk b/src/board/system76/lemp9/board.mk index a05948b..5b665e6 100644 --- a/src/board/system76/lemp9/board.mk +++ b/src/board/system76/lemp9/board.mk @@ -22,6 +22,9 @@ CFLAGS+=-DI2C_SMBUS=I2C_4 # Set type-c port manager I2C bus CFLAGS+=-DI2C_TCPM=I2C_1 +# Enable debug logging over keyboard parallel port +#CFLAGS+=-DPARPORT_DEBUG + # Set scratch ROM parameters SCRATCH_OFFSET=1024 SCRATCH_SIZE=1024 diff --git a/src/board/system76/lemp9/main.c b/src/board/system76/lemp9/main.c index 3f40d44..ba9f8fc 100644 --- a/src/board/system76/lemp9/main.c +++ b/src/board/system76/lemp9/main.c @@ -24,6 +24,10 @@ #include #include +#ifdef PARPORT_DEBUG + #include +#endif + void external_0(void) __interrupt(0) {} // timer_0 is in time.c void timer_0(void) __interrupt(1); @@ -44,7 +48,11 @@ void init(void) { ecpm_init(); kbc_init(); kbled_init(); +#ifdef PARPORT_DEBUG + parport_init(); +#else kbscan_init(); +#endif peci_init(); pmc_init(); pwm_init(); @@ -107,8 +115,10 @@ void main(void) { power_event(); break; case 1: +#ifndef PARPORT_DEBUG // Scans keyboard and sends keyboard packets kbscan_event(); +#endif break; case 2: // Passes through touchpad packets diff --git a/src/board/system76/lemp9/stdio.c b/src/board/system76/lemp9/stdio.c index 6cb8951..97faa0f 100644 --- a/src/board/system76/lemp9/stdio.c +++ b/src/board/system76/lemp9/stdio.c @@ -10,6 +10,10 @@ #include #endif +#ifdef PARPORT_DEBUG + #include +#endif + int putchar(int c) { unsigned char byte = (unsigned char)c; smfi_debug(byte); @@ -18,6 +22,9 @@ int putchar(int c) { #endif #ifdef I2C_DEBUGGER i2c_send(&I2C_SMBUS, I2C_DEBUGGER, &byte, 1); +#endif +#ifdef PARPORT_DEBUG + parport_write(&byte, 1); #endif return (int)byte; }