system76/*: Add parport logging
Add a build-time option to configure the parallel port for logging instead of using it as a keyboard.
This commit is contained in:
		| @@ -22,6 +22,9 @@ CFLAGS+=-DI2C_SMBUS=I2C_0 | |||||||
| # Set keyboard LED I2C bus | # Set keyboard LED I2C bus | ||||||
| CFLAGS+=-DI2C_KBLED=I2C_1 | CFLAGS+=-DI2C_KBLED=I2C_1 | ||||||
|  |  | ||||||
|  | # Enable debug logging over keyboard parallel port | ||||||
|  | #CFLAGS+=-DPARPORT_DEBUG | ||||||
|  |  | ||||||
| # Set scratch ROM parameters | # Set scratch ROM parameters | ||||||
| SCRATCH_OFFSET=1024 | SCRATCH_OFFSET=1024 | ||||||
| SCRATCH_SIZE=1024 | SCRATCH_SIZE=1024 | ||||||
|   | |||||||
| @@ -23,6 +23,10 @@ | |||||||
| #include <common/macro.h> | #include <common/macro.h> | ||||||
| #include <common/version.h> | #include <common/version.h> | ||||||
|  |  | ||||||
|  | #ifdef PARPORT_DEBUG | ||||||
|  |     #include <ec/parallel.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| void external_0(void) __interrupt(0) {} | void external_0(void) __interrupt(0) {} | ||||||
| // timer_0 is in time.c | // timer_0 is in time.c | ||||||
| void timer_0(void) __interrupt(1); | void timer_0(void) __interrupt(1); | ||||||
| @@ -43,7 +47,11 @@ void init(void) { | |||||||
|     ecpm_init(); |     ecpm_init(); | ||||||
|     kbc_init(); |     kbc_init(); | ||||||
|     kbled_init(); |     kbled_init(); | ||||||
|  | #ifdef PARPORT_DEBUG | ||||||
|  |     parport_init(); | ||||||
|  | #else | ||||||
|     kbscan_init(); |     kbscan_init(); | ||||||
|  | #endif | ||||||
|     peci_init(); |     peci_init(); | ||||||
|     pmc_init(); |     pmc_init(); | ||||||
|     pwm_init(); |     pwm_init(); | ||||||
| @@ -105,8 +113,10 @@ void main(void) { | |||||||
|                 power_event(); |                 power_event(); | ||||||
|                 break; |                 break; | ||||||
|             case 1: |             case 1: | ||||||
|  | #ifndef PARPORT_DEBUG | ||||||
|                 // Scans keyboard and sends keyboard packets |                 // Scans keyboard and sends keyboard packets | ||||||
|                 kbscan_event(); |                 kbscan_event(); | ||||||
|  | #endif | ||||||
|                 break; |                 break; | ||||||
|             case 2: |             case 2: | ||||||
|                 // Passes through touchpad packets |                 // Passes through touchpad packets | ||||||
|   | |||||||
| @@ -10,6 +10,10 @@ | |||||||
|     #include <ec/i2c.h> |     #include <ec/i2c.h> | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #ifdef PARPORT_DEBUG | ||||||
|  |     #include <ec/parallel.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| int putchar(int c) { | int putchar(int c) { | ||||||
|     unsigned char byte = (unsigned char)c; |     unsigned char byte = (unsigned char)c; | ||||||
|     smfi_debug(byte); |     smfi_debug(byte); | ||||||
| @@ -18,6 +22,9 @@ int putchar(int c) { | |||||||
| #endif | #endif | ||||||
| #ifdef I2C_DEBUGGER | #ifdef I2C_DEBUGGER | ||||||
|     i2c_send(&I2C_SMBUS, I2C_DEBUGGER, &byte, 1); |     i2c_send(&I2C_SMBUS, I2C_DEBUGGER, &byte, 1); | ||||||
|  | #endif | ||||||
|  | #ifdef PARPORT_DEBUG | ||||||
|  |     parport_write(&byte, 1); | ||||||
| #endif | #endif | ||||||
|     return (int)byte; |     return (int)byte; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -19,6 +19,9 @@ CFLAGS+=-DLEVEL=4 | |||||||
| # Set battery I2C bus | # Set battery I2C bus | ||||||
| CFLAGS+=-DI2C_SMBUS=I2C_0 | CFLAGS+=-DI2C_SMBUS=I2C_0 | ||||||
|  |  | ||||||
|  | # Enable debug logging over keyboard parallel port | ||||||
|  | #CFLAGS+=-DPARPORT_DEBUG | ||||||
|  |  | ||||||
| # Set scratch ROM parameters | # Set scratch ROM parameters | ||||||
| SCRATCH_OFFSET=1024 | SCRATCH_OFFSET=1024 | ||||||
| SCRATCH_SIZE=1024 | SCRATCH_SIZE=1024 | ||||||
|   | |||||||
| @@ -23,6 +23,10 @@ | |||||||
| #include <common/macro.h> | #include <common/macro.h> | ||||||
| #include <common/version.h> | #include <common/version.h> | ||||||
|  |  | ||||||
|  | #ifdef PARPORT_DEBUG | ||||||
|  |     #include <ec/parallel.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| void external_0(void) __interrupt(0) {} | void external_0(void) __interrupt(0) {} | ||||||
| // timer_0 is in time.c | // timer_0 is in time.c | ||||||
| void timer_0(void) __interrupt(1); | void timer_0(void) __interrupt(1); | ||||||
| @@ -43,7 +47,11 @@ void init(void) { | |||||||
|     ecpm_init(); |     ecpm_init(); | ||||||
|     kbc_init(); |     kbc_init(); | ||||||
|     kbled_init(); |     kbled_init(); | ||||||
|  | #ifdef PARPORT_DEBUG | ||||||
|  |     parport_init(); | ||||||
|  | #else | ||||||
|     kbscan_init(); |     kbscan_init(); | ||||||
|  | #endif | ||||||
|     peci_init(); |     peci_init(); | ||||||
|     pmc_init(); |     pmc_init(); | ||||||
|     pwm_init(); |     pwm_init(); | ||||||
| @@ -105,8 +113,10 @@ void main(void) { | |||||||
|                 power_event(); |                 power_event(); | ||||||
|                 break; |                 break; | ||||||
|             case 1: |             case 1: | ||||||
|  | #ifndef PARPORT_DEBUG | ||||||
|                 // Scans keyboard and sends keyboard packets |                 // Scans keyboard and sends keyboard packets | ||||||
|                 kbscan_event(); |                 kbscan_event(); | ||||||
|  | #endif | ||||||
|                 break; |                 break; | ||||||
|             case 2: |             case 2: | ||||||
|                 // Passes through touchpad packets |                 // Passes through touchpad packets | ||||||
|   | |||||||
| @@ -10,6 +10,10 @@ | |||||||
|     #include <ec/i2c.h> |     #include <ec/i2c.h> | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #ifdef PARPORT_DEBUG | ||||||
|  |     #include <ec/parallel.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| int putchar(int c) { | int putchar(int c) { | ||||||
|     unsigned char byte = (unsigned char)c; |     unsigned char byte = (unsigned char)c; | ||||||
|     smfi_debug(byte); |     smfi_debug(byte); | ||||||
| @@ -18,6 +22,9 @@ int putchar(int c) { | |||||||
| #endif | #endif | ||||||
| #ifdef I2C_DEBUGGER | #ifdef I2C_DEBUGGER | ||||||
|     i2c_send(&I2C_SMBUS, I2C_DEBUGGER, &byte, 1); |     i2c_send(&I2C_SMBUS, I2C_DEBUGGER, &byte, 1); | ||||||
|  | #endif | ||||||
|  | #ifdef PARPORT_DEBUG | ||||||
|  |     parport_write(&byte, 1); | ||||||
| #endif | #endif | ||||||
|     return (int)byte; |     return (int)byte; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -22,6 +22,9 @@ CFLAGS+=-DI2C_SMBUS=I2C_4 | |||||||
| # Set type-c port manager I2C bus | # Set type-c port manager I2C bus | ||||||
| CFLAGS+=-DI2C_TCPM=I2C_1 | CFLAGS+=-DI2C_TCPM=I2C_1 | ||||||
|  |  | ||||||
|  | # Enable debug logging over keyboard parallel port | ||||||
|  | #CFLAGS+=-DPARPORT_DEBUG | ||||||
|  |  | ||||||
| # Set scratch ROM parameters | # Set scratch ROM parameters | ||||||
| SCRATCH_OFFSET=1024 | SCRATCH_OFFSET=1024 | ||||||
| SCRATCH_SIZE=1024 | SCRATCH_SIZE=1024 | ||||||
|   | |||||||
| @@ -24,6 +24,10 @@ | |||||||
| #include <common/macro.h> | #include <common/macro.h> | ||||||
| #include <common/version.h> | #include <common/version.h> | ||||||
|  |  | ||||||
|  | #ifdef PARPORT_DEBUG | ||||||
|  |     #include <ec/parallel.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| void external_0(void) __interrupt(0) {} | void external_0(void) __interrupt(0) {} | ||||||
| // timer_0 is in time.c | // timer_0 is in time.c | ||||||
| void timer_0(void) __interrupt(1); | void timer_0(void) __interrupt(1); | ||||||
| @@ -44,7 +48,11 @@ void init(void) { | |||||||
|     ecpm_init(); |     ecpm_init(); | ||||||
|     kbc_init(); |     kbc_init(); | ||||||
|     kbled_init(); |     kbled_init(); | ||||||
|  | #ifdef PARPORT_DEBUG | ||||||
|  |     parport_init(); | ||||||
|  | #else | ||||||
|     kbscan_init(); |     kbscan_init(); | ||||||
|  | #endif | ||||||
|     peci_init(); |     peci_init(); | ||||||
|     pmc_init(); |     pmc_init(); | ||||||
|     pwm_init(); |     pwm_init(); | ||||||
| @@ -107,8 +115,10 @@ void main(void) { | |||||||
|                 power_event(); |                 power_event(); | ||||||
|                 break; |                 break; | ||||||
|             case 1: |             case 1: | ||||||
|  | #ifndef PARPORT_DEBUG | ||||||
|                 // Scans keyboard and sends keyboard packets |                 // Scans keyboard and sends keyboard packets | ||||||
|                 kbscan_event(); |                 kbscan_event(); | ||||||
|  | #endif | ||||||
|                 break; |                 break; | ||||||
|             case 2: |             case 2: | ||||||
|                 // Passes through touchpad packets |                 // Passes through touchpad packets | ||||||
|   | |||||||
| @@ -10,6 +10,10 @@ | |||||||
|     #include <ec/i2c.h> |     #include <ec/i2c.h> | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #ifdef PARPORT_DEBUG | ||||||
|  |     #include <ec/parallel.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| int putchar(int c) { | int putchar(int c) { | ||||||
|     unsigned char byte = (unsigned char)c; |     unsigned char byte = (unsigned char)c; | ||||||
|     smfi_debug(byte); |     smfi_debug(byte); | ||||||
| @@ -18,6 +22,9 @@ int putchar(int c) { | |||||||
| #endif | #endif | ||||||
| #ifdef I2C_DEBUGGER | #ifdef I2C_DEBUGGER | ||||||
|     i2c_send(&I2C_SMBUS, I2C_DEBUGGER, &byte, 1); |     i2c_send(&I2C_SMBUS, I2C_DEBUGGER, &byte, 1); | ||||||
|  | #endif | ||||||
|  | #ifdef PARPORT_DEBUG | ||||||
|  |     parport_write(&byte, 1); | ||||||
| #endif | #endif | ||||||
|     return (int)byte; |     return (int)byte; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user