delete some old files

This commit is contained in:
Adeeb Shihadeh 2023-09-30 16:07:26 -07:00
parent b483efe764
commit 1dd4ade197
3 changed files with 0 additions and 167 deletions

View File

@ -1,3 +0,0 @@
((c++-mode (flycheck-gcc-language-standard . "c++11")
(flycheck-clang-language-standard . "c++11")
))

View File

@ -1,59 +0,0 @@
#include <stdio.h>
#include <fcntl.h>
#include <sys/mman.h>
void hexdump(uint32_t *d, int l) {
for (int i = 0; i < l; i++) {
if (i%0x10 == 0 && i != 0) printf("\n");
printf("%8x ", d[i]);
}
printf("\n");
}
/* Power cluster primary PLL */
#define C0_PLL_MODE 0x0
#define C0_PLL_L_VAL 0x4
#define C0_PLL_ALPHA 0x8
#define C0_PLL_USER_CTL 0x10
#define C0_PLL_CONFIG_CTL 0x18
#define C0_PLL_CONFIG_CTL_HI 0x1C
#define C0_PLL_STATUS 0x28
#define C0_PLL_TEST_CTL_LO 0x20
#define C0_PLL_TEST_CTL_HI 0x24
/* Power cluster alt PLL */
#define C0_PLLA_MODE 0x100
#define C0_PLLA_L_VAL 0x104
#define C0_PLLA_ALPHA 0x108
#define C0_PLLA_USER_CTL 0x110
#define C0_PLLA_CONFIG_CTL 0x118
#define C0_PLLA_STATUS 0x128
#define C0_PLLA_TEST_CTL_LO 0x120
#define APC_DIAG_OFFSET 0x48
#define CLK_CTL_OFFSET 0x44
#define MUX_OFFSET 0x40
#define MDD_DROOP_CODE 0x7c
#define SSSCTL_OFFSET 0x160
#define PSCTL_OFFSET 0x164
int main() {
int fd = open("/dev/mem", O_RDWR);
volatile uint32_t *mb = (uint32_t *)mmap(0, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0x06400000);
volatile uint32_t *mc = (uint32_t *)mmap(0, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0x06480000);
volatile uint32_t *md = (uint32_t *)mmap(0, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0x09A20000);
while (1) {
printf("PLL MODE:%x L_VAL:%x ALPHA:%x USER_CTL:%x CONFIG_CTL:%x CONFIG_CTL_HI:%x STATUS:%x TEST_CTL_LO:%x TEST_CTL_HI:%x\n",
mb[C0_PLL_MODE/4], mb[C0_PLL_L_VAL/4], mb[C0_PLL_ALPHA/4],
mb[C0_PLL_USER_CTL/4], mb[C0_PLL_CONFIG_CTL/4], mb[C0_PLL_CONFIG_CTL_HI/4],
mb[C0_PLL_STATUS/4], mb[C0_PLL_TEST_CTL_LO/4], mb[C0_PLL_TEST_CTL_HI/4]);
printf(" MUX_OFFSET:%x CLK_CTL_OFFSET:%x APC_DIAG_OFFSET:%x MDD_DROOP_CODE:%x\n",
mb[MUX_OFFSET/4], mb[CLK_CTL_OFFSET/4], mb[APC_DIAG_OFFSET/4], mb[MDD_DROOP_CODE/4]);
printf(" PLLA MODE:%x L_VAL:%x ALPHA:%x USER_CTL:%x CONFIG_CTL:%x STATUS:%x TEST_CTL_LO:%x SSSCTL_OFFSET:%x PSCTL_OFFSET:%x\n",
mb[C0_PLLA_MODE/4], mb[C0_PLLA_L_VAL/4], mb[C0_PLLA_ALPHA/4], mb[C0_PLLA_USER_CTL/4],
mb[C0_PLLA_CONFIG_CTL/4], mb[C0_PLLA_STATUS/4], mb[C0_PLLA_TEST_CTL_LO/4],
mb[SSSCTL_OFFSET/4], mb[PSCTL_OFFSET/4]);
usleep(1000*100);
}
}

View File

@ -1,105 +0,0 @@
#!/usr/bin/env python3
import os
import time
import numpy as np
from openpilot.system.hardware.tici.hardware import Tici
from openpilot.system.hardware.tici.pins import GPIO
from openpilot.common.gpio import gpio_init, gpio_set, gpio_export
def read_power():
with open("/sys/bus/i2c/devices/0-0040/hwmon/hwmon1/in1_input") as f:
voltage_total = int(f.read()) / 1000.
with open("/sys/bus/i2c/devices/0-0040/hwmon/hwmon1/curr1_input") as f:
current_total = int(f.read())
with open("/sys/class/power_supply/bms/voltage_now") as f:
voltage = int(f.read()) / 1e6 # volts
with open("/sys/class/power_supply/bms/current_now") as f:
current = int(f.read()) / 1e3 # ma
power_som = voltage*current
power_total = voltage_total*current_total
return power_total, power_som
def read_power_avg():
pwrs = []
for _ in range(100):
pwrs.append(read_power())
time.sleep(0.01)
power_total, power_som = np.mean([x[0] for x in pwrs]), np.mean([x[1] for x in pwrs])
return "total %7.2f mW SOM %7.2f mW" % (power_total, power_som)
if __name__ == "__main__":
gpio_export(GPIO.CAM0_AVDD_EN)
gpio_export(GPIO.CAM0_RSTN)
gpio_export(GPIO.CAM1_RSTN)
gpio_export(GPIO.CAM2_RSTN)
print("hello")
os.system('kill $(pgrep -f "manager.py")')
os.system('kill $(pgrep -f "python -m selfdrive.athena.manage_athenad")')
os.system('kill $(pgrep -f "selfdrive.athena.athenad")')
# stopping weston turns off lcd3v3
os.system("sudo service weston stop")
os.system("sudo service ModemManager stop")
print("services stopped")
t = Tici()
t.initialize_hardware()
t.set_power_save(True)
t.set_screen_brightness(0)
gpio_init(GPIO.STM_RST_N, True)
gpio_init(GPIO.HUB_RST_N, True)
gpio_init(GPIO.GNSS_PWR_EN, True)
gpio_init(GPIO.LTE_RST_N, True)
gpio_init(GPIO.LTE_PWRKEY, True)
gpio_init(GPIO.CAM0_AVDD_EN, True)
gpio_init(GPIO.CAM0_RSTN, True)
gpio_init(GPIO.CAM1_RSTN, True)
gpio_init(GPIO.CAM2_RSTN, True)
os.system("sudo su -c 'echo 0 > /sys/kernel/debug/regulator/camera_rear_ldo/enable'") # cam 1v2 off
gpio_set(GPIO.CAM0_AVDD_EN, False) # cam 2v8 off
gpio_set(GPIO.LTE_RST_N, True) # quectel off
gpio_set(GPIO.GNSS_PWR_EN, False) # gps off
gpio_set(GPIO.STM_RST_N, True) # panda off
gpio_set(GPIO.HUB_RST_N, False) # hub off
# cameras in reset
gpio_set(GPIO.CAM0_RSTN, False)
gpio_set(GPIO.CAM1_RSTN, False)
gpio_set(GPIO.CAM2_RSTN, False)
time.sleep(8)
print("baseline: ", read_power_avg())
gpio_set(GPIO.CAM0_AVDD_EN, True)
time.sleep(2)
print("cam avdd: ", read_power_avg())
os.system("sudo su -c 'echo 1 > /sys/kernel/debug/regulator/camera_rear_ldo/enable'")
time.sleep(2)
print("cam dvdd: ", read_power_avg())
gpio_set(GPIO.CAM0_RSTN, True)
gpio_set(GPIO.CAM1_RSTN, True)
gpio_set(GPIO.CAM2_RSTN, True)
time.sleep(2)
print("cams up: ", read_power_avg())
gpio_set(GPIO.HUB_RST_N, True)
time.sleep(2)
print("usb hub: ", read_power_avg())
gpio_set(GPIO.STM_RST_N, False)
time.sleep(5)
print("panda: ", read_power_avg())
gpio_set(GPIO.GNSS_PWR_EN, True)
time.sleep(5)
print("gps: ", read_power_avg())
gpio_set(GPIO.LTE_RST_N, False)
time.sleep(1)
gpio_set(GPIO.LTE_PWRKEY, True)
time.sleep(1)
gpio_set(GPIO.LTE_PWRKEY, False)
time.sleep(5)
print("quectel: ", read_power_avg())