]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
TMS570 EMAC driver: Changes to allow build fir FreeRTOS based rpp-lib.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Fri, 29 Jul 2016 12:14:59 +0000 (14:14 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Fri, 29 Jul 2016 12:14:59 +0000 (14:14 +0200)
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
ports/driver/tms570_emac/tms570_netif.c

index b018a0cad2a5298d0633f57bb6111ee5658bdf18..176f6ae92619792f91719b21de0a82b6c1e847d5 100644 (file)
@@ -44,6 +44,7 @@
 //--------moje
 #include <strings.h>
 #include <stdbool.h>
+#include <stdlib.h>
 #include <bsp/tms570.h>
 #include <bsp/tms570-pinmux.h>
 #include "arch/cc.h"
@@ -322,6 +323,7 @@ tms570_eth_init_find_PHY(struct tms570_netif_state *nf_state)
 static void
 tms570_eth_init_set_pinmux(void)
 {
+#if defined(__rtems__)
   TMS570_IOMM.KICK_REG0 = 0x83E70B13U;
   TMS570_IOMM.KICK_REG1 = 0x95A4F1E0U;
 
@@ -346,6 +348,7 @@ tms570_eth_init_set_pinmux(void)
 
   TMS570_IOMM.KICK_REG0 = 0;
   TMS570_IOMM.KICK_REG1 = 0;
+#endif /*__rtems__*/
 }
 
 static err_t
@@ -1005,7 +1008,16 @@ tms570_eth_rx_pbuf_refill(struct tms570_netif_state *nf_state, int single_fl)
                           alloc_rq_bytes,
                           PBUF_POOL);
     if (new_pbuf == NULL) {
+  #if defined(__GNUC__) && !defined(__TI_COMPILER_VERSION__)
       alloc_rq_bytes = (1 << (30-__builtin_clz(alloc_rq_bytes)));
+  #else /*__GNUC__*/
+      {
+        int n;
+        while ((1 << n) < alloc_rq_bytes)
+          n++;
+        alloc_rq_bytes = 1 << (n - 1);
+      }
+  #endif /*__GNUC__*/
       if (alloc_rq_bytes <= PBUF_POOL_BUFSIZE) {
         tms570_eth_debug_printf("not enough memory\n");
         break;