]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/commitdiff
Enabled LIN high interrupt
authorMichal Horn <hornmich@fel.cvut.cz>
Mon, 1 Oct 2012 13:07:54 +0000 (15:07 +0200)
committerMichal Horn <hornmich@fel.cvut.cz>
Mon, 1 Oct 2012 13:07:54 +0000 (15:07 +0200)
include/sys_vim.h
source/commands.c
source/notification.c
source/sys_startup.c

index 02e40b41590b82a231b3a34f654b2f573cb3e5cd..319170c6e24ea085a72e316d139356b661da1c12 100644 (file)
@@ -47,6 +47,7 @@ extern void phantomInterrupt(void);
 extern void esmHighInterrupt(void);\r
 extern void phantomInterrupt(void);\r
 extern void vPreemptiveTick(void);\r
+extern void linHighLevelInterrupt(void);\r
 extern void adc1Group1Interrupt(void);\r
 extern void can1HighLevelInterrupt(void);\r
 extern void can2HighLevelInterrupt(void);\r
index 85e8f9e2fc658299a711845f786a8154bfe20d11..cbc56a3436a8b48b32aa5c7af6f78f518ac8516d 100644 (file)
@@ -91,6 +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);
        linIDReceived = xSemaphoreCreateCounting(1, 0);
        linMsgReceived = xSemaphoreCreateCounting(1, 0);
 
@@ -105,9 +106,11 @@ int cmd_do_lin_loop_back(cmd_io_t *cmd_io, const struct cmd_des *des, char *para
                xSemaphoreTake(linMsgReceived, portMAX_DELAY);
                linGetData(linREG, rxData);
                uint8_t errCnt = 0;
-               for (i = 0; i < 8; i++, txData++, rxData++) {
-                       if (*txData != *rxData) errCnt++;
+               uint8_t i;
+               for (i = 0; i < 8; i++) {
+                       if (txData[i] != rxData[i]) errCnt++;
                }
+
                if (!errCnt) {
                        print((uint8_t *)"OK");
                }
index 4d04ada8dcc0fa80dcc93bb85497e2938f284131..aa0035ada84842088cc62e617f8dbf5bc4cc46aa 100644 (file)
@@ -34,6 +34,11 @@ extern xSemaphoreHandle canMsgSent;
  *\r
  * Defined in commands.c */\r
 extern xSemaphoreHandle adcDataConverted;\r
+\r
+\r
+extern xSemaphoreHandle linMsgReceived;\r
+extern xSemaphoreHandle linIDReceived;\r
+\r
 /** @brief Data structure containing converted data from ADC\r
  *\r
  *     Defined in commands.c */\r
@@ -164,6 +169,12 @@ void linNotification(linBASE_t *lin, uint32_t flags)
 /*  enter user code and remove the while loop... */\r
     while(1);\r
 /* USER CODE BEGIN (23) */\r
+               if (flags & LIN_ID_INT) {\r
+                       xSemaphoreGiveFromISR(linIDReceived, NULL);\r
+               }\r
+               if (flags & LIN_RX_INT) {\r
+                       xSemaphoreGiveFromISR(linMsgReceived, NULL);\r
+               }\r
 /* USER CODE END */\r
 \r
 }\r
index 8fe4040290dba986ee8d7a63f3d09d2e162df700..4a7e5d42c7543eb0aa72b4fbd5ed4bde73460799 100644 (file)
@@ -99,7 +99,7 @@ static const t_isrFuncPTR s_vim_init[] =
     &phantomInterrupt,\r
     &phantomInterrupt,\r
     &phantomInterrupt,\r
-    &phantomInterrupt,\r
+    &linHighLevelInterrupt,\r
     &phantomInterrupt,\r
     &adc1Group1Interrupt,\r
     &can1HighLevelInterrupt,\r
@@ -846,7 +846,7 @@ void _c_int00()
                         | (0U << 10U)\r
                         | (0U << 11U)\r
                         | (0U << 12U)\r
-                        | (0U << 13U)\r
+                        | (1U << 13U)\r
                         | (0U << 14U)\r
                         | (1U << 15U)\r
                         | (1U << 16U)\r