; 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_fifomaster.o --asm_dir=..\List\ --list_dir=..\List\ --depend=..\output\spi_fifomaster.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_fifomaster.crf ..\Apps\SPI_FIFOMaster.c]
                          THUMB

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

                          REQUIRE _printf_percent
                          REQUIRE _printf_x
                          REQUIRE _printf_longlong_hex
                  SPI_FIFOMaster_Function PROC
;;;21     
;;;22     void SPI_FIFOMaster_Function(void)
000000  b090              SUB      sp,sp,#0x40
;;;23     {
;;;24     	SPI_InitTypeDef SPI_InitStruct; //定义SPI初始化结构体变量
;;;25     	
;;;26     #if (SPI_Mode_ == 0)	
;;;27     	volatile uint16_t SPI0_ReceiveData[16];
;;;28     	GPIO_InitTypeDef GPIO_InitStruct; //定义GPIO初始化结构体变量
;;;29     	/* 使能SPI0的时钟 */
;;;30       RCC_APB0Cmd(ENABLE);  //SPI0外设挂载在APB0时钟上
;;;31     #if defined(SC32f10xx)||defined(SC32f12xx)
;;;32     	RCC_APB0PeriphClockCmd(RCC_APB0Periph_SPI0,ENABLE);
;;;33     #endif
;;;34       /*  配置SPI0为主机 */
;;;35     	SPI_InitStruct.SPI_CPHA = SPI_CPHA_1Edge;	//SPI第一沿采集数据
;;;36     	SPI_InitStruct.SPI_CPOL = SPI_CPOL_Low;	//SPI空闲电平为低电平
;;;37     	SPI_InitStruct.SPI_DataSize = SPI_DataSize_16B;	//数据长度为16位
;;;38     	SPI_InitStruct.SPI_FirstBit = SPI_FirstBit_MSB;	//数值传输为高位在前
;;;39     	SPI_InitStruct.SPI_Mode = SPI_Mode_Master;	//SPI工作在主机模式
;;;40     	SPI_InitStruct.SPI_Prescaler = SPI_Prescaler_1024;	//SPI传输频率为APB0时钟1024分频
;;;41     	SPI_Init(SPI0,&SPI_InitStruct);		
;;;42     
;;;43       	/*CLK引脚初始化*/
;;;44     #if defined(SC32f12xx)
;;;45       GPIO_InitStruct.GPIO_Pin = GPIO_Pin_2;
;;;46       GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT_PP;
;;;47       GPIO_Init(GPIOC, &GPIO_InitStruct);
;;;48     	PC_BIT(2) = 1;
;;;49     #elif defined(SC32f10xx)
;;;50       GPIO_InitStruct.GPIO_Pin = GPIO_Pin_1;
;;;51       GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT_PP;
;;;52       GPIO_Init(GPIOB, &GPIO_InitStruct);
;;;53     	PB_BIT(1) = 1;
;;;54     #endif
;;;55     	/* 使能SPI0 */
;;;56     	SPI_Cmd(SPI0,ENABLE);
;;;57     	
;;;58     #elif (SPI_Mode_ == 1)
;;;59       volatile uint16_t SPI1_ReceiveData[16];
;;;60     	volatile uint8_t SPI1_Num = 0;
000002  2600              MOVS     r6,#0
000004  4668              MOV      r0,sp
000006  7006              STRB     r6,[r0,#0]
;;;61     	
;;;62       /* 使能SPI1的时钟 */
;;;63        RCC_APB1Cmd(ENABLE);//SPI1外设挂载在APB1时钟上 
000008  2001              MOVS     r0,#1
00000a  f7fffffe          BL       RCC_APB1Cmd
;;;64     #if defined(SC32f12xx)
;;;65       RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI1, ENABLE);
;;;66     #elif defined(SC32f10xx)
;;;67        RCC_APB1Cmd(ENABLE);//SPI1外设挂载在APB1时钟上
00000e  2001              MOVS     r0,#1
000010  f7fffffe          BL       RCC_APB1Cmd
;;;68     #endif
;;;69     	
;;;70     	/* 配置SPI1为从机 */
;;;71     	SPI_InitStruct.SPI_CPHA = SPI_CPHA_1Edge;	//SPI第一沿采集数据
;;;72     	SPI_InitStruct.SPI_CPOL = SPI_CPOL_Low;	//SPI空闲电平为低电平
;;;73     	SPI_InitStruct.SPI_DataSize = SPI_DataSize_16B;	//数据长度为16位
000014  2002              MOVS     r0,#2
;;;74     	SPI_InitStruct.SPI_FirstBit = SPI_FirstBit_MSB;	//数值传输为高位在前
;;;75     	SPI_InitStruct.SPI_Mode = SPI_Mode_Slave;	//SPI工作在从机模式
;;;76     	SPI_InitStruct.SPI_Prescaler = SPI_Prescaler_1024;	//SPI传输频率为APB1时钟1024分频	
000016  9002              STR      r0,[sp,#8]
000018  2005              MOVS     r0,#5
00001a  9601              STR      r6,[sp,#4]
00001c  0240              LSLS     r0,r0,#9
;;;77     	SPI_Init(SPI1,&SPI_InitStruct);	
00001e  4c22              LDR      r4,|L1.168|
000020  9006              STR      r0,[sp,#0x18]
000022  9603              STR      r6,[sp,#0xc]          ;72
000024  9604              STR      r6,[sp,#0x10]         ;74
000026  9605              STR      r6,[sp,#0x14]         ;75
000028  a901              ADD      r1,sp,#4
00002a  4620              MOV      r0,r4
00002c  f7fffffe          BL       SPI_Init
;;;78     	
;;;79     	/* 使能SPI1中断 */
;;;80     #if defined(SC32f12xx)
;;;81       /* 使能SPI1中断 */
;;;82       SPI_ITConfig(SPI1, SPI_IT_INTEN, ENABLE);
;;;83       NVIC_EnableIRQ(SPI1_2_IRQn);
;;;84     #elif defined(SC32f10xx)
;;;85       /* 使能SPI1中断 */
;;;86       SPI_ITConfig(SPI1, SPI_IT_INTEN, ENABLE);
000030  2201              MOVS     r2,#1
000032  4611              MOV      r1,r2
000034  4620              MOV      r0,r4
000036  f7fffffe          BL       SPI_ITConfig
00003a  4a1c              LDR      r2,|L1.172|
00003c  1521              ASRS     r1,r4,#20
00003e  6011              STR      r1,[r2,#0]
;;;87       NVIC_EnableIRQ(SPI1_IRQn);
;;;88     #endif
;;;89     	/* 使能SPI1 */
;;;90     	SPI_Cmd(SPI1,ENABLE);
000040  2101              MOVS     r1,#1
000042  4620              MOV      r0,r4
000044  f7fffffe          BL       SPI_Cmd
;;;91     #endif
;;;92     
;;;93     	while(1)
;;;94     	{	
;;;95     #if (SPI_Mode_ == 0)
;;;96     
;;;97     		
;;;98     		SPI_SendDataFIFO(SPI0,(uint32_t *)FIFOMaster_SPI0_SendData,8); //写入前8个数据
;;;99     		while(SPI_GetFlagStatus(SPI0,SPI_Flag_TXEIF) == RESET); //等待FIFO发送完成
;;;100    		SPI_ClearFlag(SPI0,SPI_Flag_TXEIF); //清除标志位
;;;101    		
;;;102    		/* SPI0主机从FIFO读出接收到的数据，一次最多从FIFO接收8个数据 */
;;;103    		while(SPI_GetFlagStatus(SPI0,SPI_Flag_RXFIF) == RESET); //等待接收FIFO已满
;;;104    		SPI_ReceiveDataFIFO(SPI0,(uint32_t *)SPI0_ReceiveData,8); //读取前8个数据
;;;105    		
;;;106    		SPI_SendDataFIFO(SPI0,(uint32_t *)(FIFOMaster_SPI0_SendData+8),8); //写入后8个数据
;;;107    		while(SPI_GetFlagStatus(SPI0,SPI_Flag_TXEIF) == RESET); //等待FIFO发送完成
;;;108    		SPI_ClearFlag(SPI0,SPI_Flag_TXEIF);
;;;109    		
;;;110    		while(SPI_GetFlagStatus(SPI0,SPI_Flag_RXFIF) == RESET); //等待接收FIFO已满
;;;111    		SPI_ReceiveDataFIFO(SPI0,(uint32_t *)(SPI0_ReceiveData+8),8); //读取后8个数据
;;;112    		
;;;113    		for(int i=0 ;i <= 15 ;i++)	printf("SPI0主机接收到的数据为“0x%x”！\r\n",SPI0_ReceiveData[i]);
;;;114    		printf("SPI0主机接收到的数据为OK！\r\n");
;;;115    		
;;;116    #elif (SPI_Mode_ == 1)
;;;117    		/* SPI1没有FIFO，需要手动发送/接收数据 */
;;;118    		while(SPI1_Num <= 15)
;;;119    		{
;;;120    			SPI_SendData(SPI1,(uint32_t)FIFOMaster_SPI1_SendData[SPI1_Num]);
;;;121    			while(SPI1_Flag == RESET);
;;;122    			SPI1_Flag = RESET;
;;;123    			SPI1_ReceiveData[SPI1_Num] = SPI_ReceiveData(SPI1);//SPI1接收数据
000048  ad07              ADD      r5,sp,#0x1c
00004a  4f19              LDR      r7,|L1.176|
00004c  e018              B        |L1.128|
                  |L1.78|
00004e  4668              MOV      r0,sp                 ;120
000050  7800              LDRB     r0,[r0,#0]            ;120
000052  4917              LDR      r1,|L1.176|
000054  0040              LSLS     r0,r0,#1              ;120
000056  1c89              ADDS     r1,r1,#2              ;120
000058  4c13              LDR      r4,|L1.168|
00005a  5a09              LDRH     r1,[r1,r0]            ;120
00005c  4620              MOV      r0,r4                 ;120
00005e  f7fffffe          BL       SPI_SendData
                  |L1.98|
000062  7838              LDRB     r0,[r7,#0]            ;121  ; SPI1_Flag
000064  2800              CMP      r0,#0                 ;121
000066  d0fc              BEQ      |L1.98|
000068  703e              STRB     r6,[r7,#0]            ;122
00006a  4620              MOV      r0,r4
00006c  f7fffffe          BL       SPI_ReceiveData
000070  4669              MOV      r1,sp
000072  7809              LDRB     r1,[r1,#0]
000074  0049              LSLS     r1,r1,#1
000076  5268              STRH     r0,[r5,r1]
;;;124    
;;;125    			SPI1_Num ++;
000078  4669              MOV      r1,sp
00007a  7808              LDRB     r0,[r1,#0]
00007c  1c40              ADDS     r0,r0,#1
00007e  7008              STRB     r0,[r1,#0]
                  |L1.128|
000080  4668              MOV      r0,sp                 ;118
000082  7800              LDRB     r0,[r0,#0]            ;118
000084  280f              CMP      r0,#0xf               ;118
000086  d9e2              BLS      |L1.78|
;;;126    			
;;;127    		}
;;;128    	
;;;129    		for(int i=0 ;i <= 15 ;i++)	printf("SPI1从机接收到的数据为“0x%x”！\r\n",SPI1_ReceiveData[i]);
000088  2400              MOVS     r4,#0
                  |L1.138|
00008a  0060              LSLS     r0,r4,#1
00008c  5a29              LDRH     r1,[r5,r0]
00008e  a009              ADR      r0,|L1.180|
000090  f7fffffe          BL       __2printf
000094  1c64              ADDS     r4,r4,#1
000096  2c0f              CMP      r4,#0xf
000098  ddf7              BLE      |L1.138|
;;;130    		/* 清除标志位，为下一次通信做准备 */
;;;131    		SPI1_Num = 0;
00009a  4668              MOV      r0,sp
00009c  7006              STRB     r6,[r0,#0]
;;;132    		SPI1_Flag = RESET;
00009e  703e              STRB     r6,[r7,#0]
;;;133    		printf("SPI1从机接收到的数据为OK！\r\n");
0000a0  a00d              ADR      r0,|L1.216|
0000a2  f7fffffe          BL       __2printf
0000a6  e7eb              B        |L1.128|
;;;134    #endif		
;;;135    	}
;;;136    }
;;;137    
                          ENDP

                  |L1.168|
                          DCD      0x40021040
                  |L1.172|
                          DCD      0xe000e100
                  |L1.176|
                          DCD      ||.data||
                  |L1.180|
0000b4  53504931          DCB      "SPI1",180,211,187,250,189,211,202,213,181,189,181,196,202
0000b8  b4d3bbfa
0000bc  bdd3cad5
0000c0  b5bdb5c4
0000c4  ca      
0000c5  fdbeddce          DCB      253,190,221,206,170,161,176,"0x%x",161,177,163,161,"\r\n"
0000c9  aaa1b030
0000cd  782578a1
0000d1  b1a3a10d
0000d5  0a      
0000d6  00                DCB      0
0000d7  00                DCB      0
                  |L1.216|
0000d8  53504931          DCB      "SPI1",180,211,187,250,189,211,202,213,181,189,181,196,202
0000dc  b4d3bbfa
0000e0  bdd3cad5
0000e4  b5bdb5c4
0000e8  ca      
0000e9  fdbeddce          DCB      253,190,221,206,170,"OK",163,161,"\r\n",0
0000ed  aa4f4ba3
0000f1  a10d0a00
0000f5  00                DCB      0
0000f6  00                DCB      0
0000f7  00                DCB      0

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

                  SPI_FIFOMaster_SPI1Handler PROC
;;;137    
;;;138    void SPI_FIFOMaster_SPI1Handler(void)
000000  b510              PUSH     {r4,lr}
;;;139    {
;;;140    #if (SPI_Mode_ == 1)
;;;141    #if  defined(SC32f10xx)||defined(SC32f12xx)
;;;142    	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|
;;;143    	{
;;;144    		SPI_ClearFlag(SPI1,SPI_Flag_SPIF);
000010  2101              MOVS     r1,#1
000012  4620              MOV      r0,r4
000014  f7fffffe          BL       SPI_ClearFlag
;;;145    		SPI1_Flag = SET;
000018  4902              LDR      r1,|L2.36|
00001a  2001              MOVS     r0,#1
00001c  7008              STRB     r0,[r1,#0]
                  |L2.30|
;;;146    	}
;;;147    #endif
;;;148    #endif
;;;149    }
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
                  FIFOMaster_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_FIFOMaster.c"
	AREA ||.rev16_text||, CODE
	THUMB
	EXPORT |__asm___16_SPI_FIFOMaster_c_43a9dbe8____REV16|
#line 463 "..\\CMSIS\\cmsis_armcc.h"
|__asm___16_SPI_FIFOMaster_c_43a9dbe8____REV16| PROC
#line 464

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

 revsh r0, r0
 bx lr
	ENDP

;*** End   embedded assembler ***
