; generated by Component: ARM Compiler 5.06 update 7 (build 960) Tool: ArmCC [4d365d]
; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave -o..\output\spi_fifoslave.o --asm_dir=..\List\ --list_dir=..\List\ --depend=..\output\spi_fifoslave.d --cpu=Cortex-M0+ --apcs=interwork --diag_suppress=9931 -I..\FWLib\SC32F1XXX_Lib\inc -I..\User\HeadFiles -I..\User -I..\Drivers -I..\Apps -I..\CMSIS -IF:\Users\SOC\AppData\Local\Arm\Packs\ARM\CMSIS\5.8.0\Device\ARM\ARMCM0plus\Include -D__UVISION_VERSION=536 -DARMCM0P -DSC32f10xx --omf_browse=..\output\spi_fifoslave.crf ..\Apps\SPI_FIFOSlave.c]
                          THUMB

                          AREA ||i.SPI_FIFOSlave_Function||, CODE, READONLY, ALIGN=2

                          REQUIRE _printf_percent
                          REQUIRE _printf_x
                          REQUIRE _printf_longlong_hex
                  SPI_FIFOSlave_Function PROC
;;;21     
;;;22     void SPI_FIFOSlave_Function(void)
000000  b092              SUB      sp,sp,#0x48
;;;23     {
;;;24     	GPIO_InitTypeDef GPIO_InitStruct;
;;;25     	GPIO_InitStruct.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_10;
000002  2003              MOVS     r0,#3
000004  0280              LSLS     r0,r0,#10
000006  4669              MOV      r1,sp
000008  8008              STRH     r0,[r1,#0]
;;;26       GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT_PP;
00000a  2402              MOVS     r4,#2
00000c  804c              STRH     r4,[r1,#2]
;;;27       GPIO_Init(GPIOB, &GPIO_InitStruct);
00000e  4831              LDR      r0,|L1.212|
000010  f7fffffe          BL       GPIO_Init
;;;28     	SPI_InitTypeDef SPI_InitStruct; //定义SPI初始化结构体变量
;;;29     	
;;;30     #if (SPI_Mode_ == 1)
;;;31     	volatile uint16_t FIFOSlave_SPI0_ReceiveData[16];
;;;32     
;;;33       /* 使能SPI0的时钟 */
;;;34       RCC_APB0Cmd(ENABLE);  //SPI0外设挂载在APB0时钟上
;;;35     #if defined(SC32f12xx)||defined(SC32f10xx)
;;;36       RCC_APB0PeriphClockCmd(RCC_APB0Periph_SPI0, ENABLE);
;;;37     
;;;38     #endif
;;;39     	
;;;40       /*  配置SPI0为从机 */
;;;41     	SPI_InitStruct.SPI_CPHA = SPI_CPHA_1Edge;	//SPI第一沿采集数据
;;;42     	SPI_InitStruct.SPI_CPOL = SPI_CPOL_Low;	//SPI空闲电平为低电平
;;;43     	SPI_InitStruct.SPI_DataSize = SPI_DataSize_16B;	//数据长度为16位
;;;44     	SPI_InitStruct.SPI_FirstBit = SPI_FirstBit_MSB;	//数值传输为高位在前
;;;45     	SPI_InitStruct.SPI_Mode = SPI_Mode_Slave;	//SPI工作在从机模式
;;;46     	SPI_InitStruct.SPI_Prescaler = SPI_Prescaler_1024;	//SPI传输频率为APB0时钟1024分频	
;;;47     	SPI_Init(SPI0,&SPI_InitStruct);		
;;;48     
;;;49     	/* 使能SPI0 */
;;;50     	SPI_Cmd(SPI0,ENABLE);
;;;51     	
;;;52     	//PB_OT(11) ;
;;;53     	
;;;54     #elif (SPI_Mode_ == 0)
;;;55       volatile uint16_t FIFOSlave_SPI1_ReceiveData[16];
;;;56     	volatile uint16_t SPI1_Num = 0;
000014  2500              MOVS     r5,#0
000016  4669              MOV      r1,sp
000018  810d              STRH     r5,[r1,#8]
;;;57     	
;;;58     #if defined(SC32f12xx)
;;;59       GPIO_InitStruct.GPIO_Pin = GPIO_Pin_1;
;;;60       GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT_PP;
;;;61       GPIO_Init(GPIOA, &GPIO_InitStruct);
;;;62     	PA_BIT(1) = 1;
;;;63     #elif defined(SC32f10xx)
;;;64       GPIO_InitStruct.GPIO_Pin = GPIO_Pin_13;
00001a  0320              LSLS     r0,r4,#12
00001c  8008              STRH     r0,[r1,#0]
;;;65       GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT_PP;
;;;66       GPIO_Init(GPIOA, &GPIO_InitStruct);
00001e  4f2e              LDR      r7,|L1.216|
000020  804c              STRH     r4,[r1,#2]            ;65
000022  4638              MOV      r0,r7
000024  f7fffffe          BL       GPIO_Init
;;;67     	PA_BIT(13) = 1;
000028  2601              MOVS     r6,#1
00002a  737e              STRB     r6,[r7,#0xd]
;;;68     #endif
;;;69       /* 使能SPI1的时钟 */
;;;70        RCC_APB1Cmd(ENABLE);//SPI1外设挂载在APB1时钟上 
00002c  4630              MOV      r0,r6
00002e  f7fffffe          BL       RCC_APB1Cmd
;;;71     #if defined(SC32f12xx)
;;;72       RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI1, ENABLE);
;;;73     #elif defined(SC32f10xx)
;;;74        RCC_APB1Cmd(ENABLE);//SPI1外设挂载在APB1时钟上
000032  2001              MOVS     r0,#1
000034  f7fffffe          BL       RCC_APB1Cmd
;;;75     #endif
;;;76     	
;;;77       /* 配置SPI1为主机 */
;;;78     	SPI_InitStruct.SPI_CPHA = SPI_CPHA_1Edge;	//SPI第一沿采集数据
;;;79     	SPI_InitStruct.SPI_CPOL = SPI_CPOL_Low;	//SPI空闲电平为低电平
;;;80     	SPI_InitStruct.SPI_DataSize = SPI_DataSize_16B;	//数据长度为16位
;;;81     	SPI_InitStruct.SPI_FirstBit = SPI_FirstBit_MSB;	//数值传输为高位在前
;;;82     	SPI_InitStruct.SPI_Mode = SPI_Mode_Master;	//SPI工作在主机模式
;;;83     	SPI_InitStruct.SPI_Prescaler = SPI_Prescaler_1024;	//SPI传输频率为APB0时钟1024分频
000038  2005              MOVS     r0,#5
;;;84     	SPI_Init(SPI1,&SPI_InitStruct);		
00003a  9404              STR      r4,[sp,#0x10]
00003c  0240              LSLS     r0,r0,#9              ;83
00003e  9603              STR      r6,[sp,#0xc]
000040  4c26              LDR      r4,|L1.220|
000042  9008              STR      r0,[sp,#0x20]
000044  9505              STR      r5,[sp,#0x14]         ;79
000046  9506              STR      r5,[sp,#0x18]         ;81
000048  a903              ADD      r1,sp,#0xc
00004a  9507              STR      r5,[sp,#0x1c]
00004c  4620              MOV      r0,r4
00004e  f7fffffe          BL       SPI_Init
;;;85     	
;;;86     #if defined(SC32f12xx)
;;;87       /* 使能SPI1中断 */
;;;88       SPI_ITConfig(SPI1, SPI_IT_INTEN, ENABLE);
;;;89       NVIC_EnableIRQ(SPI1_2_IRQn);
;;;90     #elif defined(SC32f10xx)
;;;91       /* 使能SPI1中断 */
;;;92       SPI_ITConfig(SPI1, SPI_IT_INTEN, ENABLE);
000052  2201              MOVS     r2,#1
000054  4611              MOV      r1,r2
000056  4620              MOV      r0,r4
000058  f7fffffe          BL       SPI_ITConfig
00005c  4820              LDR      r0,|L1.224|
00005e  1521              ASRS     r1,r4,#20
000060  6001              STR      r1,[r0,#0]
;;;93       NVIC_EnableIRQ(SPI1_IRQn);
;;;94     
;;;95     #endif
;;;96     
;;;97       /* 使能SPI1 */
;;;98     	SPI_Cmd(SPI1,ENABLE);
000062  2101              MOVS     r1,#1
000064  4620              MOV      r0,r4
000066  f7fffffe          BL       SPI_Cmd
;;;99     #endif
;;;100    	
;;;101    	
;;;102    	while(1)
;;;103    	{
;;;104    #if (SPI_Mode_ == 1)
;;;105    
;;;106       	SPI_SendDataFIFO(SPI0,(uint32_t *)FIFOSlave_SPI0_SendData,8);//写入前8个数据
;;;107    
;;;108    		while(SPI_GetFlagStatus(SPI0,SPI_Flag_RXFIF) == RESET); //等待接收FIFO已满
;;;109    		SPI_ReceiveDataFIFO(SPI0,(uint32_t *)FIFOSlave_SPI0_ReceiveData,8); //读取8个数据
;;;110    		
;;;111    		SPI_SendDataFIFO(SPI0,(uint32_t *)(FIFOSlave_SPI0_SendData+8),8);//写入后8个数据
;;;112    		
;;;113    		while(SPI_GetFlagStatus(SPI0,SPI_Flag_RXFIF) == RESET); //等待接收FIFO已满
;;;114    		SPI_ReceiveDataFIFO(SPI0,(uint32_t *)(FIFOSlave_SPI0_ReceiveData+8),8); //读取后8个数据
;;;115    	
;;;116    		for(int i=0 ;i <= 15 ;i++)	printf("SPI0从机接收到的数据为“0x%x”\r\n",FIFOSlave_SPI0_ReceiveData[i]);
;;;117    		printf("\r\n");
;;;118    #elif (SPI_Mode_ == 0)
;;;119    			
;;;120    		
;;;121    		
;;;122    		/* SPI1没有FIFO，需要手动发送/接收数据 */
;;;123    			for(SPI1_Num=0; SPI1_Num <= 15;SPI1_Num ++)
;;;124    		{
;;;125        
;;;126         SPI_SendData(SPI1,FIFOSlave_SPI1_SendData[SPI1_Num]);
;;;127    		 while(SPI1_Flag == RESET);
00006a  4e1e              LDR      r6,|L1.228|
;;;128    		 SPI1_Flag = RESET;
;;;129    	   FIFOSlave_SPI1_ReceiveData[SPI1_Num] = SPI_ReceiveData(SPI1);//SPI1接收数据
00006c  af09              ADD      r7,sp,#0x24
                  |L1.110|
00006e  4668              MOV      r0,sp                 ;123
000070  8105              STRH     r5,[r0,#8]            ;123
000072  2401              MOVS     r4,#1                 ;67
000074  e019              B        |L1.170|
                  |L1.118|
000076  4668              MOV      r0,sp                 ;126
000078  8900              LDRH     r0,[r0,#8]            ;126
00007a  0041              LSLS     r1,r0,#1              ;126
00007c  4819              LDR      r0,|L1.228|
00007e  1c80              ADDS     r0,r0,#2              ;126
000080  5a41              LDRH     r1,[r0,r1]            ;126
000082  4816              LDR      r0,|L1.220|
000084  f7fffffe          BL       SPI_SendData
                  |L1.136|
000088  7830              LDRB     r0,[r6,#0]            ;127  ; SPI1_Flag
00008a  2800              CMP      r0,#0                 ;127
00008c  d0fc              BEQ      |L1.136|
00008e  7035              STRB     r5,[r6,#0]            ;128
000090  4812              LDR      r0,|L1.220|
000092  f7fffffe          BL       SPI_ReceiveData
000096  4669              MOV      r1,sp
000098  8909              LDRH     r1,[r1,#8]
00009a  0049              LSLS     r1,r1,#1
00009c  5278              STRH     r0,[r7,r1]
;;;130    		  PB_OT(11) ;
00009e  480d              LDR      r0,|L1.212|
0000a0  4669              MOV      r1,sp                 ;123
0000a2  76c4              STRB     r4,[r0,#0x1b]
0000a4  8908              LDRH     r0,[r1,#8]            ;123
0000a6  1c40              ADDS     r0,r0,#1              ;123
0000a8  8108              STRH     r0,[r1,#8]            ;123
                  |L1.170|
0000aa  4668              MOV      r0,sp                 ;123
0000ac  8900              LDRH     r0,[r0,#8]            ;123
0000ae  280f              CMP      r0,#0xf               ;123
0000b0  d9e1              BLS      |L1.118|
;;;131    				
;;;132    		}
;;;133    
;;;134    		
;;;135    		for(int i=0 ;i <= 15 ;i++)	printf("SPI1主机接收到的数据为“0x%x”！\r\n",FIFOSlave_SPI1_ReceiveData[i]);
0000b2  2400              MOVS     r4,#0
                  |L1.180|
0000b4  0060              LSLS     r0,r4,#1
0000b6  5a39              LDRH     r1,[r7,r0]
0000b8  a00b              ADR      r0,|L1.232|
0000ba  f7fffffe          BL       __2printf
0000be  1c64              ADDS     r4,r4,#1
0000c0  2c0f              CMP      r4,#0xf
0000c2  ddf7              BLE      |L1.180|
;;;136    		printf("SPI1主机接收到的数据为OK！\r\n");
0000c4  a011              ADR      r0,|L1.268|
0000c6  f7fffffe          BL       __2printf
;;;137    		/* 清除标志位，为下一次通信做准备 */
;;;138    		SPI1_Num=0;
0000ca  4668              MOV      r0,sp
0000cc  8105              STRH     r5,[r0,#8]
;;;139    		SPI1_Flag = RESET;
0000ce  7035              STRB     r5,[r6,#0]
0000d0  e7cd              B        |L1.110|
;;;140    #endif
;;;141    		
;;;142    	}
;;;143    }
;;;144    
                          ENDP

0000d2  0000              DCW      0x0000
                  |L1.212|
                          DCD      0x40011100
                  |L1.216|
                          DCD      0x40011000
                  |L1.220|
                          DCD      0x40021040
                  |L1.224|
                          DCD      0xe000e100
                  |L1.228|
                          DCD      ||.data||
                  |L1.232|
0000e8  53504931          DCB      "SPI1",214,247,187,250,189,211,202,213,181,189,181,196,202
0000ec  d6f7bbfa
0000f0  bdd3cad5
0000f4  b5bdb5c4
0000f8  ca      
0000f9  fdbeddce          DCB      253,190,221,206,170,161,176,"0x%x",161,177,163,161,"\r\n"
0000fd  aaa1b030
000101  782578a1
000105  b1a3a10d
000109  0a      
00010a  00                DCB      0
00010b  00                DCB      0
                  |L1.268|
00010c  53504931          DCB      "SPI1",214,247,187,250,189,211,202,213,181,189,181,196,202
000110  d6f7bbfa
000114  bdd3cad5
000118  b5bdb5c4
00011c  ca      
00011d  fdbeddce          DCB      253,190,221,206,170,"OK",163,161,"\r\n",0
000121  aa4f4ba3
000125  a10d0a00
000129  00                DCB      0
00012a  00                DCB      0
00012b  00                DCB      0

                          AREA ||i.SPI_FIFOSlave_SPI1Handler||, CODE, READONLY, ALIGN=2

                  SPI_FIFOSlave_SPI1Handler PROC
;;;145    
;;;146    void SPI_FIFOSlave_SPI1Handler(void)
000000  b510              PUSH     {r4,lr}
;;;147    {
;;;148    
;;;149    #if (SPI_Mode_ == 0)
;;;150    #if defined(SC32f10xx)||defined(SC32f12xx)
;;;151    	if(SPI_GetFlagStatus(SPI1,SPI_Flag_SPIF))
000002  4c07              LDR      r4,|L2.32|
000004  2101              MOVS     r1,#1
000006  4620              MOV      r0,r4
000008  f7fffffe          BL       SPI_GetFlagStatus
00000c  2800              CMP      r0,#0
00000e  d006              BEQ      |L2.30|
;;;152    	{
;;;153    		SPI_ClearFlag(SPI1,SPI_Flag_SPIF);
000010  2101              MOVS     r1,#1
000012  4620              MOV      r0,r4
000014  f7fffffe          BL       SPI_ClearFlag
;;;154    		SPI1_Flag = SET;
000018  4902              LDR      r1,|L2.36|
00001a  2001              MOVS     r0,#1
00001c  7008              STRB     r0,[r1,#0]
                  |L2.30|
;;;155    	}
;;;156    	
;;;157    #endif
;;;158    #endif
;;;159    
;;;160    }
00001e  bd10              POP      {r4,pc}
                          ENDP

                  |L2.32|
                          DCD      0x40021040
                  |L2.36|
                          DCD      ||.data||

                          AREA ||.data||, DATA, ALIGN=1

                  SPI1_Flag
000000  0000              DCB      0x00,0x00
                  FIFOSlave_SPI1_SendData
000002  0011              DCW      0x0011
000004  00120013          DCW      0x0012,0x0013
000008  00140015          DCW      0x0014,0x0015
00000c  00160017          DCW      0x0016,0x0017
000010  00180019          DCW      0x0018,0x0019
000014  001a001b          DCW      0x001a,0x001b
000018  001c001d          DCW      0x001c,0x001d
00001c  001e001f          DCW      0x001e,0x001f
000020  002f              DCW      0x002f

;*** Start embedded assembler ***

#line 1 "..\\Apps\\SPI_FIFOSlave.c"
	AREA ||.rev16_text||, CODE
	THUMB
	EXPORT |__asm___15_SPI_FIFOSlave_c_b4887e92____REV16|
#line 463 "..\\CMSIS\\cmsis_armcc.h"
|__asm___15_SPI_FIFOSlave_c_b4887e92____REV16| PROC
#line 464

 rev16 r0, r0
 bx lr
	ENDP
	AREA ||.revsh_text||, CODE
	THUMB
	EXPORT |__asm___15_SPI_FIFOSlave_c_b4887e92____REVSH|
#line 478
|__asm___15_SPI_FIFOSlave_c_b4887e92____REVSH| PROC
#line 479

 revsh r0, r0
 bx lr
	ENDP

;*** End   embedded assembler ***
