[DM/MAILBOX] Support PIC mailbox in AMP
Should registers clean by master in AMP. Signed-off-by: GuEe-GUI <2991707448@qq.com>
This commit is contained in:
parent
07b114ae73
commit
c9ab55f7a5
@ -66,6 +66,7 @@ static rt_err_t pic_mbox_request(struct rt_mbox_chan *chan)
|
|||||||
struct pic_mbox *pic_mbox = raw_to_pic_mbox(chan->ctrl);
|
struct pic_mbox *pic_mbox = raw_to_pic_mbox(chan->ctrl);
|
||||||
|
|
||||||
HWREG32(pic_mbox->regs + MAILBOX_IMASK) &= ~RT_BIT(index);
|
HWREG32(pic_mbox->regs + MAILBOX_IMASK) &= ~RT_BIT(index);
|
||||||
|
HWREG32(pic_mbox->regs + MAILBOX_ISTATE) = 0;
|
||||||
|
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
@ -89,6 +90,11 @@ static rt_err_t pic_mbox_send(struct rt_mbox_chan *chan, const void *data)
|
|||||||
rt_thread_yield();
|
rt_thread_yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (HWREG32(pic_mbox->peer_regs + MAILBOX_IMASK) & RT_BIT(index))
|
||||||
|
{
|
||||||
|
return -RT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
level = rt_spin_lock_irqsave(&pic_mbox->lock);
|
level = rt_spin_lock_irqsave(&pic_mbox->lock);
|
||||||
|
|
||||||
HWREG32(pic_mbox->regs + MAILBOX_MSG(index)) = *(rt_uint32_t *)data;
|
HWREG32(pic_mbox->regs + MAILBOX_MSG(index)) = *(rt_uint32_t *)data;
|
||||||
@ -187,6 +193,12 @@ static rt_err_t pic_mbox_probe(struct rt_platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pic_mbox->peer_regs = pic_mbox->regs + size / 2;
|
pic_mbox->peer_regs = pic_mbox->regs + size / 2;
|
||||||
|
|
||||||
|
/* Init by the captain */
|
||||||
|
HWREG32(pic_mbox->regs + MAILBOX_IMASK) = 0xffffffff;
|
||||||
|
HWREG32(pic_mbox->regs + MAILBOX_ISTATE) = 0;
|
||||||
|
HWREG32(pic_mbox->peer_regs + MAILBOX_IMASK) = 0xffffffff;
|
||||||
|
HWREG32(pic_mbox->peer_regs + MAILBOX_ISTATE) = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user