m1n1.fw.asc: Make startup/shutdown more proper

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2022-07-03 23:29:03 +09:00
parent 615878ce68
commit 4d8065807c
2 changed files with 7 additions and 5 deletions

View file

@ -101,10 +101,8 @@ class StandardASC(ASC):
ep.start() ep.start()
def start(self): def start(self):
if self.is_running(): super().boot()
self.mgmt.start() self.mgmt.start()
else:
self.boot()
self.mgmt.wait_boot(1) self.mgmt.wait_boot(1)
def stop(self, state=0x10): def stop(self, state=0x10):
@ -115,11 +113,13 @@ class StandardASC(ASC):
self.mgmt.stop(state=state) self.mgmt.stop(state=state)
self.epmap = {} self.epmap = {}
self.add_ep(0, ASCManagementEndpoint(self, 0)) self.add_ep(0, ASCManagementEndpoint(self, 0))
if state < 0x10:
self.shutdown()
def boot(self): def boot(self):
print("Booting ASC...") print("Booting ASC...")
super().boot() super().boot()
self.mgmt.wait_boot() self.mgmt.wait_boot(1)
__all__.extend(k for k, v in globals().items() __all__.extend(k for k, v in globals().items()
if (callable(v) or isinstance(v, type)) and v.__module__ == __name__) if (callable(v) or isinstance(v, type)) and v.__module__ == __name__)

View file

@ -79,6 +79,8 @@ class ASC:
def boot(self): def boot(self):
self.asc.CPU_CONTROL.set(RUN=1) self.asc.CPU_CONTROL.set(RUN=1)
def shutdown(self):
self.asc.CPU_CONTROL.set(RUN=0) self.asc.CPU_CONTROL.set(RUN=0)
def add_ep(self, idx, ep): def add_ep(self, idx, ep):