往死里写

    /*The order of mailbox event processing was changed to prevent race condition errors.
        The SM1 activate Byte (Register 0x80E) was read before reading AL Event register.
        1. Handle Mailbox Read event
        2. Handle repeat toggle request
        3. Handle Mailbox write event

    */

// the SyncManager change event(0x220:4) could be acknowledged by reading the SM1 control register without notification to the local application =>check if the syncManger 1 // is still enable

// SM 1 (Mailbox Read) event is set, when the mailbox was read from the master,
//  to acknowledge the event the first byte of the mailbox has to be written,
//  by writing the first byte the mailbox is locked, too

            u8dummy = 0;
            HW_EscWriteByte(u8dummy,u16EscAddrSendMbx);

// the Mailbox Read event in the variable ALEventReg shall be reset before calling  MBX_MailboxReadInd, where a new mailbox datagram (if available) could be stored in the send mailbox


            ALEventReg &= ~(MAILBOX_READ_EVENT);
            MBX_MailboxReadInd();


// bMbxRepeatToggle holds the last state of the Repeat Bit (Bit 1)

判断是否有repeat request请求

/* Repeat Bit (Bit 1) has toggled, there is a repeat request, in MBX_MailboxRepeatReq the correct  response will put in the send mailbox again */

在这里调用函数MBX_MailboxRepeatReq(); 函数

响应the repeat request after the send mailbox was updated by writing the Repeat Bit in the Repeat Ack Bit of the PDI Ctrl-Byte of SM1(Register 0x80F)

            sm1Activate &= SM_SETTING_REPEAT_ACK;
            HW_EscWriteByte(sm1Activate,(ESC_SM_PDICONTROL_OFFSET + SIZEOF_SM_REGISTER));

/*SM 0 (Mailbox Write) event is set, when the mailbox was written from the master, to acknowledge the event the first byte of the mailbox has to be read, which will be done in MBX_CheckAndCopyMailbox */

/*the Mailbox Write event in the variable ALEventReg shall be reset before calling MBX_CheckAnd CopyMailbox, where the received mailbox datagram will be processed*/

ALEventReg &= ~(MAILBOX_WRITE_EVENT);

MBX_CheckAndCopyMailbox();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值