📄 smartcard.txt
字号:
00009e e8bd41f0 POP {r4-r8,lr} ;132
0000a2 f7ffbffe B.W SC_SendData
0000a6 2001 MOVS r0,#1 ;132
0000a8 f7fffffe BL SC_PowerCmd
0000ac 480e LDR r0,|L2.232|
0000ae f7fffffe BL USART_DeInit
0000b2 4c0e LDR r4,|L2.236|
0000b4 4620 MOV r0,r4 ;132
0000b6 f7fffffe BL GPIO_DeInit
0000ba 4620 MOV r0,r4 ;132
0000bc f7fffffe BL GPIO_DeInit
0000c0 4638 MOV r0,r7 ;132
0000c2 f7fffffe BL GPIO_DeInit
0000c6 2100 MOVS r1,#0 ;132
0000c8 2018 MOVS r0,#0x18 ;132
0000ca f7fffffe BL RCC_APB2PeriphClockCmd
0000ce e8bd41f0 POP {r4-r8,lr} ;132
0000d2 2100 MOVS r1,#0 ;132
0000d4 f44f2080 MOV r0,#0x40000 ;132
0000d8 f7ffbffe B.W RCC_APB1PeriphClockCmd
|L2.220|
0000dc 702e STRB r6,[r5,#0] ;139
0000de e7d2 B |L2.134|
;;;142
ENDP
|L2.224|
DCD 0x40011000
|L2.228|
DCD ||.bss||+0x2c
|L2.232|
DCD 0x40004800
|L2.236|
DCD 0x40010c00
AREA ||i.SC_Init||, CODE, READONLY, ALIGN=2
SC_Init PROC
;;;618 *******************************************************************************/
;;;619 static void SC_Init(void)
000000 e92d41f0 PUSH {r4-r8,lr}
;;;620 {
000004 b088 SUB sp,sp,#0x20
;;;621 GPIO_InitTypeDef GPIO_InitStructure;
;;;622 USART_InitTypeDef USART_InitStructure;
;;;623 USART_ClockInitTypeDef USART_ClockInitStructure;
;;;624
;;;625 /* Enable GPIO_3_5V, GPIORESET and GPIO_CMDVCC clocks */
;;;626 RCC_APB2PeriphClockCmd(RCC_APB2Periph_3_5V | RCC_APB2Periph_RESET |
000006 2101 MOVS r1,#1
000008 2018 MOVS r0,#0x18
00000a f7fffffe BL RCC_APB2PeriphClockCmd
;;;627 RCC_APB2Periph_CMDVCC, ENABLE);
;;;628
;;;629 /* Enable USART3 clock */
;;;630 RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
00000e 2101 MOVS r1,#1
000010 0488 LSLS r0,r1,#18
000012 f7fffffe BL RCC_APB1PeriphClockCmd
;;;631
;;;632 /* Configure USART3 CK(PB.12) as alternate function push-pull */
;;;633 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
000016 f44f5580 MOV r5,#0x1000
00001a f8ad501c STRH r5,[sp,#0x1c]
;;;634 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
00001e 2018 MOVS r0,#0x18
000020 f88d001f STRB r0,[sp,#0x1f]
;;;635 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
000024 2003 MOVS r0,#3
;;;636 GPIO_Init(GPIOB, &GPIO_InitStructure);
000026 4f3c LDR r7,|L3.280|
000028 f88d001e STRB r0,[sp,#0x1e] ;635
00002c a907 ADD r1,sp,#0x1c
00002e 4638 MOV r0,r7
000030 f7fffffe BL GPIO_Init
;;;637
;;;638 /* Configure USART3 Tx (PB.10) as alternate function open-drain */
;;;639 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
000034 10ae ASRS r6,r5,#2
000036 f8ad601c STRH r6,[sp,#0x1c]
;;;640 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
00003a 201c MOVS r0,#0x1c
00003c f88d001f STRB r0,[sp,#0x1f]
;;;641 GPIO_Init(GPIOB, &GPIO_InitStructure);
000040 a907 ADD r1,sp,#0x1c
000042 4638 MOV r0,r7
000044 f7fffffe BL GPIO_Init
;;;642
;;;643 /* Configure Smartcard Reset */
;;;644 GPIO_InitStructure.GPIO_Pin = SC_RESET;
000048 106c ASRS r4,r5,#1
00004a f8ad401c STRH r4,[sp,#0x1c]
;;;645 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
00004e 2010 MOVS r0,#0x10
000050 f88d001f STRB r0,[sp,#0x1f]
;;;646 GPIO_Init(GPIO_RESET, &GPIO_InitStructure);
000054 a907 ADD r1,sp,#0x1c
000056 4638 MOV r0,r7
000058 f7fffffe BL GPIO_Init
;;;647
;;;648 /* Configure Smartcard 3/5V */
;;;649 GPIO_InitStructure.GPIO_Pin = SC_3_5V;
00005c 2001 MOVS r0,#1
00005e f8ad001c STRH r0,[sp,#0x1c]
;;;650 GPIO_Init(GPIO_3_5V, &GPIO_InitStructure);
000062 a907 ADD r1,sp,#0x1c
000064 4638 MOV r0,r7
000066 f7fffffe BL GPIO_Init
;;;651
;;;652 /* Configure Smartcard CMDVCC */
;;;653 GPIO_InitStructure.GPIO_Pin = SC_CMDVCC;
00006a 2040 MOVS r0,#0x40
00006c f8ad001c STRH r0,[sp,#0x1c]
;;;654 GPIO_Init(GPIO_CMDVCC, &GPIO_InitStructure);
000070 a907 ADD r1,sp,#0x1c
000072 482a LDR r0,|L3.284|
000074 f7fffffe BL GPIO_Init
;;;655
;;;656 /* USART3 configuration ------------------------------------------------------*/
;;;657 /* USART3 configured as follow:
;;;658 - Word Length = 9 Bits
;;;659 - 0.5 Stop Bit
;;;660 - Even parity
;;;661 - BaudRate = 9677 baud
;;;662 - Hardware flow control disabled (RTS and CTS signals)
;;;663 - Tx and Rx enabled
;;;664 - USART Clock enabled
;;;665 */
;;;666
;;;667 /* USART Clock set to 3.6 MHz (PCLK1 (36 MHZ) / 10) */
;;;668 USART_SetPrescaler(USART3, 0x05);
000078 f8df80a4 LDR r8,|L3.288|
00007c 2105 MOVS r1,#5
00007e 4640 MOV r0,r8
000080 f7fffffe BL USART_SetPrescaler
;;;669
;;;670 /* USART Guard Time set to 16 Bit */
;;;671 USART_SetGuardTime(USART3, 16);
000084 2110 MOVS r1,#0x10
000086 4640 MOV r0,r8
000088 f7fffffe BL USART_SetGuardTime
;;;672
;;;673 USART_ClockInitStructure.USART_Clock = USART_Clock_Enable;
00008c f8ad4004 STRH r4,[sp,#4]
;;;674 USART_ClockInitStructure.USART_CPOL = USART_CPOL_Low;
000090 2400 MOVS r4,#0
;;;675 USART_ClockInitStructure.USART_CPHA = USART_CPHA_1Edge;
000092 f8ad4008 STRH r4,[sp,#8]
;;;676 USART_ClockInitStructure.USART_LastBit = USART_LastBit_Enable;
000096 1128 ASRS r0,r5,#4
000098 f8ad000a STRH r0,[sp,#0xa]
00009c f8ad4006 STRH r4,[sp,#6] ;674
;;;677 USART_ClockInit(USART3, &USART_ClockInitStructure);
0000a0 a901 ADD r1,sp,#4
0000a2 4640 MOV r0,r8
0000a4 f7fffffe BL USART_ClockInit
;;;678
;;;679
;;;680 USART_InitStructure.USART_BaudRate = 9677;
0000a8 f24250cd MOV r0,#0x25cd
;;;681 USART_InitStructure.USART_WordLength = USART_WordLength_9b;
0000ac 9003 STR r0,[sp,#0xc]
0000ae f8ad5010 STRH r5,[sp,#0x10]
;;;682 USART_InitStructure.USART_StopBits = USART_StopBits_1_5;
0000b2 f44f5040 MOV r0,#0x3000
0000b6 f8ad0012 STRH r0,[sp,#0x12]
;;;683 USART_InitStructure.USART_Parity = USART_Parity_Even;
0000ba f8ad6014 STRH r6,[sp,#0x14]
;;;684 USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
0000be 200c MOVS r0,#0xc
0000c0 f8ad0016 STRH r0,[sp,#0x16]
;;;685 USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
0000c4 f8ad4018 STRH r4,[sp,#0x18]
;;;686 USART_Init(USART3, &USART_InitStructure);
0000c8 a903 ADD r1,sp,#0xc
0000ca 4640 MOV r0,r8
0000cc f7fffffe BL USART_Init
;;;687
;;;688 /* Enable the USART3 Parity Error Interrupt */
;;;689 USART_ITConfig(USART3, USART_IT_PE, ENABLE);
0000d0 2201 MOVS r2,#1
0000d2 2128 MOVS r1,#0x28
0000d4 4640 MOV r0,r8
0000d6 f7fffffe BL USART_ITConfig
;;;690
;;;691 /* Enable the USART3 Framing Error Interrupt */
;;;692 USART_ITConfig(USART3, USART_IT_ERR, ENABLE);
0000da 2201 MOVS r2,#1
0000dc 2160 MOVS r1,#0x60
0000de 4640 MOV r0,r8
0000e0 f7fffffe BL USART_ITConfig
;;;693
;;;694 /* Enable USART3 */
;;;695 USART_Cmd(USART3, ENABLE);
0000e4 2101 MOVS r1,#1
0000e6 4640 MOV r0,r8
0000e8 f7fffffe BL USART_Cmd
;;;696
;;;697 /* Enable the NACK Transmission */
;;;698 USART_SmartCardNACKCmd(USART3, ENABLE);
0000ec 2101 MOVS r1,#1
0000ee 4640 MOV r0,r8
0000f0 f7fffffe BL USART_SmartCardNACKCmd
;;;699
;;;700 /* Enable the Smartcard Interface */
;;;701 USART_SmartCardCmd(USART3, ENABLE);
0000f4 2101 MOVS r1,#1
0000f6 4640 MOV r0,r8
0000f8 f7fffffe BL USART_SmartCardCmd
;;;702
;;;703 /* Set RSTIN HIGH */
;;;704 SC_Reset(Bit_SET);
0000fc 2001 MOVS r0,#1
0000fe f7fffffe BL SC_Reset
000102 2101 MOVS r1,#1
000104 4638 MOV r0,r7
000106 f7fffffe BL GPIO_SetBits
;;;705
;;;706 /* Select 5V */
;;;707 SC_VoltageConfig(SC_Voltage_5V);
;;;708
;;;709 /* Disable CMDVCC */
;;;710 SC_PowerCmd(DISABLE);
00010a 2000 MOVS r0,#0
00010c f7fffffe BL SC_PowerCmd
;;;711 }
000110 b008 ADD sp,sp,#0x20
000112 e8bd81f0 POP {r4-r8,pc}
;;;712
ENDP
000116 0000 DCW 0x0000
|L3.280|
DCD 0x40010c00
|L3.284|
DCD 0x40011000
|L3.288|
DCD 0x40004800
AREA ||i.SC_PTSConfig||, CODE, READONLY, ALIGN=2
SC_PTSConfig PROC
;;;201 *******************************************************************************/
;;;202 void SC_PTSConfig(void)
000000 e92d43f0 PUSH {r4-r9,lr}
;;;203 {
000004 b08d SUB sp,sp,#0x34
;;;204 RCC_ClocksTypeDef RCC_ClocksStatus;
;;;205 u32 workingbaudrate = 0, apbclock = 0;
;;;206 u8 locData = 0, PTSConfirmStatus = 1;
000006 f04f0800 MOV r8,#0
00000a 2401 MOVS r4,#1
;;;207 USART_InitTypeDef USART_InitStructure;
;;;208 USART_ClockInitTypeDef USART_ClockInitStructure;
;;;209
;;;210 /* Reconfigure the USART Baud Rate -------------------------------------------*/
;;;211 RCC_GetClocksFreq(&RCC_ClocksStatus);
00000c a808 ADD r0,sp,#0x20
00000e f8cd801c STR r8,[sp,#0x1c]
000012 f7fffffe BL RCC_GetClocksFreq
;;;212 apbclock = RCC_ClocksStatus.PCLK1_Frequency;
000016 495e LDR r1,|L4.400|
;;;213 apbclock /= ((USART3->GTPR & (u16)0x00FF) * 2);
000018 980a LDR r0,[sp,#0x28]
00001a 8809 LDRH r1,[r1,#0]
;;;214
;;;215 /* Enable the DMA Receive (Set DMAR bit only) to enable interrupt generation
;;;216 in case of a framing error FE */
;;;217 USART_DMACmd(USART3, USART_DMAReq_Rx, ENABLE);
00001c f8df9170 LDR r9,|L4.400|
000020 0609 LSLS r1,r1,#24 ;213
000022 0dc9 LSRS r1,r1,#23 ;213
000024 fbb0f5f1 UDIV r5,r0,r1 ;213
000028 f1a90918 SUB r9,r9,#0x18
00002c 2201 MOVS r2,#1
00002e 2140 MOVS r1,#0x40
000030 4648 MOV r0,r9
000032 f7fffffe BL USART_DMACmd
;;;218
;;;219 if((SC_A2R.T0 & (u8)0x10) == 0x10)
000036 4e57 LDR r6,|L4.404|
000038 7870 LDRB r0,[r6,#1] ; SC_A2R
00003a 06c0 LSLS r0,r0,#27
00003c d57e BPL |L4.316|
;;;220 {
;;;221 if(SC_A2R.T[0] != 0x11)
00003e 78b0 LDRB r0,[r6,#2] ; SC_A2R
000040 2811 CMP r0,#0x11
000042 d07b BEQ |L4.316|
;;;222 {
;;;223 /* Send PTSS */
;;;224 SCData = 0xFF;
000044 4f54 LDR r7,|L4.408|
000046 20ff MOVS r0,#0xff
000048 7038 STRB r0,[r7,#0]
;;;225 USART_SendData(USART3, SCData);
00004a 7839 LDRB r1,[r7,#0] ; SCData
00004c 4648 MOV r0,r9
00004e f7fffffe BL USART_SendData
|L4.82|
;;;226 while(USART_GetFlagStatus(USART3, USART_FLAG_TC) == RESET)
000052 2140 MOVS r1,#0x40
000054 4648 MOV r0,r9
000056 f7fffffe BL USART_GetFlagStatus
00005a 2800 CMP r0,#0
00005c d0f9 BEQ |L4.82|
;;;227 {
;;;228 }
;;;229
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -