往死里写

来源:互联网 发布:安卓7.0数据库编辑器 编辑:程序博客网 时间:2024/06/07 03:53
    /*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();

原创粉丝点击