⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stm32f10x_adc.lst

📁 针对STM32F103的UCOS移植
💻 LST
📖 第 1 页 / 共 5 页
字号:
    145              default:
    146                break;
    147            }
    148          }
   \   00000036   00BD               POP      {PC}             ;; return
   \                     ??ADC_DeInit_0:
   \   00000038   00240140           DC32     0x40012400
   \   0000003C   00280140           DC32     0x40012800
    149          
    150          /*******************************************************************************
    151          * Function Name  : ADC_Init
    152          * Description    : Initializes the ADCx peripheral according to the specified parameters
    153          *                  in the ADC_InitStruct.
    154          * Input          : - ADCx: where x can be 1 or 2 to select the ADC peripheral.
    155          *                  - ADC_InitStruct: pointer to an ADC_InitTypeDef structure that
    156          *                    contains the configuration information for the specified
    157          *                    ADC peripheral.
    158          * Output         : None
    159          * Return         : None
    160          ******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    161          void ADC_Init(ADC_TypeDef* ADCx, ADC_InitTypeDef* ADC_InitStruct)
    162          {
    163            u32 tmpreg1 = 0;
    164            u8 tmpreg2 = 0;
    165          
    166            /* Check the parameters */
    167            assert(IS_ADC_MODE(ADC_InitStruct->ADC_Mode));
    168            assert(IS_FUNCTIONAL_STATE(ADC_InitStruct->ADC_ScanConvMode));
    169            assert(IS_FUNCTIONAL_STATE(ADC_InitStruct->ADC_ContinuousConvMode));  		    
    170            assert(IS_ADC_EXT_TRIG(ADC_InitStruct->ADC_ExternalTrigConv));   
    171            assert(IS_ADC_DATA_ALIGN(ADC_InitStruct->ADC_DataAlign)); 
    172            assert(IS_ADC_REGULAR_LENGTH(ADC_InitStruct->ADC_NbrOfChannel));
    173          
    174            /*---------------------------- ADCx CR1 Configuration -----------------*/
    175            /* Get the ADCx CR1 value */
    176            tmpreg1 = ADCx->CR1;
   \                     ADC_Init:
   \   00000000   4268               LDR      R2,[R0, #+4]
    177            /* Clear DUALMODE and SCAN bits */
    178            tmpreg1 &= CR1_CLEAR_Mask;
    179            /* Configure ADCx: Dual mode and scan conversion mode */
    180            /* Set DUALMODE bits according to ADC_Mode value */
    181            /* Set SCAN bit according to ADC_ScanConvMode value */
    182            tmpreg1 |= (u32)(ADC_InitStruct->ADC_Mode | ((u32)ADC_InitStruct->ADC_ScanConvMode << 8));
    183            /* Write to ADCx CR1 */
    184            ADCx->CR1 = tmpreg1;
   \   00000002   0F4B               LDR.N    R3,??ADC_Init_0  ;; 0xfffffffffff0feff
   \   00000004   1340               ANDS     R3,R3,R2
   \   00000006   0A68               LDR      R2,[R1, #+0]
   \   00000008   1A43               ORRS     R2,R2,R3
   \   0000000A   0B79               LDRB     R3,[R1, #+4]
   \   0000000C   52EA0322           ORRS     R2,R2,R3, LSL #+8
   \   00000010   4260               STR      R2,[R0, #+4]
    185          
    186            /*---------------------------- ADCx CR2 Configuration -----------------*/
    187            /* Get the ADCx CR2 value */
    188            tmpreg1 = ADCx->CR2;
   \   00000012   8268               LDR      R2,[R0, #+8]
    189            /* Clear CONT, ALIGN and EXTTRIG bits */
    190            tmpreg1 &= CR2_CLEAR_Mask;
    191            /* Configure ADCx: external trigger event and continuous conversion mode */
    192            /* Set ALIGN bit according to ADC_DataAlign value */
    193            /* Set EXTTRIG bits according to ADC_ExternalTrigConv value */
    194            /* Set CONT bit according to ADC_ContinuousConvMode value */
    195            tmpreg1 |= (u32)(ADC_InitStruct->ADC_DataAlign | ADC_InitStruct->ADC_ExternalTrigConv |
    196                      ((u32)ADC_InitStruct->ADC_ContinuousConvMode << 1));
    197            /* Write to ADCx CR2 */
    198            ADCx->CR2 = tmpreg1;
   \   00000014   0B4B               LDR.N    R3,??ADC_Init_0+0x4  ;; 0xfffffffffff1f7fd
   \   00000016   1340               ANDS     R3,R3,R2
   \   00000018   CA68               LDR      R2,[R1, #+12]
   \   0000001A   1A43               ORRS     R2,R2,R3
   \   0000001C   8B68               LDR      R3,[R1, #+8]
   \   0000001E   1343               ORRS     R3,R3,R2
   \   00000020   4A79               LDRB     R2,[R1, #+5]
   \   00000022   53EA4202           ORRS     R2,R3,R2, LSL #+1
   \   00000026   8260               STR      R2,[R0, #+8]
    199          
    200            /*---------------------------- ADCx SQR1 Configuration -----------------*/
    201            /* Get the ADCx SQR1 value */
    202            tmpreg1 = ADCx->SQR1;
   \   00000028   C26A               LDR      R2,[R0, #+44]
    203            /* Clear L bits */
    204            tmpreg1 &= SQR1_CLEAR_Mask;
    205            /* Configure ADCx: regular channel sequence length */
    206            /* Set L bits according to ADC_NbrOfChannel value */
    207            tmpreg2 |= (ADC_InitStruct->ADC_NbrOfChannel - 1);
    208            tmpreg1 |= ((u32)tmpreg2 << 20);
    209            /* Write to ADCx SQR1 */
    210            ADCx->SQR1 = tmpreg1;
   \   0000002A   7FF47003           MVNS     R3,#+15728640
   \   0000002E   1340               ANDS     R3,R3,R2
   \   00000030   097C               LDRB     R1,[R1, #+16]
   \   00000032   491E               SUBS     R1,R1,#+1
   \   00000034   C9B2               UXTB     R1,R1
   \   00000036   53EA0151           ORRS     R1,R3,R1, LSL #+20
   \   0000003A   C162               STR      R1,[R0, #+44]
    211          }
   \   0000003C   7047               BX       LR               ;; return
   \   0000003E   00BF               Nop      
   \                     ??ADC_Init_0:
   \   00000040   FFFEF0FF           DC32     0xfffffffffff0feff
   \   00000044   FDF7F1FF           DC32     0xfffffffffff1f7fd
    212          
    213          /*******************************************************************************
    214          * Function Name  : ADC_StructInit
    215          * Description    : Fills each ADC_InitStruct member with its default value.
    216          * Input          : ADC_InitStruct : pointer to an ADC_InitTypeDef structure
    217          *                  which will be initialized.
    218          * Output         : None
    219          * Return         : None
    220          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    221          void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct)
    222          {
    223            /* Reset ADC init structure parameters values */
    224            /* Initialize the ADC_Mode member */
    225            ADC_InitStruct->ADC_Mode = ADC_Mode_Independent;
   \                     ADC_StructInit:
   \   00000000   0021               MOVS     R1,#+0
   \   00000002   0160               STR      R1,[R0, #+0]
    226          
    227            /* initialize the ADC_ScanConvMode member */
    228            ADC_InitStruct->ADC_ScanConvMode = DISABLE;
   \   00000004   0A00               MOVS     R2,R1
   \   00000006   0271               STRB     R2,[R0, #+4]
    229          
    230            /* Initialize the ADC_ContinuousConvMode member */
    231            ADC_InitStruct->ADC_ContinuousConvMode = DISABLE;
   \   00000008   4271               STRB     R2,[R0, #+5]
    232          
    233            /* Initialize the ADC_ExternalTrigConv member */
    234            ADC_InitStruct->ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
   \   0000000A   8160               STR      R1,[R0, #+8]
    235          
    236            /* Initialize the ADC_DataAlign member */
    237            ADC_InitStruct->ADC_DataAlign = ADC_DataAlign_Right;
   \   0000000C   C160               STR      R1,[R0, #+12]
    238          
    239            /* Initialize the ADC_NbrOfChannel member */
    240            ADC_InitStruct->ADC_NbrOfChannel = 1;
   \   0000000E   0121               MOVS     R1,#+1
   \   00000010   0174               STRB     R1,[R0, #+16]
    241          }
   \   00000012   7047               BX       LR               ;; return
    242          
    243          /*******************************************************************************
    244          * Function Name  : ADC_Cmd
    245          * Description    : Enables or disables the specified ADC peripheral.
    246          * Input          : - ADCx: where x can be 1 or 2 to select the ADC peripheral.
    247          *                  - NewState: new state of the ADCx peripheral. This parameter
    248          *                    can be: ENABLE or DISABLE.
    249          * Output         : None
    250          * Return         : None
    251          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    252          void ADC_Cmd(ADC_TypeDef* ADCx, FunctionalState NewState)
    253          {
    254            /* Check the parameters */
    255            assert(IS_FUNCTIONAL_STATE(NewState));
    256          
    257            if (NewState != DISABLE)
   \                     ADC_Cmd:
   \   00000000   0029               CMP      R1,#+0
   \   00000002   8168               LDR      R1,[R0, #+8]
   \   00000004   03D0               BEQ.N    ??ADC_Cmd_0
    258            {
    259              /* Set the ADON bit to wake up the ADC from power down mode */
    260              ADCx->CR2 |= CR2_ADON_Set;
   \   00000006   51F00101           ORRS     R1,R1,#0x1
   \   0000000A   8160               STR      R1,[R0, #+8]
   \   0000000C   7047               BX       LR
    261            }
    262            else
    263            {
    264              /* Disable the selected ADC peripheral */
    265              ADCx->CR2 &= CR2_ADON_Reset;
   \                     ??ADC_Cmd_0:
   \   0000000E   0122               MOVS     R2,#+1
   \   00000010   9143               BICS     R1,R1,R2
   \   00000012   8160               STR      R1,[R0, #+8]
    266            }
    267          }
   \   00000014   7047               BX       LR               ;; return
    268          
    269          /*******************************************************************************
    270          * Function Name  : ADC_DMACmd
    271          * Description    : Enables or disables the specified ADC DMA request.
    272          * Input          : - ADCx: where x can be 1 or 2 to select the ADC peripheral.
    273          *                  - NewState: new state of the selected ADC DMA transfer.
    274          *                    This parameter can be: ENABLE or DISABLE.
    275          * Output         : None
    276          * Return         : None
    277          *******************************************************************************/

   \                                 In segment CODE, align 4, keep-with-next
    278          void ADC_DMACmd(ADC_TypeDef* ADCx, FunctionalState NewState)
    279          {
    280            /* Check the parameters */
    281            assert(IS_FUNCTIONAL_STATE(NewState));
    282          
    283            if (NewState != DISABLE)
   \                     ADC_DMACmd:
   \   00000000   0029               CMP      R1,#+0
   \   00000002   8168               LDR      R1,[R0, #+8]
   \   00000004   03D0               BEQ.N    ??ADC_DMACmd_0
    284            {
    285              /* Enable the selected ADC DMA request */
    286              ADCx->CR2 |= CR2_DMA_Set;
   \   00000006   51F48071           ORRS     R1,R1,#0x100
   \   0000000A   8160               STR      R1,[R0, #+8]
   \   0000000C   7047               BX       LR
    287            }
    288            else
    289            {
    290              /* Disable the selected ADC DMA request */
    291              ADCx->CR2 &= CR2_DMA_Reset;
   \                     ??ADC_DMACmd_0:
   \   0000000E   024A               LDR.N    R2,??ADC_DMACmd_1  ;; 0xfeff
   \   00000010   0A40               ANDS     R2,R2,R1
   \   00000012   8260               STR      R2,[R0, #+8]
    292            }
    293          }
   \   00000014   7047               BX       LR               ;; return

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -