Browse Source

Update NO_SYS_SampleCode.c: Don't access heap in IRQ

Dirk Ziegelmeier 9 years ago
parent
commit
2acfa0ebe7
1 changed files with 2 additions and 2 deletions
  1. 2 2
      doc/NO_SYS_SampleCode.c

+ 2 - 2
doc/NO_SYS_SampleCode.c

@@ -2,8 +2,8 @@ void eth_mac_irq()
 {
   /* Service MAC IRQ here */
 
-  /* Allocate pbuf */
-  struct pbuf* p = pbuf_alloc(PBUF_RAW, eth_data_count, PBUF_RAM);
+  /* Allocate pbuf from pool (avoid using heap in interrupts) */
+  struct pbuf* p = pbuf_alloc(PBUF_RAW, eth_data_count, PBUF_POOL);
 
   if(p != NULL) {
     /* Copy ethernet frame into pbuf */