Skip to content

Commit

Permalink
Import ArcCore 20.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
openAUTOSAR committed Feb 23, 2020
1 parent 00fd4cc commit 32fbdfe
Show file tree
Hide file tree
Showing 237 changed files with 6,417 additions and 9,396 deletions.
9 changes: 9 additions & 0 deletions Peripherals/IoHwAb/IoHwAb.mod.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# IO Hardware Abstraction
obj-$(USE_IOHWAB) += IoHwAb_Digital.o
obj-$(USE_IOHWAB) += IoHwAb_Analog.o
obj-$(USE_IOHWAB) += IoHwAb_Pwm.o

vpath-$(USE_IOHWAB) += $(ROOTDIR)/Peripherals/IoHwAb/src
inc-$(USE_IOHWAB) += $(ROOTDIR)/Peripherals/IoHwAb/src
inc-$(USE_IOHWAB) += $(ROOTDIR)/Peripherals/IoHwAb/inc

144 changes: 144 additions & 0 deletions Peripherals/IoHwAb/inc/IoHwAb.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/*-------------------------------- Arctic Core ------------------------------
* Copyright (C) 2013, ArcCore AB, Sweden, www.arccore.com.
* Contact: <contact@arccore.com>
*
* You may ONLY use this file:
* 1)if you have a valid commercial ArcCore license and then in accordance with
* the terms contained in the written license agreement between you and ArcCore,
* or alternatively
* 2)if you follow the terms found in GNU General Public License version 2 as
* published by the Free Software Foundation and appearing in the file
* LICENSE.GPL included in the packaging of this file or here
* <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>
*-------------------------------- Arctic Core -----------------------------*/



#ifndef IOHWAB_H_
#define IOHWAB_H_

#define IOHWAB_SW_MAJOR_VERSION 1u
#define IOHWAB_SW_MINOR_VERSION 0u
#define IOHWAB_SW_PATCH_VERSION 0u

#define IOHWAB_MODULE_ID 254u
#define IOHWAB_VENDOR_ID 60u

#if defined(CFG_IOHWAB_USE_SERVICE_COMPONENT)
#include "Rte_Type.h"
#endif

#include "IoHwAb_Cfg.h"
#include "IoHwAb_Types.h"
#include "IoHwAb_Analog.h"
#include "IoHwAb_Digital.h"
#include "IoHwAb_Pwm.h"


#if (IOHWAB_USING_ADC == STD_ON)
#if defined(USE_ADC)
#include "Adc.h"
#else
#error "ADC Module is needed by IOHWAB"
#endif
#endif

#if (IOHWAB_USING_PWM == STD_ON)
#if defined(USE_PWM)
#include "Pwm.h"
#else
#error "PWM Module is needed by IOHWAB"
#endif
#endif

#if (IOHWAB_USING_DIO == STD_ON)
#if defined(USE_DIO)
#include "Dio.h"
#else
#error "DIO Module is needed by IOHWAB"
#endif
#endif


#define IOHWAB_UNLOCKED 0u
#define IOHWAB_LOCKED 1u

/******************************************** API ids *********************************************/

#define IOHWAB_INIT_ID 0x10u

#define IOHWAB_ANALOG_READ_ID 0x20u
#define IOHWAB_ANALOG_IO_CONTROL_ID 0x21u

#define IOHWAB_DIGITAL_READ_ID 0x30u
#define IOHWAB_DIGITAL_WRITE_ID 0x31u
#define IOHWAB_DIGITAL_WRITE_READBACK_ID 0x32u
#define IOHWAB_DIGITAL_IO_CONTROL_ID 0x33u

#define IOHWAB_PWMDUTY_SET_ID 0x40u
#define IOHWAB_PWMFREQUENCYANDDUTY_SET_ID 0x41u
#define IOHWAB_PWM_IO_CONTROL_ID 0x42u

#define IOHWAB_CAPTURE_GET_ID 0x50u

/***************************************** DET error ids ******************************************/

#define IOHWAB_E_INIT 0x01u

#define IOHWAB_E_PARAM_SIGNAL 0x11u
#define IOHWAB_E_PARAM_DUTY 0x12u
#define IOHWAB_E_PARAM_LEVEL 0x13u
#define IOHWAB_E_PARAM_ACTION 0x14u
#define IOHWAB_E_PARAM_PTR 0x15u

/******************************************* DET macros *******************************************/

#if (IOHWAB_DEV_ERROR_DETECT == STD_ON)

#define IOHWAB_DET_REPORT_ERROR(api, error) \
(void)Det_ReportError(IOHWAB_MODULE_ID, 0, api, error); \


#define IOHWAB_VALIDATE(expression, api, error) \
if ( !(expression) ) { \
IOHWAB_DET_REPORT_ERROR(api, error); \
} \


#define IOHWAB_VALIDATE_RETURN(expression, api, error, rv) \
if ( !(expression) ) { \
IOHWAB_DET_REPORT_ERROR(api, error); \
return rv; \
} \

#else /* IOHWAB_DEV_ERROR_DETECT */

#define IOHWAB_DET_REPORT_ERROR(api, error)
#define IOHWAB_VALIDATE(expression, api, error)
#define IOHWAB_VALIDATE_RETURN(expression, api, error, rv)

#endif /* IOHWAB_DEV_ERROR_DETECT */


#define IoHwAb_LockSave(_x) Irq_Save(_x)
#define IoHwAb_LockRestore(_x) Irq_Restore(_x)

void IoHwAb_Init( void );
void IoHwAb_MainFunction( void );


#if (IOHWAB_USING_ADC == STD_ON)

/* If using ADC, IoHwAb must implement a read function for Adc values */
Adc_ValueGroupType IoHwAb_Adc_ReadSignal( Adc_GroupType group, Adc_ChannelType channel, IoHwAb_StatusType * status );

#endif


#if (IOHWAB_USING_PWM_FREQ == STD_ON)

/* If using PWM with frequency, IoHwAb must implement conversion function from frequency to period */
Pwm_PeriodType IoHwAb_Pwm_ConvertToPeriod(Pwm_ChannelType channel, IoHwAb_FrequencyType freq);

#endif
#endif /* IOHWAB_H_ */
83 changes: 83 additions & 0 deletions Peripherals/IoHwAb/inc/IoHwAb_Internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*-------------------------------- Arctic Core ------------------------------
* Copyright (C) 2013, ArcCore AB, Sweden, www.arccore.com.
* Contact: <contact@arccore.com>
*
* You may ONLY use this file:
* 1)if you have a valid commercial ArcCore license and then in accordance with
* the terms contained in the written license agreement between you and ArcCore,
* or alternatively
* 2)if you follow the terms found in GNU General Public License version 2 as
* published by the Free Software Foundation and appearing in the file
* LICENSE.GPL included in the packaging of this file or here
* <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>
*-------------------------------- Arctic Core -----------------------------*/


#ifndef IOHWAB_INTERNAL_H_
#define IOHWAB_INTERNAL_H_

#include "Cpu.h"
#if defined(USE_DEM)
#include "Dem.h"
#include "Rte_Dem_Type.h"
#endif

#if defined(USE_DET)
#include "Det.h"
#endif

/**
* Takes a ptr to an array of big endian data and returns a uint32
* @param src
* @return converted data
*/
static inline uint32 GetU32FromPtr(uint8* src) {
uint32 value = *(src) << 24u;
value = (*(src + 1) << 16u) | value;
value = (*(src + 2) << 8u) | value;
value = (*(src + 3)) | value;
return value;
}

/**
* Takes a value and copies that value to an array of big endian data
* @param value
* @param dst
*/
static inline void SetU32ToPtr(uint32 value, uint8* dst) {
*(dst) = (value & 0xFF000000) >> 24u ;
*(dst + 1) = (value & 0x00FF0000) >> 16u ;
*(dst + 2) = (value & 0x0000FF00) >> 8u ;
*(dst + 3) = (value & 0x000000FF);
}


/**
* Takes a ptr to an array of big endian data and returns a sint32
* @param src
* @return converted data
*/
static inline sint32 GetS32FromPtr(uint8* src) {
sint32 value = *(src) << 24u;
value = (*(src + 1) << 16u) | value;
value = (*(src + 2) << 8u) | value;
value = (*(src + 3)) | value;
return value;
}

/**
* Takes a value and copies that value to an array of big endian data
* @param value
* @param dst
*/
static inline void SetS32ToPtr(sint32 value, uint8* dst) {
*(dst) = (value & 0xFF000000) >> 24 ;
*(dst + 1) = (value & 0x00FF0000) >> 16 ;
*(dst + 2) = (value & 0x0000FF00) >> 8 ;
*(dst + 3) = (value & 0x000000FF);
}




#endif /* IOHWAB_INTERNAL_H_ */
78 changes: 78 additions & 0 deletions Peripherals/IoHwAb/inc/IoHwAb_Types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*-------------------------------- Arctic Core ------------------------------
* Copyright (C) 2013, ArcCore AB, Sweden, www.arccore.com.
* Contact: <contact@arccore.com>
*
* You may ONLY use this file:
* 1)if you have a valid commercial ArcCore license and then in accordance with
* the terms contained in the written license agreement between you and ArcCore,
* or alternatively
* 2)if you follow the terms found in GNU General Public License version 2 as
* published by the Free Software Foundation and appearing in the file
* LICENSE.GPL included in the packaging of this file or here
* <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>
*-------------------------------- Arctic Core -----------------------------*/



#ifndef IOHWAB_TYPES_H_
#define IOHWAB_TYPES_H_

#include "Std_Types.h"

/* Digital levels */
typedef uint8 IoHwAb_LevelType;

/* Analog values base type */
typedef sint32 IoHwAb_AnalogValueType;

#if !defined(CFG_IOHWAB_USE_SERVICE_COMPONENT)
typedef uint32 IoHwAb_SignalType;
#endif

/* Duty cycle type */
typedef uint32 IoHwAb_DutyType;
#define IOHWAB_DUTY_MIN (IoHwAb_DutyType)0u /* 0% */
#define IOHWAB_DUTY_MAX (IoHwAb_DutyType)0x8000u /* 100% */

/* Frequency type (Hz) */
typedef uint32 IoHwAb_FrequencyType;

/* ISO14229, IoControl */
#define IOHWAB_RETURNCONTROLTOECU 0
#define IOHWAB_RESETTODEFAULT 1
#define IOHWAB_FREEZECURRENTSTATE 2
#define IOHWAB_SHORTTERMADJUST 3

/** Enum literals for DigitalLevel */
#ifndef IOHWAB_LOW
#define IOHWAB_LOW 0U
#endif /* IOHWAB_LOW */

#ifndef IOHWAB_HIGH
#define IOHWAB_HIGH 1U
#endif /* IOHWAB_HIGH */

/** Enum literals for SignalQuality */
#ifndef IOHWAB_INIVAL
#define IOHWAB_INIVAL 0U
#endif /* IOHWAB_INIVAL */

#ifndef IOHWAB_ERR
#define IOHWAB_ERR 1U
#endif /* IOHWAB_ERR */

#ifndef IOHWAB_BAD
#define IOHWAB_BAD 2U
#endif /* IOHWAB_BAD */

#ifndef IOHWAB_GOOD
#define IOHWAB_GOOD 3U
#endif /* IOHWAB_GOOD */

typedef uint8 IoHwAb_QualityType;

typedef struct {
uint8 quality;
} IoHwAb_StatusType;

#endif /* IOHWAB_TYPES_H_ */
8 changes: 8 additions & 0 deletions Peripherals/SafeIoHwAb/SafeIoHwAb.mod.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Safe IO Hardware Abstraction
vpath-$(USE_SAFEIOHWAB) += $(ROOTDIR)/Peripherals/SafeIoHwAb/src
inc-$(USE_SAFEIOHWAB) += $(ROOTDIR)/Peripherals/SafeIoHwAb/inc
obj-$(USE_SAFEIOHWAB) += SafeIoHwAb_Digital.o
obj-$(USE_SAFEIOHWAB) += SafeIoHwAb_Analog.o
obj-$(USE_SAFEIOHWAB) += SafeIoHwAb_Pwm.o
obj-$(USE_SAFEIOHWAB) += SafeIoHwAb_Cfg.o
obj-$(USE_SAFEIOHWAB) += SafeIoHwAb_Generic.o
Loading

0 comments on commit 32fbdfe

Please sign in to comment.