HPM APP
HPMicro Application solution
mp_adc.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "hpm_adc16_drv.h"
#include "hpm_adc.h"
#include "mp_pwm.h"
#include "mp_adc.h"
#include "hpm_dmamux_drv.h"
#include "hpm_dma_drv.h"

Data Structures

struct  mp_adc_pack_handle_t
 
struct  mp_adc_group_handle_t
 
struct  hpm_hdma_config_t
 
struct  hpm_hdma_t
 

Macros

#define MP_ADC_MAP_CTX   mp_adc_map
 
#define MP_ADC_MAP_COUNT   adc_map_count
 
#define MP_HDMA_MAX_COUNT   (8)
 

Functions

uint8_t mp_adcmap_get_adc_index (ADC16_Type *adc16, uint8_t adc_ch)
 
 ATTR_PLACE_AT_NONCACHEABLE_WITH_ALIGNMENT (ADC_SOC_DMA_ADDR_ALIGNMENT)
 
static ATTR_RAMFUNC void irq_process (uint8_t index)
 
static void isr_adc0 (void)
 
static void isr_adc1 (void)
 
static void isr_hdma (void)
 
uint8_t mp_adc_get_mapindex (uint8_t adc_index)
 Get ADC MAP index ;获取ADC MAP数组序号 More...
 
void mp_adc_get_default (uint8_t adc_index, hpm_adc_t *adc_t)
 Get the default value of the ADC data structure ;获取ADC数据结构默认值 More...
 
static int mp_adc_pwmpair_init (hpm_pwm_pair_t *pwm_pair_t)
 
static int mp_adc_pwm_init (hpm_pwm_t *pwm_t)
 
int mp_adc_init (uint8_t type, void *handle)
 MP ADC init ;MP ADC初始化 More...
 
int mp_adc_trigger_config (uint8_t type, void *handle)
 MP ADC trigger the preemption sampling configuration ;MP ADC触发抢占采样配置 More...
 
int mp_adc_interrupt_enable (uint8_t type, void *handle, bool enable)
 MP ADC enable interrupt ;MP ADC中断使能 More...
 
static uint8_t mp_hdma_ch_to_mux_ch (uint8_t hdma_ch)
 
static uint8_t mp_hdma_pwmch_to_muxsrc (uint8_t pwmch)
 
int mp_hdma_init_config (uint8_t type, void *handle, hpm_mp_hdma_over_callback cb)
 MP HDMA init(HDMA is used to transmit ADC sampling values. It can be used to continuously sample multiple adc values, and HDMA automatically carries the sampling results to the specified memory area) Note: After configuration, mp_hdma_transfer_start needs to be triggered to initiate the transfer ;MP HDMA初始配置(HDMA搬用ADC采样值; 常用于连续采样多个adc值,HDMA自动搬用到指定内存区域) 注意:配置完后需要 mp_hdma_transfer_start 触发开始传输 More...
 
int mp_hdma_transfer_start (uint32_t size)
 MP HDMA trigger and start transmission ;MP HDMA触发开始传输 More...
 
int mp_dma_chained_transfer_config (uint32_t size)
 MP HDMA chain transmission config, double buffered mode(In HDMA chain mode, multiple tasks are configured. In dual-buffer mode, the PING/PONG dual-buffer switching task is automatically performed without CPU intervention) ;MP HDMA链式传输配置,双缓冲模式(HDMA链式配置多任务,双缓冲模式下,自动PING/PONG双缓冲切换搬用,无需CPU干预) More...
 
void hpm_mp_api_adc_io_init (uint8_t adc_index)
 ADC IO init ;ADC IO初始化 More...
 
int hpm_mp_api_adc_set_map (const mp_adc_map_t *map_t, int count)
 Settings for the ADC MAP ;ADC MAP设置 More...
 

Variables

static hpm_hdma_t hpm_hdma = { 0 }
 
static hpm_mp_hdma_over_callback hdma_over_cb = NULL
 
static hpm_hdma_adc_t hdma_adc = { 0 }
 
static hpm_adc_t hdma_pack [(8)]
 
static const mp_adc_map_tmp_adc_map = NULL
 
static uint32_t adc_map_count = 0
 
static mp_adc_pack_handle_t adc_handle [3] = { 0 }
 

Macro Definition Documentation

◆ MP_ADC_MAP_COUNT

#define MP_ADC_MAP_COUNT   adc_map_count

◆ MP_ADC_MAP_CTX

#define MP_ADC_MAP_CTX   mp_adc_map

◆ MP_HDMA_MAX_COUNT

#define MP_HDMA_MAX_COUNT   (8)

Function Documentation

◆ ATTR_PLACE_AT_NONCACHEABLE_WITH_ALIGNMENT()

ATTR_PLACE_AT_NONCACHEABLE_WITH_ALIGNMENT ( ADC_SOC_DMA_ADDR_ALIGNMENT  )

◆ irq_process()

static ATTR_RAMFUNC void irq_process ( uint8_t  index)
inlinestatic

◆ isr_adc0()

static void isr_adc0 ( void  )
static

◆ isr_adc1()

static void isr_adc1 ( void  )
static

◆ isr_hdma()

static void isr_hdma ( void  )
static

◆ mp_adc_pwm_init()

static int mp_adc_pwm_init ( hpm_pwm_t pwm_t)
static

◆ mp_adc_pwmpair_init()

static int mp_adc_pwmpair_init ( hpm_pwm_pair_t pwm_pair_t)
static

◆ mp_adcmap_get_adc_index()

uint8_t mp_adcmap_get_adc_index ( ADC16_Type *  adc16,
uint8_t  adc_ch 
)

◆ mp_hdma_ch_to_mux_ch()

static uint8_t mp_hdma_ch_to_mux_ch ( uint8_t  hdma_ch)
static

◆ mp_hdma_pwmch_to_muxsrc()

static uint8_t mp_hdma_pwmch_to_muxsrc ( uint8_t  pwmch)
static

Variable Documentation

◆ adc_handle

mp_adc_pack_handle_t adc_handle[3] = { 0 }
static

◆ adc_map_count

uint32_t adc_map_count = 0
static

◆ hdma_adc

hpm_hdma_adc_t hdma_adc = { 0 }
static

◆ hdma_over_cb

hpm_mp_hdma_over_callback hdma_over_cb = NULL
static

◆ hdma_pack

hpm_adc_t hdma_pack[(8)]
static

◆ hpm_hdma

hpm_hdma_t hpm_hdma = { 0 }
static

◆ mp_adc_map

const mp_adc_map_t* mp_adc_map = NULL
static