head.s分析(11):关闭WATCHDOG

本文详细解析了ADI BF561 DSP处理器的启动过程,重点介绍了_real_start函数中涉及的寄存器配置与栈指针初始化等内容。

 

快乐虾

http://blog.youkuaiyun.com/lights_joy/

lights@hb165.com

  

本文适用于

ADI bf561 DSP

uclinux-2008r1.5-rc3 (移植到vdsp5)

Visual DSP++ 5.0(update 5)

  

欢迎转载,但请保留作者信息

 

 

     ENTRY(_real_start)

     [ -- sp ] = reti;

     p0.l = lo(WDOGA_CTL);

     p0.h = hi(WDOGA_CTL);

     r0 = 0xAD6(z);

     w[p0] = r0;   /* watchdog off for now */

     ssync;

这个是_real_start的开始,不知为何这里要将reti入栈?此时SP仍然指向scratch pad,下面马上就要改变SP指针了。

Watchdog就比较好理解了,下面是WDOGA_CTL寄存器的意义:

watchdog

 

1       参考资料

head.s分析(1):保存u-boot传递过来的指针(2009-1-19)

head.s分析(2)SYSCFG配置(2009-1-19)

head.s分析(3):数据及指针寄存器清0(2009-1-19)

head.s分析(4):关闭CACHE(2009-01-19)

head.s分析(5):关闭串口(2009-01-19)

head.s分析(6):栈指针初始化(2009-01-19)

head.s分析(7)init_early_exception_vectors(2009-1-19)

head.s分析(8):配置PLLSDRAM(2009-01-20)

head.s分析(9)EBIU配置(2009-01-20)

head.s分析(10):转入中断15(2009-01-20)

 

import pygame from threading import Thread from queue import Queue import time import numpy as np from mini_bdx_runtime.buttons import Buttons X_RANGE = [-0.15, 0.15] Y_RANGE = [-0.2, 0.2] YAW_RANGE = [-1.0, 1.0] # rads NECK_PITCH_RANGE = [-0.34, 1.1] HEAD_PITCH_RANGE = [-0.78, 0.3] HEAD_YAW_RANGE = [-0.5, 0.5] HEAD_ROLL_RANGE = [-0.5, 0.5] class XBoxController: def __init__(self, command_freq, only_head_control=False): self.command_freq = command_freq self.head_control_mode = only_head_control self.only_head_control = only_head_control self.last_commands = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] self.last_left_trigger = 0.0 self.last_right_trigger = 0.0 pygame.init() self.p1 = pygame.joystick.Joystick(0) self.p1.init() print(f"Loaded joystick with {self.p1.get_numaxes()} axes.") self.cmd_queue = Queue(maxsize=1) self.A_pressed = False self.B_pressed = False self.X_pressed = False self.Y_pressed = False self.LB_pressed = False self.RB_pressed = False self.buttons = Buttons() Thread(target=self.commands_worker, daemon=True).start() def commands_worker(self): while True: self.cmd_queue.put(self.get_commands()) time.sleep(1 / self.command_freq) def get_commands(self): last_commands = self.last_commands left_trigger = self.last_left_trigger right_trigger = self.last_right_trigger l_x = -1 * self.p1.get_axis(0) l_y = -1 * self.p1.get_axis(1) r_x = -1 * self.p1.get_axis(2) r_y = -1 * self.p1.get_axis(3) right_trigger = np.around((self.p1.get_axis(4) + 1) / 2, 3) left_trigger = np.around((self.p1.get_axis(5) + 1) / 2, 3) if left_trigger < 0.1: left_trigger = 0 if right_trigger < 0.1: right_trigger = 0 if not self.head_control_mode: lin_vel_y = l_x lin_vel_x = l_y ang_vel = r_x if lin_vel_x >= 0: lin_vel_x *= np.abs(X_RANGE[1]) else: lin_vel_x *= np.abs(X_RANGE[0]) if lin_vel_y >= 0: lin_vel_y *= np.abs(Y_RANGE[1]) else: lin_vel_y *= np.abs(Y_RANGE[0]) if ang_vel >= 0: ang_vel *= np.abs(YAW_RANGE[1]) else: ang_vel *= np.abs(YAW_RANGE[0]) last_commands[0] = lin_vel_x last_commands[1] = lin_vel_y last_commands[2] = ang_vel else: last_commands[0] = 0.0 last_commands[1] = 0.0 last_commands[2] = 0.0 last_commands[3] = 0.0 # neck pitch 0 for now head_yaw = l_x head_pitch = l_y head_roll = r_x if head_yaw >= 0: head_yaw *= np.abs(HEAD_YAW_RANGE[0]) else: head_yaw *= np.abs(HEAD_YAW_RANGE[1]) if head_pitch >= 0: head_pitch *= np.abs(HEAD_PITCH_RANGE[0]) else: head_pitch *= np.abs(HEAD_PITCH_RANGE[1]) if head_roll >= 0: head_roll *= np.abs(HEAD_ROLL_RANGE[0]) else: head_roll *= np.abs(HEAD_ROLL_RANGE[1]) last_commands[4] = head_pitch last_commands[5] = head_yaw last_commands[6] = head_roll for event in pygame.event.get(): if event.type == pygame.JOYBUTTONDOWN: if self.p1.get_button(0): # A button self.A_pressed = True if self.p1.get_button(1): # B button self.B_pressed = True if self.p1.get_button(3): # X button self.X_pressed = True if self.p1.get_button(4): # Y button self.Y_pressed = True if not self.only_head_control: self.head_control_mode = not self.head_control_mode if self.p1.get_button(6): # LB button self.LB_pressed = True if self.p1.get_button(7): # RB button self.RB_pressed = True if event.type == pygame.JOYBUTTONUP: self.A_pressed = False self.B_pressed = False self.X_pressed = False self.Y_pressed = False self.LB_pressed = False self.RB_pressed = False # for i in range(10): # if self.p1.get_button(i): # print(f"Button {i} pressed") up_down = self.p1.get_hat(0)[1] pygame.event.pump() # process event queue return ( np.around(last_commands, 3), self.A_pressed, self.B_pressed, self.X_pressed, self.Y_pressed, self.LB_pressed, self.RB_pressed, left_trigger, right_trigger, up_down, ) def get_last_command(self): A_pressed = False B_pressed = False X_pressed = False Y_pressed = False LB_pressed = False RB_pressed = False up_down = 0 try: ( self.last_commands, A_pressed, B_pressed, X_pressed, Y_pressed, LB_pressed, RB_pressed, self.last_left_trigger, self.last_right_trigger, up_down, ) = self.cmd_queue.get( False ) # non blocking except Exception: pass self.buttons.update( A_pressed, B_pressed, X_pressed, Y_pressed, LB_pressed, RB_pressed, up_down == 1, up_down == -1, ) return ( self.last_commands, self.buttons, self.last_left_trigger, self.last_right_trigger, ) if __name__ == "__main__": controller = XBoxController(20) while True: print(controller.get_last_command()) time.sleep(0.05)
最新发布
07-30
解释当前log 分析原因,定位具体代码位置并提供解决办法 Dec 31 19:07:05 vcswificam user.notice root: DEBUG : WATCHDOG : Anyka running at PID 560 Dec 31 19:07:06 vcswificam user.notice root: DEBUG : WATCHDOG : Anyka CPU utilization at 36% Dec 31 19:07:06 vcswificam user.notice root: INFO : WATCHDOG : Running Anyka CPU check. (36%) Over: (0/4) Under: (/4) Dec 31 19:07:12 vcswificam user.notice root: DEBUG : WATCHDOG : Anyka running at PID 560 Dec 31 19:07:13 vcswificam user.notice root: DEBUG : WATCHDOG : Anyka CPU utilization at 26% Dec 31 19:07:13 vcswificam user.notice root: INFO : WATCHDOG : Running Anyka CPU check. (26%) Over: (0/4) Under: (/4) Dec 31 19:07:18 vcswificam user.notice root: DEBUG : WATCHDOG : Anyka running at PID 560 Dec 31 19:07:19 vcswificam user.notice root: DEBUG : WATCHDOG : Anyka CPU utilization at 31% Dec 31 19:07:19 vcswificam user.notice root: INFO : WATCHDOG : Running Anyka CPU check. (31%) Over: (0/4) Under: (/4) Dec 31 19:07:25 vcswificam user.notice root: DEBUG : WATCHDOG : Anyka running at PID 560 Dec 31 19:07:25 vcswificam daemon.debug thttpd[447]: spawned CGI process 2532 for file 'cgi-bin/get_signal' Dec 31 19:07:27 vcswificam user.notice root: DEBUG : WATCHDOG : Anyka CPU utilization at 38% Dec 31 19:07:27 vcswificam user.notice root: INFO : WATCHDOG : Running Anyka CPU check. (38%) Over: (0/4) Under: (/4) Dec 31 19:07:32 vcswificam user.notice root: DEBUG : WATCHDOG : Anyka running at PID 560 Dec 31 19:07:33 vcswificam user.notice root: DEBUG : WATCHDOG : Anyka CPU utilization at 22% Dec 31 19:07:33 vcswificam user.notice root: INFO : WATCHDOG : Running Anyka CPU check. (22%) Over: (0/4) Under: (/4) Dec 31 19:07:39 vcswificam user.notice root: DEBUG : WATCHDOG : Anyka running at PID 560 Dec 31 19:07:39 vcswificam user.notice root: DEBUG : WATCHDOG : Anyka CPU utilization at 26% Dec 31 19:07:39 vcswificam user.notice root: INFO : WATCHDOG : Running Anyka CPU check. (26%) Over: (0/4) Under: (/4) Dec 31 19:07:39 vcswificam user.notice root: INFO : WATCHDOG : Running 30 second process... (Firmware version: 48.8.1, Uptime: 19:07:39 up 7 min, load average: 5.15, 3.67, 1.80) Dec 31 19:07:39 vcswificam user.notice root: DEBUG : WATCHDOG : Checking if wifi is configured to station mode. running = station Dec 31 19:07:40 vcswificam user.notice root: DEBUG : WATCHDOG : Checking if wifi is connected. wificonnecttest = 00:0A:52:0A:DF:B6 Dec 31 19:07:40 vcswificam user.notice root: INFO : WATCHDOG : WiFi = Connected. (Current: -35 / Minimum: -75) Dec 31 19:07:42 vcswificam user.notice root: INFO : WATCHDOG : IP = 172.20.1.51, Gateway = 172.20.1.1, Ping Gateway = Fail Dec 31 19:07:42 vcswificam kern.debug kernel: [ 462.250000] ieee80211 phy0: [SCAN] Scan request for 0 SSIDs. Dec 31 19:07:42 vcswificam user.notice root: OK
06-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

嵌云阁主

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值