From 6113ce71948e0f542741a30a90797b8be35e704d Mon Sep 17 00:00:00 2001 From: Michal Horn Date: Mon, 1 Oct 2012 15:52:15 +0200 Subject: [PATCH] LIN loop back rewrited to enable U602 driver and to check external loopback --- CommandStoring.dil | 4 ++-- source/commands.c | 4 ++-- source/dmm.c | 40 ++++++++++++++++++++-------------------- source/notification.c | 6 ++++-- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/CommandStoring.dil b/CommandStoring.dil index 22c04e0..7c4afa6 100644 --- a/CommandStoring.dil +++ b/CommandStoring.dil @@ -1,4 +1,4 @@ -# TMS570LS3137ZWT 10/01/12 14:52:54 +# TMS570LS3137ZWT 10/01/12 15:05:08 # ARCH=TMS570LS3137ZWT # @@ -807,7 +807,7 @@ DRIVER.SYSTEM.VAR.VIM_CHANNEL_94_INT_PRAGMA_ENABLE.VALUE=1 DRIVER.SYSTEM.VAR.VIM_CHANNEL_86_INT_PRAGMA_ENABLE.VALUE=1 DRIVER.SYSTEM.VAR.VIM_CHANNEL_78_INT_PRAGMA_ENABLE.VALUE=1 DRIVER.SYSTEM.VAR.VIM_CHANNEL_21_INT_ENABLE.VALUE=0 -DRIVER.SYSTEM.VAR.VIM_CHANNEL_13_INT_ENABLE.VALUE=0 +DRIVER.SYSTEM.VAR.VIM_CHANNEL_13_INT_ENABLE.VALUE=1 DRIVER.SYSTEM.VAR.SAFETY_INIT_HTU1_DP_PBISTCHECK_ENA.VALUE=0x00002000 DRIVER.SYSTEM.VAR.ADC_ENABLE.VALUE=1 DRIVER.SYSTEM.VAR.CORE_MPU_REGION_3_TYPE_VALUE.VALUE=0x0008 diff --git a/source/commands.c b/source/commands.c index cbc56a3..d2d4801 100644 --- a/source/commands.c +++ b/source/commands.c @@ -91,7 +91,7 @@ int cmd_do_lin_loop_back(cmd_io_t *cmd_io, const struct cmd_des *des, char *para uint8_t rxID = 0; linEnableLoopback(linREG, Digital); - linEnableNotification(linREG, LIN_RX_INT|LIN_ID_INT); + dmmREG->PC4 = (1<<15+2); linIDReceived = xSemaphoreCreateCounting(1, 0); linMsgReceived = xSemaphoreCreateCounting(1, 0); @@ -125,9 +125,9 @@ int cmd_do_lin_loop_back(cmd_io_t *cmd_io, const struct cmd_des *des, char *para else { print((uint8_t *)"FAILED: Sent and Received ID does not match.\r\n"); } - linDisableLoopback(linREG); vSemaphoreDelete(linIDReceived); vSemaphoreDelete(linMsgReceived); + dmmREG->PC5 = (1<<15+2); return 0; } diff --git a/source/dmm.c b/source/dmm.c index 361c8d9..c312366 100644 --- a/source/dmm.c +++ b/source/dmm.c @@ -50,24 +50,24 @@ void dmmInit(void) | (0 << 18); /* DMM ENA */ /** - DMM Port direction */ - dmmREG->PC1 = 1 /* DATA[0] */ - | (1 << 1) /* DATA[1] */ - | (1 << 2) /* DATA[2] */ - | (1 << 3) /* DATA[3] */ - | (1 << 4) /* DATA[4] */ - | (1 << 5) /* DATA[5] */ - | (1 << 6) /* DATA[6] */ - | (0 << 7) /* DATA[7] */ - | (0 << 8) /* DATA[8] */ - | (0 << 9) /* DATA[9] */ - | (0 << 10) /* DATA[10] */ - | (1 << 11) /* DATA[11] */ - | (0 << 12) /* DATA[12] */ - | (1 << 13) /* DATA[13] */ - | (1 << 14) /* DATA[14] */ - | (1 << 15) /* DATA[15] */ - | (0 << 16) /* DMM SYNC */ - | (1 << 17) /* DMM CLK */ + dmmREG->PC1 = 1 /* DMM SYNC */ + | (1 << 1) /* DMM CLK */ + | (1 << 2) /* DATA[0] */ + | (1 << 3) /* DATA[1] */ + | (1 << 4) /* DATA[2] */ + | (1 << 5) /* DATA[3] */ + | (1 << 6) /* DATA[4] */ + | (0 << 7) /* DATA[5] */ + | (0 << 8) /* DATA[6] */ + | (0 << 9) /* DATA[7] */ + | (0 << 10) /* DATA[8] */ + | (1 << 11) /* DATA[9] */ + | (0 << 12) /* DATA[10] */ + | (1 << 13) /* DATA[11] */ + | (1 << 14) /* DATA[12] */ + | (1 << 15) /* DATA[13] */ + | (0 << 16) /* DATA[14] */ + | (1 << 17) /* DATA[15] */ | (1 << 18); /* DMM ENA */ /** - DMM Port open drain enable */ @@ -110,7 +110,7 @@ void dmmInit(void) | (1 << 14) /* DATA[14] */ | (1 << 15) /* DATA[15] */ | (1 << 16) /* DMM SYNC */ - | (1 << 17) /* DMM CLK */ + | (0 << 17) /* DMM CLK */ | (1 << 18); /* DMM ENA */ @@ -153,7 +153,7 @@ void dmmInit(void) | (1 << 14) /* DATA[14] */ | (0 << 15) /* DATA[15] */ | (1 << 16) /* DMM SYNC */ - | (1 << 17) /* DMM CLK */ + | (0 << 17) /* DMM CLK */ | (1 << 18); /* DMM ENA */ /* USER CODE BEGIN (3) */ diff --git a/source/notification.c b/source/notification.c index aa0035a..5f23ae7 100644 --- a/source/notification.c +++ b/source/notification.c @@ -111,6 +111,7 @@ void adcNotification(adcBASE_t *adc, uint32_t group) adc->GxFIFORESETCR[1] = 1; } /* USER CODE END */ + } /* USER CODE BEGIN (12) */ @@ -149,6 +150,7 @@ void canMessageNotification(canBASE_t *node, uint32_t messageBox) } /* USER CODE END */ + } /* USER CODE BEGIN (16) */ @@ -166,13 +168,12 @@ void gioNotification(int bit) /* USER CODE END */ void linNotification(linBASE_t *lin, uint32_t flags) { -/* enter user code and remove the while loop... */ - while(1); /* USER CODE BEGIN (23) */ if (flags & LIN_ID_INT) { xSemaphoreGiveFromISR(linIDReceived, NULL); } if (flags & LIN_RX_INT) { + lin->FLR |= (1 << 9); xSemaphoreGiveFromISR(linMsgReceived, NULL); } /* USER CODE END */ @@ -213,6 +214,7 @@ void sciNotification(sciBASE_t *sci, uint32_t flags) } } /* USER CODE END */ + } /* USER CODE BEGIN (30) */ -- 2.39.2