LWL/MDK-ARM/keilpro/Listing/can1.txt
youxianghua faacc7b570 提交
2024-07-10 14:01:39 +08:00

304 lines
14 KiB
Plaintext

; generated by Component: ARM Compiler 5.06 update 7 (build 960) Tool: ArmCC [4d365d]
; commandline ArmCC [--list --debug -c --asm --interleave -o.\output\can1.o --asm_dir=.\Listing\ --list_dir=.\Listing\ --depend=.\output\can1.d --cpu=Cortex-M3 --apcs=interwork -O3 --diag_suppress=9931 -I..\..\template\Libraries\CMSIS\startup -I..\..\template\Libraries\CMSIS -I..\..\template\Libraries\STM32F10x_StdPeriph_Driver\inc -I..\..\template\Libraries\STM32F10x_StdPeriph_Driver\src -I..\..\nlib -I..\user\inc -I..\user\src -ID:\Keil533\ARM\RV31\INC -ID:\Keil533\ARM\CMSIS\Include -ID:\Keil533\ARM\INC\ST\STM32F10x -D__MICROLIB -D__UVISION_VERSION=525 -DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD --omf_browse=.\output\can1.crf ..\user\src\can1.c]
THUMB
AREA ||.text||, CODE, READONLY, ALIGN=2
REQUIRE _printf_percent
REQUIRE _printf_d
REQUIRE _printf_int_dec
CAN_Mode_Init PROC
;;;24 // 其他,初始化失败;
;;;25 u8 CAN_Mode_Init(u8 tsjw,u8 tbs2,u8 tbs1,u16 brp,u8 mode)
000000 e92d47f0 PUSH {r4-r10,lr}
;;;26 {
000004 b08a SUB sp,sp,#0x28
000006 4689 MOV r9,r1
000008 4680 MOV r8,r0
00000a 461e MOV r6,r3
00000c 4617 MOV r7,r2
;;;27 GPIO_InitTypeDef GPIO_InitStructure;
;;;28 CAN_InitTypeDef CAN_InitStructure;
;;;29 CAN_FilterInitTypeDef CAN_FilterInitStructure;
;;;30 #if CAN_RX0_INT_ENABLE
;;;31 NVIC_InitTypeDef NVIC_InitStructure;
;;;32 #endif
;;;33
;;;34 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);//使能PORTA时钟
00000e 2101 MOVS r1,#1
000010 2004 MOVS r0,#4
000012 f8dda048 LDR r10,[sp,#0x48]
000016 f7fffffe BL RCC_APB2PeriphClockCmd
;;;35
;;;36 RCC_APB1PeriphClockCmd(RCC_APB1Periph_CAN1, ENABLE);//使能CAN1时钟
00001a 2101 MOVS r1,#1
00001c 0648 LSLS r0,r1,#25
00001e f7fffffe BL RCC_APB1PeriphClockCmd
;;;37
;;;38 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
000022 f44f5080 MOV r0,#0x1000
000026 f8ad001c STRH r0,[sp,#0x1c]
;;;39 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
00002a 2003 MOVS r0,#3
00002c f88d001e STRB r0,[sp,#0x1e]
;;;40 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //复用推挽
000030 2018 MOVS r0,#0x18
;;;41 GPIO_Init(GPIOA, &GPIO_InitStructure); //初始化IO
000032 4c5a LDR r4,|L1.412|
000034 f88d001f STRB r0,[sp,#0x1f] ;40
000038 a907 ADD r1,sp,#0x1c
00003a 4620 MOV r0,r4
00003c f7fffffe BL GPIO_Init
;;;42
;;;43 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
000040 14e0 ASRS r0,r4,#19
000042 f8ad001c STRH r0,[sp,#0x1c]
;;;44 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //上拉输入
000046 2048 MOVS r0,#0x48
000048 f88d001f STRB r0,[sp,#0x1f]
;;;45 GPIO_Init(GPIOA, &GPIO_InitStructure); //初始化IO
00004c a907 ADD r1,sp,#0x1c
00004e 4620 MOV r0,r4
000050 f7fffffe BL GPIO_Init
;;;46
;;;47 //CAN单元设置
;;;48 CAN_InitStructure.CAN_TTCM=DISABLE; //非时间触发通信模式
000054 2400 MOVS r4,#0
;;;49 CAN_InitStructure.CAN_ABOM=DISABLE; //软件自动离线管理
;;;50 CAN_InitStructure.CAN_AWUM=DISABLE; //睡眠模式通过软件唤醒(清除CAN->MCR的SLEEP位)
;;;51 CAN_InitStructure.CAN_NART=ENABLE; //禁止报文自动传送
;;;52 CAN_InitStructure.CAN_RFLM=DISABLE; //报文不锁定,新的覆盖旧的
;;;53 CAN_InitStructure.CAN_TXFP=DISABLE; //优先级由报文标识符决定
;;;54 CAN_InitStructure.CAN_Mode= mode; //模式设置: mode:0,普通模式;1,回环模式;
000056 f88da002 STRB r10,[sp,#2]
;;;55 //设置波特率
;;;56 CAN_InitStructure.CAN_SJW=tsjw; //重新同步跳跃宽度(Tsjw)为tsjw+1个时间单位 CAN_SJW_1tq CAN_SJW_2tq CAN_SJW_3tq CAN_SJW_4tq
00005a f88d8003 STRB r8,[sp,#3]
00005e f88d4006 STRB r4,[sp,#6] ;48
000062 f88d4008 STRB r4,[sp,#8] ;50
000066 2501 MOVS r5,#1 ;51
;;;57 CAN_InitStructure.CAN_BS1=tbs1; //Tbs1=tbs1+1个时间单位CAN_BS1_1tq ~CAN_BS1_16tq
;;;58 CAN_InitStructure.CAN_BS2=tbs2; //Tbs2=tbs2+1个时间单位CAN_BS2_1tq ~ CAN_BS2_8tq
;;;59 CAN_InitStructure.CAN_Prescaler=brp; //分频系数(Fdiv)为brp+1
000068 f8ad6000 STRH r6,[sp,#0]
00006c f88d4007 STRB r4,[sp,#7] ;49
000070 f88d5009 STRB r5,[sp,#9] ;51
;;;60 CAN_Init(CAN1, &CAN_InitStructure); //初始化CAN1
000074 4e4a LDR r6,|L1.416|
000076 f88d400a STRB r4,[sp,#0xa] ;52
00007a f88d7004 STRB r7,[sp,#4] ;57
00007e f88d400b STRB r4,[sp,#0xb] ;53
000082 f88d9005 STRB r9,[sp,#5] ;58
000086 4669 MOV r1,sp
000088 4630 MOV r0,r6
00008a f7fffffe BL CAN_Init
;;;61
;;;62 CAN_FilterInitStructure.CAN_FilterNumber=0; //过滤器0
00008e f88d4016 STRB r4,[sp,#0x16]
;;;63 CAN_FilterInitStructure.CAN_FilterMode=CAN_FilterMode_IdMask; //屏蔽位模式
000092 f88d4017 STRB r4,[sp,#0x17]
;;;64 CAN_FilterInitStructure.CAN_FilterScale=CAN_FilterScale_32bit; //32位宽
000096 f88d5018 STRB r5,[sp,#0x18]
;;;65 CAN_FilterInitStructure.CAN_FilterIdHigh=0x0000; //32位ID
00009a f8ad400c STRH r4,[sp,#0xc]
;;;66 CAN_FilterInitStructure.CAN_FilterIdLow=0x0000;
;;;67 CAN_FilterInitStructure.CAN_FilterMaskIdHigh=0x0000;//32位MASK
00009e f8ad4010 STRH r4,[sp,#0x10]
0000a2 f8ad400e STRH r4,[sp,#0xe] ;66
;;;68 CAN_FilterInitStructure.CAN_FilterMaskIdLow=0x0000;
0000a6 f8ad4012 STRH r4,[sp,#0x12]
;;;69 CAN_FilterInitStructure.CAN_FilterFIFOAssignment=CAN_Filter_FIFO0;//过滤器0关联到FIFO0
0000aa f8ad4014 STRH r4,[sp,#0x14]
;;;70 CAN_FilterInitStructure.CAN_FilterActivation=ENABLE;//激活过滤器0
0000ae f88d5019 STRB r5,[sp,#0x19]
;;;71
;;;72 CAN_FilterInit(&CAN_FilterInitStructure); //滤波器初始化
0000b2 a803 ADD r0,sp,#0xc
0000b4 f7fffffe BL CAN_FilterInit
;;;73
;;;74 #if CAN_RX0_INT_ENABLE
;;;75 CAN_ITConfig(CAN1,CAN_IT_FMP0,ENABLE); //FIFO0消息挂号中断允许.
0000b8 2201 MOVS r2,#1
0000ba 2102 MOVS r1,#2
0000bc 4630 MOV r0,r6
0000be f7fffffe BL CAN_ITConfig
;;;76
;;;77 NVIC_InitStructure.NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn;
0000c2 2014 MOVS r0,#0x14
0000c4 f88d0020 STRB r0,[sp,#0x20]
;;;78 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; // 主优先级为1
0000c8 f88d5021 STRB r5,[sp,#0x21]
;;;79 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; // 次优先级为0
0000cc f88d4022 STRB r4,[sp,#0x22]
;;;80 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
0000d0 f88d5023 STRB r5,[sp,#0x23]
;;;81 NVIC_Init(&NVIC_InitStructure);
0000d4 a808 ADD r0,sp,#0x20
0000d6 f7fffffe BL NVIC_Init
;;;82 #endif
;;;83 return 0;
;;;84 }
0000da b00a ADD sp,sp,#0x28
0000dc 2000 MOVS r0,#0 ;83
0000de e8bd87f0 POP {r4-r10,pc}
;;;85
ENDP
USB_LP_CAN1_RX0_IRQHandler PROC
;;;87 //中断服务函数
;;;88 void USB_LP_CAN1_RX0_IRQHandler(void)
0000e2 b530 PUSH {r4,r5,lr}
;;;89 {
0000e4 b085 SUB sp,sp,#0x14
;;;90 CanRxMsg RxMessage;
;;;91 int i=0;
0000e6 2400 MOVS r4,#0
;;;92
;;;93 CAN_Receive(CAN1, 0, &RxMessage);
0000e8 466a MOV r2,sp
0000ea 4621 MOV r1,r4
0000ec 482c LDR r0,|L1.416|
0000ee f7fffffe BL CAN_Receive
0000f2 466d MOV r5,sp ;90
|L1.244|
;;;94
;;;95 for(i=0;i<8;i++)
;;;96 {
;;;97 printf("rxbuf[%d]:%d\r\n",i,RxMessage.Data[i]);
0000f4 1928 ADDS r0,r5,r4
0000f6 4621 MOV r1,r4
0000f8 7ac2 LDRB r2,[r0,#0xb]
0000fa a02a ADR r0,|L1.420|
0000fc f7fffffe BL __2printf
000100 1c64 ADDS r4,r4,#1
000102 2c08 CMP r4,#8 ;95
000104 dbf6 BLT |L1.244|
|L1.262|
;;;98 }
;;;99 }
000106 b005 ADD sp,sp,#0x14
000108 bd30 POP {r4,r5,pc}
;;;100 #endif
ENDP
Can_Send_Msg PROC
;;;106 // 其他,失败;
;;;107 u32 Can_Send_Msg(u8* msg,u8 len,u32 appid)
00010a b5f0 PUSH {r4-r7,lr}
;;;108 {
00010c b085 SUB sp,sp,#0x14
;;;109 u8 mbox;
;;;110 u16 i=0;
00010e 2300 MOVS r3,#0
;;;111 CanTxMsg TxMessage;
;;;112 // TxMessage.StdId=0x12; // 标准标识符
;;;113 TxMessage.ExtId=appid; // 设置扩展标示符
;;;114 TxMessage.IDE=CAN_Id_Extended ; //
000110 9201 STR r2,[sp,#4]
000112 2204 MOVS r2,#4
000114 f88d2008 STRB r2,[sp,#8]
;;;115 TxMessage.RTR=CAN_RTR_Data; // 数据帧
000118 f88d3009 STRB r3,[sp,#9]
;;;116 TxMessage.DLC=len; // 要发送的数据长度
00011c f88d100a STRB r1,[sp,#0xa]
000120 466a MOV r2,sp ;111
000122 e004 B |L1.302|
|L1.292|
;;;117 for(i=0;i<len;i++)
;;;118 TxMessage.Data[i]=msg[i];
000124 5cc4 LDRB r4,[r0,r3]
000126 18d5 ADDS r5,r2,r3
000128 1c5b ADDS r3,r3,#1
00012a 72ec STRB r4,[r5,#0xb]
00012c b29b UXTH r3,r3 ;117
|L1.302|
00012e 428b CMP r3,r1 ;117
000130 d3f8 BCC |L1.292|
;;;119 mbox= CAN_Transmit(CAN1, &TxMessage);
000132 4f1b LDR r7,|L1.416|
000134 4611 MOV r1,r2
000136 4638 MOV r0,r7
000138 f7fffffe BL CAN_Transmit
00013c 4606 MOV r6,r0
;;;120 i=0;
00013e 2400 MOVS r4,#0
;;;121 while((CAN_TransmitStatus(CAN1, mbox)==CAN_TxStatus_Failed)&&(i<0XFFF))i++; //等待发送结束
000140 f64075ff MOV r5,#0xfff
000144 e001 B |L1.330|
|L1.326|
000146 1c64 ADDS r4,r4,#1
000148 b2a4 UXTH r4,r4
|L1.330|
00014a 4631 MOV r1,r6
00014c 4638 MOV r0,r7
00014e f7fffffe BL CAN_TransmitStatus
000152 b908 CBNZ r0,|L1.344|
000154 42ac CMP r4,r5
000156 d3f6 BCC |L1.326|
|L1.344|
;;;122 if(i>=0XFFF)return 1;
000158 42ac CMP r4,r5
00015a d302 BCC |L1.354|
00015c 2001 MOVS r0,#1
|L1.350|
;;;123 return 0;
;;;124 }
00015e b005 ADD sp,sp,#0x14
000160 bdf0 POP {r4-r7,pc}
|L1.354|
000162 2000 MOVS r0,#0 ;123
000164 e7fb B |L1.350|
;;;125 //can口接收数据查询
ENDP
Can_Receive_Msg PROC
;;;128 // 其他,接收的数据长度;
;;;129 u8 Can_Receive_Msg(u8 *buf)
000166 b530 PUSH {r4,r5,lr}
;;;130 {
;;;131 u32 i;
;;;132 CanRxMsg RxMessage;
;;;133 if( CAN_MessagePending(CAN1,CAN_FIFO0)==0)return 0; //没有接收到数据,直接退出
000168 4d0d LDR r5,|L1.416|
00016a 4604 MOV r4,r0 ;130
00016c b085 SUB sp,sp,#0x14 ;130
00016e 2100 MOVS r1,#0
000170 4628 MOV r0,r5
000172 f7fffffe BL CAN_MessagePending
000176 2800 CMP r0,#0
000178 d0c5 BEQ |L1.262|
;;;134 CAN_Receive(CAN1, CAN_FIFO0, &RxMessage);//读取数据
00017a 466a MOV r2,sp
00017c 2100 MOVS r1,#0
00017e 4628 MOV r0,r5
000180 f7fffffe BL CAN_Receive
;;;135 for(i=0;i<8;i++)
000184 2100 MOVS r1,#0
000186 4668 MOV r0,sp ;132
|L1.392|
;;;136 buf[i]=RxMessage.Data[i];
000188 1842 ADDS r2,r0,r1
00018a 7ad2 LDRB r2,[r2,#0xb]
00018c 5462 STRB r2,[r4,r1]
00018e 1c49 ADDS r1,r1,#1
000190 2908 CMP r1,#8 ;135
000192 d3f9 BCC |L1.392|
;;;137 return RxMessage.DLC;
000194 f89d000a LDRB r0,[sp,#0xa]
;;;138 }
000198 e7b5 B |L1.262|
;;;139
ENDP
00019a 0000 DCW 0x0000
|L1.412|
DCD 0x40010800
|L1.416|
DCD 0x40006400
|L1.420|
0001a4 72786275 DCB "rxbuf[%d]:%d\r\n",0
0001a8 665b2564
0001ac 5d3a2564
0001b0 0d0a00
0001b3 00 DCB 0