Add PWM control
This commit is contained in:
parent
35a869bb49
commit
3fb1ecd84b
4
Makefile
4
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)
|
||||
|
8
src/board/system76/galp3-c/include/board/pwm.h
Normal file
8
src/board/system76/galp3-c/include/board/pwm.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef _BOARD_PWM_H
|
||||
#define _BOARD_PWM_H
|
||||
|
||||
#include <ec/pwm.h>
|
||||
|
||||
void pwm_init(void);
|
||||
|
||||
#endif // _BOARD_PWM_H
|
@ -9,6 +9,7 @@
|
||||
#include <board/kbscan.h>
|
||||
#include <board/pmc.h>
|
||||
#include <board/ps2.h>
|
||||
#include <board/pwm.h>
|
||||
|
||||
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
|
||||
}
|
||||
|
8
src/board/system76/galp3-c/pwm.c
Normal file
8
src/board/system76/galp3-c/pwm.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include <board/pwm.h>
|
||||
|
||||
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;
|
||||
}
|
34
src/ec/it8587e/include/ec/pwm.h
Normal file
34
src/ec/it8587e/include/ec/pwm.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef _EC_PWM_H
|
||||
#define _EC_PWM_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// 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
|
Loading…
x
Reference in New Issue
Block a user