diff --git a/Makefile b/Makefile index 9ee2c5b..7c2e4ee 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ # Parameter for current board -#BOARD?=system76/galp3-c +BOARD?=system76/galp3-c #BOARD?=arduino/mega2560 #BOARD?=arduino/micro -BOARD?=arduino/uno +#BOARD?=arduino/uno # Set build directory BUILD=build/$(BOARD) diff --git a/src/board/system76/galp3-c/include/board/pwm.h b/src/board/system76/galp3-c/include/board/pwm.h new file mode 100644 index 0000000..256fde8 --- /dev/null +++ b/src/board/system76/galp3-c/include/board/pwm.h @@ -0,0 +1,8 @@ +#ifndef _BOARD_PWM_H +#define _BOARD_PWM_H + +#include + +void pwm_init(void); + +#endif // _BOARD_PWM_H diff --git a/src/board/system76/galp3-c/main.c b/src/board/system76/galp3-c/main.c index 7b72bfb..d0328f2 100644 --- a/src/board/system76/galp3-c/main.c +++ b/src/board/system76/galp3-c/main.c @@ -9,6 +9,7 @@ #include #include #include +#include void external_0(void) __interrupt(0) { printf("external_0\n"); @@ -40,8 +41,9 @@ void init(void) { kbc_init(); pmc_init(); kbscan_init(); + pwm_init(); - //TODO: INTC, PECI, PWM, SMBUS + //TODO: INTC, PECI, SMBUS // PECI information can be found here: https://www.intel.com/content/dam/www/public/us/en/documents/design-guides/core-i7-lga-2011-guide.pdf } diff --git a/src/board/system76/galp3-c/pwm.c b/src/board/system76/galp3-c/pwm.c new file mode 100644 index 0000000..3a66f2a --- /dev/null +++ b/src/board/system76/galp3-c/pwm.c @@ -0,0 +1,8 @@ +#include + +void pwm_init(void) { + // Set T0CHSEL to TACH0A and T1CHSEL to TACH1A + TSWCTLR = 0; + // Turn on the CPU fan at full blast (temperature control TODO) + DCR2 = 0xFF; +} diff --git a/src/ec/it8587e/include/ec/pwm.h b/src/ec/it8587e/include/ec/pwm.h new file mode 100644 index 0000000..5967f27 --- /dev/null +++ b/src/ec/it8587e/include/ec/pwm.h @@ -0,0 +1,34 @@ +#ifndef _EC_PWM_H +#define _EC_PWM_H + +#include + +// Duty cycle register 0 +__xdata volatile uint8_t __at(0x1802) DCR0; +// Duty cycle register 1 +__xdata volatile uint8_t __at(0x1803) DCR1; +// Duty cycle register 2 +__xdata volatile uint8_t __at(0x1804) DCR2; +// Duty cycle register 3 +__xdata volatile uint8_t __at(0x1805) DCR3; +// Duty cycle register 4 +__xdata volatile uint8_t __at(0x1806) DCR4; +// Duty cycle register 5 +__xdata volatile uint8_t __at(0x1807) DCR5; +// Duty cycle register 6 +__xdata volatile uint8_t __at(0x1808) DCR6; +// Duty cycle register 7 +__xdata volatile uint8_t __at(0x1809) DCR7; + +// Fan one tachometer least significant byte reading register +__xdata volatile uint8_t __at(0x181E) F1TLRR; +// Fan one tachometer most significant byte reading register +__xdata volatile uint8_t __at(0x181F) F1TMRR; +// Fan two tachometer least significant byte reading register +__xdata volatile uint8_t __at(0x1820) F2TLRR; +// Fan two tachometer most significant byte reading register +__xdata volatile uint8_t __at(0x1821) F2TMRR; +// Tachometer switch control register +__xdata volatile uint8_t __at(0x1848) TSWCTLR; + +#endif // _EC_PWM_H