Skip to content

Commit

Permalink
Updated IoHwAb
Browse files Browse the repository at this point in the history
  • Loading branch information
mahi committed Jan 16, 2012
1 parent cf24d91 commit 49ae4b9
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 13 deletions.
6 changes: 1 addition & 5 deletions arch/ppc/mpc55xx/drivers/Dio.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,17 @@ static int Channel_Group_Config_Contains(const Dio_ChannelGroupType* _channelGro

Dio_LevelType Dio_ReadChannel(Dio_ChannelType channelId)
{
Dio_LevelType level;
Dio_LevelType level = STD_LOW;
VALIDATE_CHANNEL(channelId, DIO_READCHANNEL_ID);
if (SIU.PCR[channelId].B.IBE) {
// Read level from SIU.
if (SIU.GPDI [channelId].R) {
level = STD_HIGH;
} else {
level = STD_LOW;
}
} else if(SIU.PCR[channelId].B.OBE) {
// Read level from SIU.
if (SIU.GPDO [channelId].R) {
level = STD_HIGH;
} else {
level = STD_LOW;
}
}
#if ( DIO_DEV_ERROR_DETECT == STD_ON )
Expand Down
6 changes: 4 additions & 2 deletions common/cirq_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@
#include <assert.h>
#endif

#if defined(__GNUC__)
#define MEMCPY(_x,_y,_z) __builtin_memcpy(_x,_y,_z)
//#define MEMCPY(_x,_y,_z) memcpy(_x,_y,_z)

#else
#define MEMCPY(_x,_y,_z) memcpy(_x,_y,_z)
#endif

/* TODO: Not threadsafe, add DisableAllInterrts()/EnableAllInterrupts() */

Expand Down
8 changes: 8 additions & 0 deletions include/EcuM.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#if defined(USE_COM)
#include "ComStack_Types.h"
#endif
#if defined(USE_RTE)
#include "Rte_Types.h"
#endif


/** @name Error Codes */
//@{
Expand Down Expand Up @@ -61,6 +65,7 @@
#define ECUM_COMM_HASREQUESTEDRUN_ID (0x1b)
#define ECUM_ARC_STARTUPTWO_ID (0x20)

#if !defined(USE_RTE)
/** Possible states */
typedef enum {
ECUM_STATE_APP_RUN = 0x32,
Expand All @@ -86,6 +91,7 @@ typedef enum {
ECUM_STATE_RESET = 0x90,
ECUM_STATE_GO_OFF_ONE = 0x4d
} EcuM_StateType;
#endif

typedef uint8 EcuM_UserType;

Expand Down Expand Up @@ -136,11 +142,13 @@ typedef enum
ECUM_WKACT_SHUTDOWN = 3 /**< Immediate shutdown */
} EcuM_WakeupReactionType;

#if !defined(USE_RTE)
typedef enum
{
ECUM_BOOT_TARGET_APP = 0, /**< The Ecu will boot into the application */
ECUM_BOOT_TARGET_BOOTLOADER = 1 /**< The Ecu will boot into the bootloader */
} EcuM_BootTargetType;
#endif


#define ECUM_MODULE_ID MODULE_ID_ECUM
Expand Down
94 changes: 88 additions & 6 deletions include/IoHwAb.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,91 @@
* -------------------------------- Arctic Core ------------------------------*/


/*
* ----------------------------------------------------------------------------
* NOTE: This file is a stub only. ECU software needs to provide a generated IO
* hardware abstraction module that overrides this file.
* ----------------------------------------------------------------------------
*/

#ifndef IOHWAB_H_
#define IOHWAB_H_

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

#define IOHWAB_MODULE_ID 0xAB
#define IOHWAB_VENDOR_ID 1

#if defined(USE_RTE)
#include "Rte_Types.h"
#endif

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

#include "Pwm.h"
#include "IoHwAb_Cbk.h"


#define IOHWAB_UNLOCKED 0
#define IOHWAB_LOCKED 1

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

#define IOHWAB_INIT_ID 0x10

#define IOHWAB_ANALOG_GET_ID 0x20

#define IOHWAB_DIGITAL_GET_ID 0x30
#define IOHWAB_DIGITAL_SET_ID 0x31

#define IOHWAB_PWMDUTY_SET_ID 0x40
#define IOHWAB_PWMFREQUENCYANDDUTY_SET_ID 0x41

#define IOHWAB_CAPTURE_GET_ID 0x50

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

#define IOHWAB_E_INIT 0x01

#define IOHWAB_E_PARAM_CHANNEL 0x11
#define IOHWAB_E_PARAM_DUTY 0x12

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

#if (IOHWAB_DEV_ERROR_DETECT == STD_ON)

#define IOHWAB_DET_REPORT_ERROR(api, error) \
do { \
Det_ReportError(IOHWAB_MODULE_ID, 0, api, error); \
} while(0)

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

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

#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 );


#endif /* IOHWAB_H_ */

0 comments on commit 49ae4b9

Please sign in to comment.