Intel® MAX® 10 Analog to Digital Converter User Guide

ID 683596
Date 1/03/2024
Public
Document Table of Contents

5.6. ADC HAL Device Driver for Nios® Processor

The Modular ADC Core and Modular Dual ADC Core IP core provides a HAL device driver. You can integrate the device driver into the HAL system library for Nios® processor systems.

The IP cores provide software files that define low-level access to the hardware. You can use the macros definition and functions in the software files to initialize the cores.

  • altera_modular_adc_sequencer_regs.h—this file defines the register map for the sequencer core. It provides symbolic constants to access the low-level hardware.
  • altera_modular_adc_sample_store_regs.h—this file defines the register for sample storage core. It provides symbolic constants to access the low-level hardware.
  • altera_modular_adc.h or altera_modular_dual_adc.h—include this file into your application. It automatically includes the other header files and defines additional functions.
  • altera_modular_adc.c or altera_modular_dual_adc.c—this file implements helper functions that are defined in the header file.

In the same design, there can only be a single type of IP core, either Modular ADC Core or Modular Dual ADC Core IP.

In Intel® Quartus® Prime Standard Edition software version 22.1, you need to apply the following software settings based on the IP core configuration (Core Variant).

  1. All instantiated IP core(s) apply Standard sequencer with external sample storage.
    1. Enable external_sample_storage in BSP Editor > BSP Driver tab.
  2. Instantiated IP cores have different Core Variant.
    1. Enable different_sample_storage in BSP Editor > BSP Driver tab.
    2. Modify alt_sys_init.c
      1. For Avalon-MM sample storage (_CORE_VARIANT = 0 or 1),

        Change ALTERA_MODULAR_ADC_INSTANCE to ALTERA_MODULAR_ADC_INSTANCE_AVL_MEM

        Change ALTERA_MODULAR_ADC_INIT to ALTERA_MODULAR_ADC_INIT_AVL_MEM
      2. For external sample storage (_CORE_VARIANT = 2),

        Change ALTERA_MODULAR_ADC_INSTANCE to ALTERA_MODULAR_ADC_INSTANCE_EXT

        Change ALTERA_MODULAR_ADC_INIT to ALTERA_MODULAR_ADC_INIT_EXT

Note: The value of _CORE_VARIANT can be found in system.h.