From c00ced398c382c333815461d31e4d98929f1fd29 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Thu, 28 Apr 2011 14:59:31 +0000 Subject: [PATCH] Remove ACE files that are not necessary for the SmartFusion demo. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1395 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../drivers/mss_ace/ace_flags.c | 1678 ----------------- .../MicroSemi_Code/drivers/mss_ace/ace_sse.c | 306 --- .../drivers/mss_ace/ace_transform.c | 467 ----- .../MicroSemi_Code/drivers/mss_ace/mss_ace.c | 126 +- .../MicroSemi_Code/drivers/mss_ace/mss_ace.h | 434 ++--- 5 files changed, 281 insertions(+), 2730 deletions(-) delete mode 100644 Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/ace_flags.c delete mode 100644 Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/ace_sse.c delete mode 100644 Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/ace_transform.c diff --git a/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/ace_flags.c b/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/ace_flags.c deleted file mode 100644 index 926a80dc2..000000000 --- a/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/ace_flags.c +++ /dev/null @@ -1,1678 +0,0 @@ -/******************************************************************************* - * (c) Copyright 2009 Actel Corporation. All rights reserved. - * - * SVN $Revision: 2840 $ - * SVN $Date: 2010-07-20 17:00:32 +0100 (Tue, 20 Jul 2010) $ - */ -#include "mss_ace.h" -#include "mss_ace_configurator.h" -#include "../../CMSIS/a2fxxxm3.h" -#include "../../CMSIS/mss_assert.h" -#include "../../drivers_config/mss_ace/ace_handles.h" -#include "../../drivers_config/mss_ace/ace_config.h" -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define MAX_FULL_FLAG_NAME_LENGTH (MAX_CHANNEL_NAME_LENGTH + MAX_FLAG_NAME_LENGTH + 1) - -/*-------------------------------------------------------------------------*//** - * Number of flag types supported. - * the supported flag types are: - * - BASIC_THRESHOLD_OVER - * - BASIC_THRESHOLD_UNDER - * - STATE_FILTERED_OVER - * - STATE_FILTERED_UNDER - * - DUAL_HYSTERESIS_OVER - * - DUAL_HYSTERESIS_UNDER - * - IPMI_HYSTERESIS_OVER - * - IPMI_HYSTERESIS_UNDER - */ -#define NB_OF_FLAG_TYPES 8 - -/*-------------------------------------------------------------------------*//** - * - */ -#define THRESHOLD_FLAG0 0u -#define THRESHOLD_FLAG1 1u -#define THRESHOLD_FLAG2 2u -#define THRESHOLD_FLAG3 3u -#define THRESHOLD_FLAG4 4u -#define THRESHOLD_FLAG5 5u -#define THRESHOLD_FLAG6 6u -#define THRESHOLD_FLAG7 7u -#define THRESHOLD_FLAG8 8u -#define THRESHOLD_FLAG9 9u -#define THRESHOLD_FLAG10 10u -#define THRESHOLD_FLAG11 11u -#define THRESHOLD_FLAG12 12u -#define THRESHOLD_FLAG13 13u -#define THRESHOLD_FLAG14 14u -#define THRESHOLD_FLAG15 15u -#define THRESHOLD_FLAG16 16u -#define THRESHOLD_FLAG17 17u -#define THRESHOLD_FLAG18 18u -#define THRESHOLD_FLAG19 19u -#define THRESHOLD_FLAG20 20u -#define THRESHOLD_FLAG21 21u -#define THRESHOLD_FLAG22 22u -#define THRESHOLD_FLAG23 23u -#define THRESHOLD_FLAG24 24u -#define THRESHOLD_FLAG25 25u -#define THRESHOLD_FLAG26 26u -#define THRESHOLD_FLAG27 27u -#define THRESHOLD_FLAG28 28u -#define THRESHOLD_FLAG29 29u -#define THRESHOLD_FLAG30 30u -#define THRESHOLD_FLAG31 31u -#define NB_OF_THRESHOLD_IRQ 32u - -/*-------------------------------------------------------------------------*//** - * - */ -void ace_init_flags( void ); - -/*-------------------------------------------------------------------------*//** - * Flag interrupots routines function prototypes - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag0_IRQHandler( void ); -#else -void ACE_PPE_Flag0_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag1_IRQHandler( void ); -#else -void ACE_PPE_Flag1_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag2_IRQHandler( void ); -#else -void ACE_PPE_Flag2_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag3_IRQHandler( void ); -#else -void ACE_PPE_Flag3_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag4_IRQHandler( void ); -#else -void ACE_PPE_Flag4_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag5_IRQHandler( void ); -#else -void ACE_PPE_Flag5_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag6_IRQHandler( void ); -#else -void ACE_PPE_Flag6_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag7_IRQHandler( void ); -#else -void ACE_PPE_Flag7_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag8_IRQHandler( void ); -#else -void ACE_PPE_Flag8_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag9_IRQHandler( void ); -#else -void ACE_PPE_Flag9_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag10_IRQHandler( void ); -#else -void ACE_PPE_Flag10_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag11_IRQHandler( void ); -#else -void ACE_PPE_Flag11_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag12_IRQHandler( void ); -#else -void ACE_PPE_Flag12_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag13_IRQHandler( void ); -#else -void ACE_PPE_Flag13_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag14_IRQHandler( void ); -#else -void ACE_PPE_Flag14_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag15_IRQHandler( void ); -#else -void ACE_PPE_Flag15_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag16_IRQHandler( void ); -#else -void ACE_PPE_Flag16_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag17_IRQHandler( void ); -#else -void ACE_PPE_Flag17_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag18_IRQHandler( void ); -#else -void ACE_PPE_Flag18_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag19_IRQHandler( void ); -#else -void ACE_PPE_Flag19_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag20_IRQHandler( void ); -#else -void ACE_PPE_Flag20_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag21_IRQHandler( void ); -#else -void ACE_PPE_Flag21_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag22_IRQHandler( void ); -#else -void ACE_PPE_Flag22_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag23_IRQHandler( void ); -#else -void ACE_PPE_Flag23_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag24_IRQHandler( void ); -#else -void ACE_PPE_Flag24_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag25_IRQHandler( void ); -#else -void ACE_PPE_Flag25_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag26_IRQHandler( void ); -#else -void ACE_PPE_Flag26_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag27_IRQHandler( void ); -#else -void ACE_PPE_Flag27_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag28_IRQHandler( void ); -#else -void ACE_PPE_Flag28_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag29_IRQHandler( void ); -#else -void ACE_PPE_Flag29_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag30_IRQHandler( void ); -#else -void ACE_PPE_Flag30_IRQHandler( void ); -#endif - -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag31_IRQHandler( void ); -#else -void ACE_PPE_Flag31_IRQHandler( void ); -#endif - -/*-------------------------------------------------------------------------*//** - * - */ -#if (ACE_NB_OF_PPE_FLAGS > 0) -extern ppe_flag_desc_t g_ppe_flags_desc_table[ACE_NB_OF_PPE_FLAGS]; -#endif - -extern ace_channel_desc_t g_ace_channel_desc_table[ACE_NB_OF_INPUT_CHANNELS]; - -extern ace_adc_config_t g_ace_adc_config[ACE_NB_OF_ADC]; - -#if (ACE_NB_OF_PPE_FLAGS > 0) -/*-------------------------------------------------------------------------*//** - Lookup table indexed on flag_id_t of the index of the flag's descriptor index - in the flag descriptors table g_ppe_flags_desc_table[] - */ -static ace_flag_handle_t g_ppe_flag_handles_lut[NB_OF_PPE_FLAGS]; - -/*-------------------------------------------------------------------------*//** - * - */ -static flag_isr_t g_ppe_flags_isr_lut[NB_OF_PPE_FLAGS]; - -/*-------------------------------------------------------------------------*//** - * - */ -static global_flag_isr_t g_ppe_global_flags_isr; - -/*-------------------------------------------------------------------------*//** - * - */ -static channel_flag_isr_t g_ppe_channel_flags_isr_lut[ACE_NB_OF_INPUT_CHANNELS]; -#endif - -/*-------------------------------------------------------------------------*//** - Intialise the ACE driver's internal data structures used by flag control - functions. - */ -void ace_init_flags( void ) -{ - /* Ensure the generated ACE configuration files are consistent. */ - ASSERT(NB_OF_ACE_FLAG_HANDLES == ACE_NB_OF_PPE_FLAGS); - -#if (ACE_NB_OF_PPE_FLAGS > 0) - { - uint8_t flag_idx; - uint8_t channel_idx; - - for ( flag_idx = 0u; flag_idx < (uint8_t)NB_OF_PPE_FLAGS; ++flag_idx ) - { - g_ppe_flags_isr_lut[flag_idx] = 0; - g_ppe_flag_handles_lut[flag_idx] = INVALID_FLAG_HANDLE; - } - - for ( flag_idx = 0u; flag_idx < (uint8_t)ACE_NB_OF_PPE_FLAGS; ++flag_idx ) - { - ASSERT( g_ppe_flags_desc_table[flag_idx].flag_id < NB_OF_PPE_FLAGS ); - g_ppe_flag_handles_lut[g_ppe_flags_desc_table[flag_idx].flag_id] = (ace_flag_handle_t)flag_idx; - } - - for ( channel_idx = 0u; channel_idx < (uint8_t)ACE_NB_OF_INPUT_CHANNELS; ++channel_idx ) - { - g_ppe_channel_flags_isr_lut[channel_idx] = 0; - } - - g_ppe_global_flags_isr = 0u; - } -#endif -} - -/*-------------------------------------------------------------------------*//** - * - */ -uint32_t ACE_is_hysteresis_flag( ace_flag_handle_t flag_handle ) -{ - uint32_t hysteresis = 0u; - -#if (ACE_NB_OF_PPE_FLAGS > 0) - ASSERT( flag_handle < NB_OF_ACE_FLAG_HANDLES ); - - if ( g_ppe_flags_desc_table[flag_handle].flag_type >= DUAL_HYSTERESIS_OVER ) - { - hysteresis = 1u; - } -#endif - return hysteresis; -} - -/*-------------------------------------------------------------------------*//** - * - */ -uint32_t ACE_is_under_flag -( - ace_flag_handle_t flag_handle -) -{ - uint32_t is_under = 0; - -#if (ACE_NB_OF_PPE_FLAGS > 0) - const uint32_t flag_type_lut[NB_OF_FLAG_TYPES] = - { - 0, /* BASIC_THRESHOLD_OVER */ - 1, /* BASIC_THRESHOLD_UNDER */ - 0, /* STATE_FILTERED_OVER */ - 1, /* STATE_FILTERED_UNDER */ - 0, /* DUAL_HYSTERESIS_OVER */ - 1, /* DUAL_HYSTERESIS_UNDER */ - 0, /* IPMI_HYSTERESIS_OVER */ - 1, /* IPMI_HYSTERESIS_UNDER */ - }; - - ASSERT(flag_handle < ACE_NB_OF_PPE_FLAGS); - if (flag_handle < ACE_NB_OF_PPE_FLAGS) - { - uint8_t flag_type; - flag_type = g_ppe_flags_desc_table[flag_handle].flag_type; - ASSERT(flag_type < NB_OF_FLAG_TYPES); - if (flag_type < NB_OF_FLAG_TYPES) - { - is_under = flag_type_lut[flag_type]; - } - } -#endif - return is_under; -} - -/*-------------------------------------------------------------------------*//** - Mask of the threshold value bits within a PPE RAM meory location holding the - threshold value for a flag. - */ -#define PPE_RAM_THRESHOLD_MASK 0x0000FFFFuL - -/*-------------------------------------------------------------------------*//** - * TODO: handle IPMI hysteresis flags - */ -void ACE_set_flag_threshold -( - ace_flag_handle_t flag_handle, - uint16_t new_threshold -) -{ -#if (ACE_NB_OF_PPE_FLAGS > 0) - uint16_t ppe_offset; - - ASSERT( flag_handle < NB_OF_ACE_FLAG_HANDLES ); - - if ( flag_handle < NB_OF_ACE_FLAG_HANDLES ) - { - - ppe_offset = g_ppe_flags_desc_table[flag_handle].threshold_ppe_offset; - - if ( ACE_is_hysteresis_flag( flag_handle ) == 0u ) - { - ACE->PPE_RAM_DATA[ppe_offset] = (ACE->PPE_RAM_DATA[ppe_offset] & (uint32_t)~PPE_RAM_THRESHOLD_MASK) + new_threshold; - } - else - { - uint16_t high_threshold; - uint16_t low_threshold; - ace_channel_handle_t channel_handle; - uint16_t hysteresis; - uint32_t adc_id; - uint16_t adc_resolution; - - high_threshold = (uint16_t)(ACE->PPE_RAM_DATA[ppe_offset] & PPE_RAM_THRESHOLD_MASK); - low_threshold = (uint16_t)(ACE->PPE_RAM_DATA[ppe_offset + 1u] & PPE_RAM_THRESHOLD_MASK); - ASSERT(high_threshold > low_threshold); - hysteresis = (uint16_t)(high_threshold - low_threshold) / 2u; - - channel_handle = g_ppe_flags_desc_table[flag_handle].channel_handle; - adc_id = (uint32_t)(g_ace_channel_desc_table[channel_handle].signal_id) >> 4u; - ASSERT( adc_id < (uint32_t)ACE_NB_OF_ADC ); - - if ( adc_id < (uint32_t)ACE_NB_OF_ADC ) - { - adc_resolution = g_ace_adc_config[adc_id].adc_resolution - 1u; - - high_threshold = new_threshold + hysteresis; - if ( high_threshold > adc_resolution ) - { - high_threshold = adc_resolution; - } - - if ( hysteresis > new_threshold ) - { - low_threshold = 1u; - } - else - { - low_threshold = new_threshold - hysteresis; - } - - ACE->PPE_RAM_DATA[ppe_offset] = (ACE->PPE_RAM_DATA[ppe_offset] & ~PPE_RAM_THRESHOLD_MASK) + high_threshold; - ACE->PPE_RAM_DATA[ppe_offset + 1u] = (ACE->PPE_RAM_DATA[ppe_offset + 1u] & (uint32_t)~PPE_RAM_THRESHOLD_MASK) + low_threshold; - } - } - } -#endif -} - - -/*-------------------------------------------------------------------------*//** - * - */ -#define FLAG_OVER_UNDER_MASK 0x01u -#define FLAG_OVER 0x00u -#define FLAF_UNDER 0x01 - -void ACE_set_flag_assertion -( - ace_flag_handle_t flag_handle, - uint16_t assertion_value -) -{ -#if (ACE_NB_OF_PPE_FLAGS > 0) - uint16_t ppe_offset; - - ASSERT( flag_handle < NB_OF_ACE_FLAG_HANDLES ); - - if ( flag_handle < NB_OF_ACE_FLAG_HANDLES ) - { - if (ACE_is_hysteresis_flag(flag_handle)) - { - uint8_t flag_direction; - flag_direction = g_ppe_flags_desc_table[flag_handle].flag_type & FLAG_OVER_UNDER_MASK; - - if ( FLAG_OVER == flag_direction ) - { - ppe_offset = g_ppe_flags_desc_table[flag_handle].threshold_ppe_offset; - } - else - { - ppe_offset = g_ppe_flags_desc_table[flag_handle].threshold_ppe_offset + 1u; - } - } - else - { - ppe_offset = g_ppe_flags_desc_table[flag_handle].threshold_ppe_offset; - } - ACE->PPE_RAM_DATA[ppe_offset] = (ACE->PPE_RAM_DATA[ppe_offset] & ~PPE_RAM_THRESHOLD_MASK) + assertion_value; - } -#endif -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_set_flag_deassertion -( - ace_flag_handle_t flag_handle, - uint16_t assertion_value -) -{ -#if (ACE_NB_OF_PPE_FLAGS > 0) - uint16_t ppe_offset; - - ASSERT( flag_handle < NB_OF_ACE_FLAG_HANDLES ); - ASSERT(ACE_is_hysteresis_flag(flag_handle)); - - if ((flag_handle < NB_OF_ACE_FLAG_HANDLES) && (ACE_is_hysteresis_flag(flag_handle))) - { - uint8_t flag_direction; - flag_direction = g_ppe_flags_desc_table[flag_handle].flag_type & FLAG_OVER_UNDER_MASK; - - if ( FLAG_OVER == flag_direction ) - { - ppe_offset = g_ppe_flags_desc_table[flag_handle].threshold_ppe_offset + 1u; - } - else - { - ppe_offset = g_ppe_flags_desc_table[flag_handle].threshold_ppe_offset; - } - - ACE->PPE_RAM_DATA[ppe_offset] = (ACE->PPE_RAM_DATA[ppe_offset] & ~PPE_RAM_THRESHOLD_MASK) + assertion_value; - } -#endif -} - -/*-------------------------------------------------------------------------*//** - * - */ -void -ACE_set_flag_hysteresis -( - ace_flag_handle_t flag_handle, - uint16_t adc_hysteresis -) -{ -#if (ACE_NB_OF_PPE_FLAGS > 0) - uint16_t ppe_offset; - uint32_t high_threshold; - uint32_t low_threshold; - uint32_t nominal_threshold; - uint16_t adc_resolution; - uint32_t adc_id; - - ASSERT( flag_handle < NB_OF_ACE_FLAG_HANDLES ); - ASSERT(ACE_is_hysteresis_flag(flag_handle)); - - if ( ( flag_handle < NB_OF_ACE_FLAG_HANDLES ) && ( ACE_is_hysteresis_flag( flag_handle ) ) ) - { - ace_channel_handle_t channel_handle; - - ppe_offset = g_ppe_flags_desc_table[flag_handle].threshold_ppe_offset; - - high_threshold = ACE->PPE_RAM_DATA[ppe_offset] & PPE_RAM_THRESHOLD_MASK; - low_threshold = ACE->PPE_RAM_DATA[ppe_offset + 1u] & PPE_RAM_THRESHOLD_MASK; - ASSERT(high_threshold > low_threshold); - nominal_threshold = (low_threshold + ((high_threshold - low_threshold) / 2u)); - - channel_handle = g_ppe_flags_desc_table[flag_handle].channel_handle; - adc_id = (uint32_t)((uint32_t)g_ace_channel_desc_table[channel_handle].signal_id >> 4u); - ASSERT( adc_id < (uint32_t)ACE_NB_OF_ADC ); - - if ( adc_id < (uint32_t)ACE_NB_OF_ADC ) - { - adc_resolution = g_ace_adc_config[adc_id].adc_resolution; - - high_threshold = nominal_threshold + adc_hysteresis; - if ( high_threshold > adc_resolution ) - { - high_threshold = (uint32_t)adc_resolution - 1u; - } - - if ( adc_hysteresis > nominal_threshold ) - { - low_threshold = 1u; - } - else - { - low_threshold = nominal_threshold - adc_hysteresis; - } - - ACE->PPE_RAM_DATA[ppe_offset] = (ACE->PPE_RAM_DATA[ppe_offset] & ~PPE_RAM_THRESHOLD_MASK) + high_threshold; - ACE->PPE_RAM_DATA[ppe_offset + 1u] = (ACE->PPE_RAM_DATA[ppe_offset + 1u] & ~PPE_RAM_THRESHOLD_MASK) + low_threshold; - } - } -#endif -} - - -/*-------------------------------------------------------------------------*//** - * - */ -void -ACE_set_channel_hysteresis -( - ace_channel_handle_t channel_handle, - uint16_t adc_hysteresis -) -{ -#if (ACE_NB_OF_PPE_FLAGS > 0) - ace_flag_handle_t flag_handle; - - ASSERT( channel_handle < NB_OF_ACE_CHANNEL_HANDLES ); - - if ( channel_handle < NB_OF_ACE_CHANNEL_HANDLES ) - { - uint16_t i; - - for( i = 0u; i < g_ace_channel_desc_table[channel_handle].nb_of_flags; ++i ) - { - flag_handle = (ace_flag_handle_t)g_ace_channel_desc_table[channel_handle].p_flags_array[i]; - ACE_set_flag_hysteresis( flag_handle, adc_hysteresis ); - } - } -#endif -} - -/*============================================================================== - * - */ - -/*-------------------------------------------------------------------------*//** - Masking a flag_id with FLAG_BIT_OFFSET_MASK results in the offset of the - flag bit within a PPE__FLAGSn register. - */ -#define FLAG_BIT_OFFSET_MASK 0x0000001FuL - -/*-------------------------------------------------------------------------*//** - Shifting right a flag_id by FLAG_PPE_REG_SHIFT results in identifying the - PPE_FLAGSn or PPE_SFFLAGS the flags belongs to. - */ -#define FLAG_PPE_REG_SHIFT 5u - -/*-------------------------------------------------------------------------*//** - There is a set of 5 PPE flag registers to control and report status of the PPE - flags resulting in the PPE flags being grouped into 5 separate flag groups at - the register level. Each register provides status or control for 32 flags. - */ -#define NB_OF_FLAG_GROUPS 5u -#define NB_OF_FLAGS_PER_GROUP 32u - -#if (ACE_NB_OF_PPE_FLAGS > 0) -/*-------------------------------------------------------------------------*//** - Lookup table of the address PPE_FLAGSn registers for fast reading of PPE - status. - */ -static volatile uint32_t * const g_ppe_flags_regs_lut[NB_OF_FLAG_GROUPS] = -{ - &ACE->PPE_FLAGS0, - &ACE->PPE_FLAGS1, - &ACE->PPE_FLAGS2, - &ACE->PPE_FLAGS3, - &ACE->PPE_SFFLAGS -}; - -/*-------------------------------------------------------------------------*//** - Lookup table of the address of the PPE flags interrupt enable registers. - */ -static uint32_t volatile * const flags_irq_enable_regs_lut[NB_OF_FLAG_GROUPS] = -{ - &ACE->PPE_FLAGS0_IRQ_EN, - &ACE->PPE_FLAGS1_IRQ_EN, - &ACE->PPE_FLAGS2_IRQ_EN, - &ACE->PPE_FLAGS3_IRQ_EN, - &ACE->PPE_SFFLAGS_IRQ_EN -}; - -/*-------------------------------------------------------------------------*//** - Lookup table of the address of the PPE flags interrupt status registers. - */ -static uint32_t volatile const * const flags_irq_status_regs_lut[NB_OF_FLAG_GROUPS] = -{ - &ACE->PPE_FLAGS0_IRQ, - &ACE->PPE_FLAGS1_IRQ, - &ACE->PPE_FLAGS2_IRQ, - &ACE->PPE_FLAGS3_IRQ, - &ACE->PPE_SFFLAGS_IRQ -}; - -/*-------------------------------------------------------------------------*//** - Lookup table of the address of the PPE flags interrupt clearing registers. - */ -static uint32_t volatile * const flags_irq_clear_regs_lut[NB_OF_FLAG_GROUPS] = -{ - &ACE->PPE_FLAGS0_IRQ_CLR, - &ACE->PPE_FLAGS1_IRQ_CLR, - &ACE->PPE_FLAGS2_IRQ_CLR, - &ACE->PPE_FLAGS3_IRQ_CLR, - &ACE->PPE_SFFLAGS_IRQ_CLR -}; - -/*-------------------------------------------------------------------------*//** - * - */ -static const IRQn_Type threshold_irqn_lut[NB_OF_THRESHOLD_IRQ] = -{ - ACE_PPE_Flag0_IRQn, - ACE_PPE_Flag1_IRQn, - ACE_PPE_Flag2_IRQn, - ACE_PPE_Flag3_IRQn, - ACE_PPE_Flag4_IRQn, - ACE_PPE_Flag5_IRQn, - ACE_PPE_Flag6_IRQn, - ACE_PPE_Flag7_IRQn, - ACE_PPE_Flag8_IRQn, - ACE_PPE_Flag9_IRQn, - ACE_PPE_Flag10_IRQn, - ACE_PPE_Flag11_IRQn, - ACE_PPE_Flag12_IRQn, - ACE_PPE_Flag13_IRQn, - ACE_PPE_Flag14_IRQn, - ACE_PPE_Flag15_IRQn, - ACE_PPE_Flag16_IRQn, - ACE_PPE_Flag17_IRQn, - ACE_PPE_Flag18_IRQn, - ACE_PPE_Flag19_IRQn, - ACE_PPE_Flag20_IRQn, - ACE_PPE_Flag21_IRQn, - ACE_PPE_Flag22_IRQn, - ACE_PPE_Flag23_IRQn, - ACE_PPE_Flag24_IRQn, - ACE_PPE_Flag25_IRQn, - ACE_PPE_Flag26_IRQn, - ACE_PPE_Flag27_IRQn, - ACE_PPE_Flag28_IRQn, - ACE_PPE_Flag29_IRQn, - ACE_PPE_Flag30_IRQn, - ACE_PPE_Flag31_IRQn -}; -#endif - -/*-------------------------------------------------------------------------*//** - */ -ace_flag_handle_t -ACE_get_flag_handle -( - const uint8_t * p_sz_full_flag_name -) -{ - ace_flag_handle_t flag_handle = INVALID_FLAG_HANDLE; -#if (ACE_NB_OF_PPE_FLAGS > 0) - ace_flag_handle_t flag_idx; - - for ( flag_idx = (ace_flag_handle_t)0; flag_idx < NB_OF_ACE_FLAG_HANDLES; ++flag_idx ) - { - if ( g_ppe_flags_desc_table[flag_idx].p_sz_flag_name != 0 ) - { - int32_t diff; - diff = strncmp( (const char *)p_sz_full_flag_name, (const char *)g_ppe_flags_desc_table[flag_idx].p_sz_flag_name, (size_t)MAX_FULL_FLAG_NAME_LENGTH ); - if ( 0 == diff ) - { - /* flag name found. */ - flag_handle = (ace_flag_handle_t)flag_idx; - break; - } - } - } -#endif - return flag_handle; -} - -/*-------------------------------------------------------------------------*//** - */ -int32_t -ACE_get_flag_status -( - ace_flag_handle_t flag_handle -) -{ - int32_t flag_state = UNKNOWN_FLAG; -#if (ACE_NB_OF_PPE_FLAGS > 0) - ppe_flag_id_t flag_id; - - ASSERT( flag_handle < NB_OF_ACE_FLAG_HANDLES ); - - if ( flag_handle < NB_OF_ACE_FLAG_HANDLES ) - { - uint32_t flag_bit_offset; - uint32_t ppe_flag_group; - uint32_t flag_id_mask; - uint32_t flag_status; - - flag_id = g_ppe_flags_desc_table[flag_handle].flag_id; - - if ( flag_id < NB_OF_PPE_FLAGS ) - { - flag_bit_offset = ((uint32_t)flag_id & FLAG_BIT_OFFSET_MASK); - ppe_flag_group = ((uint32_t)flag_id >> FLAG_PPE_REG_SHIFT); - flag_id_mask = 1uL << flag_bit_offset; - flag_status = *(g_ppe_flags_regs_lut[ppe_flag_group]) & flag_id_mask; - if ( flag_status > 0u ) - { - flag_state = FLAG_ASSERTED; - } - else - { - flag_state = FLAG_NOT_ASSERTED; - } - } - - } -#endif - return flag_state; -} - - -/*-------------------------------------------------------------------------*//** - */ -const uint8_t * -ACE_get_flag_name -( - ace_flag_handle_t flag_handle -) -{ - const uint8_t * psz_flag_name = 0; -#if (ACE_NB_OF_PPE_FLAGS > 0) - ASSERT( flag_handle < NB_OF_ACE_FLAG_HANDLES ); - - if ( flag_handle < NB_OF_ACE_FLAG_HANDLES ) - { - psz_flag_name = g_ppe_flags_desc_table[flag_handle].p_sz_flag_name; - } -#endif - return psz_flag_name; -} - -/*-------------------------------------------------------------------------*//** - */ -ace_channel_handle_t -ACE_get_flag_channel -( - ace_flag_handle_t flag_handle -) -{ - ace_channel_handle_t channel_handle = INVALID_CHANNEL_HANDLE; -#if (ACE_NB_OF_PPE_FLAGS > 0) - ASSERT( flag_handle < NB_OF_ACE_FLAG_HANDLES ); - - if ( flag_handle < NB_OF_ACE_FLAG_HANDLES ) - { - channel_handle = g_ppe_flags_desc_table[flag_handle].channel_handle; - } -#endif - return channel_handle; -} - -/*-------------------------------------------------------------------------*//** - */ -uint32_t -ACE_get_channel_flag_count -( - ace_channel_handle_t channel_handle -) -{ - uint32_t flag_count = 0; -#if (ACE_NB_OF_PPE_FLAGS > 0) - ASSERT( channel_handle < ACE_NB_OF_INPUT_CHANNELS ); - if (channel_handle < ACE_NB_OF_INPUT_CHANNELS) - { - flag_count = g_ace_channel_desc_table[channel_handle].nb_of_flags; - } -#endif - return flag_count; -} - -/*-------------------------------------------------------------------------*//** - - */ -ace_flag_handle_t -ACE_get_channel_first_flag -( - ace_channel_handle_t channel_handle, - uint16_t * iterator -) -{ - ace_flag_handle_t flag_handle = INVALID_FLAG_HANDLE; -#if (ACE_NB_OF_PPE_FLAGS > 0) - ASSERT( channel_handle < NB_OF_ACE_CHANNEL_HANDLES); - - *iterator = 0u; - - if ( channel_handle < NB_OF_ACE_CHANNEL_HANDLES) - { - if ( g_ace_channel_desc_table[channel_handle].nb_of_flags > 0u ) - { - flag_handle = (ace_flag_handle_t)g_ace_channel_desc_table[channel_handle].p_flags_array[*iterator]; - } - } -#endif - return flag_handle; -} - -/*-------------------------------------------------------------------------*//** - - */ -ace_flag_handle_t -ACE_get_channel_next_flag -( - ace_channel_handle_t channel_handle, - uint16_t * iterator -) -{ - ace_flag_handle_t flag_handle = INVALID_FLAG_HANDLE; -#if (ACE_NB_OF_PPE_FLAGS > 0) - ASSERT( channel_handle < NB_OF_ACE_CHANNEL_HANDLES); - - if ( channel_handle < NB_OF_ACE_CHANNEL_HANDLES) - { - ++(*iterator); - - if ( *iterator >= g_ace_channel_desc_table[channel_handle].nb_of_flags ) - { - *iterator = 0u; - } - - if ( g_ace_channel_desc_table[channel_handle].nb_of_flags > 0u ) - { - flag_handle = (ace_flag_handle_t)g_ace_channel_desc_table[channel_handle].p_flags_array[*iterator]; - } - } -#endif - return flag_handle; -} - - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_enable_channel_flags_irq -( - ace_channel_handle_t channel_handle -) -{ -#if (ACE_NB_OF_PPE_FLAGS > 0) - uint32_t flag_idx; - ace_flag_handle_t flag_handle; - - ASSERT( channel_handle < NB_OF_ACE_CHANNEL_HANDLES ); - - if ( channel_handle < NB_OF_ACE_CHANNEL_HANDLES ) - { - for ( flag_idx = 0u; flag_idx < g_ace_channel_desc_table[channel_handle].nb_of_flags; ++flag_idx ) - { - flag_handle = (ace_flag_handle_t)g_ace_channel_desc_table[channel_handle].p_flags_array[flag_idx]; - ACE_enable_flag_irq( flag_handle ); - } - } -#endif -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_disable_channel_flags_irq -( - ace_channel_handle_t channel_handle -) -{ -#if (ACE_NB_OF_PPE_FLAGS > 0) - uint32_t flag_idx; - ace_flag_handle_t flag_handle; - - ASSERT( channel_handle < NB_OF_ACE_CHANNEL_HANDLES ); - - if ( channel_handle < NB_OF_ACE_CHANNEL_HANDLES ) - { - for ( flag_idx = 0u; flag_idx < g_ace_channel_desc_table[channel_handle].nb_of_flags; ++flag_idx ) - { - flag_handle = (ace_flag_handle_t)g_ace_channel_desc_table[channel_handle].p_flags_array[flag_idx]; - ACE_disable_flag_irq( flag_handle ); - } - } -#endif -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_clear_channel_flags_irq -( - ace_channel_handle_t channel_handle -) -{ -#if (ACE_NB_OF_PPE_FLAGS > 0) - uint32_t flag_idx; - ace_flag_handle_t flag_handle; - - ASSERT( channel_handle < NB_OF_ACE_CHANNEL_HANDLES ); - - if ( channel_handle < NB_OF_ACE_CHANNEL_HANDLES ) - { - for ( flag_idx = 0u; flag_idx < g_ace_channel_desc_table[channel_handle].nb_of_flags; ++flag_idx ) - { - flag_handle = (ace_flag_handle_t)g_ace_channel_desc_table[channel_handle].p_flags_array[flag_idx]; - ACE_clear_flag_irq( flag_handle ); - } - } -#endif -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_enable_flag_irq -( - ace_flag_handle_t flag_handle -) -{ -#if (ACE_NB_OF_PPE_FLAGS > 0) - ASSERT( flag_handle < NB_OF_ACE_FLAG_HANDLES ); - - if ( flag_handle < NB_OF_ACE_FLAG_HANDLES ) - { - ppe_flag_id_t flag_id; - uint32_t flag_bit_offset; - uint32_t ppe_flag_group; - uint32_t flag_id_mask; - - flag_id = g_ppe_flags_desc_table[flag_handle].flag_id; - - ASSERT( flag_id < NB_OF_PPE_FLAGS ); - - flag_bit_offset = ((uint32_t)flag_id & FLAG_BIT_OFFSET_MASK); - ppe_flag_group = ((uint32_t)flag_id >> FLAG_PPE_REG_SHIFT); - flag_id_mask = 1uL << flag_bit_offset; - - ASSERT( ppe_flag_group < NB_OF_FLAG_GROUPS ); - - if ( ppe_flag_group < NB_OF_FLAG_GROUPS ) - { - *(flags_irq_enable_regs_lut[ppe_flag_group]) |= flag_id_mask; - } - - NVIC_EnableIRQ( threshold_irqn_lut[flag_bit_offset] ); - } -#endif -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_disable_flag_irq -( - ace_flag_handle_t flag_handle -) -{ -#if (ACE_NB_OF_PPE_FLAGS > 0) - ASSERT( flag_handle < NB_OF_ACE_FLAG_HANDLES ); - - if ( flag_handle < NB_OF_ACE_FLAG_HANDLES ) - { - ppe_flag_id_t flag_id; - uint32_t flag_bit_offset; - uint32_t ppe_flag_group; - uint32_t flag_id_mask; - - flag_id = g_ppe_flags_desc_table[flag_handle].flag_id; - - ASSERT( flag_id < NB_OF_PPE_FLAGS ); - - flag_bit_offset = ((uint32_t)flag_id & FLAG_BIT_OFFSET_MASK); - ppe_flag_group = ((uint32_t)flag_id >> FLAG_PPE_REG_SHIFT); - flag_id_mask = 1uL << flag_bit_offset; - - ASSERT( ppe_flag_group < NB_OF_FLAG_GROUPS ); - - if ( ppe_flag_group < NB_OF_FLAG_GROUPS ) - { - *(flags_irq_enable_regs_lut[ppe_flag_group]) &= (uint32_t)~flag_id_mask; - } - } -#endif -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_clear_flag_irq -( - ace_flag_handle_t flag_handle -) -{ -#if (ACE_NB_OF_PPE_FLAGS > 0) - ASSERT( flag_handle < NB_OF_ACE_FLAG_HANDLES ); - - if ( flag_handle < NB_OF_ACE_FLAG_HANDLES ) - { - ppe_flag_id_t flag_id; - uint32_t flag_bit_offset; - uint32_t ppe_flag_group; - uint32_t flag_id_mask; - - flag_id = g_ppe_flags_desc_table[flag_handle].flag_id; - - ASSERT( flag_id < NB_OF_PPE_FLAGS ); - - flag_bit_offset = ((uint32_t)flag_id & FLAG_BIT_OFFSET_MASK); - ppe_flag_group = ((uint32_t)flag_id >> FLAG_PPE_REG_SHIFT); - flag_id_mask = 1uL << flag_bit_offset; - - ASSERT( ppe_flag_group < NB_OF_FLAG_GROUPS ); - - if ( ppe_flag_group < NB_OF_FLAG_GROUPS ) - { - *(flags_irq_clear_regs_lut[ppe_flag_group]) |= flag_id_mask; - } - } -#endif -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_register_flag_isr -( - ace_flag_handle_t flag_handle, - flag_isr_t flag_isr -) -{ -#if (ACE_NB_OF_PPE_FLAGS > 0) - ppe_flag_id_t flag_id; - - ASSERT( flag_handle < NB_OF_ACE_FLAG_HANDLES ); - - if ( flag_handle < NB_OF_ACE_FLAG_HANDLES ) - { - flag_id = g_ppe_flags_desc_table[flag_handle].flag_id; - - ASSERT( flag_id < NB_OF_PPE_FLAGS ); - - if ( flag_id < NB_OF_PPE_FLAGS ) - { - g_ppe_flags_isr_lut[flag_id] = flag_isr; - } - } -#endif -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_register_channel_flags_isr -( - ace_channel_handle_t channel_handle, - channel_flag_isr_t channel_flag_isr -) -{ -#if (ACE_NB_OF_PPE_FLAGS > 0) - ASSERT( channel_handle < NB_OF_ACE_CHANNEL_HANDLES ); - - if ( channel_handle < NB_OF_ACE_CHANNEL_HANDLES ) - { - g_ppe_channel_flags_isr_lut[channel_handle] = channel_flag_isr; - } -#endif -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_register_global_flags_isr -( - global_flag_isr_t global_flag_isr -) -{ -#if (ACE_NB_OF_PPE_FLAGS > 0) - g_ppe_global_flags_isr = global_flag_isr; -#endif -} - - -/*============================================================================== - * - */ - -/*-------------------------------------------------------------------------*//** - * Actual PPE flag interrupt service routines: - */ - -static void process_flag_irq( uint8_t threshold_flag_id ) -{ -#if (ACE_NB_OF_PPE_FLAGS > 0) - uint8_t flag_group; - uint32_t threshold_flag_mask; - ppe_flag_id_t flag_id; - uint32_t irq_enable_reg; - uint32_t irq_status_reg; - uint32_t irq_active; - - threshold_flag_mask = 1uL << threshold_flag_id; - - - for ( flag_group = 0u; flag_group < NB_OF_FLAG_GROUPS; ++flag_group ) - { - irq_enable_reg = *flags_irq_enable_regs_lut[flag_group]; - irq_status_reg = *flags_irq_status_regs_lut[flag_group]; - irq_active = threshold_flag_mask & irq_enable_reg & irq_status_reg; - - if ( irq_active ) - { - ace_flag_handle_t flag_handle; - ace_channel_handle_t channel_handle; - - flag_id = (ppe_flag_id_t)((flag_group * NB_OF_FLAGS_PER_GROUP) + threshold_flag_id); - flag_handle = g_ppe_flag_handles_lut[flag_id]; - - /* Call individual flag handler */ - if ( g_ppe_flags_isr_lut[flag_id] != 0 ) - { - g_ppe_flags_isr_lut[flag_id]( flag_handle ); - } - - /* Call the channel flag handler. */ - channel_handle = g_ppe_flags_desc_table[flag_handle].channel_handle; - if ( channel_handle < NB_OF_ACE_CHANNEL_HANDLES ) - { - if ( g_ppe_channel_flags_isr_lut[channel_handle] != 0 ) - { - g_ppe_channel_flags_isr_lut[channel_handle]( flag_handle ); - } - } - - /* Call the global flag handler. */ - if ( g_ppe_global_flags_isr != 0 ) - { - g_ppe_global_flags_isr( flag_handle, channel_handle ); - } - - /* Clear the flag interrupt */ - *flags_irq_clear_regs_lut[flag_group] |= threshold_flag_mask; - } - } -#endif -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag0_IRQHandler( void ) -#else -void ACE_PPE_Flag0_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG0 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag0_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag1_IRQHandler( void ) -#else -void ACE_PPE_Flag1_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG1 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag1_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag2_IRQHandler( void ) -#else -void ACE_PPE_Flag2_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG2 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag2_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag3_IRQHandler( void ) -#else -void ACE_PPE_Flag3_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG3 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag3_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag4_IRQHandler( void ) -#else -void ACE_PPE_Flag4_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG4 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag4_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag5_IRQHandler( void ) -#else -void ACE_PPE_Flag5_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG5 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag5_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag6_IRQHandler( void ) -#else -void ACE_PPE_Flag6_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG6 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag6_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag7_IRQHandler( void ) -#else -void ACE_PPE_Flag7_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG7 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag7_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag8_IRQHandler( void ) -#else -void ACE_PPE_Flag8_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG8 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag8_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag9_IRQHandler( void ) -#else -void ACE_PPE_Flag9_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG9 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag9_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag10_IRQHandler( void ) -#else -void ACE_PPE_Flag10_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG10 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag10_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag11_IRQHandler( void ) -#else -void ACE_PPE_Flag11_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG11 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag11_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag12_IRQHandler( void ) -#else -void ACE_PPE_Flag12_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG12 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag12_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag13_IRQHandler( void ) -#else -void ACE_PPE_Flag13_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG13 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag13_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag14_IRQHandler( void ) -#else -void ACE_PPE_Flag14_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG14 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag14_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag15_IRQHandler( void ) -#else -void ACE_PPE_Flag15_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG15 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag15_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag16_IRQHandler( void ) -#else -void ACE_PPE_Flag16_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG16 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag16_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag17_IRQHandler( void ) -#else -void ACE_PPE_Flag17_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG17 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag17_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag18_IRQHandler( void ) -#else -void ACE_PPE_Flag18_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG18 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag18_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag19_IRQHandler( void ) -#else -void ACE_PPE_Flag19_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG19 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag19_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag20_IRQHandler( void ) -#else -void ACE_PPE_Flag20_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG20 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag20_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag21_IRQHandler( void ) -#else -void ACE_PPE_Flag21_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG21 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag21_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag22_IRQHandler( void ) -#else -void ACE_PPE_Flag22_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG22 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag22_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag23_IRQHandler( void ) -#else -void ACE_PPE_Flag23_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG23 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag23_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag24_IRQHandler( void ) -#else -void ACE_PPE_Flag24_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG24 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag24_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag25_IRQHandler( void ) -#else -void ACE_PPE_Flag25_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG25 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag25_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag26_IRQHandler( void ) -#else -void ACE_PPE_Flag26_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG26 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag26_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag27_IRQHandler( void ) -#else -void ACE_PPE_Flag27_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG27 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag27_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag28_IRQHandler( void ) -#else -void ACE_PPE_Flag28_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG28 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag28_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag29_IRQHandler( void ) -#else -void ACE_PPE_Flag29_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG29 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag29_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag30_IRQHandler( void ) -#else -void ACE_PPE_Flag30_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG30 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag30_IRQn ); -} - -/*-------------------------------------------------------------------------*//** - * - */ -#if defined(__GNUC__) -__attribute__((__interrupt__)) void ACE_PPE_Flag31_IRQHandler( void ) -#else -void ACE_PPE_Flag31_IRQHandler( void ) -#endif -{ - process_flag_irq( THRESHOLD_FLAG31 ); - NVIC_ClearPendingIRQ( ACE_PPE_Flag31_IRQn ); -} - -#ifdef __cplusplus -} -#endif - diff --git a/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/ace_sse.c b/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/ace_sse.c deleted file mode 100644 index eefb06b18..000000000 --- a/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/ace_sse.c +++ /dev/null @@ -1,306 +0,0 @@ -/******************************************************************************* - * (c) Copyright 2009 Actel Corporation. All rights reserved. - * - * SVN $Revision: 2905 $ - * SVN $Date: 2010-08-20 14:03:28 +0100 (Fri, 20 Aug 2010) $ - */ -#include "mss_ace.h" -#include "mss_ace_configurator.h" -#include "../../drivers_config/mss_ace/ace_handles.h" -#include "../../drivers_config/mss_ace/ace_config.h" - -#include "../../CMSIS/a2fxxxm3.h" -#include "../../CMSIS/mss_assert.h" -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define SSE_START 1uL -#define SSE_STOP 0uL - -#define NB_OF_ANALOG_BLOCKS 3u -#define SEE_RAM_WORD_SIZE 512 - -#define TS_ENABLE_MASK 0x01u -#define PPE_ENABLE_MASK 0x01u -#define ADC_RESET_MASK 0x10u -#define ADC_FIFO_CLR_MASK 0x04u -#define PDMA_DATAOUT_CLR_MASK 0x04u - - -/*-------------------------------------------------------------------------*//** - * - */ -extern ace_procedure_desc_t g_sse_sequences_desc_table[ACE_NB_OF_SSE_PROCEDURES]; - -/*-------------------------------------------------------------------------*//** - * - */ -sse_sequence_handle_t -ACE_get_sse_seq_handle -( - const uint8_t * p_sz_sequence_name -) -{ - uint16_t seq_idx; - sse_sequence_handle_t handle = INVALID_SSE_SEQ_HANDLE; - - for ( seq_idx = 0u; seq_idx < (uint32_t)ACE_NB_OF_SSE_PROCEDURES; ++seq_idx ) - { - if ( g_sse_sequences_desc_table[seq_idx].p_sz_proc_name != 0 ) - { - int32_t diff; - diff = strncmp( (const char *)p_sz_sequence_name, (const char *)g_sse_sequences_desc_table[seq_idx].p_sz_proc_name, MAX_PROCEDURE_NAME_LENGTH ); - if ( 0 == diff ) - { - /* channel name found. */ - handle = seq_idx; - break; - } - } - } - return handle; -} - -/*-------------------------------------------------------------------------*//** - * - */ -static uint32_t volatile * const sse_pc_ctrl_lut[NB_OF_ANALOG_BLOCKS] = -{ - &ACE->PC0_CTRL, - &ACE->PC1_CTRL, - &ACE->PC2_CTRL -}; - -static uint32_t volatile * const sse_pc_lo_lut[NB_OF_ANALOG_BLOCKS] = -{ - &ACE->PC0_LO, - &ACE->PC1_LO, - &ACE->PC2_LO -}; - -static uint32_t volatile * const sse_pc_hi_lut[NB_OF_ANALOG_BLOCKS] = -{ - &ACE->PC0_HI, - &ACE->PC1_HI, - &ACE->PC2_HI -}; - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_load_sse -( - sse_sequence_handle_t sequence -) -{ - ASSERT( sequence < (sse_sequence_handle_t)ACE_NB_OF_SSE_PROCEDURES ); - - if ( sequence < (sse_sequence_handle_t)ACE_NB_OF_SSE_PROCEDURES ) - { - uint16_t i; - uint16_t offset; - const uint16_t * p_ucode; - - ASSERT( g_sse_sequences_desc_table[sequence].sse_pc_id < NB_OF_ANALOG_BLOCKS ); - - if ( g_sse_sequences_desc_table[sequence].sse_pc_id < NB_OF_ANALOG_BLOCKS ) - { - /* Stop relevant program counter. */ - *sse_pc_ctrl_lut[g_sse_sequences_desc_table[sequence].sse_pc_id] = SSE_STOP; - - /* Load microcode into SEE RAM.*/ - p_ucode = g_sse_sequences_desc_table[sequence].sse_ucode; - offset = g_sse_sequences_desc_table[sequence].sse_load_offset; - - for ( i = 0u; i < g_sse_sequences_desc_table[sequence].sse_ucode_length; ++i ) - { - ACE->SSE_RAM_DATA[offset + i] = (uint32_t)*p_ucode; - ++p_ucode; - } - } - } -} - - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_start_sse -( - sse_sequence_handle_t sequence -) -{ - ASSERT( sequence < (sse_sequence_handle_t)ACE_NB_OF_SSE_PROCEDURES ); - - if ( sequence < (sse_sequence_handle_t)ACE_NB_OF_SSE_PROCEDURES ) - { - uint16_t pc; - - ASSERT( g_sse_sequences_desc_table[sequence].sse_pc_id < NB_OF_ANALOG_BLOCKS ); - ASSERT( g_sse_sequences_desc_table[sequence].sse_load_offset < SEE_RAM_WORD_SIZE ); - - pc = g_sse_sequences_desc_table[sequence].sse_load_offset; - - if ( pc < 256u ) - { - *sse_pc_lo_lut[g_sse_sequences_desc_table[sequence].sse_pc_id] = pc; - } - else - { - *sse_pc_hi_lut[g_sse_sequences_desc_table[sequence].sse_pc_id] = pc - 256; - } - - *sse_pc_ctrl_lut[g_sse_sequences_desc_table[sequence].sse_pc_id] = SSE_START; - - /* Enable Sample Sequencing Engine in case it was not done as part of - * system boot. */ - ACE->SSE_TS_CTRL |= TS_ENABLE_MASK; - } -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_restart_sse -( - sse_sequence_handle_t sequence -) -{ - ASSERT( sequence < ACE_NB_OF_SSE_PROCEDURES ); - ASSERT( g_sse_sequences_desc_table[sequence].sse_pc_id < NB_OF_ANALOG_BLOCKS ); - ASSERT( g_sse_sequences_desc_table[sequence].sse_load_offset < SEE_RAM_WORD_SIZE ); - - if ( sequence < (sse_sequence_handle_t)ACE_NB_OF_SSE_PROCEDURES ) - { - uint16_t pc; - - pc = g_sse_sequences_desc_table[sequence].sse_loop_pc; - - if ( pc < 256u ) - { - *sse_pc_lo_lut[g_sse_sequences_desc_table[sequence].sse_pc_id] = pc; - } - else - { - *sse_pc_hi_lut[g_sse_sequences_desc_table[sequence].sse_pc_id] = pc - 256; - } - - *sse_pc_ctrl_lut[g_sse_sequences_desc_table[sequence].sse_pc_id] = SSE_START; - } -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_stop_sse -( - sse_sequence_handle_t sequence -) -{ - ASSERT( sequence < ACE_NB_OF_SSE_PROCEDURES ); - - if ( sequence < (sse_sequence_handle_t)ACE_NB_OF_SSE_PROCEDURES ) - { - /* Stop relevant program counter. */ - *sse_pc_ctrl_lut[g_sse_sequences_desc_table[sequence].sse_pc_id] = SSE_STOP; - } -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_resume_sse -( - sse_sequence_handle_t sequence -) -{ - ASSERT( sequence < ACE_NB_OF_SSE_PROCEDURES ); - - if ( sequence < (sse_sequence_handle_t)ACE_NB_OF_SSE_PROCEDURES ) - { - *sse_pc_ctrl_lut[g_sse_sequences_desc_table[sequence].sse_pc_id] = SSE_START; - } -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_enable_sse_irq -( - sse_irq_id_t sse_irq_id -) -{ - ASSERT( sse_irq_id < NB_OF_SSE_FLAG_IRQS ); - - ACE->SSE_IRQ_EN |= 1uL << (uint32_t)sse_irq_id; -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_disable_sse_irq -( - sse_irq_id_t sse_irq_id -) -{ - ASSERT( sse_irq_id < NB_OF_SSE_FLAG_IRQS ); - - ACE->SSE_IRQ_EN &= (uint32_t)~(1uL << (uint32_t)sse_irq_id); -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_clear_sse_irq -( - sse_irq_id_t sse_irq_id -) -{ - ASSERT( sse_irq_id < NB_OF_SSE_FLAG_IRQS ); - - ACE->SSE_IRQ_CLR |= 1uL << (uint32_t)sse_irq_id; -} - -/*-------------------------------------------------------------------------*//** - * - */ -void ACE_clear_sample_pipeline(void) -{ - uint32_t saved_sse_ctrl; - uint32_t saved_ppe_ctrl; - - /* Pause the Sample Sequencing Engine. */ - saved_sse_ctrl = ACE->SSE_TS_CTRL; - ACE->SSE_TS_CTRL = ACE->SSE_TS_CTRL & ~((uint32_t)TS_ENABLE_MASK); - - /* Pause the Post Processing Engine. */ - saved_ppe_ctrl = ACE->PPE_CTRL; - ACE->PPE_CTRL = ACE->PPE_CTRL & ~((uint32_t)PPE_ENABLE_MASK); - - /* Reset the ADCs */ - ACE->ADC0_MISC_CTRL |= ADC_RESET_MASK; - ACE->ADC1_MISC_CTRL |= ADC_RESET_MASK; - ACE->ADC2_MISC_CTRL |= ADC_RESET_MASK; - - /* Clear ADC FIFOs */ - ACE->ADC0_FIFO_CTRL |= ADC_FIFO_CLR_MASK; - ACE->ADC1_FIFO_CTRL |= ADC_FIFO_CLR_MASK; - ACE->ADC2_FIFO_CTRL |= ADC_FIFO_CLR_MASK; - - /* clear DMA FIFOs */ - ACE->PPE_PDMA_CTRL |= PDMA_DATAOUT_CLR_MASK; - - /* Unpause the Post Processing Engine. */ - ACE->PPE_CTRL = saved_ppe_ctrl; - - /* Unpause the Sample Sequencing Engine. */ - ACE->SSE_TS_CTRL = saved_sse_ctrl; -} - -#ifdef __cplusplus -} -#endif - diff --git a/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/ace_transform.c b/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/ace_transform.c deleted file mode 100644 index 0a44a6aae..000000000 --- a/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/ace_transform.c +++ /dev/null @@ -1,467 +0,0 @@ -/******************************************************************************* - * (c) Copyright 2010 Actel Corporation. All rights reserved. - * - * This file contains the implementation of the functions used to dynamically - * control the linear transforms applied by the ACE post processing engine to - * the samples read from the SSE. - * - * SVN $Revision: 2908 $ - * SVN $Date: 2010-08-20 16:01:28 +0100 (Fri, 20 Aug 2010) $ - */ - -#include "mss_ace.h" -#include "mss_ace_configurator.h" -#include "mtd_data.h" -#include "envm_layout.h" -#include "../../CMSIS/a2fxxxm3.h" -#include "../../CMSIS/mss_assert.h" -#include "../../drivers_config/mss_ace/ace_config.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The ACE_set_linear_transform() is only available when using ACE configuration - * files generated by Libero 9.1 or later. - */ -#ifdef ACE_CFG_DATA_FORMAT_VERSION - -/*------------------------------------------------------------------------------ - * Masks ans shift values used to derive the ABPS ranges from the analog block - * configuration. - */ -#define ABPS1_CFG_BITS_MASK (uint32_t)0x06 -#define ABPS1_CFG_BITS_SHIFT (uint32_t)1 - -#define ABPS2_CFG_BITS_MASK (uint32_t)0x60 -#define ABPS2_CFG_BITS_SHIFT (uint32_t)5 - -/*------------------------------------------------------------------------------ - * One Bit DAC definitions. - */ -#define OBD_CURRENT (uint32_t)1 -#define OBD_VOLTAGE (uint32_t)0 - -#define OBD_MODE_MASK (uint32_t)0x01 -#define OBD_CHOPPING_MASK (uint32_t)0x02 - -/*-------------------------------------------------------------------------*//** - Neutral factor and offset for m*x + c trnasform. - */ -#define NEUTRAL_M_FACTOR 0x4000 -#define NEUTRAL_C_OFFSET 0x0000 - -/*-------------------------------------------------------------------------*//** - Enumearation of the various input channel types. This is used to differentiate - between channel types in order to extract the relevant factory calibration - data(m1 and c1). - */ -typedef enum channel_type -{ - ABPS1_CHAN = 0, - ABPS2_CHAN, - CMB_CHAN, - TMB_CHAN, - DIRECT_ADC_INPUT_CHAN, - OBDOUT_CHAN, - FLOATING_CHAN -} cal_channel_type_t; - -/*-------------------------------------------------------------------------*//** - This data structure is used to store factory calibration data for a specific - analog input. - */ -typedef struct __channel_calibration_t -{ - uint16_t mext; - uint16_t m1; - uint16_t c1; -} channel_calibration_t; - -/*-------------------------------------------------------------------------*//** - Local functions - */ -int32_t extend_sign -( - uint16_t x -); - -uint32_t adjust_to_24bit_ace_format -( - int64_t signed48 -); - -uint32_t adjust_to_16bit_ace_format -( - int64_t signed48 -); - -void get_calibration -( - adc_channel_id_t channel_id, - channel_calibration_t * p_calibration -); - -void write_transform_coefficients -( - ace_channel_handle_t channel_handle, - uint32_t m, - uint32_t c -); - -/*-------------------------------------------------------------------------*//** - - */ -extern const uint8_t g_ace_external_varef_used[ACE_NB_OF_ADC]; - -extern ace_channel_desc_t g_ace_channel_desc_table[ACE_NB_OF_INPUT_CHANNELS]; - -extern const ppe_transforms_desc_t g_ace_ppe_transforms_desc_table[ACE_NB_OF_INPUT_CHANNELS]; - -/*------------------------------------------------------------------------------ - * Pointer to the manufacturing test data containing trimming information - * generated during manufacturing. - */ -static const mtd_data_t * const p_mtd_data = (mtd_data_t *)MTD_ADDRESS; - -/*-------------------------------------------------------------------------*//** - See "mss_ace.h" for details of how to use this function. - */ -int16_t ACE_get_default_m_factor -( - ace_channel_handle_t channel_handle -) -{ - ASSERT( channel_handle < NB_OF_ACE_CHANNEL_HANDLES ); - - return g_ace_ppe_transforms_desc_table[channel_handle].m_ppe_offset; -} - -/*-------------------------------------------------------------------------*//** - See "mss_ace.h" for details of how to use this function. - */ -int16_t ACE_get_default_c_offset -( - ace_channel_handle_t channel_handle -) -{ - ASSERT( channel_handle < NB_OF_ACE_CHANNEL_HANDLES ); - - return g_ace_ppe_transforms_desc_table[channel_handle].c_ppe_offset; -} - -/*-------------------------------------------------------------------------*//** - See "mss_ace.h" for details of how to use this function. - - m = m2 * m1 * mext - c = (m2 * c1 * mext) + (c2 * mext) - */ -void ACE_set_linear_transform -( - ace_channel_handle_t channel_handle, - int16_t m2, - int16_t c2 -) -{ - adc_channel_id_t channel_id; - uint32_t m; - uint32_t c; - int32_t m32; - int64_t m64; - int32_t c32; - int64_t c64_1; - int64_t c64_2; - uint16_t m1; - uint16_t c1; - uint16_t mext; - - channel_calibration_t calibration; - - ASSERT( channel_handle < NB_OF_ACE_CHANNEL_HANDLES ); - - if(channel_handle < NB_OF_ACE_CHANNEL_HANDLES) - { - channel_id = g_ace_channel_desc_table[channel_handle].signal_id; - - get_calibration(channel_id, &calibration); - - m1 = calibration.m1; - c1 = calibration.c1; - - mext = calibration.mext; - - /* - * m = m2 * m1 * mext - */ - m32 = extend_sign(m2) * extend_sign(m1); - m64 = (int64_t)m32 * extend_sign(mext); - - /* Convert 48-bit result to 32-bit ACE format result. */ - m = adjust_to_16bit_ace_format(m64); - - /* - * c = (m2 * c1 * mext) + (c2 * mext) - */ - c32 = extend_sign(m2) * extend_sign(c1); - c64_1 = (int64_t)c32 * extend_sign(mext); - - c64_2 = ((int64_t)(extend_sign(c2) * extend_sign(mext))) << 14; - - c = adjust_to_24bit_ace_format(c64_1 + c64_2); - - write_transform_coefficients(channel_handle, m, c); - } -} - -/*-------------------------------------------------------------------------*//** - Extend 16-bit signed number to 32-bit signed number. - */ -int32_t extend_sign -( - uint16_t x -) -{ - int32_t y; - const uint32_t sign_bit_mask = 0x00008000u; - - y = (x ^ sign_bit_mask) - sign_bit_mask; - - return y; -} - -/*-------------------------------------------------------------------------*//** - Take a 48-bit signed number, adjust it for saturation in the range -8 to - +7.999, translate into 24-bit ACE format. - */ -uint32_t adjust_to_24bit_ace_format -( - int64_t signed48 -) -{ - int32_t ace24_format; - const int64_t MAX_POSITIVE = 0x00001FFFFFFFFFFFuLL; /* +7.9999 */ - const int64_t MIN_NEGATIVE = 0xFFFF200000000000uLL; /* -8 */ - - /* Check saturation. */ - if(signed48 > MAX_POSITIVE) - { - signed48 = MAX_POSITIVE; - } - else if(signed48 < MIN_NEGATIVE) - { - signed48 = MIN_NEGATIVE; - } - - /* Adjust to 24-bit ACE format. */ - ace24_format = (uint32_t)(signed48 >> 14); - - return ace24_format; -} - -/*-------------------------------------------------------------------------*//** - Take a 48-bit signed number, adjust it for saturation in the range -8 to - +7.999, translate into 16-bit ACE format. - */ -uint32_t adjust_to_16bit_ace_format -( - int64_t signed48 -) -{ - int32_t ace24_format; - const int64_t MAX_POSITIVE = 0x00001FFFFFFFFFFFuLL; /* +7.9999 */ - const int64_t MIN_NEGATIVE = 0xFFFF200000000000uLL; /* -8 */ - - /* Check saturation. */ - if(signed48 > MAX_POSITIVE) - { - signed48 = MAX_POSITIVE; - } - else if(signed48 < MIN_NEGATIVE) - { - signed48 = MIN_NEGATIVE; - } - - /* Adjust to 24-bit ACE format. */ - ace24_format = (uint32_t)(signed48 >> 20); - - return ace24_format; -} - -/*-------------------------------------------------------------------------*//** - - */ -void get_calibration -( - adc_channel_id_t channel_id, - channel_calibration_t * p_calibration -) -{ - const uint32_t channel_mask = 0x0000000F; - const uint32_t CMB_MUX_SEL_MASK = 0x01; - const uint32_t TMB_MUX_SEL_MASK = 0x01; - - const cal_channel_type_t channel_type_lut[16] = - { - FLOATING_CHAN, - ABPS1_CHAN, - ABPS2_CHAN, - CMB_CHAN, - TMB_CHAN, - ABPS1_CHAN, - ABPS2_CHAN, - CMB_CHAN, - TMB_CHAN, - DIRECT_ADC_INPUT_CHAN, - DIRECT_ADC_INPUT_CHAN, - DIRECT_ADC_INPUT_CHAN, - DIRECT_ADC_INPUT_CHAN, - FLOATING_CHAN, - FLOATING_CHAN, - OBDOUT_CHAN - }; - - cal_channel_type_t channel_type; - uint32_t channel_nb; - uint32_t adc_nb; - uint32_t range; - uint32_t quad_id; - mtd_calibration_mc_t const * p_mc_coeff = 0; - - channel_nb = channel_id & channel_mask; - channel_type = channel_type_lut[channel_nb]; - adc_nb = ((uint32_t)channel_id & 0x30u) >> 4u; - - quad_id = adc_nb * 2; - - if ( (channel_nb > 4) && (channel_nb < 9) ) { ++quad_id; } - - switch ( channel_type ) - { - case ABPS1_CHAN: - range = (ACE->ACB_DATA[quad_id].b8 & ABPS1_CFG_BITS_MASK) >> ABPS1_CFG_BITS_SHIFT; - p_mc_coeff = &p_mtd_data->abps_calibration[quad_id][0][range]; - break; - - case ABPS2_CHAN: - range = (ACE->ACB_DATA[quad_id].b8 & ABPS2_CFG_BITS_MASK) >> ABPS2_CFG_BITS_SHIFT; - p_mc_coeff = &p_mtd_data->abps_calibration[quad_id][1][range]; - break; - - case CMB_CHAN: - { - uint32_t cmb_mux_sel = (uint32_t)ACE->ACB_DATA[quad_id].b9 & CMB_MUX_SEL_MASK; - if ( cmb_mux_sel == 0 ) - { /* current monitor */ - p_mc_coeff = &p_mtd_data->cm_calibration[quad_id]; - } - else - { /* direct input */ - p_mc_coeff = &p_mtd_data->quads_direct_input_cal[quad_id][0]; - } - } - break; - - case TMB_CHAN: - { - uint32_t tmb_mux_sel = (uint32_t)ACE->ACB_DATA[quad_id].b10 & TMB_MUX_SEL_MASK; - if ( tmb_mux_sel == 0 ) - { /* temperature monitor */ - p_mc_coeff = &p_mtd_data->tm_calibration[quad_id]; - } - else - { /* direct input */ - p_mc_coeff = &p_mtd_data->quads_direct_input_cal[quad_id][1]; - } - } - break; - - case DIRECT_ADC_INPUT_CHAN: - { - const uint32_t channel_to_direct_in_lut[16] - = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 0, 0, 0}; - uint32_t direct_in_id; - - direct_in_id = channel_to_direct_in_lut[channel_id & channel_mask]; - p_mc_coeff = &p_mtd_data->adc_direct_input_cal[adc_nb][direct_in_id]; - } - break; - - case OBDOUT_CHAN: - { - uint32_t obd_mode = (uint32_t)ACE->ACB_DATA[quad_id].b6 & OBD_MODE_MASK; - uint32_t chopping_option = (uint32_t)ACE->ACB_DATA[quad_id].b6 & OBD_CHOPPING_MASK; - if (obd_mode > 0) - { - obd_mode = 1; - } - if (chopping_option > 0) - { - chopping_option = 1; - } - p_mc_coeff = &p_mtd_data->obd_calibration[adc_nb][obd_mode][chopping_option]; - } - break; - - case FLOATING_CHAN: - default: - /* Give neutral values is invalid channel. */ - p_calibration->m1 = NEUTRAL_M_FACTOR; - p_calibration->c1 = NEUTRAL_C_OFFSET; - break; - } - - if (p_mc_coeff != 0) - { - p_calibration->m1 = p_mc_coeff->m; - p_calibration->c1 = p_mc_coeff->c; - - } - - /*-------------------------------------------------------------------------- - Retrieve the value of the mext factor. This depends if external VAREF is - used by the ADC sampling the analog input channel. - */ - if (g_ace_external_varef_used[adc_nb]) - { - p_calibration->mext = p_mtd_data->global_settings.varef_m; - } - else - { - p_calibration->mext = NEUTRAL_M_FACTOR; - } -} - -/*-------------------------------------------------------------------------*//** - Write new m and c transform factors into the PPE RAM. The m and c factors - should be in 32-bit ACE number format. The factors will be merged with - relevant PE opcode into PPE RAM. The 32-bit factors are shifted right by one - byte giving a 24-bit ACE number which is then merged with an 8-bit PPE opcode - located in the most significant byte of the PPE RAM location. - */ -void write_transform_coefficients -( - ace_channel_handle_t channel_handle, - uint32_t m, - uint32_t c -) -{ - uint16_t m_ppe_offset; - uint16_t c_ppe_offset; - const uint32_t PPE_OPCODE_MASK = 0xFF000000u; - - m_ppe_offset = g_ace_ppe_transforms_desc_table[channel_handle].m_ppe_offset; - c_ppe_offset = g_ace_ppe_transforms_desc_table[channel_handle].c_ppe_offset; - - ACE->PPE_RAM_DATA[m_ppe_offset] - = (ACE->PPE_RAM_DATA[m_ppe_offset] & PPE_OPCODE_MASK) | (m >> 8u); - - ACE->PPE_RAM_DATA[c_ppe_offset] - = (ACE->PPE_RAM_DATA[c_ppe_offset] & PPE_OPCODE_MASK) | (c >> 8u); -} - -#endif /* ACE_CFG_DATA_FORMAT_VERSION */ - -#ifdef __cplusplus -} -#endif diff --git a/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/mss_ace.c b/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/mss_ace.c index cd717f036..ebd1e8dde 100644 --- a/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/mss_ace.c +++ b/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/mss_ace.c @@ -1,6 +1,6 @@ /******************************************************************************* * (c) Copyright 2009 Actel Corporation. All rights reserved. - * + * * SVN $Revision: 2905 $ * SVN $Date: 2010-08-20 14:03:28 +0100 (Fri, 20 Aug 2010) $ */ @@ -16,7 +16,7 @@ #ifdef __cplusplus extern "C" { -#endif +#endif #define START_ADC_CONVERSION 0x80uL @@ -31,8 +31,10 @@ void ace_init_convert(void); void ACE_init( void ) { /* Initialize driver's internal data. */ - ace_init_flags(); - + #if (ACE_NB_OF_PPE_FLAGS > 0) + ace_init_flags(); + #endif + /* Initialize the data structures used by conversion functions. */ ace_init_convert(); } @@ -70,13 +72,13 @@ uint16_t ACE_get_adc_result uint32_t data_valid; ASSERT( adc_id < NB_OF_ANALOG_MODULES ); - + if ( adc_id < (uint8_t)NB_OF_ANALOG_MODULES ) { do { data_valid = *adc_status_reg_lut[adc_id] & ADC_DATAVALID_MASK; } while ( !data_valid ); - + result = (uint16_t)(*adc_status_reg_lut[adc_id] & ADC_RESULT_MASK); } return result; @@ -88,7 +90,7 @@ uint16_t ACE_get_adc_result #define SDD_ENABLE_MASK 0x20uL #define SDD_REG_SEL_MASK 0x40uL - + #define DAC0_SYNC_EN_MASK 0x10uL #define DAC1_SYNC_EN_MASK 0x20uL #define DAC2_SYNC_EN_MASK 0x40uL @@ -149,7 +151,7 @@ void ACE_configure_sdd ) { ASSERT( sdd_id < NB_OF_SDD ); - + if ( sdd_id < NB_OF_SDD ) { const uint8_t sdd_2_quad_lut[NB_OF_SDD] = {0u, 2u, 4u}; @@ -157,16 +159,16 @@ void ACE_configure_sdd uint8_t obd_mode_idx = 1u; uint8_t chopping_mode_idx = 0u; uint32_t saved_pc2_ctrl; - + quad_id = sdd_2_quad_lut[sdd_id]; - + /* Pause the SSE PC2 while accesses to ACB from APB3 are taking place. */ saved_pc2_ctrl = ACE->PC2_CTRL; ACE->PC2_CTRL = 0u; - + /* Select between voltage/current and RTZ modes.*/ ACE->ACB_DATA[quad_id].b6 = mode; - + /* Load manufacturing generated trim value. */ if ( (mode & OBD_MODE_MASK) > 0u ) { @@ -178,17 +180,17 @@ void ACE_configure_sdd } ACE->ACB_DATA[quad_id].b4 = p_mtd_data->odb_trimming[sdd_id][obd_mode_idx][chopping_mode_idx]; - + /* Restore SSE PC2 operations since no ACB accesses should take place * beyond this point. */ ACE->PC2_CTRL = saved_pc2_ctrl; - + /* Set SDD resolution. */ *dac_ctrl_reg_lut[sdd_id] = (uint32_t)resolution; - + /* Update SDD value through SSE_DACn_BYTES01. */ *dac_ctrl_reg_lut[sdd_id] |= SDD_REG_SEL_MASK; - + /* Synchronous or individual SDD update. */ if ( INDIVIDUAL_UPDATE == sync_update ) { @@ -210,7 +212,7 @@ void ACE_enable_sdd ) { ASSERT( sdd_id < NB_OF_SDD ); - + if ( sdd_id < NB_OF_SDD ) { *dac_ctrl_reg_lut[sdd_id] |= SDD_ENABLE_MASK; @@ -226,7 +228,7 @@ void ACE_disable_sdd ) { ASSERT( sdd_id < NB_OF_SDD ); - + if ( sdd_id < NB_OF_SDD ) { *dac_ctrl_reg_lut[sdd_id] &= ~SDD_ENABLE_MASK; @@ -243,7 +245,7 @@ void ACE_set_sdd_value ) { ASSERT( sdd_id < NB_OF_SDD ); - + if ( sdd_id < NB_OF_SDD ) { *dac_byte2_reg_lut[sdd_id] = sdd_value >> 16; @@ -262,9 +264,9 @@ void ACE_set_sdd_value_sync ) { uint32_t dac_sync_ctrl; - + dac_sync_ctrl = ACE->DAC_SYNC_CTRL; - + if ( SDD_NO_UPDATE != sdd0_value ) { ACE->DAC0_BYTE2 = sdd0_value >> 16; @@ -286,7 +288,7 @@ void ACE_set_sdd_value_sync ACE->SSE_DAC2_BYTES01 = sdd2_value; dac_sync_ctrl |= DAC2_SYNC_UPDATE; } - + ACE->DAC_SYNC_CTRL = dac_sync_ctrl; } @@ -357,23 +359,23 @@ void ACE_set_comp_reference { uint8_t scb_id; uint32_t odd; - + odd = (uint32_t)comp_id & 0x01uL; - + ASSERT( comp_id < NB_OF_COMPARATORS ); ASSERT( reference < NB_OF_COMP_REF ); ASSERT( odd ); /* Only Temperature block comparators have configurable reference input. */ - + if ( (comp_id < NB_OF_COMPARATORS) && (reference < NB_OF_COMP_REF) && (odd) ) { uint32_t saved_pc2_ctrl; - + scb_id = comp_id_2_scb_lut[comp_id]; - + /* Pause the SSE PC2 while accesses to ACB from APB3 are taking place. */ saved_pc2_ctrl = ACE->PC2_CTRL; ACE->PC2_CTRL = 0u; - + if ( ADC_IN_COMP_REF == reference ) { ACE->ACB_DATA[scb_id].b10 &= (uint8_t)~B10_COMP_VREF_SW_MASK; @@ -384,7 +386,7 @@ void ACE_set_comp_reference ACE->ACB_DATA[scb_id].b10 &= (uint8_t)~B10_COMP_VREF_SW_MASK; ACE->ACB_DATA[scb_id].b11 = (ACE->ACB_DATA[scb_id].b11 & (uint8_t)~B11_DAC_MUXSEL_MASK) + (uint8_t)reference; } - + /* Restore SSE PC2 operations since no ACB accesses should take place * beyond this point. */ ACE->PC2_CTRL = saved_pc2_ctrl; @@ -401,22 +403,22 @@ void ACE_set_comp_hysteresis ) { uint8_t scb_id; - + ASSERT( comp_id < NB_OF_COMPARATORS ); ASSERT( hysteresis < NB_OF_HYSTERESIS ); - + if ( (comp_id < NB_OF_COMPARATORS) && (hysteresis < NB_OF_HYSTERESIS) ) { uint32_t odd; uint32_t saved_pc2_ctrl; - + scb_id = comp_id_2_scb_lut[comp_id]; odd = (uint32_t)comp_id & 0x01uL; - + /* Pause the SSE PC2 while accesses to ACB from APB3 are taking place. */ saved_pc2_ctrl = ACE->PC2_CTRL; ACE->PC2_CTRL = 0u; - + if ( odd ) { /* Temperature monitor block comparator. */ @@ -427,7 +429,7 @@ void ACE_set_comp_hysteresis /* Current monitor block comparator. */ ACE->ACB_DATA[scb_id].b9 = (ACE->ACB_DATA[scb_id].b9 & HYSTERESIS_MASK) | (uint8_t)((uint8_t)hysteresis << HYSTERESIS_SHIFT); } - + /* Restore SSE PC2 operations since no ACB accesses should take place * beyond this point. */ ACE->PC2_CTRL = saved_pc2_ctrl; @@ -435,7 +437,7 @@ void ACE_set_comp_hysteresis } /*-------------------------------------------------------------------------*//** - + */ void ACE_enable_comp ( @@ -443,21 +445,21 @@ void ACE_enable_comp ) { uint8_t scb_id; - + ASSERT( comp_id < NB_OF_COMPARATORS ); - + if ( comp_id < NB_OF_COMPARATORS ) { uint32_t odd; uint32_t saved_pc2_ctrl; - + scb_id = comp_id_2_scb_lut[comp_id]; odd = (uint32_t)comp_id & 0x01uL; - + /* Pause the SSE PC2 while accesses to ACB from APB3 are taking place. */ saved_pc2_ctrl = ACE->PC2_CTRL; ACE->PC2_CTRL = 0u; - + if ( odd ) { /* Temperature monitor block comparator. */ @@ -468,7 +470,7 @@ void ACE_enable_comp /* Current monitor block comparator. */ ACE->ACB_DATA[scb_id].b9 |= COMPARATOR_ENABLE_MASK; } - + /* Restore SSE PC2 operations since no ACB accesses should take place * beyond this point. */ ACE->PC2_CTRL = saved_pc2_ctrl; @@ -484,21 +486,21 @@ void ACE_disable_comp ) { uint8_t scb_id; - + ASSERT( comp_id < NB_OF_COMPARATORS ); - + if ( comp_id < NB_OF_COMPARATORS ) { uint32_t odd; uint32_t saved_pc2_ctrl; - + scb_id = comp_id_2_scb_lut[comp_id]; odd = (uint32_t)comp_id & 0x01uL; - + /* Pause the SSE PC2 while accesses to ACB from APB3 are taking place. */ saved_pc2_ctrl = ACE->PC2_CTRL; ACE->PC2_CTRL = 0u; - + if ( odd ) { /* Temperature monitor block comparator. */ @@ -509,7 +511,7 @@ void ACE_disable_comp /* Current monitor block comparator. */ ACE->ACB_DATA[scb_id].b9 &= (uint8_t)~COMPARATOR_ENABLE_MASK; } - + /* Restore SSE PC2 operations since no ACB accesses should take place * beyond this point. */ ACE->PC2_CTRL = saved_pc2_ctrl; @@ -539,7 +541,7 @@ void ACE_enable_comp_rise_irq ) { ASSERT( comp_id < NB_OF_COMPARATORS ); - + ACE->COMP_IRQ_EN |= (FIRST_RISE_IRQ_MASK << (uint32_t)comp_id); } @@ -552,7 +554,7 @@ void ACE_disable_comp_rise_irq ) { ASSERT( comp_id < NB_OF_COMPARATORS ); - + ACE->COMP_IRQ_EN &= ~(FIRST_RISE_IRQ_MASK << (uint32_t)comp_id); } @@ -565,7 +567,7 @@ void ACE_clear_comp_rise_irq ) { ASSERT( comp_id < NB_OF_COMPARATORS ); - + ACE->COMP_IRQ_CLR |= (FIRST_RISE_IRQ_MASK << (uint32_t)comp_id); } @@ -578,7 +580,7 @@ void ACE_enable_comp_fall_irq ) { ASSERT( comp_id < NB_OF_COMPARATORS ); - + ACE->COMP_IRQ_EN |= (FIRST_FALL_IRQ_MASK << (uint32_t)comp_id); } @@ -591,7 +593,7 @@ void ACE_disable_comp_fall_irq ) { ASSERT( comp_id < NB_OF_COMPARATORS ); - + ACE->COMP_IRQ_EN &= ~(FIRST_FALL_IRQ_MASK << (uint32_t)comp_id); } @@ -604,7 +606,7 @@ void ACE_clear_comp_fall_irq ) { ASSERT( comp_id < NB_OF_COMPARATORS ); - + ACE->COMP_IRQ_CLR |= (FIRST_FALL_IRQ_MASK << (uint32_t)comp_id); } @@ -643,9 +645,9 @@ ACE_get_first_channel ) { ace_channel_handle_t channel_handle; - + channel_handle = (ace_channel_handle_t)0; - + return channel_handle; } @@ -659,12 +661,12 @@ ACE_get_next_channel ) { ++channel_handle; - + if ( channel_handle >= NB_OF_ACE_CHANNEL_HANDLES ) { channel_handle = (ace_channel_handle_t)0; } - + return channel_handle; } @@ -679,7 +681,7 @@ ACE_get_channel_handle { uint16_t channel_idx; ace_channel_handle_t channel_handle = INVALID_CHANNEL_HANDLE; - + for ( channel_idx = 0u; channel_idx < (uint16_t)ACE_NB_OF_INPUT_CHANNELS; ++channel_idx ) { if ( g_ace_channel_desc_table[channel_idx].p_sz_channel_name != 0 ) @@ -708,7 +710,7 @@ ACE_get_input_channel_handle { uint16_t channel_idx; ace_channel_handle_t channel_handle = INVALID_CHANNEL_HANDLE; - + for ( channel_idx = 0u; channel_idx < (uint16_t)ACE_NB_OF_INPUT_CHANNELS; ++channel_idx ) { if ( g_ace_channel_desc_table[channel_idx].signal_id == channel_id ) @@ -732,10 +734,10 @@ ACE_get_ppe_sample { uint16_t sample; uint16_t ppe_offset; - + ppe_offset = g_ace_channel_desc_table[channel_handle].signal_ppe_offset; sample = (uint16_t)(ACE->PPE_RAM_DATA[ppe_offset] >> 16u); - + return sample; } diff --git a/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/mss_ace.h b/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/mss_ace.h index ec4f00ed7..2acc01b1e 100644 --- a/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/mss_ace.h +++ b/Demo/CORTEX_A2F200_IAR_and_Keil/MicroSemi_Code/drivers/mss_ace/mss_ace.h @@ -1,6 +1,6 @@ /******************************************************************************* * (c) Copyright 2009 Actel Corporation. All rights reserved. - * + * * SmartFusion ACE driver public API. * * SVN $Revision: 2884 $ @@ -101,13 +101,13 @@ • Sigma Delta Digital to Analog Converters (SDD) control • Direct analog block configuration and usage - + Initialization The ACE driver is initialized through a call to the ACE_init() function. The ACE_init() function must be called before any other ACE driver functions can be called. It initializes the ACE’s internal data. - + Reading analog input channels values and properties The ACE driver allows retrieving the most recent post processed sample value for each analog input. It also allows retrieving the name of the analog input @@ -129,7 +129,7 @@ • const uint8_t * ACE_get_channel_name( ace_channel_handle_t channel_handle ) • channel_type_t ACE_get_channel_type( ace_channel_handle_t channel_handle ) - + Post Processing Engine flags The SmartFusion ACE Post Processing Engine (PPE) provides the ability to monitor the state of analog input channels and detect when certain threshold values are @@ -162,7 +162,7 @@ • ace_flag_handle_t ACE_get_flag_handle (const uint8_t *p_sz_full_flag_name) • ace_flag_handle_t ACE_get_channel_first_flag (ace_channel_handle_t channel_handle, uint16_t *iterator) • ace_flag_handle_t ACE_get_channel_next_flag (ace_channel_handle_t channel_handle, uint16_t *iterator) - + The current status of a flag can be polled using the following function: • int32_t ACE_get_flag_status (ace_flag_handle_t flag_handle) @@ -203,7 +203,7 @@ • const uint8_t * ACE_get_flag_name (ace_flag_handle_t flag_handle) • ace_channel_handle_t ACE_get_flag_channel (ace_flag_handle_t flag_handle) - + Conversion to and from real world units The ACE driver provides a set of conversion functions to convert sample values read from the post processing engine into real world units: @@ -216,27 +216,27 @@ PPE sample values. These functions are typically used for dynamically adjusting flags threshold values. - + Sample Sequencing Engine control The ACE driver provides a set of functions for dynamically controlling the Sample Sequencing Engine. These functions are only required for managing multiple sampling sequences. The use of these functions is not required for most applications since the SSE is already configured and running by the time the application starts. - + Sample Sequencing Engine Interrupts Control The ACE driver provides a set of functions for managing interrupts generated by the Sample Sequencing Engine. These functions allow enabling, disabling and clearing interrupt defined as part of the sampling sequence. These functions also allow controlling interrupts generated by the ADCs. - + Comparators control The ACE driver provides a set of functions for managing interrupts generated based on the change of state of the high speed comparators. Functions are also provided to dynamically modify the comparators configuration. - + Sigma Delta Digital to Analog Converters (SDD) control The ACE driver provides functions for controlling the output value of the Sigma Delta DACs (SDD). Functions are also provided for dynamically adjusting the @@ -250,9 +250,9 @@ #ifdef __cplusplus extern "C" { -#endif +#endif -#include "../../drivers_config/mss_ace/ace_handles.h" +#include "ace_handles.h" /*-------------------------------------------------------------------------*//** Analog to Digital Converter channel IDs. @@ -325,7 +325,7 @@ void ACE_init( void ); /*============================================================================== ============== Direct Analog Block Configuration and Usage ==================== =============================================================================*/ - + /*=========================================================================*//** @defgroup group1 Direct Analog Block Configuration and Usage These functions are intended for using the SmartFusion analog block hardware @@ -338,10 +338,10 @@ void ACE_init( void ); channel identified by the channel_id parameter. This function is provided for test purposes. It must not be used while the Sample Sequencing Engine is running. - + @param channel_id The channel_id parameter identifies the analog input channel to sample. - + @return This function does not return a value. */ @@ -353,11 +353,11 @@ void ACE_start_adc /*-------------------------------------------------------------------------*//** The ACE_get_adc_result () function reads the result of the last input channel sampling performed by the ADC identified as parameter. - + @param adc_id The adc_id parameter identifies which of the possible three ADC to read the sample result from. - + @return The ACE_start_adc_sync() function returns the ADC result from the ADC specified as parameter. @@ -382,7 +382,7 @@ uint16_t ACE_get_adc_result /*-------------------------------------------------------------------------*//** The sdd_id_t enumeration is used to identify the Sigma Delta DACs to the SDD control functions, ACE_configure_sdd(), ACE_enable_sdd(), ACE_disable_sdd() - and ACE_set_sdd_value(). There is one SDD per analog module. + and ACE_set_sdd_value(). There is one SDD per analog module. */ typedef enum { @@ -394,7 +394,7 @@ typedef enum /*-------------------------------------------------------------------------*//** The sdd_resolution_t enumeration is used as a parameter to the - ACE_configure_sdd() function to specify DAC resolution of the Sigma Delta DAC. + ACE_configure_sdd() function to specify DAC resolution of the Sigma Delta DAC. */ typedef enum { @@ -435,21 +435,21 @@ typedef enum more important than accuracy. A call to this function is not required if relying on the configuration selected in the ACE configurator being loaded after reset by the system boot. - + @param sdd_id The sdd_id parameter specifies which Sigma Delta DAC is configured by this function. Allowed values are: - SDD0_OUT - SDD1_OUT - SDD2_OUT - + @param resolution The resolution parameter specifies the desired resolution of the Sigma Delta DAC. Allowed values are: - SDD_8_BITS - SDD_16_BITS - SDD_24_BITS - + @param mode The mode parameter specifies the operating mode of the Sigma Delta DAC. It specifies whether a current or voltage should be generated and whether @@ -459,7 +459,7 @@ typedef enum - SDD_VOLTAGE_MODE - SDD_RETURN_TO_ZERO - SDD_NON_RTZ - + @param sync_update The sync_update parameter specifies whether the SDD output will be updated individually though a call to ACE_set_sdd_value() or synchronously with one @@ -485,8 +485,8 @@ void ACE_configure_sdd ); /*-------------------------------------------------------------------------*//** - The ACE_enable_sdd() function is used to enable a Sigma Delta DAC. - + The ACE_enable_sdd() function is used to enable a Sigma Delta DAC. + @param sdd_id The sdd_id parameter specifies the Sigma Delta DAC to enable. */ @@ -497,7 +497,7 @@ void ACE_enable_sdd /*-------------------------------------------------------------------------*//** The ACE_disable_sdd() function is used to disable a Sigma Delta DAC. - + @param sdd_id The sdd_id parameter specifies the Sigma Delta DAC to disable. */ @@ -515,10 +515,10 @@ void ACE_disable_sdd the SDD resolution into account. A maximum voltage of 2.56V or a maximum current of 256uA will be generated when the sdd_value is set the maximum value allowed by the SDD resolution - + @param sdd_id The sdd_id parameter specifies which Sigma Delta DAC is being set. - + @param sdd_value The sdd_value parameter specifies the value of the Sigma Delta DAC output. It is a fraction of SDD resolution. The voltage/current value generated from @@ -605,17 +605,17 @@ void ACE_set_sdd_value_sync subsequently used as parameter to function ACE_get_ppe_sample() used to read the most recent post processed sample for the analog input identified through the channel/service name passed as argument to this function. - + @param p_sz_channel_name The p_sz_channel_name parameter is a zero-terminated string containing the name of the channel/service as entered in the ACE configurator. - + @return This function returns a channel handle. This channel handle is required as parameter to function ACE_get_ppe_sample(). It will return INVALID_CHANNEL_HANDLE if the channel/service name is not recognized. - + @code uint16_t adc_result; ace_channel_handle_t at0; @@ -632,10 +632,10 @@ ACE_get_channel_handle /*-------------------------------------------------------------------------*//** The ACE_get_input_channel_handle() function returns the channel handle for the hardware analog input channel specified as parameter. - + @param channel_id The channel_id parameter identifies a hardware analog input of the ACE. - + @return This function returns a channel handle. This channel handle is required as parameter to other ACE driver functions dealing with analog inputs. @@ -652,7 +652,7 @@ ACE_get_input_channel_handle The ACE_get_ppe_sample() function is used to read the most recent post processed sample for the analog input channel associated with the channel handle passed as parameter. - + @param channel_handle The channel_handle parameter identifies the analog input channel for which this function will return the most recent ADC conversion result adjusted for @@ -663,13 +663,13 @@ ACE_get_input_channel_handle ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @return This function returns a 16 bit value representing the adjusted value of the ADC conversion result for the analog input channel identified by the channel handle passed as parameter. The return value is actually a 12, 10 or 8 bits number depending on the configuration of the ADC. - + @code uint16_t adc_result; ace_channel_handle_t at0; @@ -688,7 +688,7 @@ ACE_get_ppe_sample associated with the channel handle passed as parameter. The channel name is the name used in the ACE configurator software tool when adding a service to the ACE. - + @param channel_handle The channel_handle parameter identifies the analog input channel for which we want to retrieve the channel name. The available channel handle values can @@ -697,7 +697,7 @@ ACE_get_ppe_sample to ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @return This function returns a pointer to a zero-terminated string containing the name of the channel. It returns 0 if the channel handle passed as parameter @@ -727,7 +727,7 @@ typedef enum analog input channel identified by the channel handle passed as parameter. This function allows determining whether the quantity measured through the ADC is a voltage, current or temperature. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -736,7 +736,7 @@ typedef enum ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @return This function returns one of the following values to report the type of quantity measure throught the channel: @@ -754,21 +754,21 @@ ACE_get_channel_type The ACE_get_channel_count() function returns the total number of configured analog input channels. It is the number of channels available for use as opposed to the theorical number of physical channels supported by the device. - + @return The ACE_get_channel_count() function returns the total number of input channels that were configured in the ACE configurator. The ACE_get_channel_count() function returns 0 if no input channels were configured. - + @code uint32_t inc; uint32_t nb_of_channels; ace_channel_handle_t current_channel; - + nb_of_channels = ACE_get_channel_count(); current_channel = ACE_get_first_channel(); - + for (inc = 0; inc < nb_of_channels; ++inc) { adc_result = ACE_get_ppe_sample( current_channel ); @@ -787,20 +787,20 @@ ACE_get_channel_count The ACE_get_first_channel() function returns the channel handle of one of the channel controlled by the ACE. This function is used to start iterating though the list of analog input channels handled by the ACE. - + @return The ACE_get_first_channel() function returns the first channel handle found in the ACE driver's internal channel handles list or INVALID_CHANNEL_HANDLE if there are no channels defined in the ACE configuration. - + @code uint32_t inc; uint32_t nb_of_channels; ace_channel_handle_t current_channel; - + nb_of_channels = ACE_get_channel_count(); current_channel = ACE_get_first_channel(); - + for (inc = 0; inc < nb_of_channels; ++inc) { adc_result = ACE_get_ppe_sample( current_channel ); @@ -819,7 +819,7 @@ ACE_get_first_channel The ACE_get_next_channel() returns the channel handle of the channel following the one passed as parameter. This function is used to iterate through the list of analog input channels handled by the ACE. - + @param channel_handle The channel_handle parameter identifies from which channel the driver should look in its channel handle list to return the next channel handle. The @@ -830,20 +830,20 @@ ACE_get_first_channel channel_handle returned by a previous call to ACE_get_first_channel(). The second and subsequent calls to ACE_get_next_channel() would typically use the channel_handle returned by a previous call to ACE_get_next_channel(). - + @return The ACE_get_next_channel() function returns the channel handle of the channel following the one passed as parameter or INVALID_CHANNEL_HANDLE if the end of the channels list has been reached. - + @code uint32_t inc; uint32_t nb_of_channels; ace_channel_handle_t current_channel; - + nb_of_channels = ACE_get_channel_count(); current_channel = ACE_get_first_channel(); - + for (inc = 0; inc < nb_of_channels; ++inc) { adc_result = ACE_get_ppe_sample( current_channel ); @@ -893,18 +893,18 @@ typedef uint16_t sse_sequence_handle_t; Sequencing Engine sequence identified by the sequence name passed as parameter. The sequence handler can then be used as parameter to other SSE sequence control functions to identify the sequence to control. - + @param p_sz_sequence_name The p_sz_sequence_name parameter is a pointer to a zero-terminated string containing the name of the sampling sequence for which we want to retrieve the handle. - + @return The ACE_get_sse_seq_handle() function returns the handle used to identify the sequence passed as parameter with other ACE driver sampling sequence control functions. It returns INVALID_SSE_SEQ_HANDLE if the sequence name passed as parameter is not recognized. - + @code sse_sequence_handle_t sse_seq_handle; sse_seq_handle = ACE_get_sse_seq_handle("ProcedureA"); @@ -925,7 +925,7 @@ ACE_get_sse_seq_handle The ACE_load_sse() function loads the ACE Sample Sequencing Engine (SSE) RAM with the microcode implementing the sampling sequence identified by the SSE sequence handler passed as parameter. - + @param sequence The sequence parameter is the SSE sequence handler identifying the sampling sequence to load into the ACE SSE. The value for this handler is retrieved @@ -943,7 +943,7 @@ void ACE_load_sse before the loop part of the sequence is started. You must ensure that the sampling sequence has been loaded into the ACE's SSE before calling this function. - + @param sequence The sequence parameter is the SSE sequence handler identifying the sampling sequence to load into the ACE SSE. The value for this handler is retrieved @@ -961,7 +961,7 @@ void ACE_start_sse intialization phase of the sequence. This function would typically be called after stopping the sampling sequence using the ACE_stop_see() function or with non-repeating sequences. - + @param sequence The sequence parameter is the SSE sequence handler identifying the sampling sequence to load into the ACE SSE. The value for this handler is retrieved @@ -975,7 +975,7 @@ void ACE_restart_sse /*-------------------------------------------------------------------------*//** The ACE_stop_sse() function stops execution of the Sample Sequencing Engine (SSE) sequence indentified by the sequence handle passed as parameter. - + @param sequence The sequence parameter is the SSE sequence handle identifying the sampling sequence to load into the ACE SSE. The value for this handler is retrieved @@ -991,7 +991,7 @@ void ACE_stop_sse sampling sequence identified by the sequence handle passed as parameter to resume execution. This function is typically used to restart execution of a sequence at the point where it was stopped through a call to ACE_stop_sse(). - + @param sequence The sequence parameter is the SSE sequence handler identifying the sampling sequence to load into the ACE SSE. The value for this handler is retrieved @@ -1008,7 +1008,7 @@ void ACE_resume_sse post processed samples within the ACE hardware. It is intended for use when switching between sampling sequences and using peripheral DMA. It avoids receiving stale samples generated as a result of a previous sampling sequence. - + The example below shows how this function can be used to ensure that no sample generated as a result of sampling sequence sequence_a will be generated once sampling sequence_b is started. Please note that it is important to stop the @@ -1019,7 +1019,7 @@ void ACE_resume_sse ACE_clear_sample_pipeline(); ACE_start_sse(sequence_b); @endcode - + The example below shows how to ensure that the first sample read through PDMA will be from the first channel in the sampling sequence. @code @@ -1028,9 +1028,9 @@ void ACE_resume_sse ACE_restart_sse(sequence_a); PDMA_start ( - PDMA_CHANNEL_0, - PDMA_ACE_PPE_DATAOUT, - (uint32_t)g_samples_buffer[g_pdma_buffer_idx], + PDMA_CHANNEL_0, + PDMA_ACE_PPE_DATAOUT, + (uint32_t)g_samples_buffer[g_pdma_buffer_idx], SAMPLES_BUFFER_SIZE ); @endcode @@ -1085,7 +1085,7 @@ typedef enum /*-------------------------------------------------------------------------*//** The ACE_enable_sse_irq() function enables the Sample Sequencing Engine (SSE) interrupt source specified as parameter to generate interrupts. - + @param sse_irq_id The sse_irq_id parameter identifies the SSE interrupt source controlled by this function. @@ -1098,7 +1098,7 @@ void ACE_enable_sse_irq /*-------------------------------------------------------------------------*//** The ACE_disable_sse_irq() function disables the Sample Sequencing Engine (SSE) interrupt source specified as parameter from generating interrupts. - + @param sse_irq_id The sse_irq_id parameter identifies the SSE interrupt source controlled by this function. @@ -1111,7 +1111,7 @@ void ACE_disable_sse_irq /*-------------------------------------------------------------------------*//** The ACE_clear_sse_irq() function clears the Sampling Sequencing Engine (SSE) interrupt specified as parameter. - + @param sse_irq_id The sse_irq_id parameter identifies the SSE interrupt source controlled by this function. @@ -1193,10 +1193,10 @@ typedef enum The ACE_set_comp_reference() function is used to select the reference input of a temperature monitor block comparator. The reference input of a temperature monitor can be an ADC direct input or one of the SDD's output. - + @param comp_id The comp_id parameter specifies the comparator for which to select the - reference input. Since only temperature monitor block comparators have a + reference input. Since only temperature monitor block comparators have a selectable reference input, allowed values are: - CMP1 - CMP3 @@ -1204,7 +1204,7 @@ typedef enum - CMP7 - CMP9 - CMP11 - + @param reference The reference parameter specify the signal that will be used as reference by the comparator. Allowed values are: @@ -1223,19 +1223,19 @@ void ACE_set_comp_reference The ACE_set_comp_hysteresis() function is used to set the hysteresis of a comparator. There are four possible hystereris settings: no hysteresis, +/-10mV, +/-30mV or +/-100mV. - + @param comp_id The comp_id parameter specifies the comparator for which this function will set the hyteresis. - + @param hysteresis - The hysteresis parameter specifies the hysteresis that will be applied to + The hysteresis parameter specifies the hysteresis that will be applied to the comparator's input. Allowed values are: - NO_HYSTERESIS - HYSTERESIS_10_MV - HYSTERESIS_30_MV - HYSTERESIS_100_MV - + */ void ACE_set_comp_hysteresis ( @@ -1246,7 +1246,7 @@ void ACE_set_comp_hysteresis /*-------------------------------------------------------------------------*//** The ACE_enable_comp() function is used to enable the comparator specified as parameter. - + @param comp_id The comp_id parameter specifies which comparator will be enabled by a call to this function. @@ -1259,7 +1259,7 @@ void ACE_enable_comp /*-------------------------------------------------------------------------*//** The ACE_disable_comp() function is used to disable the comparator specified as parameter. - + @param comp_id The comp_id parameter specifies which comparator will be disabled by a call to this function. @@ -1286,7 +1286,7 @@ void ACE_disable_comp - void ACE_Comp9_Rise_IRQHandler( void ); - void ACE_Comp10_Rise_IRQHandler( void ); - void ACE_Comp11_Rise_IRQHandler( void ); - + @param comp_id The comp_id parameter specifies which comparator will be enabled to generate rising interrupts. @@ -1300,7 +1300,7 @@ void ACE_enable_comp_rise_irq The ACE_disable_comp_rise_irq() function is used to disable interrupts from being generated when the positive input of the comparator specified as parameter rises above the negative input of the comparator. - + @param comp_id The comp_id parameter specifies which comparator will be disabled from generating rising interrupts. @@ -1313,11 +1313,11 @@ void ACE_disable_comp_rise_irq /*-------------------------------------------------------------------------*//** The ACE_clear_comp_rise_irq() function is used to clear rise interrupts. This function is typically called as part of the rise interrupt service routine. - + @param comp_id The comp_id parameter specifies the comparator for which to clear the rise interrupt. - + Example: @code void ACE_Comp1_Rise_IRQHandler( void ) @@ -1350,7 +1350,7 @@ void ACE_clear_comp_rise_irq - void ACE_Comp9_Fall_IRQHandler( void ); - void ACE_Comp10_Fall_IRQHandler( void ); - void ACE_Comp11_Fall_IRQHandler( void ); - + @param comp_id The comp_id parameter specifies which comparator will be enabled to generate fall interrupts. @@ -1364,7 +1364,7 @@ void ACE_enable_comp_fall_irq The ACE_disable_comp_fall_irq() function is used to disable interrupts from being generated when the positive input of the comparator specified as parameter falls below the negative input of the comparator. - + @param comp_id The comp_id parameter specifies which comparator will be disabled from generating fall interrupts. @@ -1377,11 +1377,11 @@ void ACE_disable_comp_fall_irq /*-------------------------------------------------------------------------*//** The ACE_clear_comp_fall_irq() function is used to clear fall interrupts. This function is typically called as part of the fall interrupt service routine. - + @param comp_id The comp_id parameter specifies the comparator for which to clear the fall interrupt. - + Example: @code void ACE_Comp1_Fall_IRQHandler( void ) @@ -1402,7 +1402,7 @@ void ACE_clear_comp_fall_irq status. It returns a 32 bit value indicating which comparators experienced a fall and/or rise event. These status bits can be cleared using the ACE_clear_comp_rise_irq() and ACE_clear_comp_fall_irq() functions. - + @return The return value is a 32 bit numnber where bits 0 to 11 indicate which comparator experienced a fall event and bits 21 to 23 indicate which @@ -1426,7 +1426,7 @@ uint32_t ACE_get_comp_status( void ); The ACE_is_hysteresis_flag() function indicates if an hysteresis is applied to the analog input sample value when determining the state of the flag identified as parameter. - + @param flag_handle The flag_handle parameter identifies one of the flags generated based on the value of an analog input channel. The available flag handle values can be @@ -1435,7 +1435,7 @@ uint32_t ACE_get_comp_status( void ); ACE_get_flag_handle() when the name of the flag is known, or by iterating though all flags associated with an analog input channel using the ACE_get_channel_first_flag() and ACE_get_channel_next_flag(). - + @return This function returns the value one if a hysteresis is applied to the channel sample values as part of determining the state of the flag identified as @@ -1450,7 +1450,7 @@ uint32_t ACE_is_hysteresis_flag The ACE_is_under_flag() function indicates whether a flag is triggered when the monitored analog input falls below the flag's threshold level or above the flag's threshold level. - + @param flag_handle The flag_handle parameter identifies one of the flags generated based on the value of an analog input channel. The available flag handle values can be @@ -1459,7 +1459,7 @@ uint32_t ACE_is_hysteresis_flag ACE_get_flag_handle() when the name of the flag is known, or by iterating though all flags associated with an analog input channel using the ACE_get_channel_first_flag() and ACE_get_channel_next_flag(). - + @return This function returns the value one if the flag identified as parameter triggers as a result of the monitored input falling below the flag's @@ -1482,7 +1482,7 @@ uint32_t ACE_is_under_flag over flag configured with a 100 millivolts hysteresis will result in the flag being asserted when the voltage reaches 1.1 volts and deasserted when the voltage falls below 0.9 volt. - + @param flag_handle The flag_handle parameter identifies one of the flags generated based on the value of an analog input channel. The available flag handle values can be @@ -1491,13 +1491,13 @@ uint32_t ACE_is_under_flag ACE_get_flag_handle() when the name of the flag is known, or by iterating though all flags associated with an analog input channel using the ACE_get_channel_first_flag() and ACE_get_channel_next_flag(). - + @param new_threshold The new_threshold parameter specifies the new threshold level that must be reached in order for the flag to be raised. The value of this parameter is the sample value resulting from a post processing engine conversion of the desired analog input threshold level. - + Example: The function below sets the threshold of the flag specified as parameter to 1 volt. @@ -1509,7 +1509,7 @@ uint32_t ACE_is_under_flag { uint16_t new_threshold; ace_channel_handle_t channel_handle; - + channel_handle = ACE_get_flag_channel(flag_handle); new_threshold = ACE_convert_from_mV(channel_handle, 1000); ACE_set_flag_threshold(flag_handle, new_threshold); @@ -1535,7 +1535,7 @@ void ACE_set_flag_threshold ACE_get_flag_handle() when the name of the flag is known, or by iterating though all flags associated with an analog input channel using the ACE_get_channel_first_flag() and ACE_get_channel_next_flag(). - + @param adc_hysteresis The adc_hysteresis parameter is the value to add and subtract to the threshold value to obtain the hysteresis high and low limits triggering flag @@ -1549,22 +1549,22 @@ void ACE_set_flag_threshold configurator for one of the analog inputs and one of the flags associated with that input. The method used to compute the adc_hysteresis value will work for all - input types including ABPS inputs where zero Volts is not equivalent to a + input types including ABPS inputs where zero Volts is not equivalent to a PPE sample value of zero. - + @code ace_channel_handle_t channel_handle; ace_flag_handle_t flag_handle; uint16_t adc_hysteresis; uint16_t upper_limit; uint16_t lower_limit; - + channel_handle = VoltageMonitor; flag_handle = VoltageMonitor_OVER_1V; - + upper_limit = ACE_convert_from_mV(channel_handle, 100); lower_limit = ACE_convert_from_mV(channel_handle, 0); - + if (upper_limit > lower_limit) { adc_hysteresis = upper_limit - lower_limit; @@ -1573,7 +1573,7 @@ void ACE_set_flag_threshold { adc_hysteresis = lower_limit - upper_limit; } - + ACE_set_flag_hysteresis(flag_handle, adc_hysteresis); @endcode */ @@ -1603,7 +1603,7 @@ ACE_set_flag_hysteresis ACE_get_flag_handle() when the name of the flag is known, or by iterating though all flags associated with an analog input channel using the ACE_get_channel_first_flag() and ACE_get_channel_next_flag(). - + @param assertion_value The assertion_value parameter is the Post Processing Engine sample value that must be reached for the flag, identified through the flag_handle parameter, @@ -1626,7 +1626,7 @@ void ACE_set_flag_assertion intended to be used where the threshold value is not centered within the hysteresis window. They allow specifying the actual threshold values at which the flag will be asserted and deasserted. - + @param flag_handle The flag_handle parameter identifies one of the flags generated based on the value of an analog input channel. The available flag handle values can be @@ -1635,7 +1635,7 @@ void ACE_set_flag_assertion ACE_get_flag_handle() when the name of the flag is known, or by iterating though all flags associated with an analog input channel using the ACE_get_channel_first_flag() and ACE_get_channel_next_flag(). - + @param assertion_value The assertion_value parameter is the Post Processing Engine sample value that must be reached for the flag, identified through the flag_handle @@ -1654,7 +1654,7 @@ void ACE_set_flag_deassertion analog input channel sample values when generating flags. It sets the hysteresis for all flags generated based on the value of the analog input channel identified by the channel handle passed as first parameter. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in @@ -1682,7 +1682,7 @@ ACE_set_channel_hysteresis /*-------------------------------------------------------------------------*//** * */ - + /*============================================================================== ================================== Flags ====================================== =============================================================================*/ @@ -1713,7 +1713,7 @@ ACE_set_channel_hysteresis by the flag name passed as parameter. The flag handle obtained through this function is then used as parameter to other flag control functions to identify which flag is to be controlled by the called function. - + @param p_sz_full_flag_name The p_sz_full_flag_name parameter is a pointer to a zero-terminated string holding the name of the flag as specified in the ACE configurator. The full @@ -1722,7 +1722,7 @@ ACE_set_channel_hysteresis For example, the full name for the flag called "CriticalOver" raised when the input channel called "MainSupply" reaches a critical level would be named "MainSupply:CriticalOver". - + @return The ACE_get_flag_handle() returns the flag handle associated with the flag name passed as parameter. It returns INVALID_FLAG_HANDLE when the flag name @@ -1738,7 +1738,7 @@ ACE_get_flag_handle The ACE_get_flag_status() function returns the current status of the flag specified as parameter. The flag is identified through the name specified in the ACE configurator when the flag was created. - + @param flag_handle The flag_handle parameter identifies one of the flags generated based on the value of an analog input channel. The available flag handle values can be @@ -1747,7 +1747,7 @@ ACE_get_flag_handle ACE_get_flag_handle() when the name of the flag is known, or by iterating though all flags associated with an analog input channel using the ACE_get_channel_first_flag() and ACE_get_channel_next_flag(). - + @return The ACE_get_flag_status() function returns one of the following values depending on the current status of the flag: @@ -1768,7 +1768,7 @@ ACE_get_flag_status sampled on the analog input channel identified as parameter are enabled to generate interrupts by this function. It enables flag interrupts both at the ACE PEE flag and Cortex-M3 interrupt controller levels. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -1791,7 +1791,7 @@ void ACE_enable_channel_flags_irq generating interrupts by this function. The interrupt is only disabled at the ACE PPE flag level in order to avoid disabling other cahnnel's flag interrupts which may happen to use the same ACE threshold interrupt line. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -1813,7 +1813,7 @@ void ACE_disable_channel_flags_irq sampled on the analog input channel identified as parameter are cleared by this function. This function would typically be used before enabling the flag interrupts in order to ignore past events. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -1833,7 +1833,7 @@ void ACE_clear_channel_flags_irq generated flags specified as parameter to interrupt the Cortex-M3 processor. It enables flag interrupts both at the ACE PPE flag and Cortex-M3 interrupt controller levels. - + @param flag_handle The flag_handle parameter identifies one of the flags generated based on the value of an analog input channel. The available flag handle values can be @@ -1853,7 +1853,7 @@ void ACE_enable_flag_irq generated flags from interrupting the Cortex-M3. The interrupt is only disabled at the ACE PPE flag level in order to avoid disabling other flags interrupts which may happen to use the same ACE threshold interrupt line. - + @param flag_handle The flag_handle parameter identifies one of the flags generated based on the value of an analog input channel. The available flag handle values can be @@ -1872,7 +1872,7 @@ void ACE_disable_flag_irq The ACE_clear_flag_irq() function clears the interrupt for the flag specified as parameter. This function would typically be used before enabling the flag interrupt in order to ignore past events. - + @param flag_handle The flag_handle parameter identifies one of the flags generated based on the value of an analog input channel. The available flag handle values can be @@ -1890,7 +1890,7 @@ void ACE_clear_flag_irq /*-------------------------------------------------------------------------*//** The ACE_get_flag_name() function returns the name of the flag identified by the flag handle passed as parameter. - + @param flag_handle The flag_handle parameter identifies one of the flags generated based on the value of an analog input channel. The available flag handle values can be @@ -1899,7 +1899,7 @@ void ACE_clear_flag_irq ACE_get_flag_handle() when the name of the flag is known, or by iterating though all flags associated with an analog input channel using the ACE_get_channel_first_flag() and ACE_get_channel_next_flag(). - + @return The ACE_get_flag_name() function returns a pointer to a zero-terminated string containing the name of the flag identified by the flag handle passed @@ -1915,7 +1915,7 @@ ACE_get_flag_name The ACE_get_flag_channel() function returns the handle of the channel monitored in order to generate the flag identified by the flag handle passed as parameter. - + @param flag_handle The flag_handle parameter identifies one of the flags generated based on the value of an analog input channel. The available flag handle values can be @@ -1924,7 +1924,7 @@ ACE_get_flag_name ACE_get_flag_handle() when the name of the flag is known, or by iterating though all flags associated with an analog input channel using the ACE_get_channel_first_flag() and ACE_get_channel_next_flag(). - + @return The ACE_get_flag_channel() function returns a channel handle identifying the analog input channel monitored by the flag passed as parameter. @@ -1940,7 +1940,7 @@ ACE_get_flag_channel associated with the input channel specified by the channel_handle parameter. It indicates how many flags are generated based on the value of the specified analog input channel. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in @@ -1949,13 +1949,13 @@ ACE_get_flag_channel ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @return The ACE_get_channel_flag_count() function returns the total number of flags that are generated based on the value of the specified analog input channel. The ACE_get_channel_flag_count() function returns 0 if no input channels were configured. - + Example @code uint32_t inc; @@ -1963,10 +1963,10 @@ ACE_get_flag_channel uint16_t flag_iterator; ace_flag_handle_t current_flag; ace_channel_handle_t channel_handle; - + nb_of_flags = ACE_get_channel_flag_count(channel_handle); current_flag = ACE_get_channel_first_flag(channel_handle, &flag_iterator); - + for (inc = 0; inc < nb_of_flags; ++inc) { current_flag = ACE_get_channel_next_flag(channel_handle, &flag_iterator); @@ -1987,7 +1987,7 @@ ACE_get_channel_flag_count pointed to by the second function parameter. The iterator can be used subsequently as a parameter to the ACE_get_channel_next_flag() function to iterate through all flags associated with the analog input channel. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -1996,21 +1996,21 @@ ACE_get_channel_flag_count ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param iterator The iterator parameter is a pointer to a uint16_t iterator variable. The value of the iterator variable will be set by the ACE_get_channel_first_flag() functions so that it can be used in subsequent calls to ACE_get_channel_next_flag() to keep track of the current location in the list of flags associated with the analog input channel. - + @return The ACE_get_channel_first_flag() function returns a flag handle identifying one of the flags generated based on the value of the analog input channel identified by the channel_handle parameter. It returns INVALID_FLAG_HANDLE if no flags are generated based on the analog input channel input or if the channel handle is invalid. - + Example @code uint32_t inc; @@ -2018,10 +2018,10 @@ ACE_get_channel_flag_count uint16_t flag_iterator; ace_flag_handle_t current_flag; ace_channel_handle_t channel_handle; - + nb_of_flags = ACE_get_channel_flag_count(channel_handle); current_flag = ACE_get_channel_first_flag(channel_handle, &flag_iterator); - + for (inc = 0; inc < nb_of_flags; ++inc) { current_flag = ACE_get_channel_next_flag(channel_handle, &flag_iterator); @@ -2041,7 +2041,7 @@ ACE_get_channel_first_flag associated with the analog input channel identified by the channel handle passed as parameter. The retrieved flag handle is the next one in the driver's internal flag list based on the iterator parameter. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -2050,14 +2050,14 @@ ACE_get_channel_first_flag ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param iterator The iterator parameter is a pointer to a uint16_t iterator variable. The value of the iterator variable will be set by the ACE_get_channel_first_flag() functions so that it can be used in subsequent calls to ACE_get_channel_next_flag() to keep track of the current location in the list of flags associated with the analog input channel. - + Example @code uint32_t inc; @@ -2065,10 +2065,10 @@ ACE_get_channel_first_flag uint16_t flag_iterator; ace_flag_handle_t current_flag; ace_channel_handle_t channel_handle; - + nb_of_flags = ACE_get_channel_flag_count(channel_handle); current_flag = ACE_get_channel_first_flag(channel_handle, &flag_iterator); - + for (inc = 0; inc < nb_of_flags; ++inc) { current_flag = ACE_get_channel_next_flag(channel_handle, &flag_iterator); @@ -2089,12 +2089,12 @@ ACE_get_channel_next_flag with the ACE driver and associated with a particular flag through the ACE_register_flag_isr() function. The ACE driver will call the flag handler function when the associated flag is raised. - + Declaring and Implementing PPE Flag Handler Functions PPE flag handler functions should follow the following prototype: void my_flag_handler ( ace_flag_handle_t flag_handle ); The actual name of the PPE flag handler is unimportant. You can use any name of - your choice for the PPE flag handler. + your choice for the PPE flag handler. The flag_handle parameter passes the handle of the raised flag to the flag handler function. */ @@ -2104,7 +2104,7 @@ typedef void (*flag_isr_t)( ace_flag_handle_t flag_handle ); The ACE_register_flag_isr() function is used to register a handler function with the ACE driver. The registered function will be called by the ACE driver when the associated flag is raised by the ACE post processing engine. - + @param flag_handle The flag_handle parameter identifies one of the flags generated based on the value of an analog input channel. The available flag handle values can be @@ -2113,33 +2113,33 @@ typedef void (*flag_isr_t)( ace_flag_handle_t flag_handle ); ACE_get_flag_handle() when the name of the flag is known, or by iterating though all flags associated with an analog input channel using the ACE_get_channel_first_flag() and ACE_get_channel_next_flag(). - + @param flag_isr The flag_isr parameter is a pointer to a flag handler function with the - following prototype: - void handler_function_name(ace_flag_handle_t flag_handle) + following prototype: + void handler_function_name(ace_flag_handle_t flag_handle) The flag handler function is called by the ACE driver as part of the relevant post processing engine flag interrupt service routine. It does not need to handle flag interrupt clearing as this is done by the ACE driver. - + @code void my_critical_handler( void ); - + void system_init( void ) { ace_flag_handle_t flag_handle; - + flag_handle = ACE_get_flag_handle( "MainSupply:CriticalLevel" ); ACE_register_flag_isr( flag_handle, my_critical_handler ); ACE_enable_flag_irq( flag_handle ); } - + void my_critical_handler( ace_flag_handle_t flag_handle ) { panic( flag_handle ); } - + @endcode */ void ACE_register_flag_isr @@ -2155,7 +2155,7 @@ void ACE_register_flag_isr channel through the ACE_register_channel_flags_isr() function. The ACE driver will call the channel flags handler function when one of the flags for the associated ADC input channel is raised. - + Declaring and Implementing PPE Channel Flag Handler Functions PPE channel flag handler functions should follow the following prototype: void my_channel_flag_handler ( ace_flag_handle_t flag_handle ); @@ -2172,7 +2172,7 @@ typedef void (*channel_flag_isr_t)( ace_flag_handle_t flag_handle ); handler will be called by the ACE driver when one of the flag generated based on the value of the analog input channel identified by the channel handle passed as parameter is asserted. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -2181,30 +2181,30 @@ typedef void (*channel_flag_isr_t)( ace_flag_handle_t flag_handle ); ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param channel_flag_isr The channel_flag_isr parameter is pointer to a function taking a flag handle - as parameter. - void handler_function_name(ace_flag_handle_t flag_handle) + as parameter. + void handler_function_name(ace_flag_handle_t flag_handle) The flag handler function is called by the ACE driver as part of the relevant post processing engine flag interrupt service routine. It does not need to handle flag interrupt clearing as this is done by the ACE driver. - + Example The example below demonstrates the use of the ACE_register_channel_flags_isr() function in a system where the ACE is configured to have an analog input channels named "MainSupply" with one flag named "Critical" generated based on the value of "MainSupply" channel. The names "MainSupply" and "Critical" - were user selected in the ACE configurator. + were user selected in the ACE configurator. @code void main_supply_handler (ace_flag_handle_t flag_handle); - + void system_init(void) { ACE_register_channel_flag_isr(MainSupply, main_supply_handler); ACE_enable_channel_flags_irq(MainSupply); } - + void main_supply_handler (ace_flag_handle_t flag_handle) { if (MainSupply_Critical == flag_handle) @@ -2212,7 +2212,7 @@ typedef void (*channel_flag_isr_t)( ace_flag_handle_t flag_handle ); panic(flag_handle); } } - + @endcode */ void ACE_register_channel_flags_isr @@ -2227,12 +2227,12 @@ void ACE_register_channel_flags_isr registered with the ACE driver through the ACE_register_global_flags_isr() function. The ACE driver will call the global flags handler function when any flag for any ADC input channel is raised. - + Declaring and Implementing Global Flag Handler Functions PPE global flag handler functions should follow the following prototype: - void my_global_flag_handler( - ace_flag_handle_t flag_handle, - ace_channel_handle_t channel_handle + void my_global_flag_handler( + ace_flag_handle_t flag_handle, + ace_channel_handle_t channel_handle ); The actual name of the PPE global flag handler is unimportant. You can use any name of your choice for the PPE global flag handler. The flag_handle parameter @@ -2247,7 +2247,7 @@ typedef void (*global_flag_isr_t)( ace_flag_handle_t flag_handle, ace_channel_ha The ACE_register_global_flags_isr() function is used to register a global flag handler function with the ACE driver. The registered global handler will be called when any flag interrupt is generated. - + @param global_flag_isr The global_flag_isr parameter is a pointer to a function taking a flag handle and channel handle as parameter. @@ -2279,10 +2279,10 @@ void ACE_register_global_flags_isr ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param sample_value The sample_value parameter is the result of an analog to digital conversion. - + @return The ACE_convert_adc_input_to_mV() returns the number of millivolts derived from the ADC sample value passed as parameter. @@ -2296,7 +2296,7 @@ uint32_t ACE_convert_adc_input_to_mV /*-------------------------------------------------------------------------*//** The ACE_convert_to_mV() function converts a PPE sample value into milli-Volts. It handles prescaling adjusments based on ACE configuration for ABPS inputs. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -2305,10 +2305,10 @@ uint32_t ACE_convert_adc_input_to_mV ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param sample_value The sample_value parameter is the result of an analog to digital conversion. - + @return The ACE_convert_to_mV() returns the number of millivolts derived from the PPE sample value passed as parameter. The returned value can be either @@ -2324,7 +2324,7 @@ int32_t ACE_convert_to_mV The ACE_convert_to_mA() function converts a PPE sample value into milli-Amps. The result of the conversion is only meaningful if the PPE sample value results from the conversion of a current monitor input. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -2333,11 +2333,11 @@ int32_t ACE_convert_to_mV ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param sample_value The sample_value parameter is the result of an analog to digital conversion of the voltage generated by a current monitor analog block. - + @return The ACE_convert_to_mA() returns the number of milliamps derived from the PPE sample value passed as parameter. @@ -2352,7 +2352,7 @@ uint32_t ACE_convert_to_mA The ACE_convert_to_Kelvin() function converts a PPE sample value into degrees Kelvin. The result of the conversion is only meaningful if the PPE sample value results from the conversion of a temperature monitor input. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -2361,11 +2361,11 @@ uint32_t ACE_convert_to_mA ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param sample_value The sample_value parameter is the result of an analog to digital conversion of the voltage generated by a temperature monitor analog block. - + @return The ACE_convert_to_Kelvin() returns the number of degrees Kelvin derived from the PPE sample value passed as parameter. @@ -2380,7 +2380,7 @@ uint32_t ACE_convert_to_Kelvin The ACE_convert_to_Celsius() function converts a PPE sample value into tenths of degrees Celsius. The result of the conversion is only meaningful if the PPE sample value results from the conversion of a temperature monitor input. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -2389,11 +2389,11 @@ uint32_t ACE_convert_to_Kelvin ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param sample_value The sample_value parameter is the result of an analog to digital conversion of the voltage generated by a temperature monitor analog block. - + @return The ACE_convert_to_Celsius() returns the number of tenths of degrees Celsius derived from the PPE sample value passed as parameter. @@ -2408,7 +2408,7 @@ int32_t ACE_convert_to_Celsius The ACE_convert_to_Fahrenheit() function converts a PPE sample value into degrees Fahrenheit. The result of the conversion is only meaningful if the PPE sample value results from the conversion of a temperature monitor input. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -2417,11 +2417,11 @@ int32_t ACE_convert_to_Celsius ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param sample_value The sample_value parameter is the result of an analog to digital conversion of the voltage generated by a temperature monitor analog block. - + @return The ACE_convert_to_Fahrenheit() returns the number of degrees Fahrenheit derived from the PPE sample value passed as parameter. @@ -2439,7 +2439,7 @@ int32_t ACE_convert_to_Fahrenheit This function is intended for use when directly controlling the ADC, not when using samples read from the PPE. It does not account for prescaling taking place before the ADC hardware input. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -2448,11 +2448,11 @@ int32_t ACE_convert_to_Fahrenheit ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param voltage The voltage parameter is the milli-Volts voltage value for which we want this function to return the associated ADC sample result value. - + @return The ACE_convert_mV_to_adc_value() returns the ADC sample value that would be produced if the analog input channel identified by channel_handle was set to @@ -2470,7 +2470,7 @@ uint16_t ACE_convert_mV_to_adc_value voltage value on the analog input channel specified as parameter. This function handles prescaling adjusments based on ACE configuration for ABPS inputs. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -2479,11 +2479,11 @@ uint16_t ACE_convert_mV_to_adc_value ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param voltage The voltage parameter is the milli-Volts voltage value for which we want this function to return the associated PPE sample result value. - + @return The ACE_convert_from_mV() returns the PPE sample value that would be produced if the analog input channel identified by channel_handle was set to the @@ -2501,7 +2501,7 @@ uint16_t ACE_convert_from_mV current value on the analog input channel specified as parameter. The result of the conversion is only meaningful if the analog input channel specified as parameter is configured as a current monitoring channel. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -2510,11 +2510,11 @@ uint16_t ACE_convert_from_mV ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param current The current parameter is the milli-Amps current value for which we want this function to return the associated PPE sample result value. - + @return The ACE_convert_from_mA() returns the PPE sample value that would be produced if the analog input channel identified by channel_handle was set to the @@ -2532,7 +2532,7 @@ uint16_t ACE_convert_from_mA temperature value on the analog input channel specified as parameter. The result of the conversion is only meaningful if the analog input channel specified as parameter is configured as a temperature monitoring channel. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -2541,11 +2541,11 @@ uint16_t ACE_convert_from_mA ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param temperature The temperature parameter is the degrees Kelvin temperature value for which we want this function to return the associated PPE sample result value. - + @return The ACE_convert_from_Kelvin() returns the PPE sample value that would be produced if the analog input channel identified by channel_handle was set to @@ -2563,7 +2563,7 @@ uint16_t ACE_convert_from_Kelvin temperature value on the analog input channel specified as parameter. The result of the conversion is only meaningful if the analog input channel specified as parameter is configured as a temperature monitoring channel. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -2572,11 +2572,11 @@ uint16_t ACE_convert_from_Kelvin ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param temperature The temperature parameter is the degrees Celsius temperature value for which we want this function to return the associated PPE sample result value. - + @return The ACE_convert_from_Celsius() returns the PPE sample value that would be produced if the analog input channel identified by channel_handle was set to @@ -2594,7 +2594,7 @@ uint16_t ACE_convert_from_Celsius this temperature value on the analog input channel specified as parameter. The result of the conversion is only meaningful if the analog input channel specified as parameter is configured as a temperature monitoring channel. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in the @@ -2603,11 +2603,11 @@ uint16_t ACE_convert_from_Celsius ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param temperature The temperature parameter is the degrees Fahrenheit temperature value for which we want this function to return the associated PPE sample result value. - + @return The ACE_convert_from_Fahrenheit() returns the PPE sample value that would be produced if the analog input channel identified by channel_handle was set to @@ -2630,7 +2630,7 @@ uint16_t ACE_convert_from_Fahrenheit The PDMA sampling values are obtained by configuring the PDMA controller to transfer data from the ACE into a memory buffer. The ACE_translate_pdma_value() function is used to interpret the content of that memory buffer. - + Please note that the translation of PDMA data containing raw ADC values from ABPS inputs will result in sample values with an unexpected polarity. The returned sample value will have the opposite polarity to the actual analog @@ -2638,28 +2638,28 @@ uint16_t ACE_convert_from_Fahrenheit the analog front end that are normally hidden by the PPE processing of ADC raw samples. The translation of raw ADC values from analog inputs other than ABPS inputs will result in correct sample values. - + @param pdma_value The pdma_value parameter is a 32-bit value received from the ACE through a - peripheral DMA transfer. - + peripheral DMA transfer. + @param channel_id The channel_id parameter is a pointer to an ADC channel ID variable. It is used to return the ID of the ADC channel from which the PPE sample value was generated from. This parameter can be set to zero if retrieving the channel ID is not required. - + @return The ACE_translate_pdma_value() returns the PPE sample value extracted from the PDMA sampling value. - + Example: @code uint16_t ppe_value; uint16_t pdma_value; adc_channel_id_t channel_id; ace_channel_handle_t channel_handle; - + pdma_value = get_next_pdma_ace_sample(); ppe_value = ACE_translate_pdma_value(pdma_value, &channel_id); channel_handle = ACE_get_input_channel_handle(channel_id); @@ -2668,7 +2668,7 @@ uint16_t ACE_convert_from_Fahrenheit display_value(channel_handle, ppe_value); } @endcode - + */ uint16_t ACE_translate_pdma_value ( @@ -2686,7 +2686,7 @@ uint16_t ACE_translate_pdma_value - ACE_get_default_c_offset() - ACE_set_linear_transform() The post processing engine performs a linear transform on analog input samples - obtained from the sample sequencing engine. The main purpose of this linear + obtained from the sample sequencing engine. The main purpose of this linear transform is to apply part specific factory calibration to the analog samples in order to achieve high accuracy. A second user specified linear transform can also be optionally applied to the analog samples. This second linear @@ -2712,7 +2712,7 @@ uint16_t ACE_translate_pdma_value factor of the user defined linear transform applied by the post processing engine to analog samples. The user defined linear transform m factor default value is selected in the ACE configurator tool. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in @@ -2721,7 +2721,7 @@ uint16_t ACE_translate_pdma_value to ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @return The ACE_get_default_m_factor() function returns the user transform m factor default value. It is a signed 16-bit number representing a factor in the @@ -2738,7 +2738,7 @@ int16_t ACE_get_default_m_factor offset of the user defined linear transform applied by the post processing engine to analog samples. The user defined linear transform c offset default value is selected in the ACE configurator tool. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in @@ -2747,7 +2747,7 @@ int16_t ACE_get_default_m_factor to ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @return The ACE_get_default_c_offset() function returns the user linear transform’s c offset default value. It is a signed 16-bit number representing a factor @@ -2764,7 +2764,7 @@ int16_t ACE_get_default_c_offset linear transform applied to analog input samples by the post processing engine. The linear transform is of the form y = m.x + b where the m factor and c offset are in the range -2 to +1.99993896484375. - + @param channel_handle The channel_handle parameter identifies one of the analog input channels monitored by the ACE. The available channel handle values can be found in @@ -2773,27 +2773,27 @@ int16_t ACE_get_default_c_offset to ACE_get_channel_handle() when the name of the channel is known, or by iterating though all analog input channel using the ACE_get_first_channel() and ACE_get_next_channel(). - + @param m2 The m2 parameter specifies the user defined transform’s m factor. It is a signed 16-bit number representing a factor in the range -2 to +1.99993896484375. The value of the m2 factor is obtained by multiplying the parameter’s absolute value by 2^-14. For example, a value of 0x7000 represents a 1.75 factor and a value of 0xE000 represents a -0.5 factor. - + @param c2 The c2 parameter specifies the user defined transform’s c offset. It is a signed 16-bit number representing an offset in the range -2 to +1.99993896484375. The value of the c2 offset is obtained by multiplying the parameter’s absolute value by 2^-14. For example, a value of 0x1000 represents a 0.25 offset and a value of 0xB000 represents a -1.25 offset. - + @code void reset_to_default(ace_channel_handle_t channel_handle) { int16_t m; int16_t c; - + m = ACE_get_default_m_factor(channel_handle); c = ACE_get_default_c_offset(channel_handle); ACE_set_linear_transform(channel_handle, m, c); @@ -2808,7 +2808,7 @@ void ACE_set_linear_transform ); /** @} */ - + #ifdef __cplusplus } #endif -- 2.39.5