MLC interface driver
Main macros/functions of driver

Macros

#define MLC_WRITE(addr, data)   *((volatile uint16_t*)BASE_ADDRESS+addr)=(uint16_t)(data)
 
#define MLC_READ(addr)   *((volatile uint16_t*)BASE_ADDRESS+addr)
 
#define FPGA_check_faults()   MLC_READ(FPGA_FAULTS_ADDR)
 
#define NO_FAULTS   0x3F
 

Functions

void MLC_init ()
 
void MLC_global_enable ()
 
void MLC_global_disable ()
 
void MLC_PWR_on (uint16_t pwr)
 
void MLC_PWR_off (uint16_t pwr)
 
void MLC_DBG_set (uint16_t dbg)
 
void MLC_DBG_clear (uint16_t dbg)
 
__inline void MLC_write (uint16_t addr, uint16_t data)
 
__inline uint16_t MLC_read (uint16_t addr)
 

Detailed Description

Macro Definition Documentation

#define FPGA_check_faults ( )    MLC_READ(FPGA_FAULTS_ADDR)

Macro for reading FAULT inputs from converters.

Definition at line 506 of file MLC_drv.h.

#define MLC_READ (   addr)    *((volatile uint16_t*)BASE_ADDRESS+addr)

Macro for reading from XINTF/EMIF connected peripherals.

Parameters
addraddress of external peripheral, use defined constants READ_*
Returns
read from peripheral

Definition at line 486 of file MLC_drv.h.

Referenced by MLC_ADC_read(), and MLC_init().

#define MLC_WRITE (   addr,
  data 
)    *((volatile uint16_t*)BASE_ADDRESS+addr)=(uint16_t)(data)

Macro for writing to XINTF/EMIF connected peripherals. CAUTION ! Macro casts it's data parameter to UNSIGNED INT of 16b wide. If design requires writing of SIGNED INT, then data can be UNSIGNED INT without problem, however automatic cast from other data types (i.e. float) will not work. They will be always positive.

Parameters
addruint16_t address of external peripheral, use defined constants WRITE_*
datauint16_t data to write to peripheral

Definition at line 480 of file MLC_drv.h.

Referenced by MLC_ADC_reset(), MLC_ADC_setup(), MLC_ADC_setup_SOC(), MLC_DBG_clear(), MLC_DBG_set(), MLC_init(), MLC_LCD_clrscr(), MLC_LCD_write_str(), MLC_LCD_write_to(), MLC_PWR_off(), and MLC_PWR_on().

#define NO_FAULTS   0x3F

Constant defining value returned by FPGA_check_faults() when no FAULT is active.

Definition at line 511 of file MLC_drv.h.

Function Documentation

void MLC_DBG_clear ( uint16_t  dbg)

Clear debug outputs according to ones in dbg parameter.

Parameters
dbgdefines which debug outputs should be set to 0. I.e. passing 0x01 will turn off debug LED V1.

Definition at line 1791 of file MLC_drv.c.

References MLC_WRITE, and WRITE_DBGLEDS.

void MLC_DBG_set ( uint16_t  dbg)

Set debug outputs according to ones in dbg parameter.

Parameters
dbgdefines which debug outputs should be set to 1. I.e. passing 0x01 will turn on debug LED V1.

Definition at line 1785 of file MLC_drv.c.

References MLC_WRITE, and WRITE_DBGLEDS.

void MLC_global_disable ( )

Use GPIO60 to disable CPLD and FPGA functionality. Useful for detecting DSP reset via JTAG. Requires CPLD firmware at least 0.4

Definition at line 872 of file MLC_drv.c.

References mlc_info_t::cpld_fw_ver.

void MLC_global_enable ( )

Use GPIO60 to enable CPLD and FPGA functionality. Useful for detecting DSP reset via JTAG. Requires CPLD firmware at least 0.4

Definition at line 855 of file MLC_drv.c.

References mlc_info_t::cpld_fw_ver.

void MLC_init ( )

This function should be called first, it initializes XINTF ZONE0, ZONE7 (if ext. RAM is used) and fixed purpose GPIOs.

Definition at line 824 of file MLC_drv.c.

References AD_OS0, AD_RNG_5V, AD_SOC_ALL_DEFAULT, DBG_INFO_PUTS, MLC_ADC_reset(), MLC_ADC_setup(), MLC_ADC_setup_SOC(), MLC_READ, MLC_WRITE, mlc_info_t::mod_fw_ver, READ_EXT_VER, and RW_EXT_LED_REG.

Here is the call graph for this function:

void MLC_PWR_off ( uint16_t  pwr)

Turn off PWR outputs according to ones in pwr parameter.

Parameters
pwrdefines which outputs should be turn off, in fact this means, that output will be floating, because those power outputs are open collector so turn off means disconnect from ground.

Definition at line 1779 of file MLC_drv.c.

References MLC_WRITE, and WRITE_PWR_OUT.

void MLC_PWR_on ( uint16_t  pwr)

Turn on PWR outputs according to ones in pwr parameter.

Parameters
pwrdefines which outputs should be turn on, in fact this means, that output will be zero level. But those power outputs are open collector so turn on means connect to ground.

Definition at line 1773 of file MLC_drv.c.

References MLC_WRITE, and WRITE_PWR_OUT.

__inline uint16_t MLC_read ( uint16_t  addr)

Function for reading from XINTF connected peripherals. However using macro MLC_READ() is recommended due higher performance.

Parameters
addraddress of external peripheral, use defined constants READ_*
Returns
value from periheral

Definition at line 501 of file MLC_drv.h.

References BASE_ADDRESS.

__inline void MLC_write ( uint16_t  addr,
uint16_t  data 
)

Function for writing to XINTF connected peripherals. However using macro MLC_WRITE() is recommended due higher performance.

Parameters
addraddress of external peripheral, use defined constants WRITE_*
datadata to write to periheral

Definition at line 495 of file MLC_drv.h.

References BASE_ADDRESS.