Azure Sphere MT3620 M4 API Reference Manual
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Function

M-HAL ADC function list information, ADC hardware initializing and de-initializing, setting and getting ADC parameters set, enabling and disabling ADC hardware output, gets ADC sample data using FIFO mode, gets ADC sample data using DMA mode, enabling and disabling clock. More...

Overview

M-HAL ADC function list information, ADC hardware initializing and de-initializing, setting and getting ADC parameters set, enabling and disabling ADC hardware output, gets ADC sample data using FIFO mode, gets ADC sample data using DMA mode, enabling and disabling clock.

Functions

int mtk_mhal_adc_init (struct mtk_adc_controller *ctlr)
 This function is used to initialize an ADC hardware controller. More...
 
int mtk_mhal_adc_deinit (struct mtk_adc_controller *ctlr)
 This function is used to de-initialize an ADC
hardware controller. More...
 
int mtk_mhal_adc_fsm_param_set (struct mtk_adc_controller *ctlr, struct adc_fsm_param *adc_fsm_parameter)
 This function is used to configure ADC controller parameters. More...
 
int mtk_mhal_adc_start (struct mtk_adc_controller *ctlr)
 This function is used to start the predefined channels by ADC
parameter configre API, please refer to the structure
channel_map for detail info. More...
 
int mtk_mhal_adc_stop (struct mtk_adc_controller *ctlr)
 This function is used to stop ADC controller. More...
 
int mtk_mhal_adc_enable_clk (struct mtk_adc_controller *ctlr)
 This function is used to enable ADC clock. More...
 
int mtk_mhal_adc_disable_clk (struct mtk_adc_controller *ctlr)
 This function is used to disable ADC clock. More...
 
int mtk_mhal_adc_fifo_handle_rx (struct mtk_adc_controller *ctlr)
 This function is used to read FIFO data from HW. More...
 

Function Documentation

int mtk_mhal_adc_init ( struct mtk_adc_controller ctlr)

This function is used to initialize an ADC hardware controller.

Usage: The main sequence is as bellow:
1.Call this function after allocating ADC controller.
2.Before operating ADC hardware, this API should be called firstly.

Parameters
[in]ctlr: Abstract an ADC controller.
Returns
If return value is 0, it means success.
If return value is -ADC_EPTR , it means ctlr is NULL.
int mtk_mhal_adc_deinit ( struct mtk_adc_controller ctlr)

This function is used to de-initialize an ADC
hardware controller.

Usage: This function should be called before releasing ADC
controller.

Parameters
[in]ctlr: Abstract an ADC controller.
Returns
If return value is 0, it means success.
If return value is -ADC_EPTR , it means ctlr is NULL.
int mtk_mhal_adc_fsm_param_set ( struct mtk_adc_controller ctlr,
struct adc_fsm_param adc_fsm_parameter 
)

This function is used to configure ADC controller parameters.

Usage: OS-HAL calls this API to set ADC hardware,
and this function should be called before ADC start or
ADC start channel.

Parameters
[in]ctlr: Abstract an ADC controller.
[in]adc_fsm_parameter: ADC parameter information.
Returns
If return value is 0, it means success.
If return value is -ADC_EPTR , it means ctlr is NULL.
If return value is -ADC_EPARAMETER , it means parameter invalid.
int mtk_mhal_adc_start ( struct mtk_adc_controller ctlr)

This function is used to start the predefined channels by ADC
parameter configre API, please refer to the structure
channel_map for detail info.

Usage: OS-HAL calls this API to start ADC hardware,
and this function should be called after setting ADC parameters.

Parameters
[in]ctlr: Abstract an ADC controller.
Returns
If return value is 0, it means success.
If return value is -ADC_EPTR , it means ctlr is NULL.
int mtk_mhal_adc_stop ( struct mtk_adc_controller ctlr)

This function is used to stop ADC controller.

Usage: The main sequence of the API is as bellow:
1.This function should be called after setting ADC parameters.
2.This function should be called before ADC de-initializing.

Parameters
[in]ctlr: Abstract an ADC controller.
Returns
If return value is 0, it means success.
If return value is -ADC_EPTR , it means ctlr is NULL.
int mtk_mhal_adc_enable_clk ( struct mtk_adc_controller ctlr)

This function is used to enable ADC clock.

Usage: It must be called before operating hardware;
otherwise, the access to ADC register will fail. The function should
be called in the sequence as bellow:
alloc_controller-> enable_clk->adc_init.

Parameters
[in]ctlr: Abstract an ADC controller.
Returns
If return value is 0, it means success.
If return value is -ADC_EPTR , it means ctlr is NULL.
int mtk_mhal_adc_disable_clk ( struct mtk_adc_controller ctlr)

This function is used to disable ADC clock.

Usage: When Hardware is not in use, advise to disable clock.

Parameters
[in]ctlr: Abstract an ADC controller.
Returns
If return value is 0, it means success.
If return value is -ADC_EPTR , it means ctlr is NULL.
int mtk_mhal_adc_fifo_handle_rx ( struct mtk_adc_controller ctlr)

This function is used to read FIFO data from HW.

Usage: It must be called in irq function with FIFO mode.

Parameters
[in]ctlr: Abstract an ADC controller.
Returns
If return value is 0, it means success.
If return value is -ADC_EPTR , it means ctlr is NULL.