From: joek Date: Sun, 24 Jun 2012 19:10:23 +0000 (+0200) Subject: Added support for LIN on MPC5567. Also make it possible to build a standalone LIN... X-Git-Url: http://rtime.felk.cvut.cz/gitweb/arc.git/commitdiff_plain/cfd47f7e43ce8f9af979efc4828cfa02eb88fd30 Added support for LIN on MPC5567. Also make it possible to build a standalone LIN master without any CAN network. --- diff --git a/arch/ppc/mpc55xx/drivers/Lin.c b/arch/ppc/mpc55xx/drivers/Lin.c index 2f4661fe..90530383 100644 --- a/arch/ppc/mpc55xx/drivers/Lin.c +++ b/arch/ppc/mpc55xx/drivers/Lin.c @@ -37,7 +37,11 @@ static uint32 LinChannelBitTimeInTicks[ LIN_CONTROLLER_CNT ]; #define LIN_MAX_MSG_LENGTH 8 +#ifdef CFG_MPC5567 +#define ESCI(exp) (volatile struct ESCI_tag *)(0xFFFB0000 + (0x4000 * exp)) +#else #define ESCI(exp) (volatile struct ESCI_tag *)(0xFFFA0000 + (0x4000 * exp)) +#endif /* LIN145: Reset -> LIN_UNINIT: After reset, the Lin module shall set its state to LIN_UNINIT. */ static Lin_DriverStatusType LinDriverStatus = LIN_UNINIT; @@ -302,6 +306,7 @@ static void LinInterruptB() { LinInterrupt(LIN_CTRL_B); } +#ifndef CFG_MPC5567 static void LinInterruptC() { LinInterrupt(LIN_CTRL_C); @@ -326,6 +331,7 @@ static void LinInterruptH() { LinInterrupt(LIN_CTRL_H); } +#endif #ifdef MPC551X_ERRATA_REV_A void LinTimeOutInterrupt( uint8 channel ) @@ -440,28 +446,48 @@ void Lin_InitChannel( uint8 Channel, const Lin_ChannelConfigType* Config ) /* Install the interrupt */ switch(Channel){ case 0: +#ifdef CFG_MPC5567 + ISR_INSTALL_ISR2("LinIsr", LinInterruptA, (IrqType)(ESCI_A_COMB0),LIN_PRIO, 0); +#else ISR_INSTALL_ISR2("LinIsr", LinInterruptA, (IrqType)(SCI_A_COMB),LIN_PRIO, 0); +#endif break; case 1: +#ifdef CFG_MPC5567 + ISR_INSTALL_ISR2("LinIsr", LinInterruptB, (IrqType)(ESCI_A_COMB1),LIN_PRIO, 0); +#else ISR_INSTALL_ISR2("LinIsr", LinInterruptB, (IrqType)(SCI_B_COMB),LIN_PRIO, 0); +#endif break; case 2: +#ifndef CFG_MPC5567 ISR_INSTALL_ISR2("LinIsr", LinInterruptC, (IrqType)(SCI_C_COMB),LIN_PRIO, 0); +#endif break; case 3: +#ifndef CFG_MPC5567 ISR_INSTALL_ISR2("LinIsr", LinInterruptD, (IrqType)(SCI_D_COMB),LIN_PRIO, 0); +#endif break; case 4: +#ifndef CFG_MPC5567 ISR_INSTALL_ISR2("LinIsr", LinInterruptE, (IrqType)(SCI_E_COMB),LIN_PRIO, 0); +#endif break; case 5: +#ifndef CFG_MPC5567 ISR_INSTALL_ISR2("LinIsr", LinInterruptF, (IrqType)(SCI_F_COMB),LIN_PRIO, 0); +#endif break; case 6: +#ifndef CFG_MPC5567 ISR_INSTALL_ISR2("LinIsr", LinInterruptG, (IrqType)(SCI_G_COMB+2),LIN_PRIO, 0); +#endif break; case 7: +#ifndef CFG_MPC5567 ISR_INSTALL_ISR2("LinIsr", LinInterruptH, (IrqType)(SCI_H_COMB+3),LIN_PRIO, 0); +#endif break; default: break; diff --git a/boards/board_common.mk b/boards/board_common.mk index ae8a6aee..2b6653a1 100644 --- a/boards/board_common.mk +++ b/boards/board_common.mk @@ -179,6 +179,7 @@ obj-$(USE_LIN) += Lin_PBcfg.o obj-$(USE_LIN) += Lin_Lcfg.o obj-$(USE_LIN)-$(CFG_MPC560X) += LinFlex.o obj-$(USE_LIN)-$(CFG_MPC5516) += Lin.o +obj-$(USE_LIN)-$(CFG_MPC5567) += Lin.o # LinIf obj-$(USE_LINIF) += LinIf_Lcfg.o diff --git a/boards/mpc5567qrtech/build_config.mk b/boards/mpc5567qrtech/build_config.mk index 8eeb773c..0f9a9e1d 100644 --- a/boards/mpc5567qrtech/build_config.mk +++ b/boards/mpc5567qrtech/build_config.mk @@ -14,6 +14,7 @@ CFG=PPC BOOKE E200Z6 MPC55XX MPC5567 BRD_MPC5567QRTECH SPE MOD_AVAIL+=ADC DIO DMA CAN GPT LIN MCU PORT PWM WDG NVM MEMIF FEE FLS # System + Communication + Diagnostic MOD_AVAIL+=CANIF CANTP J1939TP COM DCM DEM DET ECUM IOHWAB KERNEL PDUR WDGM RTE +MOD_AVAIL+=LINIF LINSM LIN # Network management MOD_AVAIL+=COMM NM CANNM CANSM # Additional diff --git a/communication/ComM/ComM.c b/communication/ComM/ComM.c index 0d7c97ff..91e41553 100644 --- a/communication/ComM/ComM.c +++ b/communication/ComM/ComM.c @@ -54,7 +54,13 @@ #include "ComM_Internal.h" /** @req COMM506 @req COMM353 */ +#if defined(USE_CANSM) #include "CanSM.h" +#endif + +#if defined(USE_LINSM) +#include "LinSM.h" +#endif /** @req COMM347 */ #if defined(USE_NM) || defined(COMM_TESTS) @@ -470,9 +476,16 @@ static Std_ReturnType ComM_Internal_PropagateGetCurrentComMode( ComM_UserHandleT Std_ReturnType status = E_OK; ComM_ModeType mode = COMM_FULL_COMMUNICATION; switch (Channel->BusType) { +#if defined(USE_CANSM) || defined(COMM_TESTS) case COMM_BUS_TYPE_CAN: status = CanSM_GetCurrentComMode(Channel->BusSMNetworkHandle, &mode); break; +#endif +#if defined(USE_LINSM) + case COMM_BUS_TYPE_LIN: + status = LinSM_GetCurrentComMode(Channel->BusSMNetworkHandle, &mode); + break; +#endif default: status = E_NOT_OK; break; diff --git a/communication/Nm/Nm.c b/communication/Nm/Nm.c index a98ed6a1..34f59ad4 100644 --- a/communication/Nm/Nm.c +++ b/communication/Nm/Nm.c @@ -13,7 +13,10 @@ * for more details. * -------------------------------- Arctic Core ------------------------------*/ + +#if defined(USE_CANNM) #include "CanNm.h" +#endif #include "Nm.h" #include "Nm_Internal.h"