mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-24 15:43:11 +00:00
m1n1.fw.afk: Add more hello handlers used by aop
Signed-off-by: Eileen Yoon <eyn@gmx.com>
This commit is contained in:
parent
eb3710edb1
commit
bf5a3a6e98
1 changed files with 25 additions and 15 deletions
|
@ -150,11 +150,30 @@ class AFKRingBufEndpoint(ASCBaseEndpoint):
|
|||
def start(self):
|
||||
self.send(AFKEP_Init())
|
||||
|
||||
def stop(self):
|
||||
self.log("Shutting down")
|
||||
self.send(AFKEP_Shutdown())
|
||||
while self.alive:
|
||||
self.asc.work()
|
||||
|
||||
@msg_handler(0xa0, AFKEP_Init_Ack)
|
||||
def Init_Ack(self, msg):
|
||||
self.alive = True
|
||||
return True
|
||||
|
||||
@msg_handler(0xc1, AFKEP_Shutdown_Ack)
|
||||
def Shutdown_Ack(self, msg):
|
||||
self.alive = False
|
||||
self.log("Shutdown ACKed")
|
||||
return True
|
||||
|
||||
@msg_handler(0x80, AFKEP_Init)
|
||||
def Hello(self, msg):
|
||||
self.rxbuf, self.rxbuf_dva = self.asc.ioalloc(0x10000)
|
||||
self.txbuf, self.txbuf_dva = self.asc.ioalloc(0x10000)
|
||||
self.send(AFKEP_Init_Ack())
|
||||
return True
|
||||
|
||||
@msg_handler(0x89, AFKEP_GetBuf)
|
||||
def GetBuf(self, msg):
|
||||
size = msg.SIZE * AFKRingBuf.BLOCK_SIZE
|
||||
|
@ -168,18 +187,6 @@ class AFKRingBufEndpoint(ASCBaseEndpoint):
|
|||
self.log(f"Buffer: phys={self.iobuffer:#x} dva={self.iobuffer_dva:#x} size={size:#x}")
|
||||
return True
|
||||
|
||||
def stop(self):
|
||||
self.log("Shutting down")
|
||||
self.send(AFKEP_Shutdown())
|
||||
while self.alive:
|
||||
self.asc.work()
|
||||
|
||||
@msg_handler(0xc1, AFKEP_Shutdown_Ack)
|
||||
def Shutdown_Ack(self, msg):
|
||||
self.alive = False
|
||||
self.log("Shutdown ACKed")
|
||||
return True
|
||||
|
||||
@msg_handler(0x8a, AFKEP_InitRB)
|
||||
def InitTX(self, msg):
|
||||
self.txq = self.init_rb(msg)
|
||||
|
@ -194,10 +201,13 @@ class AFKRingBufEndpoint(ASCBaseEndpoint):
|
|||
self.start_queues()
|
||||
return True
|
||||
|
||||
@msg_handler(0x8c, AFKEP_InitRB)
|
||||
def InitUnk(self, msg):
|
||||
return True # no op
|
||||
|
||||
def init_rb(self, msg):
|
||||
off = msg.OFFSET * AFKRingBuf.BLOCK_SIZE
|
||||
size = msg.SIZE * AFKRingBuf.BLOCK_SIZE
|
||||
|
||||
return AFKRingBuf(self, self.iobuffer + off, size)
|
||||
|
||||
def start_queues(self):
|
||||
|
|
Loading…
Reference in a new issue