From: joek Date: Mon, 28 Feb 2011 16:23:14 +0000 (+0100) Subject: Removed WdgM from PPC drivers. X-Git-Url: https://rtime.felk.cvut.cz/gitweb/arc.git/commitdiff_plain/70cbbd12ea6975f4bf3e681f2969e9c3e9bc2cef Removed WdgM from PPC drivers. --- diff --git a/arch/ppc/mpc55xx/drivers/WdgM.c b/arch/ppc/mpc55xx/drivers/WdgM.c deleted file mode 100644 index 8e2f654c..00000000 --- a/arch/ppc/mpc55xx/drivers/WdgM.c +++ /dev/null @@ -1,191 +0,0 @@ -/* -------------------------------- Arctic Core ------------------------------ - * Arctic Core - the open source AUTOSAR platform http://arccore.com - * - * Copyright (C) 2009 ArcCore AB - * - * This source code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by the - * Free Software Foundation; See . - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * -------------------------------- Arctic Core ------------------------------*/ - - - - - - - - -#include "WdgM.h" -#include "Mcu.h" - -const WdgM_ConfigType *wdgMConfigPtr; -static WdgM_SupervisedStatusType WdgM_GlobalSupervisionStatus = WDBG_ALIVE_OK; - -Std_ReturnType WdgM_UpdateAliveCounter (WdgM_SupervisedEntityIdType SEid) -{ - Wdgm_SupervisionType *supervisionPtr = &(wdgMConfigPtr->Wdgm_SupervisionPtr)[SEid]; - - if (supervisionPtr->ActivationStatus == WDBG_SUPERVISION_ENABLED) - { - supervisionPtr->AliveCounter++; - } - return (E_OK); -} - -Std_ReturnType WdgM_ActivateAliveSupervision (WdgM_SupervisedEntityIdType SEid) -{ - Wdgm_SupervisionType *supervisionPtr = &(wdgMConfigPtr->Wdgm_SupervisionPtr)[SEid]; - - supervisionPtr->ActivationStatus = WDBG_SUPERVISION_ENABLED; - - return (E_OK); -} - -Std_ReturnType WdgM_DeactivateAliveSupervision (WdgM_SupervisedEntityIdType SEid) -{ - Wdgm_SupervisionType *supervisionPtr = &(wdgMConfigPtr->Wdgm_SupervisionPtr)[SEid]; - - supervisionPtr->ActivationStatus = WDBG_SUPERVISION_DISABLED; - return (E_OK); -} - -void WdgM_Init(const WdgM_ConfigType *ConfigPtr) -{ - WdgM_SupervisedEntityIdType SEid; - Wdgm_SupervisionType *supervisionPtr; - WdgM_SupervisedEntityType* supervisedEntityPtr; - - for (SEid = 0; SEid < WDBG_NBR_OF_ALIVE_SIGNALS; SEid++) - { - supervisionPtr = &(ConfigPtr->Wdgm_SupervisionPtr)[SEid]; - supervisedEntityPtr = (WdgM_SupervisedEntityType*)&(ConfigPtr->WdgM_SupervisedEntityPtr)[SEid]; - supervisionPtr->ActivationStatus = supervisedEntityPtr->WdgM_ActivationStatus; - } - wdgMConfigPtr = ConfigPtr; - -} - -void WdgM_MainFunction_AliveSupervision (void) -{ - WdgM_SupervisedEntityIdType SEid; - Wdgm_SupervisionType *supervisionPtr; - const WdgM_SupervisedEntityType *entityPtr; - WdgM_SupervisionCounterType aliveCalc, nSC, nAl, eai; - WdgM_SupervisedStatusType maxLocal = WDBG_ALIVE_OK; - static WdgM_SupervisionCounterType expiredSupervisionCycles = 0; - - for (SEid = 0; SEid < WDBG_NBR_OF_ALIVE_SIGNALS; SEid++) - { - supervisionPtr = &(wdgMConfigPtr->Wdgm_SupervisionPtr)[SEid]; - entityPtr = &(wdgMConfigPtr->WdgM_SupervisedEntityPtr)[SEid]; - - if (WDBG_SUPERVISION_ENABLED == supervisionPtr->ActivationStatus) - { - supervisionPtr->SupervisionCycle++; - /* Only perform supervision on the reference cycle. */ - if (supervisionPtr->SupervisionCycle == entityPtr->WdgM_SupervisionReferenceCycle) - { - /* Alive algorithm. * - * n (Al) - n(SC) + EAI == 0 */ - if (entityPtr->WdgM_ExpectedAliveIndications > entityPtr->WdgM_SupervisionReferenceCycle) - { - /* Scenario A */ - eai = -entityPtr->WdgM_ExpectedAliveIndications + 1; - - } - else - { - /* Scenario B */ - eai = entityPtr->WdgM_SupervisionReferenceCycle - 1; - } - nSC = supervisionPtr->SupervisionCycle; - nAl = supervisionPtr->AliveCounter; - aliveCalc = nAl - nSC + eai; - - if ((aliveCalc <= entityPtr->WdgM_MaxMargin) && - (aliveCalc >= -entityPtr->WdgM_MinMargin)) - { - /* Entity alive OK. */ - supervisionPtr->SupervisionStatus = WDBG_ALIVE_OK; - } - else - { - /* Entity alive NOK. */ - supervisionPtr->SupervisionStatus = WDBG_ALIVE_FAILED; - if (WDBG_ALIVE_FAILED > maxLocal) - { - maxLocal = WDBG_ALIVE_FAILED; - } - } - - if (WDBG_ALIVE_FAILED == supervisionPtr->SupervisionStatus) - { - if (supervisionPtr->NbrOfFailedRefCycles > entityPtr->WdgM_FailedSupervisionReferenceCycleTolerance) - { - supervisionPtr->SupervisionStatus = WDBG_ALIVE_EXPIRED; - if (WDBG_ALIVE_EXPIRED > maxLocal) - { - maxLocal = WDBG_ALIVE_EXPIRED; - } - } - else - { - supervisionPtr->NbrOfFailedRefCycles++; - } - } - - /* Reset counters. */ - supervisionPtr->SupervisionCycle = 0; - supervisionPtr->AliveCounter = 0; - } - } - } - - /* Try to heal global status. */ - if (WDBG_ALIVE_EXPIRED != WdgM_GlobalSupervisionStatus) - { - WdgM_GlobalSupervisionStatus = maxLocal; - } - else - { - WdgM_GlobalSupervisionStatus = WDBG_ALIVE_EXPIRED; - } - - if (WDBG_ALIVE_EXPIRED == WdgM_GlobalSupervisionStatus) - { - expiredSupervisionCycles++; - } - - if (expiredSupervisionCycles >= wdgMConfigPtr->WdgM_ExpiredSupervisionCycleTolerance) - { - WdgM_GlobalSupervisionStatus = WDBG_ALIVE_STOPPED; - } -} - -boolean WdgM_IsAlive(void) -{ - - if ( WDBG_ALIVE_STOPPED > WdgM_GlobalSupervisionStatus ) - { - return (TRUE); - } - else - { - return (FALSE); - } -} - -void WdgM_MainFunction_Trigger (void) -{ - if ( WdgM_IsAlive() ) - { - KickWatchdog(); - } -} - - diff --git a/arch/ppc/mpc55xx/drivers/WdgM.h b/arch/ppc/mpc55xx/drivers/WdgM.h deleted file mode 100644 index 9a0a63cf..00000000 --- a/arch/ppc/mpc55xx/drivers/WdgM.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -------------------------------- Arctic Core ------------------------------ - * Arctic Core - the open source AUTOSAR platform http://arccore.com - * - * Copyright (C) 2009 ArcCore AB - * - * This source code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by the - * Free Software Foundation; See . - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * -------------------------------- Arctic Core ------------------------------*/ - - - - - - - - -#include "WdgM_Cfg.h" - -Std_ReturnType WdgM_UpdateAliveCounter (WdgM_SupervisedEntityIdType SEid); -Std_ReturnType WdgM_ActivateAliveSupervision (WdgM_SupervisedEntityIdType SEid); -Std_ReturnType WdgM_DeactivateAliveSupervision (WdgM_SupervisedEntityIdType SEid); -void WdgM_Init(const WdgM_ConfigType* ConfigPtr); -void WdgM_MainFunction_AliveSupervision (void); -void WdgM_MainFunction_Trigger (void); diff --git a/arch/ppc/mpc55xx/drivers/WdgM_cfg.h b/arch/ppc/mpc55xx/drivers/WdgM_cfg.h deleted file mode 100644 index 32c9d6f8..00000000 --- a/arch/ppc/mpc55xx/drivers/WdgM_cfg.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -------------------------------- Arctic Core ------------------------------ - * Arctic Core - the open source AUTOSAR platform http://arccore.com - * - * Copyright (C) 2009 ArcCore AB - * - * This source code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by the - * Free Software Foundation; See . - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * -------------------------------- Arctic Core ------------------------------*/ - - - - - - - - - -#ifndef WDGM_CFG_H_ -#define WDGM_CFG_H_ - -#include "Std_Types.h" -#include "WdgM_Lcfg.h" - - -typedef enum -{ - WDBG_ALIVE_OK, - WDBG_ALIVE_FAILED, - WDBG_ALIVE_EXPIRED, - WDBG_ALIVE_STOPPED, - WDBG_ALIVE_DEACTIVATED, -}WdgM_AliveSupervisionStatusType; - -typedef enum -{ - WDBG_SUPERVISION_DISABLED, - WDBG_SUPERVISION_ENABLED -}WdgM_ActivationStatusType; - -typedef int16_t WdgM_SupervisionCounterType ; - -typedef struct -{ - WdgM_SupervisionCounterType AliveCounter; - WdgM_SupervisionCounterType SupervisionCycle; - WdgM_AliveSupervisionStatusType SupervisionStatus; - WdgM_SupervisionCounterType NbrOfFailedRefCycles; - WdgM_ActivationStatusType ActivationStatus; -}Wdgm_SupervisionType; - -typedef struct -{ - const WdgM_SupervisedEntityIdType WdgM_SupervisedEntityID; - const WdgM_ActivationStatusType WdgM_ActivationStatus; - const WdgM_SupervisionCounterType WdgM_ExpectedAliveIndications; - const WdgM_SupervisionCounterType WdgM_SupervisionReferenceCycle; - const WdgM_SupervisionCounterType WdgM_FailedSupervisionReferenceCycleTolerance; - const WdgM_SupervisionCounterType WdgM_MinMargin; - const WdgM_SupervisionCounterType WdgM_MaxMargin; -}WdgM_SupervisedEntityType; - -typedef struct -{ - uint16 WdgM_SupervisionCycle; - uint16 WdgM_NumberOfSupervisedEntities; - uint16 WdgM_ExpiredSupervisionCycleTolerance; - const WdgM_SupervisedEntityType *WdgM_SupervisedEntityPtr; - Wdgm_SupervisionType *Wdgm_SupervisionPtr; -}WdgM_ConfigType; - -extern const WdgM_ConfigType WdgMAliveSupervision; - -#endif /* WDGM_CFG_H_ */