; 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\adc_cycleconversion_dma.o --asm_dir=..\List\ --list_dir=..\List\ --depend=..\output\adc_cycleconversion_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\adc_cycleconversion_dma.crf ..\Apps\ADC_CycleConversion_DMA.c]
                          THUMB

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

                  ADC_CycleConversion_DMAHandler PROC
;;;76     
;;;77     void ADC_CycleConversion_DMAHandler(void)
000000  b510              PUSH     {r4,lr}
;;;78     {
;;;79       if(DMA_GetFlagStatus(DMA0, DMA_FLAG_TCIF))
000002  4c09              LDR      r4,|L1.40|
000004  2102              MOVS     r1,#2
000006  4620              MOV      r0,r4
000008  f7fffffe          BL       DMA_GetFlagStatus
00000c  2800              CMP      r0,#0
00000e  d00a              BEQ      |L1.38|
;;;80       {
;;;81         DMA_ClearFlag(DMA0, DMA_FLAG_TCIF | DMA_FLAG_HTIF);
000010  2106              MOVS     r1,#6
000012  4620              MOV      r0,r4
000014  f7fffffe          BL       DMA_ClearFlag
;;;82         ADC_Flag = SET;
000018  4904              LDR      r1,|L1.44|
00001a  2001              MOVS     r0,#1
00001c  7008              STRB     r0,[r1,#0]
;;;83         
;;;84         /* 停止ADC连续转换 */
;;;85         ADC_ConvModeConfig(ADC,ADC_ConvMode_Single);
00001e  2100              MOVS     r1,#0
000020  4803              LDR      r0,|L1.48|
000022  f7fffffe          BL       ADC_ConvModeConfig
                  |L1.38|
;;;86       }
;;;87     }
000026  bd10              POP      {r4,pc}
;;;88     
                          ENDP

                  |L1.40|
                          DCD      0x40010800
                  |L1.44|
                          DCD      ||.data||
                  |L1.48|
                          DCD      0x40022110

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

                          REQUIRE _printf_percent
                          REQUIRE _printf_x
                          REQUIRE _printf_longlong_hex
                  ADC_CycleConversion_DMA_Function PROC
;;;13     
;;;14     void ADC_CycleConversion_DMA_Function(void)
000000  b096              SUB      sp,sp,#0x58
;;;15     {
;;;16       ADC_InitTypeDef ADC_InitStruct; //定义ADC初始化结构体变量
;;;17       DMA_InitTypeDef DMA_InitStruct; //定义DMA初始化结构体变量
;;;18       uint16_t ADC_ValueArray[20];
;;;19       uint16_t ADC_ValueMax, ADC_ValueMin, ADC_ValueMean, ADC_ValueNum;
;;;20       uint32_t ADC_ValueSum = 0;
000002  2400              MOVS     r4,#0
;;;21       
;;;22       RCC_APB2Cmd(ENABLE);  //ADC外设挂载在APB2时钟上
000004  2001              MOVS     r0,#1
000006  f7fffffe          BL       RCC_APB2Cmd
;;;23       RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA, ENABLE);
00000a  2101              MOVS     r1,#1
00000c  4608              MOV      r0,r1
00000e  f7fffffe          BL       RCC_AHBPeriphClockCmd
;;;24       
;;;25       ADC_InitStruct.ADC_ConvMode = ADC_ConvMode_Continuous;  //ADC单次转换模式
000012  2001              MOVS     r0,#1
000014  02c0              LSLS     r0,r0,#11
000016  4669              MOV      r1,sp
000018  8188              STRH     r0,[r1,#0xc]
;;;26       ADC_InitStruct.ADC_Prescaler = ADC_Prescaler_3CLOCK;  //转换时间为3个周期
00001a  01c0              LSLS     r0,r0,#7
;;;27       ADC_InitStruct.ADC_VREF = ADC_VREF_VDD; //参考电压为VDD
;;;28       ADC_InitStruct.ADC_EAIN = ADC_EAIN_0; //把ADC0设为ADC输入引脚
00001c  9000              STR      r0,[sp,#0]
00001e  2001              MOVS     r0,#1
;;;29       
;;;30       ADC_Init(ADC, &ADC_InitStruct); //根据结构体标志位配置ADC
000020  4e2d              LDR      r6,|L2.216|
000022  2500              MOVS     r5,#0                 ;27
000024  9001              STR      r0,[sp,#4]
000026  9502              STR      r5,[sp,#8]            ;28
000028  4630              MOV      r0,r6
00002a  f7fffffe          BL       ADC_Init
;;;31       ADC_SetChannel(ADC,ADC_Channel_VDD_D4);
00002e  211f              MOVS     r1,#0x1f
000030  4630              MOV      r0,r6
000032  f7fffffe          BL       ADC_SetChannel
;;;32       
;;;33       /* DMA外设配置 */
;;;34       DMA_StructInit(&DMA_InitStruct);
000036  a804              ADD      r0,sp,#0x10
000038  f7fffffe          BL       DMA_StructInit
;;;35       
;;;36       DMA_InitStruct.DMA_CircularMode = DMA_CircularMode_Disable;
00003c  4669              MOV      r1,sp
00003e  824d              STRH     r5,[r1,#0x12]
;;;37       DMA_InitStruct.DMA_DataSize = DMA_DataSize_HalfWord;
000040  2004              MOVS     r0,#4
000042  8288              STRH     r0,[r1,#0x14]
;;;38       DMA_InitStruct.DMA_TargetMode = DMA_TargetMode_INC_CIRC;
000044  2003              MOVS     r0,#3
000046  0200              LSLS     r0,r0,#8
000048  82c8              STRH     r0,[r1,#0x16]
;;;39       DMA_InitStruct.DMA_SourceMode = DMA_SourceMode_FIXED;
00004a  830d              STRH     r5,[r1,#0x18]
;;;40       DMA_InitStruct.DMA_SrcAddress = (uint32_t)&ADC->ADC_VALUE;
00004c  4822              LDR      r0,|L2.216|
;;;41       DMA_InitStruct.DMA_DstAddress = (uint32_t)ADC_ValueArray;
;;;42       DMA_InitStruct.DMA_Request = DMA_Request_ADC;
;;;43       DMA_InitStruct.DMA_BufferSize = 20;
;;;44       
;;;45       DMA_Init(DMA0, &DMA_InitStruct);
00004e  4f23              LDR      r7,|L2.220|
000050  3008              ADDS     r0,r0,#8              ;40
000052  9009              STR      r0,[sp,#0x24]         ;42
000054  203b              MOVS     r0,#0x3b              ;42
000056  0600              LSLS     r0,r0,#24             ;42
000058  9008              STR      r0,[sp,#0x20]         ;43
00005a  2014              MOVS     r0,#0x14              ;43
00005c  ad0b              ADD      r5,sp,#0x2c           ;41
00005e  9007              STR      r0,[sp,#0x1c]
000060  950a              STR      r5,[sp,#0x28]         ;42
000062  a904              ADD      r1,sp,#0x10
000064  4638              MOV      r0,r7
000066  f7fffffe          BL       DMA_Init
;;;46       
;;;47       DMA_ITConfig(DMA0,DMA_IT_INTEN | DMA_IT_TCIE,ENABLE);
00006a  2103              MOVS     r1,#3
00006c  2201              MOVS     r2,#1
00006e  0409              LSLS     r1,r1,#16
000070  4638              MOV      r0,r7
000072  f7fffffe          BL       DMA_ITConfig
000076  491a              LDR      r1,|L2.224|
000078  14f0              ASRS     r0,r6,#19
00007a  6008              STR      r0,[r1,#0]
;;;48       NVIC_EnableIRQ(DMA0_IRQn);
;;;49       
;;;50       ADC_DMACmd(ADC, ENABLE);
00007c  2101              MOVS     r1,#1
00007e  4630              MOV      r0,r6
000080  f7fffffe          BL       ADC_DMACmd
;;;51       ADC_Cmd(ADC,ENABLE);
000084  2101              MOVS     r1,#1
000086  4630              MOV      r0,r6
000088  f7fffffe          BL       ADC_Cmd
;;;52       DMA_Cmd(DMA0, ENABLE);
00008c  2101              MOVS     r1,#1
00008e  4638              MOV      r0,r7
000090  f7fffffe          BL       DMA_Cmd
;;;53       
;;;54       ADC_SoftwareStartConv(ADC); // 开启转换
000094  4630              MOV      r0,r6
000096  f7fffffe          BL       ADC_SoftwareStartConv
;;;55       
;;;56       while(!ADC_Flag); //等待ADC 20次转换完成
00009a  4812              LDR      r0,|L2.228|
                  |L2.156|
00009c  7801              LDRB     r1,[r0,#0]  ; ADC_Flag
00009e  2900              CMP      r1,#0
0000a0  d0fc              BEQ      |L2.156|
;;;57       
;;;58       /* 获取20次ADC转换的平均值，去除最大最小值 */
;;;59       ADC_ValueMax = 0;
0000a2  2300              MOVS     r3,#0
;;;60       ADC_ValueMin = 0X01 << 14;
0000a4  2201              MOVS     r2,#1
0000a6  0392              LSLS     r2,r2,#14
;;;61       for(ADC_ValueNum = 0; ADC_ValueNum < 20; ADC_ValueNum ++)
0000a8  4618              MOV      r0,r3
                  |L2.170|
;;;62       {
;;;63         ADC_ValueSum += ADC_ValueArray[ADC_ValueNum];
0000aa  0041              LSLS     r1,r0,#1
0000ac  5a69              LDRH     r1,[r5,r1]
0000ae  190c              ADDS     r4,r1,r4
;;;64         if(ADC_ValueArray[ADC_ValueNum] > ADC_ValueMax)
0000b0  4299              CMP      r1,r3
0000b2  d900              BLS      |L2.182|
;;;65           ADC_ValueMax = ADC_ValueArray[ADC_ValueNum];
0000b4  460b              MOV      r3,r1
                  |L2.182|
;;;66         if(ADC_ValueArray[ADC_ValueNum] < ADC_ValueMin)
0000b6  4291              CMP      r1,r2
0000b8  d200              BCS      |L2.188|
;;;67           ADC_ValueMin = ADC_ValueArray[ADC_ValueNum];
0000ba  460a              MOV      r2,r1
                  |L2.188|
0000bc  1c40              ADDS     r0,r0,#1
0000be  b280              UXTH     r0,r0                 ;61
0000c0  2814              CMP      r0,#0x14              ;61
0000c2  d3f2              BCC      |L2.170|
;;;68       }
;;;69       
;;;70       ADC_ValueMean = (uint16_t)((ADC_ValueSum - ADC_ValueMax - ADC_ValueMin) / 18);
0000c4  1ae0              SUBS     r0,r4,r3
0000c6  1a80              SUBS     r0,r0,r2
0000c8  2112              MOVS     r1,#0x12
0000ca  f7fffffe          BL       __aeabi_uidivmod
0000ce  b281              UXTH     r1,r0
;;;71       
;;;72       printf("\r\n ADC Conversion Value is 0x%x \r\n",ADC_ValueMean);
0000d0  a005              ADR      r0,|L2.232|
0000d2  f7fffffe          BL       __2printf
                  |L2.214|
;;;73       
;;;74       while(1);
0000d6  e7fe              B        |L2.214|
;;;75     }
;;;76     
                          ENDP

                  |L2.216|
                          DCD      0x40022110
                  |L2.220|
                          DCD      0x40010800
                  |L2.224|
                          DCD      0xe000e100
                  |L2.228|
                          DCD      ||.data||
                  |L2.232|
0000e8  0d0a2041          DCB      "\r\n ADC Conversion Value is 0x%x \r\n",0
0000ec  44432043
0000f0  6f6e7665
0000f4  7273696f
0000f8  6e205661
0000fc  6c756520
000100  69732030
000104  78257820
000108  0d0a00  
00010b  00                DCB      0

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

                  ADC_Flag
000000  00                DCB      0x00

;*** Start embedded assembler ***

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

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

 revsh r0, r0
 bx lr
	ENDP

;*** End   embedded assembler ***
