]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blobdiff - rpp/src/sys/notification.c
Enable ethernet interrupts for all platforms
[pes-rpp/rpp-lib.git] / rpp / src / sys / notification.c
index ba000dfe4586064aab93f263c91818a83f6bdfeb..bd16549edc63e0848de57ad364e8f47bfe156fba 100644 (file)
 /** @file notification.c
-*   @brief User Notification Definition File
-*   @date 15.Mar.2012
-*   @version 03.01.00
-*
-*   This file  defines  empty  notification  routines.
-*   The user needs to remove the while loop and define
-*   the sequence.
-*
-*/
+ *   @brief User Notification Definition File
+ *   @date 15.Mar.2012
+ *   @version 03.01.00
+ *
+ *   This file  defines  empty  notification  routines.
+ *   The user needs to remove the while loop and define
+ *   the sequence.
+ *
+ */
 
 /* Include Files */
 
-//#include "ti_drv_esm.h"
-//#include "sys_selftest.h"
-//#include "ti_drv_adc.h"
-//#include "ti_drv_can.h"
-//#include "ti_drv_gio.h"
-//#include "ti_drv_lin.h"
-//#include "ti_drv_mibspi.h"
-//#include "ti_drv_sci.h"
-//#include "ti_drv_het.h"
-//#include "ti_drv_i2c.h"
-/* USER CODE BEGIN (0) */
-//#include "FreeRTOS.h"
-//#include "os_semphr.h"
-//#include "os_task.h"
-
 #include "sys/sys.h"
-
-/* USER CODE END */
+#include "rpp/eth.h"
+#include "sys/ti_drv_can.h"
 
 void esmGroup1Notification(uint32_t channel)
 {
 /*  enter user code and remove the while loop... */
-    while(1);
-/* USER CODE BEGIN (1) */
-/* USER CODE END */
-
+       while (1) ;
 }
 
-/* USER CODE BEGIN (2) */
-/* USER CODE END */
-
 void esmGroup2Notification(uint32_t channel)
 {
 /*  enter user code and remove the while loop... */
-    while(1);
-/* USER CODE BEGIN (3) */
-/* USER CODE END */
-
+       while (1) ;
 }
 
-/* USER CODE BEGIN (4) */
-/* USER CODE END */
-
 void memoryPort0TestFailNotification(uint32_t groupSelect, uint32_t dataSelect, uint32_t address, uint32_t data)
 {
 /*  enter user code and remove the while loop... */
-    while(1);
-/* USER CODE BEGIN (5) */
-/* USER CODE END */
-
+       while (1) ;
 }
 
-/* USER CODE BEGIN (6) */
-/* USER CODE END */
-
 void memoryPort1TestFailNotification(uint32_t groupSelect, uint32_t dataSelect, uint32_t address, uint32_t data)
 {
 /*  enter user code and remove the while loop... */
-    while(1);
-/* USER CODE BEGIN (7) */
-/* USER CODE END */
-
+       while (1) ;
 }
-
-/* USER CODE BEGIN (8) */
-/* USER CODE END */
-
-/* USER CODE BEGIN (12) */
 /** @brief Semaphore blocking task when it waits for interrupt signaling message receive
  *
  */
-// FIXME It seems that all the following are test application specific, because no one
-// else in the library uses this variables. The functionality the notification
-// provides could be replaced with a proper interface between subsystems.
-// This where called extern on the file, which is not a good approach to include
-// application specific variables in lower layers, coupling bidireccionally both
-// layers.
-// This was moved from cmd_can.c
-/** Semaphore used for blocking task until message is received */
-xSemaphoreHandle canMsgReceived;
-/** Semaphore used for blocking task until message is sent */
-xSemaphoreHandle canMsgSent;
-/** Pointer to Destination CAN registers */
-canBASE_t* canDst;
-/** Pointer to Source CAN registers */
-canBASE_t* canSrc;
-/** Can message box for received messages */
-uint32_t canMsgBox;
-/** Error counter for errors in sending */
-uint32_t canSendError;
-/** Error counter for errors in receiving */
-uint32_t canRecError;
-
-/* USER CODE END */
 void canErrorNotification(canBASE_t *node, uint32_t notification)
-{
-/* USER CODE BEGIN (13) */
-
-    if (node == canSrc) {
-        canSendError = notification;
-        xSemaphoreGiveFromISR(canMsgSent, NULL);
-    }
-    if (node == canDst) {
-        canRecError = notification;
-        xSemaphoreGiveFromISR(canMsgReceived, NULL);
-    }
-
-/* USER CODE END */
-
-}
-
-/* USER CODE BEGIN (14) */
-/* USER CODE END */
+{}
 
 void canMessageNotification(canBASE_t *node, uint32_t messageBox)
-{
-/* USER CODE BEGIN (15) */
-
-    if (messageBox == canMsgBox)
-    {
-        if (node == canDst) {
-            // node 2 - receive testloopback message complete
-            while(!canIsRxMessageArrived(node, canMsgBox))
-                ;
-            xSemaphoreGiveFromISR(canMsgReceived, NULL);
-        }
-        if (node == canSrc) {
-            xSemaphoreGiveFromISR(canMsgSent, NULL);
-        }
-    }
-/* USER CODE END */
-}
+{}
 
-/* USER CODE BEGIN (16) */
-/* USER CODE END */
 void gioNotification(int bit)
 {
 /*  enter user code and remove the while loop... */
-    while(1);
-/* USER CODE BEGIN (19) */
-/* USER CODE END */
-
+       while (1) ;
 }
 
-/* USER CODE BEGIN (20) */
-/* USER CODE END */
 void i2cNotification(i2cBASE_t *i2c, uint32_t flags)
 {
 /*  enter user code and remove the while loop... */
-    while(1);
-/* USER CODE BEGIN (21) */
-/* USER CODE END */
-
+       while (1) ;
 }
 
-/* USER CODE BEGIN (24) */
-/* USER CODE END */
 void mibspiNotification(mibspiBASE_t *mibspi, uint32_t flags)
 {
 /*  enter user code and remove the while loop... */
-    while(1);
-/* USER CODE BEGIN (25) */
-/* USER CODE END */
-
+       while (1) ;
 }
 
-/* USER CODE BEGIN (26) */
-/* USER CODE END */
-
 void mibspiGroupNotification(mibspiBASE_t *mibspi, uint32_t group)
 {
 /*  enter user code and remove the while loop... */
-    while(1);
-/* USER CODE BEGIN (27) */
-/* USER CODE END */
-
-}
-/* USER CODE BEGIN (28) */
-/* USER CODE END */
-
-void sciNotification(sciBASE_t *sci, uint32_t flags)
-{
-/* USER CODE BEGIN (29) */
-    if (sci == sciREG) {
-        if (flags & SCI_RX_INT) {
-            sciReceive(sci, 1, NULL);   // Restart receiving
-        }
-    }
-/* USER CODE END */
-
+       while (1) ;
 }
 
-/* USER CODE BEGIN (30) */
-/* USER CODE END */
-void pwmNotification(hetBASE_t * hetREG,uint32_t pwm, uint32_t notification)
+void pwmNotification(hetBASE_t *hetREG,uint32_t pwm, uint32_t notification)
 {
 /*  enter user code and remove the while loop... */
-    while(1);
-/* USER CODE BEGIN (33) */
-/* USER CODE END */
-
+       while (1) ;
 }
 
-/* USER CODE BEGIN (34) */
-/* USER CODE END */
-
-void edgeNotification(hetBASE_t * hetREG,uint32_t edge)
+void edgeNotification(hetBASE_t *hetREG,uint32_t edge)
 {
 /*  enter user code and remove the while loop... */
-    while(1);
-/* USER CODE BEGIN (35) */
-/* USER CODE END */
-
+       while (1) ;
 }
 
-/* USER CODE BEGIN (36) */
-/* USER CODE END */
-
 void hetNotification(hetBASE_t *het, uint32_t offset)
 {
 /*  enter user code and remove the while loop... */
-    while(1);
-/* USER CODE BEGIN (37) */
-/* USER CODE END */
-
-}
-
-/** Semaphore used to stop command, until message is received */
-xSemaphoreHandle linMsgReceived;
-/** Semaphore used to stop command, until ID is received */
-xSemaphoreHandle linIDReceived;
-void linNotification(linBASE_t *lin, uint32_t flags)
-{
-    /* FIXME Moved code from somewhere else. It was in cmd_lin.c
-     * It seems that nobody in the library uses this.
-     * sys/ti_drv_lin.c calls this function from linLowLevelInterrupt()
-     * The function prototipe is in sys/ti_drv_lin.h, so maybe it should be
-     * better to move it there, but because it is a "high-level" notification
-     * it could be here.
-     */
-    if (flags & LIN_ID_INT) {
-        xSemaphoreGiveFromISR(linIDReceived, NULL);
-    }
-    if (flags & LIN_RX_INT) {
-        lin->FLR |= (1 << 9);
-        xSemaphoreGiveFromISR(linMsgReceived, NULL);
-    }
+       while (1) ;
 }
 
-#define PHY_LINK_MONITOR_INT 1
-
+#ifndef FREERTOS_POSIX
+extern boolean_t HostPendErrHandler(void);
 #if PHY_LINK_MONITOR_INT
 extern boolean_t LinkIntHandler(void);
+#endif
 #pragma INTERRUPT(MDIOMiscInt, IRQ)
 void MDIOMiscInt(void)
 {
-       if(LinkIntHandler())return;
-}
+       if (HostPendErrHandler()) return;
+#if PHY_LINK_MONITOR_INT
+       if (LinkIntHandler()) return;
 #endif
+}
 
 extern void RxIntHandler(uint32_t instNum);
 extern void TxIntHandler(uint32_t instNum);
@@ -280,14 +112,14 @@ void EMACCore0RxIsr(void)
 {
        countEMACCore0RxIsr++;
        RxIntHandler(0);
-    /* FIXME was in emac_cmd.c/eth.c and should move somewhere else.
-    rx_irq_cnt++;
+       /* FIXME was in emac_cmd.c/eth.c and should move somewhere else.
+          rx_irq_cnt++;
 
-    // We know we have only one RX Packet Buffer descriptor --
-    // so we write it in CP to disable interrupt
-    EMACRxCPWrite(emacBase, channel, (unsigned int)rx_desc);
-    EMACCoreIntAck(emacBase, EMAC_INT_CORE0_RX);
-    */
+          // We know we have only one RX Packet Buffer descriptor --
+          // so we write it in CP to disable interrupt
+          EMACRxCPWrite(emacBase, channel, (unsigned int)rx_desc);
+          EMACCoreIntAck(emacBase, EMAC_INT_CORE0_RX);
+        */
 }
 
 volatile int countEMACCore0TxIsr = 0;
@@ -296,15 +128,13 @@ void EMACCore0TxIsr(void)
 {
        countEMACCore0TxIsr++;
        TxIntHandler(0);
-    /* FIXME Was in emac_cmd.c/eth.c and should move somewhere else
-    tx_irq_cnt++;
-    // If is not being processed by the EMAC anymore
-    if (!(fr1.PktFlgLen & EMAC_DSC_FLAG_OWNER)) {
-       EMACTxCPWrite(emacBase, channel, (unsigned int)&fr1);
-       EMACCoreIntAck(emacBase, EMAC_INT_CORE0_TX);
-    }
-    */
-}
-
-/* USER CODE BEGIN (38) */
-/* USER CODE END */
+       /* FIXME Was in emac_cmd.c/eth.c and should move somewhere else
+          tx_irq_cnt++;
+          // If is not being processed by the EMAC anymore
+          if (!(fr1.PktFlgLen & EMAC_DSC_FLAG_OWNER)) {
+          EMACTxCPWrite(emacBase, channel, (unsigned int)&fr1);
+          EMACCoreIntAck(emacBase, EMAC_INT_CORE0_TX);
+          }
+        */
+}
+#endif /* ifndef FREERTOS_POSIX */
\ No newline at end of file