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

📄 hw_config.s79

📁 用于监视I2C通信总线
💻 S79
📖 第 1 页 / 共 4 页
字号:
//  262   USART_Init(USART1, &USART_InitStructure);
        LDR.N    R4,??DataTable9  ;; 0x40013800
        MOVS     R0,#+9600
        STR      R0,[R1, #+0]
        MOVS     R0,#+0
        STR      R0,[R1, #+4]
        MOVS     R2,#+1536
        STRH     R2,[R1, #+8]
        STRH     R0,[R1, #+12]
        MOVS     R0,#+12
        STRH     R0,[R1, #+10]
        MOVS     R0,R4
        _BLF     USART_Init,??USART_Init??rT
//  263 
//  264   /* Enable the USART Receive interrupt */
//  265   USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
        LDR.N    R1,??USART_Config_Default_0  ;; 0x525
        MOVS     R2,#+1
        MOVS     R0,R4
        POP      {R4,LR}          ;; Pop
        CFI R4 SameValue
        CFI ?RET R14
        CFI CFA R13+0
        _BF.W    USART_ITConfig,??USART_ITConfig??rT
        DATA
??USART_Config_Default_0:
        DC32     0x525
        CFI EndBlock cfiBlock6
//  266 }
//  267 
//  268 /*******************************************************************************
//  269 * Function Name  :  UART0_Config.
//  270 * Description    :  Configure the UART 1 according to the linecoding structure.
//  271 * Input          :  None.
//  272 * Return         :  Configuration status
//  273                     TRUE : configuration done with success
//  274                     FALSE : configuration aborted.
//  275 *******************************************************************************/

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock7 Using cfiCommon0
        CFI Function USART_Config
        THUMB
//  276 bool USART_Config(void)
//  277 {
//  278 
//  279   /* set the Stop bit*/
//  280   switch (linecoding.format)
USART_Config:
        LDR.N    R2,??USART_Config_0  ;; linecoding
        PUSH     {R4,LR}
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
        MOVS     R0,#+0
        LDRB     R1,[R2, #+4]
        CBZ      R1,??USART_Config_1
        CMP      R1,#+1
        BEQ.N    ??USART_Config_2
        CMP      R1,#+2
        BEQ.N    ??USART_Config_3
        B.N      ??USART_Config_4
//  281   {
//  282     case 0:
//  283       USART_InitStructure.USART_StopBits = USART_StopBits_1;
??USART_Config_1:
        MOVS     R3,#+0
??USART_Config_5:
        LDR.N    R1,??DataTable6  ;; USART_InitStructure
        STRH     R3,[R1, #+6]
//  284       break;
//  285     case 1:
//  286       USART_InitStructure.USART_StopBits = USART_StopBits_1_5;
//  287       break;
//  288     case 2:
//  289       USART_InitStructure.USART_StopBits = USART_StopBits_2;
//  290       break;
//  291     default :
//  292     {
//  293       USART_Config_Default();
//  294       return (FALSE);
//  295     }
//  296   }
//  297 
//  298   /* set the parity bit*/
//  299   switch (linecoding.paritytype)
        LDRB     R3,[R2, #+5]
        CBZ      R3,??USART_Config_6
        CMP      R3,#+1
        BEQ.N    ??USART_Config_7
        CMP      R3,#+2
        BEQ.N    ??USART_Config_8
        B.N      ??USART_Config_4
??USART_Config_2:
        MOVS     R3,#+12288
        B.N      ??USART_Config_5
??USART_Config_3:
        MOVS     R3,#+8192
        B.N      ??USART_Config_5
??USART_Config_4:
        BL       USART_Config_Default
        MOVS     R0,#+0
        POP      {R4,PC}
//  300   {
//  301     case 0:
//  302       USART_InitStructure.USART_Parity = USART_Parity_No;
//  303       break;
//  304     case 1:
//  305       USART_InitStructure.USART_Parity = USART_Parity_Even;
??USART_Config_7:
        MOVS     R3,#+1024
        B.N      ??USART_Config_6
//  306       break;
//  307     case 2:
//  308       USART_InitStructure.USART_Parity = USART_Parity_Odd;
??USART_Config_8:
        MOVS     R3,#+1536
??USART_Config_6:
        STRH     R3,[R1, #+8]
//  309       break;
//  310     default :
//  311     {
//  312       USART_Config_Default();
//  313       return (FALSE);
//  314     }
//  315   }
//  316 
//  317   /*set the data type : only 8bits and 9bits is supported */
//  318   switch (linecoding.datatype)
        LDRB     R3,[R2, #+6]
        CMP      R3,#+7
        BEQ.N    ??USART_Config_9
        CMP      R3,#+8
        BEQ.N    ??USART_Config_10
        B.N      ??USART_Config_4
//  319   {
//  320     case 0x07:
//  321       USART_InitStructure.USART_WordLength = USART_WordLength_8b;
??USART_Config_9:
        MOVS     R3,#+0
        B.N      ??USART_Config_11
//  322       break;
//  323     case 0x08:
//  324       USART_InitStructure.USART_WordLength = USART_WordLength_9b;
??USART_Config_10:
        MOVS     R3,#+4096
//  325       break;
//  326     default :
//  327     {
//  328       USART_Config_Default();
//  329       return (FALSE);
//  330     }
//  331   }
//  332 
//  333   USART_InitStructure.USART_BaudRate = linecoding.bitrate;
??USART_Config_11:
        LDR      R2,[R2, #+0]
//  334   USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
//  335   USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
//  336   USART_Init(USART1, &USART_InitStructure);
        LDR.N    R4,??DataTable9  ;; 0x40013800
        STRH     R3,[R1, #+4]
        STR      R2,[R1, #+0]
        STRH     R0,[R1, #+12]
        MOVS     R0,#+12
        STRH     R0,[R1, #+10]
        MOVS     R0,R4
        _BLF     USART_Init,??USART_Init??rT
//  337   USART_Cmd(USART1, ENABLE);
        MOVS     R1,#+1
        MOVS     R0,R4
        _BLF     USART_Cmd,??USART_Cmd??rT
//  338   return (TRUE);
        MOVS     R0,#+1
        POP      {R4,PC}          ;; return
        DATA
??USART_Config_0:
        DC32     linecoding
        CFI EndBlock cfiBlock7
//  339 }

        RSEG CODE:CODE:NOROOT(2)
        DATA
??DataTable6:
        DC32     USART_InitStructure
//  340 
//  341 /*******************************************************************************
//  342 * Function Name  : USB_To_UART_Send_Data.
//  343 * Description    : send the received data from USB to the UART 0.
//  344 * Input          : data_buffer: data address.
//  345                    Nb_bytes: number of bytes to send.
//  346 * Return         : none.
//  347 *******************************************************************************/

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock8 Using cfiCommon0
        CFI Function USB_To_USART_Send_Data
        THUMB
//  348 void USB_To_USART_Send_Data(u8* data_buffer, u8 Nb_bytes)
//  349 {
USB_To_USART_Send_Data:
        PUSH     {R4-R6,LR}
        CFI ?RET Frame(CFA, -4)
        CFI R6 Frame(CFA, -8)
        CFI R5 Frame(CFA, -12)
        CFI R4 Frame(CFA, -16)
        CFI CFA R13+16
        MOVS     R4,R0
        MOVS     R5,R1
//  350   u32 i;
//  351 
//  352   for (i = 0; i < Nb_bytes; i++)
        MOVS     R6,#+0
        B.N      ??USB_To_USART_Send_Data_0
//  353   {
//  354     USART_SendData(USART1, *(data_buffer + i));
??USB_To_USART_Send_Data_1:
        LDRB     R1,[R4, R6]
        LDR.N    R0,??DataTable9  ;; 0x40013800
//  355   }
        ADDS     R6,R6,#+1
        _BLF     USART_SendData,??USART_SendData??rT
??USB_To_USART_Send_Data_0:
        CMP      R6,R5
        BCC.N    ??USB_To_USART_Send_Data_1
//  356 }
        POP      {R4-R6,PC}       ;; return
        CFI EndBlock cfiBlock8
//  357 
//  358 /*******************************************************************************
//  359 * Function Name  : UART_To_USB_Send_Data.
//  360 * Description    : send the received data from UART 0 to USB.
//  361 * Input          : None.
//  362 * Return         : none.
//  363 *******************************************************************************/

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock9 Using cfiCommon0
        CFI Function USART_To_USB_Send_Data
        THUMB
//  364 void USART_To_USB_Send_Data(void)
//  365 {
USART_To_USB_Send_Data:
        LDR.N    R0,??USART_To_USB_Send_Data_0  ;; USART_InitStructure + 4
        PUSH     {R4,R5,LR}
        CFI ?RET Frame(CFA, -4)
        CFI R5 Frame(CFA, -8)
        CFI R4 Frame(CFA, -12)
        CFI CFA R13+12
        LDR.N    R4,??USART_To_USB_Send_Data_0+0x4  ;; count_in
        LDRH     R1,[R0, #+0]
        LDR.N    R5,??USART_To_USB_Send_Data_0+0x8  ;; buffer_in
        LDR.N    R0,??DataTable9  ;; 0x40013800
        CBNZ     R1,??USART_To_USB_Send_Data_1
//  366   if (USART_InitStructure.USART_WordLength == USART_WordLength_8b)
//  367   {
//  368     buffer_in[count_in] = USART_ReceiveData(USART1) & 0x7F;
        _BLF     USART_ReceiveData,??USART_ReceiveData??rT
        LDR      R1,[R4, #+0]
        LSLS     R0,R0,#+25
        LSRS     R0,R0,#+25
        B.N      ??USART_To_USB_Send_Data_2
//  369   }
//  370   else if (USART_InitStructure.USART_WordLength == USART_WordLength_9b)
??USART_To_USB_Send_Data_1:
        LSRS     R2,R0,#+18
        CMP      R1,R2
        BNE.N    ??USART_To_USB_Send_Data_3
//  371   {
//  372     buffer_in[count_in] = USART_ReceiveData(USART1);
        _BLF     USART_ReceiveData,??USART_ReceiveData??rT
        LDR      R1,[R4, #+0]
??USART_To_USB_Send_Data_2:
        STRB     R0,[R5, R1]
//  373   }
//  374   count_in++;
??USART_To_USB_Send_Data_3:
        LDR      R2,[R4, #+0]
//  375   UserToPMABufferCopy(buffer_in, ENDP1_TXADDR, count_in);
        MOVS     R1,#+192
        MOVS     R0,R5
        ADDS     R2,R2,#+1
        STR      R2,[R4, #+0]
        UXTH     R2,R2
        _BLF     UserToPMABufferCopy,??UserToPMABufferCopy??rT
//  376   SetEPTxCount(ENDP1, count_in);
        LDR      R1,[R4, #+0]
        MOVS     R0,#+1
        UXTH     R1,R1
        _BLF     SetEPTxCount,??SetEPTxCount??rT
//  377   SetEPTxValid(ENDP1);
        MOVS     R0,#+1
        POP      {R4,R5,LR}       ;; Pop
        CFI R4 SameValue
        CFI R5 SameValue
        CFI ?RET R14
        CFI CFA R13+0
        _BF.W    SetEPTxValid,??SetEPTxValid??rT
        DATA
??USART_To_USB_Send_Data_0:
        DC32     USART_InitStructure + 4
        DC32     count_in
        DC32     buffer_in
        CFI EndBlock cfiBlock9
//  378 }

        RSEG CODE:CODE:NOROOT(2)
        DATA
??DataTable9:
        DC32     0x40013800
//  379 
//  380 /*******************************************************************************
//  381 * Function Name  : Get_SerialNum.
//  382 * Description    : Create the serial number string descriptor.
//  383 * Input          : None.
//  384 * Output         : None.
//  385 * Return         : None.
//  386 *******************************************************************************/

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock10 Using cfiCommon0
        CFI Function Get_SerialNum
        THUMB
//  387 void Get_SerialNum(void)
//  388 {
//  389   u32 Device_Serial0, Device_Serial1, Device_Serial2;
//  390 
//  391   Device_Serial0 = *(vu32*)(0x1FFFF7E8);
Get_SerialNum:
        LDR.N    R0,??Get_SerialNum_0  ;; 0x1ffff7e8
//  392   Device_Serial1 = *(vu32*)(0x1FFFF7EC);
        LDR.N    R1,??Get_SerialNum_0+0x4  ;; 0x1ffff7ec
//  393   Device_Serial2 = *(vu32*)(0x1FFFF7F0);
        LDR.N    R2,??Get_SerialNum_0+0x8  ;; 0x1ffff7f0
        PUSH     {R4,LR}
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
        LDR      R0,[R0, #+0]
        LDR      R1,[R1, #+0]
        LDR      R2,[R2, #+0]
//  394 
//  395   if (Device_Serial0 != 0)
        CBZ      R0,??Get_SerialNum_1
//  396   {
//  397     Virtual_Com_Port_StringSerial[2] = (u8)(Device_Serial0 & 0x000000FF);
        LDR.N    R3,??Get_SerialNum_0+0xC  ;; Virtual_Com_Port_StringSerial
//  398     Virtual_Com_Port_StringSerial[4] = (u8)((Device_Serial0 & 0x0000FF00) >> 8);
        LSRS     R4,R0,#+8
        STRB     R0,[R3, #+2]
        STRB     R4,[R3, #+4]
//  399     Virtual_Com_Port_StringSerial[6] = (u8)((Device_Serial0 & 0x00FF0000) >> 16);
        LSRS     R4,R0,#+16
        STRB     R4,[R3, #+6]
//  400     Virtual_Com_Port_StringSerial[8] = (u8)((Device_Serial0 & 0xFF000000) >> 24);
        LSRS     R0,R0,#+24
        STRB     R0,[R3, #+8]
//  401 
//  402     Virtual_Com_Port_StringSerial[10] = (u8)(Device_Serial1 & 0x000000FF);
        STRB     R1,[R3, #+10]
//  403     Virtual_Com_Port_StringSerial[12] = (u8)((Device_Serial1 & 0x0000FF00) >> 8);
        LSRS     R0,R1,#+8
        STRB     R0,[R3, #+12]
//  404     Virtual_Com_Port_StringSerial[14] = (u8)((Device_Serial1 & 0x00FF0000) >> 16);
        LSRS     R0,R1,#+16
        STRB     R0,[R3, #+14]
//  405     Virtual_Com_Port_StringSerial[16] = (u8)((Device_Serial1 & 0xFF000000) >> 24);
        LSRS     R0,R1,#+24
        STRB     R0,[R3, #+16]
//  406 
//  407     Virtual_Com_Port_StringSerial[18] = (u8)(Device_Serial2 & 0x000000FF);
        STRB     R2,[R3, #+18]
//  408     Virtual_Com_Port_StringSerial[20] = (u8)((Device_Serial2 & 0x0000FF00) >> 8);
        LSRS     R0,R2,#+8
        STRB     R0,[R3, #+20]
//  409     Virtual_Com_Port_StringSerial[22] = (u8)((Device_Serial2 & 0x00FF0000) >> 16);
        LSRS     R0,R2,#+16
        STRB     R0,[R3, #+22]
//  410     Virtual_Com_Port_StringSerial[24] = (u8)((Device_Serial2 & 0xFF000000) >> 24);
        LSRS     R0,R2,#+24
        STRB     R0,[R3, #+24]
//  411   }
//  412 }
??Get_SerialNum_1:
        POP      {R4,PC}          ;; return
        Nop      
        DATA
??Get_SerialNum_0:
        DC32     0x1ffff7e8
        DC32     0x1ffff7ec
        DC32     0x1ffff7f0
        DC32     Virtual_Com_Port_StringSerial
        CFI EndBlock cfiBlock10

⌨️ 快捷键说明

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