; 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_communication_dma.o --asm_dir=..\List\ --list_dir=..\List\ --depend=..\output\spi_communication_dma.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_communication_dma.crf ..\Apps\SPI_Communication_DMA.c]
                          THUMB

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

                  SPI_Communication_DMA_DAM0Handler PROC
;;;183    
;;;184    void SPI_Communication_DMA_DAM0Handler(void)
000000  4770              BX       lr
;;;185    {
;;;186    #if (SPI_Mode_ == 0)
;;;187      if(DMA_GetFlagStatus(DMA0, DMA_FLAG_TCIF))
;;;188      {
;;;189        DMA_ClearFlag(DMA0, DMA_FLAG_TCIF);
;;;190        SPI0_Flag = SET;
;;;191      }
;;;192    #endif
;;;193    }
;;;194    
                          ENDP


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

                  SPI_Communication_DMA_DMA1Handler PROC
;;;194    
;;;195    void SPI_Communication_DMA_DMA1Handler(void)
000000  b510              PUSH     {r4,lr}
;;;196    {
;;;197    #if (SPI_Mode_ == 1)
;;;198      if(DMA_GetFlagStatus(DMA1, DMA_FLAG_TCIF))
000002  4c07              LDR      r4,|L2.32|
000004  2102              MOVS     r1,#2
000006  4620              MOV      r0,r4
000008  f7fffffe          BL       DMA_GetFlagStatus
00000c  2800              CMP      r0,#0
00000e  d006              BEQ      |L2.30|
;;;199      {    SPI1_Flag = SET;
000010  4904              LDR      r1,|L2.36|
000012  2001              MOVS     r0,#1
000014  7008              STRB     r0,[r1,#0]
;;;200        DMA_ClearFlag(DMA1, DMA_FLAG_TCIF);
000016  2102              MOVS     r1,#2
000018  4620              MOV      r0,r4
00001a  f7fffffe          BL       DMA_ClearFlag
                  |L2.30|
;;;201    
;;;202      }
;;;203    #endif
;;;204    }
00001e  bd10              POP      {r4,pc}
;;;205    
                          ENDP

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

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

                          REQUIRE _printf_percent
                          REQUIRE _printf_d
                          REQUIRE _printf_int_dec
                  SPI_Communication_DMA_Function PROC
;;;21     
;;;22     void SPI_Communication_DMA_Function(void)
000000  b0c2              SUB      sp,sp,#0x108
;;;23     {
;;;24     	uint8_t i; 
;;;25     	SPI_InitTypeDef SPI_InitStruct; //定义SPI初始化结构体变量
;;;26       DMA_InitTypeDef DMA_InitStruct; //定义DMA初始化结构体变量
;;;27     	
;;;28     	/* 结构体成员初始化 */
;;;29       SPI_StructInit(&SPI_InitStruct);
000002  a807              ADD      r0,sp,#0x1c
000004  f7fffffe          BL       SPI_StructInit
;;;30       DMA_StructInit(&DMA_InitStruct);
000008  4668              MOV      r0,sp
00000a  f7fffffe          BL       DMA_StructInit
;;;31     	
;;;32     	/* 使能DMA的时钟 */
;;;33       RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA, ENABLE);
00000e  2101              MOVS     r1,#1
000010  4608              MOV      r0,r1
000012  f7fffffe          BL       RCC_AHBPeriphClockCmd
;;;34     	
;;;35     #if (SPI_Mode_ == 0)	
;;;36     	volatile uint8_t Communication_DMA_SPI0_SendData[200];
;;;37     
;;;38     	for(i=0;i<200;i++)
;;;39     	{
;;;40     	 Communication_DMA_SPI0_SendData[i] = i;//被搬运数组写入数据
;;;41     	}
;;;42       /* 使能SPI0的时钟 */
;;;43       RCC_APB0Cmd(ENABLE);  //SPI0和1外设挂载在APB0时钟上
;;;44     #if defined(SC32f10xx)||defined(SC32f12xx)
;;;45       RCC_APB0PeriphClockCmd(RCC_APB0Periph_SPI0, ENABLE);
;;;46     #endif
;;;47       /* 配置SPI0为主机 */
;;;48       SPI_InitStruct.SPI_CPHA = SPI_CPHA_1Edge;	//SPI第一沿采集数据
;;;49       SPI_InitStruct.SPI_CPOL = SPI_CPOL_High;	//SPI空闲电平为高电平
;;;50       SPI_InitStruct.SPI_DataSize = SPI_DataSize_8B;	//数据长度为8位
;;;51       SPI_InitStruct.SPI_FirstBit = SPI_FirstBit_MSB;	//数值传输为高位在前
;;;52       SPI_InitStruct.SPI_Mode = SPI_Mode_Master;	//SPI工作在主机模式
;;;53       SPI_InitStruct.SPI_Prescaler = SPI_Prescaler_1024;	//SPI传输频率为APB0时钟1024分频
;;;54       SPI_Init(SPI0, &SPI_InitStruct);
;;;55       /* 使能SPI0发送的DMA功能 */
;;;56       SPI_DMACmd(SPI0, SPI_DMAReq_TX, ENABLE);
;;;57     	/*CLK引脚初始化*/
;;;58     	GPIO_InitTypeDef GPIO_InitStruct; //定义GPIO初始化结构体变量
;;;59     #if defined(SC32f12xx)
;;;60       GPIO_InitStruct.GPIO_Pin = GPIO_Pin_2;
;;;61       GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT_PP;
;;;62       GPIO_Init(GPIOC, &GPIO_InitStruct);
;;;63     	PC_BIT(2) = 1;
;;;64     #elif defined(SC32f10xx)
;;;65       GPIO_InitStruct.GPIO_Pin = GPIO_Pin_1;
;;;66       GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT_PP;
;;;67       GPIO_Init(GPIOB, &GPIO_InitStruct);
;;;68     	PB_BIT(1) = 1;
;;;69     #endif
;;;70     
;;;71       /* 使能SPI0 */
;;;72       SPI_Cmd(SPI0, ENABLE);
;;;73     
;;;74       /* DMA0外设配置 */
;;;75       DMA_InitStruct.DMA_BufferSize = 200;	//DMA搬运数量为200个
;;;76       DMA_InitStruct.DMA_CircularMode = DMA_CircularMode_Disable;	//关闭循环模式
;;;77       DMA_InitStruct.DMA_DataSize = DMA_DataSize_Byte;	//传输宽度为字节
;;;78       DMA_InitStruct.DMA_SourceMode = DMA_SourceMode_INC_CIRC;	//源地址循环递增
;;;79       DMA_InitStruct.DMA_TargetMode = DMA_TargetMode_FIXED;	//目标地址固定
;;;80       DMA_InitStruct.DMA_SrcAddress = (uint32_t)Communication_DMA_SPI0_SendData;
;;;81       DMA_InitStruct.DMA_DstAddress = (uint32_t)&SPI0->SPI_DATA;
;;;82     #if defined(SC32f10xx)||defined(SC32f12xx)
;;;83       DMA_InitStruct.DMA_Request = DMA_Request_SPI0_TX;	//SPI0 发送触发DMA0
;;;84     #endif
;;;85       DMA_InitStruct.DMA_Priority = DMA_Priority_HIGH;	//设置优先级为高
;;;86       DMA_Init(DMA0, &DMA_InitStruct);
;;;87       /* 开启DMA0传输完成中断 */
;;;88       DMA_ITConfig(DMA0, DMA_IT_INTEN | DMA_IT_TCIE, ENABLE);
;;;89       NVIC_EnableIRQ(DMA0_IRQn);
;;;90       DMA_Cmd(DMA0, ENABLE);	//使能DMA0
;;;91     
;;;92     #elif (SPI_Mode_ == 1)
;;;93      volatile uint8_t Communication_DMA_SPI1_ReceiveData[200];
;;;94     	
;;;95       /* 使能SPI1的时钟 */
;;;96        RCC_APB1Cmd(ENABLE);//SPI1外设挂载在APB1时钟上 
000016  2001              MOVS     r0,#1
000018  f7fffffe          BL       RCC_APB1Cmd
;;;97     #if defined(SC32f12xx)
;;;98       RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI1, ENABLE);
;;;99     #elif defined(SC32f10xx)
;;;100       RCC_APB1Cmd(ENABLE);//SPI1外设挂载在APB1时钟上
00001c  2001              MOVS     r0,#1
00001e  f7fffffe          BL       RCC_APB1Cmd
;;;101    #endif
;;;102    
;;;103    	GPIO_InitTypeDef GPIO_InitStruct; //定义GPIO初始化结构体变量
;;;104    #if defined(SC32f10xx) ||defined(SC32f12xx)
;;;105      GPIO_InitStruct.GPIO_Pin = GPIO_Pin_2;
000022  2004              MOVS     r0,#4
000024  4669              MOV      r1,sp
000026  8688              STRH     r0,[r1,#0x34]
;;;106      GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT_PP;
000028  2002              MOVS     r0,#2
00002a  86c8              STRH     r0,[r1,#0x36]
;;;107      GPIO_Init(GPIOA, &GPIO_InitStruct);
00002c  4c2a              LDR      r4,|L3.216|
00002e  a90d              ADD      r1,sp,#0x34
000030  4620              MOV      r0,r4
000032  f7fffffe          BL       GPIO_Init
;;;108    	PA_BIT(2) = 1;	
000036  2101              MOVS     r1,#1
000038  70a1              STRB     r1,[r4,#2]
;;;109    #endif
;;;110    	/* 配置SPI1为从机 */
;;;111      SPI_InitStruct.SPI_CPHA = SPI_CPHA_1Edge;	//SPI第一沿采集数据
00003a  2600              MOVS     r6,#0
;;;112      SPI_InitStruct.SPI_CPOL = SPI_CPOL_High;	//SPI空闲电平为高电平
;;;113      SPI_InitStruct.SPI_DataSize = SPI_DataSize_8B;	//数据长度为8位
;;;114      SPI_InitStruct.SPI_FirstBit = SPI_FirstBit_MSB;	//数值传输为高位在前
;;;115      SPI_InitStruct.SPI_Mode = SPI_Mode_Slave;	//SPI工作在从机模式
;;;116      SPI_Init(SPI1, &SPI_InitStruct);
00003c  4d27              LDR      r5,|L3.220|
00003e  2410              MOVS     r4,#0x10              ;112
000040  9609              STR      r6,[sp,#0x24]         ;113
000042  9608              STR      r6,[sp,#0x20]         ;114
000044  960b              STR      r6,[sp,#0x2c]         ;115
000046  a907              ADD      r1,sp,#0x1c
000048  4628              MOV      r0,r5
00004a  9607              STR      r6,[sp,#0x1c]
00004c  940a              STR      r4,[sp,#0x28]
00004e  f7fffffe          BL       SPI_Init
;;;117      /* 使能SPI1接收的DMA功能 */
;;;118      SPI_DMACmd(SPI1, SPI_DMAReq_RX, ENABLE);
000052  2201              MOVS     r2,#1
000054  2140              MOVS     r1,#0x40
000056  4628              MOV      r0,r5
000058  f7fffffe          BL       SPI_DMACmd
;;;119      /* 使能SPI1 */
;;;120      SPI_Cmd(SPI1, ENABLE);
00005c  2101              MOVS     r1,#1
00005e  4628              MOV      r0,r5
000060  f7fffffe          BL       SPI_Cmd
;;;121    
;;;122      /* DMA1外设配置 */
;;;123      DMA_InitStruct.DMA_BufferSize = 200;	//DMA搬运数量为200个
000064  20c8              MOVS     r0,#0xc8
;;;124      DMA_InitStruct.DMA_CircularMode = DMA_CircularMode_Enable;	//开启循环模式
000066  9003              STR      r0,[sp,#0xc]
000068  4669              MOV      r1,sp
00006a  804c              STRH     r4,[r1,#2]
;;;125      DMA_InitStruct.DMA_DataSize = DMA_DataSize_Byte;	//传输宽度为字节
00006c  808e              STRH     r6,[r1,#4]
;;;126      DMA_InitStruct.DMA_SourceMode = DMA_SourceMode_FIXED;	//源地址固定
;;;127      DMA_InitStruct.DMA_TargetMode = DMA_TargetMode_INC_CIRC;	//源地址循环递增
00006e  2003              MOVS     r0,#3
000070  810e              STRH     r6,[r1,#8]            ;126
000072  0200              LSLS     r0,r0,#8
000074  80c8              STRH     r0,[r1,#6]
;;;128      DMA_InitStruct.DMA_SrcAddress = (uint32_t)&SPI1->SPI_DATA;
000076  4819              LDR      r0,|L3.220|
;;;129      DMA_InitStruct.DMA_DstAddress = (uint32_t)Communication_DMA_SPI1_ReceiveData;
000078  ad0f              ADD      r5,sp,#0x3c
00007a  300c              ADDS     r0,r0,#0xc            ;128
;;;130    #if defined(SC32f10xx)||defined(SC32f12xx)
;;;131      DMA_InitStruct.DMA_Request = DMA_Request_SPI1_RX;	//SPI1 接收触发DMA1
00007c  9005              STR      r0,[sp,#0x14]
00007e  200f              MOVS     r0,#0xf
000080  0600              LSLS     r0,r0,#24
;;;132    
;;;133    #endif
;;;134      DMA_InitStruct.DMA_Priority = DMA_Priority_VERY_HIGH;	//设置优先级为非常高
000082  9004              STR      r0,[sp,#0x10]
000084  9506              STR      r5,[sp,#0x18]         ;131
000086  2003              MOVS     r0,#3
;;;135      DMA_Init(DMA1, &DMA_InitStruct);
000088  4c15              LDR      r4,|L3.224|
00008a  8008              STRH     r0,[r1,#0]            ;134
00008c  4620              MOV      r0,r4
00008e  f7fffffe          BL       DMA_Init
;;;136      /* 开启DMA1传输完成中断 */
;;;137      DMA_ITConfig(DMA1, DMA_IT_INTEN | DMA_IT_TCIE, ENABLE);
000092  2103              MOVS     r1,#3
000094  2201              MOVS     r2,#1
000096  0409              LSLS     r1,r1,#16
000098  4620              MOV      r0,r4
00009a  f7fffffe          BL       DMA_ITConfig
00009e  4811              LDR      r0,|L3.228|
0000a0  14a1              ASRS     r1,r4,#18
0000a2  6001              STR      r1,[r0,#0]
;;;138      NVIC_EnableIRQ(DMA1_IRQn);
;;;139      DMA_Cmd(DMA1, ENABLE);//使能DMA1
0000a4  2101              MOVS     r1,#1
0000a6  4620              MOV      r0,r4
0000a8  f7fffffe          BL       DMA_Cmd
;;;140    
;;;141    #endif
;;;142    
;;;143      while(1)
;;;144      {
;;;145    #if (SPI_Mode_ == 0)
;;;146        printf("SPI0主机发送数据为：\r\n");
;;;147    		for(i=0;i<200;i++)
;;;148    	    {
;;;149    				printf("%d、", Communication_DMA_SPI0_SendData[i]);
;;;150    			}
;;;151    			printf("\r\n");
;;;152    		
;;;153        DMA_SoftwareTrigger(DMA0);	//软件触发第一次搬运
;;;154    
;;;155        while(SPI0_Flag == RESET);	//等待DMA0搬运完成
;;;156        SPI0_Flag = RESET; //清标志
;;;157    			
;;;158        /* 重新写入DMA通道传输值 */
;;;159        DMA_SetCurrDataCounter(DMA0, 200);	
;;;160    			
;;;161        /* 重新使能SPI0的DMA功能，才能开启新一轮通信 */
;;;162        SPI_DMACmd(SPI0, SPI_DMAReq_TX, DISABLE);
;;;163        SPI_DMACmd(SPI0, SPI_DMAReq_TX, ENABLE);
;;;164    			
;;;165    #elif (SPI_Mode_ == 1)
;;;166    	
;;;167        while(SPI1_Flag == RESET);	//等待DMA1搬运完成
0000ac  4f0e              LDR      r7,|L3.232|
                  |L3.174|
0000ae  7838              LDRB     r0,[r7,#0]  ; SPI1_Flag
0000b0  2800              CMP      r0,#0
0000b2  d0fc              BEQ      |L3.174|
;;;168        SPI1_Flag = RESET;	
0000b4  703e              STRB     r6,[r7,#0]
;;;169    
;;;170        printf("SPI1从机接收到的数据为：\r\n");
0000b6  a00d              ADR      r0,|L3.236|
0000b8  f7fffffe          BL       __2printf
;;;171    			
;;;172        for(i=0;i<200;i++)
0000bc  2400              MOVS     r4,#0
                  |L3.190|
;;;173    	  {
;;;174    			printf("%d、", Communication_DMA_SPI1_ReceiveData[i]);
0000be  5d29              LDRB     r1,[r5,r4]
0000c0  a011              ADR      r0,|L3.264|
0000c2  f7fffffe          BL       __2printf
0000c6  1c64              ADDS     r4,r4,#1
0000c8  b2e4              UXTB     r4,r4                 ;172
0000ca  2cc8              CMP      r4,#0xc8              ;172
0000cc  d3f7              BCC      |L3.190|
;;;175    	  }
;;;176    		printf("\r\n");
0000ce  a00d              ADR      r0,|L3.260|
0000d0  f7fffffe          BL       __2printf
0000d4  e7eb              B        |L3.174|
;;;177    			
;;;178    
;;;179    
;;;180    #endif
;;;181      }
;;;182    }
;;;183    
                          ENDP

0000d6  0000              DCW      0x0000
                  |L3.216|
                          DCD      0x40011000
                  |L3.220|
                          DCD      0x40021040
                  |L3.224|
                          DCD      0x40010840
                  |L3.228|
                          DCD      0xe000e100
                  |L3.232|
                          DCD      ||.data||
                  |L3.236|
0000ec  53504931          DCB      "SPI1",180,211,187,250,189,211,202,213,181,189,181,196,202
0000f0  b4d3bbfa
0000f4  bdd3cad5
0000f8  b5bdb5c4
0000fc  ca      
0000fd  fdbeddce          DCB      253,190,221,206,170,163,186
000101  aaa3ba  
                  |L3.260|
000104  0d0a00            DCB      "\r\n",0
000107  00                DCB      0
                  |L3.264|
000108  2564a1a2          DCB      "%d",161,162,0
00010c  00      
00010d  00                DCB      0
00010e  00                DCB      0
00010f  00                DCB      0

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

                  SPI1_Flag
000000  00                DCB      0x00

;*** Start embedded assembler ***

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

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

 revsh r0, r0
 bx lr
	ENDP

;*** End   embedded assembler ***
