Decrease pmc latency

This commit is contained in:
Jeremy Soller 2020-02-24 09:45:10 -07:00
parent 130ab9d61f
commit 83c224c229
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1
3 changed files with 111 additions and 59 deletions

View File

@ -99,26 +99,43 @@ void main(void) {
uint32_t last_time = 0; uint32_t last_time = 0;
for(main_cycle = 0; ; main_cycle++) { for(main_cycle = 0; ; main_cycle++) {
uint32_t time = time_get(); switch (main_cycle % 5) {
case 0:
// Handle power states // Handle power states
power_event(); power_event();
break;
case 1:
// Scans keyboard and sends keyboard packets // Scans keyboard and sends keyboard packets
kbscan_event(); kbscan_event();
break;
case 2:
// Passes through touchpad packets // Passes through touchpad packets
touchpad_event(&PS2_3); touchpad_event(&PS2_3);
// Handle lid close/open break;
lid_event(); case 3:
// Checks for keyboard/mouse packets from host // Checks for keyboard/mouse packets from host
kbc_event(&KBC); kbc_event(&KBC);
break;
case 4:
// Handle lid close/open
lid_event();
break;
}
if (main_cycle == 0) {
uint32_t time = time_get();
// Only run the following once a second // Only run the following once a second
if (last_time > time || (time - last_time) >= 1000) { if (last_time > time || (time - last_time) >= 1000) {
last_time = time; last_time = time;
// Updates fan status and temps // Updates fan status and temps
peci_event(); peci_event();
// Updates battery status // Updates battery status
battery_event(); battery_event();
} }
}
// Handles ACPI communication // Handles ACPI communication
pmc_event(&PMC_1); pmc_event(&PMC_1);
// AP/EC communication over SMFI // AP/EC communication over SMFI

View File

@ -99,26 +99,43 @@ void main(void) {
uint32_t last_time = 0; uint32_t last_time = 0;
for(main_cycle = 0; ; main_cycle++) { for(main_cycle = 0; ; main_cycle++) {
uint32_t time = time_get(); switch (main_cycle % 5) {
case 0:
// Handle power states // Handle power states
power_event(); power_event();
break;
case 1:
// Scans keyboard and sends keyboard packets // Scans keyboard and sends keyboard packets
kbscan_event(); kbscan_event();
break;
case 2:
// Passes through touchpad packets // Passes through touchpad packets
touchpad_event(&PS2_3); touchpad_event(&PS2_3);
// Handle lid close/open break;
lid_event(); case 3:
// Checks for keyboard/mouse packets from host // Checks for keyboard/mouse packets from host
kbc_event(&KBC); kbc_event(&KBC);
break;
case 4:
// Handle lid close/open
lid_event();
break;
}
if (main_cycle == 0) {
uint32_t time = time_get();
// Only run the following once a second // Only run the following once a second
if (last_time > time || (time - last_time) >= 1000) { if (last_time > time || (time - last_time) >= 1000) {
last_time = time; last_time = time;
// Updates fan status and temps // Updates fan status and temps
peci_event(); peci_event();
// Updates battery status // Updates battery status
battery_event(); battery_event();
} }
}
// Handles ACPI communication // Handles ACPI communication
pmc_event(&PMC_1); pmc_event(&PMC_1);
// AP/EC communication over SMFI // AP/EC communication over SMFI

View File

@ -101,28 +101,46 @@ void main(void) {
uint32_t last_time = 0; uint32_t last_time = 0;
for(main_cycle = 0; ; main_cycle++) { for(main_cycle = 0; ; main_cycle++) {
uint32_t time = time_get(); switch (main_cycle % 5) {
case 0:
// Handle power states // Handle power states
power_event(); power_event();
break;
case 1:
// Scans keyboard and sends keyboard packets // Scans keyboard and sends keyboard packets
kbscan_event(); kbscan_event();
break;
case 2:
// Passes through touchpad packets // Passes through touchpad packets
touchpad_event(&PS2_3); touchpad_event(&PS2_3);
// Handle lid close/open break;
lid_event(); case 3:
// Checks for keyboard/mouse packets from host // Checks for keyboard/mouse packets from host
kbc_event(&KBC); kbc_event(&KBC);
break;
case 4:
// Handle lid close/open
lid_event();
break;
}
if (main_cycle == 0) {
uint32_t time = time_get();
// Only run the following once a second // Only run the following once a second
if (last_time > time || (time - last_time) >= 1000) { if (last_time > time || (time - last_time) >= 1000) {
last_time = time; last_time = time;
// Updates fan status and temps // Updates fan status and temps
peci_event(); peci_event();
// Updates battery status // Updates battery status
battery_event(); battery_event();
// Updates type-c port // Updates type-c port
tcpm_event(); tcpm_event();
} }
}
// Handles ACPI communication // Handles ACPI communication
pmc_event(&PMC_1); pmc_event(&PMC_1);
// AP/EC communication over SMFI // AP/EC communication over SMFI