mbfuncdisc.txt 8.97 KB
; generated by Component: ARM Compiler 5.06 update 6 (build 750) Tool: ArmCC [4d3637]
; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave -o.\flash\obj\mbfuncdisc.o --asm_dir=.\Flash\List\ --list_dir=.\Flash\List\ --depend=.\flash\obj\mbfuncdisc.d --cpu=Cortex-M4.fp --apcs=interwork -O1 --diag_suppress=9931,870 -I..\..\Libraries\CMSIS\Include -I..\..\Libraries\CMSIS\Device\ST\STM32F4xx\Include -I..\..\Libraries\STM32F4xx_StdPeriph_Driver\inc -I..\..\uCOS-III\uC-CPU -I..\..\uCOS-III\uC-LIB -I..\..\uCOS-III\uCOS-III\Ports -I..\..\uCOS-III\uCOS-III\Source -I..\..\uCOS-III\uC-CPU\ARM-Cortex-M4\RealView -I..\..\uCOS-III\uC-LIB\Ports\ARM-Cortex-M4\RealView -I..\..\uCOS-III\uCOS-III\Ports\ARM-Cortex-M4\Generic\RealView -I..\..\User -I..\..\User\bsp -I..\..\User\bsp\inc -I..\..\User\libapp -I..\..\RL-ARM\Config -I..\..\RL-ARM\Driver -I..\..\RL-ARM\RL-RTX\inc -I..\..\User\bsp\BSP -I..\..\RL-ARM\RL-CAN -I..\..\Libraries\DSP_LIB\Include -I..\..\MODBUS\modbus\rtu -I..\..\MODBUS\BARE\port -I..\..\MODBUS\modbus\include -I..\..\User\bsp\BSP -I..\..\PLC -I..\..\Avoid -I..\..\User\parameter -I..\..\User\LaserMotionCtr -I..\..\User\W5100S -I..\..\User\bsp -I..\..\User\CHASSIS -I..\..\User\CONTROLFUNCTION -I..\..\User\DATAUPDATE -I..\..\User\HARAWARE -I..\..\User\MOTORDRIVER -I..\..\User\NAVAGATION -I..\..\User\PLATFORM -I..\..\User\SENSOR -I.\RTE\_Flash -IC:\Users\YDJ\AppData\Local\Arm\Packs\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Users\YDJ\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.13.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION=527 -D_RTE_ -DSTM32F407xx -DUSE_STDPERIPH_DRIVER -DSTM32F40_41xxx -D__RTX -D__FPU_USED=1 --omf_browse=.\flash\obj\mbfuncdisc.crf ..\..\MODBUS\modbus\functions\mbfuncdisc.c]
                          THUMB

                          AREA ||i.eMBFuncReadDiscreteInputs||, CODE, READONLY, ALIGN=1

                  eMBFuncReadDiscreteInputs PROC
;;;48     eMBException
;;;49     eMBFuncReadDiscreteInputs( UCHAR * pucFrame, USHORT * usLen )
000000  b570              PUSH     {r4-r6,lr}
;;;50     {
000002  460c              MOV      r4,r1
;;;51         USHORT          usRegAddress;
;;;52         USHORT          usDiscreteCnt;
;;;53         UCHAR           ucNBytes;
;;;54         UCHAR          *pucFrameCur;
;;;55     
;;;56         eMBException    eStatus = MB_EX_NONE;
000004  2600              MOVS     r6,#0
;;;57         eMBErrorCode    eRegStatus;
;;;58     
;;;59         if( *usLen == ( MB_PDU_FUNC_READ_SIZE + MB_PDU_SIZE_MIN ) )
000006  8821              LDRH     r1,[r4,#0]
000008  2905              CMP      r1,#5
00000a  d002              BEQ      |L1.18|
;;;60         {
;;;61             usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF] << 8 );
;;;62             usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF + 1] );
;;;63             usRegAddress++;
;;;64     
;;;65             usDiscreteCnt = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_DISCCNT_OFF] << 8 );
;;;66             usDiscreteCnt |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_DISCCNT_OFF + 1] );
;;;67     
;;;68             /* Check if the number of registers to read is valid. If not
;;;69              * return Modbus illegal data value exception. 
;;;70              */
;;;71             if( ( usDiscreteCnt >= 1 ) &&
;;;72                 ( usDiscreteCnt < MB_PDU_FUNC_READ_DISCCNT_MAX ) )
;;;73             {
;;;74                 /* Set the current PDU data pointer to the beginning. */
;;;75                 pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF];
;;;76                 *usLen = MB_PDU_FUNC_OFF;
;;;77     
;;;78                 /* First byte contains the function code. */
;;;79                 *pucFrameCur++ = MB_FUNC_READ_DISCRETE_INPUTS;
;;;80                 *usLen += 1;
;;;81     
;;;82                 /* Test if the quantity of coils is a multiple of 8. If not last
;;;83                  * byte is only partially field with unused coils set to zero. */
;;;84                 if( ( usDiscreteCnt & 0x0007 ) != 0 )
;;;85                 {
;;;86                     ucNBytes = ( UCHAR ) ( usDiscreteCnt / 8 + 1 );
;;;87                 }
;;;88                 else
;;;89                 {
;;;90                     ucNBytes = ( UCHAR ) ( usDiscreteCnt / 8 );
;;;91                 }
;;;92                 *pucFrameCur++ = ucNBytes;
;;;93                 *usLen += 1;
;;;94     
;;;95                 eRegStatus =
;;;96                     eMBRegDiscreteCB( pucFrameCur, usRegAddress, usDiscreteCnt );
;;;97     
;;;98                 /* If an error occured convert it into a Modbus exception. */
;;;99                 if( eRegStatus != MB_ENOERR )
;;;100                {
;;;101                    eStatus = prveMBError2Exception( eRegStatus );
;;;102                }
;;;103                else
;;;104                {
;;;105                    /* The response contains the function code, the starting address
;;;106                     * and the quantity of registers. We reuse the old values in the 
;;;107                     * buffer because they are still valid. */
;;;108                    *usLen += ucNBytes;;
;;;109                }
;;;110            }
;;;111            else
;;;112            {
;;;113                eStatus = MB_EX_ILLEGAL_DATA_VALUE;
;;;114            }
;;;115        }
;;;116        else
;;;117        {
;;;118            /* Can't be a valid read coil register request because the length
;;;119             * is incorrect. */
;;;120            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
00000c  2603              MOVS     r6,#3
                  |L1.14|
;;;121        }
;;;122        return eStatus;
00000e  4630              MOV      r0,r6
;;;123    }
000010  bd70              POP      {r4-r6,pc}
                  |L1.18|
000012  7841              LDRB     r1,[r0,#1]            ;61
000014  0209              LSLS     r1,r1,#8              ;61
000016  7882              LDRB     r2,[r0,#2]            ;62
000018  430a              ORRS     r2,r2,r1              ;62
00001a  1c52              ADDS     r2,r2,#1              ;63
00001c  b293              UXTH     r3,r2                 ;63
00001e  78c1              LDRB     r1,[r0,#3]            ;65
000020  0209              LSLS     r1,r1,#8              ;65
000022  7902              LDRB     r2,[r0,#4]            ;66
000024  430a              ORRS     r2,r2,r1              ;66
000026  1e51              SUBS     r1,r2,#1              ;71
000028  f24075cf          MOV      r5,#0x7cf             ;71
00002c  42a9              CMP      r1,r5                 ;71
00002e  d221              BCS      |L1.116|
000030  2100              MOVS     r1,#0                 ;76
000032  8021              STRH     r1,[r4,#0]            ;76
000034  2102              MOVS     r1,#2                 ;79
000036  f8001b01          STRB     r1,[r0],#1            ;79
00003a  8821              LDRH     r1,[r4,#0]            ;80
00003c  1c49              ADDS     r1,r1,#1              ;80
00003e  8021              STRH     r1,[r4,#0]            ;80
000040  0751              LSLS     r1,r2,#29             ;84
000042  d004              BEQ      |L1.78|
000044  2101              MOVS     r1,#1                 ;86
000046  eb0101d2          ADD      r1,r1,r2,LSR #3       ;86
00004a  b2cd              UXTB     r5,r1                 ;86
00004c  e001              B        |L1.82|
                  |L1.78|
00004e  f3c205c7          UBFX     r5,r2,#3,#8           ;90
                  |L1.82|
000052  f8005b01          STRB     r5,[r0],#1            ;92
000056  8821              LDRH     r1,[r4,#0]            ;93
000058  1c49              ADDS     r1,r1,#1              ;93
00005a  8021              STRH     r1,[r4,#0]            ;93
00005c  4619              MOV      r1,r3                 ;95
00005e  f7fffffe          BL       eMBRegDiscreteCB
000062  b118              CBZ      r0,|L1.108|
000064  f7fffffe          BL       prveMBError2Exception
000068  4606              MOV      r6,r0                 ;101
00006a  e7d0              B        |L1.14|
                  |L1.108|
00006c  8820              LDRH     r0,[r4,#0]            ;108
00006e  4428              ADD      r0,r0,r5              ;108
000070  8020              STRH     r0,[r4,#0]            ;108
000072  e7cc              B        |L1.14|
                  |L1.116|
000074  2603              MOVS     r6,#3                 ;113
000076  e7ca              B        |L1.14|
;;;124    
                          ENDP


;*** Start embedded assembler ***

#line 1 "..\\..\\MODBUS\\modbus\\functions\\mbfuncdisc.c"
	AREA ||.rev16_text||, CODE
	THUMB
	EXPORT |__asm___12_mbfuncdisc_c_09bb778e____REV16|
#line 129 "..\\..\\Libraries\\CMSIS\\Include\\core_cmInstr.h"
|__asm___12_mbfuncdisc_c_09bb778e____REV16| PROC
#line 130

 rev16 r0, r0
 bx lr
	ENDP
	AREA ||.revsh_text||, CODE
	THUMB
	EXPORT |__asm___12_mbfuncdisc_c_09bb778e____REVSH|
#line 144
|__asm___12_mbfuncdisc_c_09bb778e____REVSH| PROC
#line 145

 revsh r0, r0
 bx lr
	ENDP
	AREA ||.rrx_text||, CODE
	THUMB
	EXPORT |__asm___12_mbfuncdisc_c_09bb778e____RRX|
#line 300
|__asm___12_mbfuncdisc_c_09bb778e____RRX| PROC
#line 301

 rrx r0, r0
 bx lr
	ENDP

;*** End   embedded assembler ***