⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bum.asm

📁 蓝牙设备中HCI语言传输数据
💻 ASM
📖 第 1 页 / 共 5 页
字号:
;----------------;加密模式改变事件;EventCode=08H;入口参数:;  Length = r0;----------------HCI_Encryption_Change_Event:    lcall Throw_Away_HCI_Event_Parameter    ret;------------------------;链接的连接字改变完成事件;EventCode=09H;入口参数:;  Length = r0;------------------------HCI_Change_Connection_Link_Key_Complete_Event:    lcall Throw_Away_HCI_Event_Parameter    ret;--------------------;主单元连接字完成事件;EventCode=0AH;入口参数:;  Length = r0;--------------------HCI_Master_Link_Key_Complete_Event:    lcall Throw_Away_HCI_Event_Parameter    ret;------------------------;远程支持特性读取完成事件;EventCode=0BH;入口参数:;  Length = r0;------------------------HCI_Read_Remote_Supported_Features_Complete_Event:    lcall Throw_Away_HCI_Event_Parameter    ret;------------------------;远程版本信息读取完成事件;EventCode=0CH;入口参数:;  Length = r0;------------------------HCI_Read_Remote_Version_Information_Complete_Event:    lcall Throw_Away_HCI_Event_Parameter    ret;---------------;QoS设置完成事件;EventCode=0DH;入口参数:;  Length = r0;---------------HCI_QoS_Setup_Complete_Event:    lcall Throw_Away_HCI_Event_Parameter    ret;-------------;指令完成事件;EventCode=0EH;入口参数:;  Length = r0;-------------HCI_Command_Complete_Event:    lcall Throw_Away_HCI_Event_Parameter    cjne r7,#00,CE_ComComEventLost         ;事件参数丢失    ;80h - Num_HCI_Command_Packets    ;81h - OpCode (低八位)    ;82h - OpCode (高八位)    ;83h ... Command Parameters    mov r0,#82h    mov a,@r0                           ;OpCode高八位    anl a,#0fch    rr a    rr a                                ;OGF -> A    mov r1,a                            ;OGF -> R1    mov r0,#0eh                         ;EventCode ->R0    ;判断指令分组的OGF    cjne r1,#01h,CE_LP_Commands    ;---------------------    ;Link Control Commands    ;---------------------    lcall HCI_Link_Control_Commands    retCE_LP_Commands:    cjne r1,#02h,CE_HCB_Commands    ;--------------------    ;Link Policy Commands    ;--------------------    lcall HCI_Link_Policy_Commands    retCE_HCB_Commands:    cjne r1,#03h,CE_IP_Commands    ;-----------------------------------    ;Host Controller & Baseband Commands    ;-----------------------------------    lcall HCI_Host_Controller_Baseband_Commands    retCE_IP_Commands:    cjne r1,#04h,CE_SP_Commands    ;------------------------    ;Informational Parameters    ;------------------------    lcall HCI_Informational_Parameters    retCE_SP_Commands:    cjne r1,#06h,CE_T_Commands    ;-----------------    ;Status Parameters    ;-----------------    lcall HCI_Status_Parameters    retCE_T_Commands:    cjne r1,#06h,CE_Factory_Commands    ;----------------    ;Testing Commands    ;----------------    lcall HCI_Status_Parameters    retCE_Factory_Commands:    cjne r1,#3fh,CE_Undefine_Commands    ;----------------    ;Factory Commands    ;----------------    lcall Factroy_Commands    retCE_Undefine_Commands:    retCE_ComComEventLost:    mov r0,#0ffh        ;Hardware_Code = R0    lcall BUM_Hardware_Error_Event    ret;-----------------;HCI指令的事件处理;入口参数:;  EventCode = R0;-----------------HCI_Link_Control_Commands:    ;------------------------------------------------------------------    ;OGF = 0x01    ;(0001)Inquiry    ;      [0002]Inquiry_Cancel    ;      [0003]Periodic_Inquiry_Mode    ;      [0004]Exit_Periodic_Inquiry_Mode    ;(0005)Create_Connection    ;(0006)Disconnect    ;(0007)Add_SCO_Connect    ;            0008    ;            0009 Accept_Connection_Request    ;            000A Reject_Connection_Request    ;      [000B]Link_Key_Request_Reply    ; ...    ;(001F)Read_Clock_Offset    ;------------------------------------------------------------------    ;EventCode = (R0)    ;------------------------------------------------------------------    ;指令状态事件:          Status                      = (80h)    ;                       Num_HCI_Command_Packets     = (81h)    ;                       OpCode                      = [(83h),(82h)]    ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -    ;指令完成事件:          Num_HCI_Command_Packets     = (80h)    ;                       Command_OpCode              = [(82h),(81h)]    ;                       Return Parameters           = [.. ,84h,83h]    ;------------------------------------------------------------------    cjne r0,#0eh,LCC_CSE   ;是否为指令完成事件,不是跳转到指令状态事件处理    lcall LCC_CCE          ;是指令完成事件    ret    ;============    ;指令状态事件    LCC_CSE:    mov r0,#80h    mov a,@r0              ;Status -> A    jnz HCI_LCC_FAIL    ret    ;------------    HCI_LCC_FAIL:        mov r0,#82h        mov a,@r0          ;OCF = (r2,r1)        mov r1,a        inc r0        mov a,@r0        anl a,#03h        mov r2,a        cjne r2,#00h,LCC_NEW_SE        cjne r1,#01h,HCI_CC_SE        ;HCI_Inquiry Status Event        mov r0,#80h        mov a,#1dh        mov @r0,a           ;Status = 1DH (失败)        mov r0,#03h         ;OpCode = BUM_Init_As_Master        mov r1,#01h         ;Length        lcall BUM_Complete_Event        ret    HCI_CC_SE:        cjne r1,#05h,HCI_D_SE        ;HCI_Create_Connection Status Event        mov r0,#80h        mov a,#1dh        mov @r0,a           ;Status = 1DH (失败)        mov r0,#05h         ;OpCode = BUM_Create_DataConnection        mov r1,#01h         ;Length        lcall BUM_Complete_Event        ret    HCI_D_SE:        cjne r1,#06h,HCI_ASCOC_SE        ;HCI_Disconnect Status Event        mov r0,#80h        mov a,#1dh        mov @r0,a           ;Status = 1DH (失败)        mov r0,#06h         ;OpCode = BUM_Disconnect_DataConnection        mov r1,#01h         ;Length        lcall BUM_Complete_Event        ret    HCI_ASCOC_SE:        cjne r1,#07h,LCC_SE_Undefine        ;HCI_Add_SCO_Connection Status Event        ret    LCC_SE_Undefine:        ret    LCC_NEW_SE:        ret    ;=======    LCC_CCE:        ;指令完成事件        retHCI_Link_Policy_Commands:    ;------------------------------------------------------------------    ;OGF = 0x02    ;      [0001]Hold_Mode    ;            0002    ;      [0003]Sniff_Mode    ;      [0004]Exit_Sniff_Mode    ;      [0005]Park_Mode    ;      [0006]Exit_Park_Mode    ;      [0007]QoS_Setup    ;            0008    ;      [0009]Role_Discovery    ;            000A    ;      [000B]Switch_Role    ;      [000C]Read_Link_Policy_Settings    ;      [000D]Write_Link_Policy_Settings    ; ...    ;------------------------------------------------------------------    ;EventCode = (R0)    ;------------------------------------------------------------------    ;指令状态事件:          Status                      = (80h)    ;                       Num_HCI_Command_Packets     = (81h)    ;                       OpCode                      = [(83h),(82h)]    ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -    ;指令完成事件:          Num_HCI_Command_Packets     = (80h)    ;                       Command_OpCode              = [(82h),(81h)]    ;                       Return Parameters           = [.. ,84h,83h]    ;------------------------------------------------------------------    cjne r0,#0eh,LPC_CSE   ;是否为指令完成事件,不是跳转到指令状态事件处理    lcall LPC_CCE          ;是指令完成事件    ret    ;============    ;指令状态事件    LPC_CSE:    mov r0,#80h    mov a,@r0              ;Status -> A    jnz HCI_LPC_FAIL    ret    ;------------    HCI_LPC_FAIL:        mov r0,#82h        mov a,@r0          ;OCF = (r2,r1)        mov r1,a        inc r0        mov a,@r0        anl a,#03h        mov r2,a        cjne r2,#00h,LPC_SE        lcall LPC_OLD_SE        ret    LPC_SE:        lcall LPC_NEW_SE        ret    LPC_OLD_SE:        cjne r1,#05h,HCI_EPM_SE        ;--------------------------        ;HCI_Park_Mode Status Event        mov r0,#07h     ;OpCode        mov r1,#01h     ;Length        lcall BUM_Complete_Event        ret    HCI_EPM_SE:        cjne r1,#06h,LPC_SE_Undefine        ;-------------------------------        ;HCI_Exit_Park_Mode Status Event        mov r0,#08h     ;OpCode        mov r1,#01h     ;Length        lcall BUM_Complete_Event        ret    LPC_SE_Undefine:        ret    LPC_NEW_SE:        ret    ;=======    LPC_CCE:        ;指令完成事件        mov r0,#81h        mov a,@r0          ;OCF = (r2,r1)        mov r1,a        inc r0        mov a,@r0        anl a,#03h        mov r2,a        cjne r2,#00h,LPC_CE        lcall LPC_OLD_CE        ret    LPC_CE:        lcall LPC_NEW_CE        ret    ;********************    LPC_OLD_CE:        cjne r1,#01h,HCI_LPC_0002_CE        ;----------------------------        ;HCI_Hold_Mode Complete Event        ret    HCI_LPC_0002_CE:        cjne r1,#02h,HCI_SM_CE        ;----        ;None        ret    HCI_SM_CE:        cjne r1,#03h,HCI_ESM_CE        ;-----------------------------        ;HCI_Sniff_Mode Complete Event        ret    HCI_ESM_CE:        cjne r1,#04h,HCI_PM_CE        ;----------------------------------        ;HCI_Exit_Sniff_Mode Complete Event        ret    HCI_PM_CE:        cjne r1,#05h,HCI_EPM_CE        ;----------------------------        ;HCI_Park_Mode Complete Event        mov r0,#83h        mov a,@r0        jnz HCI_PM_FAIL        mov r0,#80h        mov @r0,a        mov r0,#07h     ;OpCode        mov r1,#01h     ;Length        lcall BUM_Complete_Event        ret        HCI_PM_FAIL:            mov r0,#80h            mov @r0,a            mov r0,#07h     ;OpCode            mov r1,#01h     ;Length            lcall BUM_Complete_Event            ret    HCI_EPM_CE:        cjne r1,#06h,HCI_QSS_CE        ;---------------------------------        ;HCI_Exit_Park_Mode Complete Event        mov r0,#83h        mov a,@r0        jnz HCI_EPM_FAIL        mov r0,#80h        mov @r0,a        mov r0,#08h     ;OpCode        mov r1,#01h     ;Length        lcall BUM_Complete_Event        ret        HCI_EPM_FAIL:            mov r0,#80h            mov @r0,a            mov r0,#08h     ;OpCode            mov r1,#01h     ;Length            lcall BUM_Complete_Event            ret    HCI_QSS_CE:        cjne r1,#07h,HCI_LPC_0008_CE        ;----------------------------        ;HCI_QoS_Setup Complete Event        ret    HCI_LPC_0008_CE:        cjne r1,#08h,HCI_RD_CE        ;----        ;None        ret    HCI_RD_CE:        cjne r1,#09h,HCI_LPC_000A_CE        ;---------------------------------        ;HCI_Role_Discovery Complete Event        ret    HCI_LPC_000A_CE:        cjne r1,#0ah,HCI_SR_CE        ;----        ;None        ret    HCI_SR_CE:        cjne r1,#0bh,HCI_RLPS_CE        ;-----------        ;Switch_Role        ret    HCI_RLPS_CE:        cjne r1,#0ch,HCI_WLPS_CE        ;-------------------------        ;Read_Link_Policy_Settings        ret    HCI_WLPS_CE:        cjne r1,#0dh,LPC_CE_Undefine        ;--------------------------        ;Write_Link_Policy_Settings        mov r0,#83h        mov a,@r0        jnz HCI_WLPS_FAIL        ret        HCI_WLPS_FAIL:            ret    LPC_CE_Undefine:        ret    LPC_NEW_CE:        ret    retHCI_Host_Controller_BaseBand_Commands:    ;------------------------------------------------------------------    ;OGF = 0x03    ;      [0001]Set_Event_Mask    ;            0002    ;      [0003]Reset    ;            0004    ;      [0005]Set_Event_Filter    ;            0006    ;            0007    ;      [0008]Flush    ;      [0009]Read_PIN_Type    ;      [000A]Write_PIN_Type    ;      [000B]Create_New_Unit_Key    ; ...    ;      [001A]Write_Scan_Enable    ;      [001B]Read_Page_Scan_Activity    ;      [001C]Write_Page_Scan_Activity    ;      [001D]Read_Inquiry_Scan_Activity    ;      [001E]Write_Inquiry_Scan_Activity    ; ...    ;      [003E]Write_Page_Scan_Mode    ;------------------------------------------------------------------    ;EventCode = (R0)    ;------------------------------------------------------------------    ;指令状态事件:          Status                      = (80h)    ;                       Num_HCI_Command_Packets     = (81h)    ;                       OpCode                      = [(83h),(82h)]    ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -    ;指令完成事件:          Num_HCI_Command_Packets     = (80h)    ;                       Command_OpCode              = [(82h),(81h)]    ;                       Return Parameters           = [.. ,84h,83h]    ;------------------------------------------------------------------    cjne r0,#0eh,HCBC_CSE   ;是否为指令完成事件,不是跳转到指令状态事件处理    lcall HCBC_CCE          ;是指令完成事件    ret    ;============    ;指令状态事件    HCBC_CSE:    mov r0,#80h    mov a,@r0              ;Status -> A    jnz HCI_HCBC_FAIL    ret    ;------------    HCI_HCBC_FAIL:        mov r0,#82h        mov a,@r0          ;OCF = (r2,r1)        mov r1,a        inc r0        mov a,@r0        anl a,#03h        mov r2,a        cjne r2,#00h,HCBC_NEW_SE        cjne r1,#01h,HCBC_SE_Undefine        ret    HCBC_SE_Undefine:        ret    HCBC_NEW_SE:        ret    ;=======    HCBC_CCE:        ;指令完成事件        mov r0,#81h        mov a,@r0          ;OCF = (r2,r1)        mov r1,a        inc r0        mov a,@r0        anl a,#03h        mov r2,a        cjne r2,#00h,HCBC_CE        lcall HCBC_OLD_CE        ret    HCBC_CE:        lcall HCBC_NEW_CE        ret    ;********************    HCBC_OLD_CE:        cjne r1,#01h,HCI_0002_CE        ;Set_Event_Master Complete Event        ret    HCI_0002_CE:        cjne r1,#02h,HCI_R_CE        ret    HCI_R_CE:        cjne r1,#03h,HCI_0004_CE        ;HCI_Reset Complete Event        mov r0,#83h        mov a,@r0        jnz R_CE_FAIL        ;SUCCESS        mov r0,#80h        mov a,#00h        mov @r0,a           ;Status = 00h        mov r0,#01h         ;BUM_Reset

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -