File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
components/drivers/mailbox Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ static rt_err_t pic_mbox_request(struct rt_mbox_chan *chan)
6666 struct pic_mbox * pic_mbox = raw_to_pic_mbox (chan -> ctrl );
6767
6868 HWREG32 (pic_mbox -> regs + MAILBOX_IMASK ) &= ~RT_BIT (index );
69+ HWREG32 (pic_mbox -> regs + MAILBOX_ISTATE ) = 0 ;
6970
7071 return RT_EOK ;
7172}
@@ -89,6 +90,11 @@ static rt_err_t pic_mbox_send(struct rt_mbox_chan *chan, const void *data)
8990 rt_thread_yield ();
9091 }
9192
93+ if (HWREG32 (pic_mbox -> peer_regs + MAILBOX_IMASK ) & RT_BIT (index ))
94+ {
95+ return - RT_ERROR ;
96+ }
97+
9298 level = rt_spin_lock_irqsave (& pic_mbox -> lock );
9399
94100 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)
187193 }
188194
189195 pic_mbox -> peer_regs = pic_mbox -> regs + size / 2 ;
196+
197+ /* Init by the captain */
198+ HWREG32 (pic_mbox -> regs + MAILBOX_IMASK ) = 0xffffffff ;
199+ HWREG32 (pic_mbox -> regs + MAILBOX_ISTATE ) = 0 ;
200+ HWREG32 (pic_mbox -> peer_regs + MAILBOX_IMASK ) = 0xffffffff ;
201+ HWREG32 (pic_mbox -> peer_regs + MAILBOX_ISTATE ) = 0 ;
190202 }
191203 else
192204 {
You can’t perform that action at this time.
0 commit comments