Ryo Iizuka / libMiMic

Dependents:   MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more

Revision:
20:3b0b444b4deb
Parent:
12:efe841863fc8
Child:
21:f2a70f15301f
--- a/core/uip/NyLPC_cUipService.c	Sat Apr 27 13:31:57 2013 +0000
+++ b/core/uip/NyLPC_cUipService.c	Sun Apr 28 08:54:44 2013 +0000
@@ -449,7 +449,7 @@
  * 取得したいメモリサイズを指定します。(このサイズは、イーサネットヘッダのサイズを含みません。)
  * このサイズよりも小さなサイズが割り当てられることがあります。
  * @return
- * IPペイロードのためのメモリブロックを返します。
+ * 成功:IPペイロードのためのメモリブロックを返します。/失敗:NULL
  */
 void* NyLPC_cUipService_allocTxBuf(NyLPC_TUInt16 i_hint,NyLPC_TUInt16* o_size)
 {
@@ -459,13 +459,13 @@
     NyLPC_cMutex_lock(&(inst->_mutex));
     ethbuf=(struct NyLPC_TTxBufferHeader*)inst->_ethif->allocTxBuf(i_hint+sizeof(struct NyLPC_TEthernetIIHeader),o_size);
     NyLPC_cMutex_unlock(&(inst->_mutex));
-    if(ethbuf!=NULL){
-        //イーサネットバッファのサイズを計算
-        *o_size-=sizeof(struct NyLPC_TEthernetIIHeader);
-        //イーサネットバッファのアドレスを計算
-        return &(((struct TEthPacket*)(ethbuf+1))->data);
+    if(ethbuf==NULL){
+        return NULL;
     }
-    return NULL;
+    //イーサネットバッファのサイズを計算
+    *o_size-=sizeof(struct NyLPC_TEthernetIIHeader);
+    //イーサネットバッファのアドレスを計算
+    return &(((struct TEthPacket*)(ethbuf+1))->data);
 }
 
 
@@ -622,4 +622,5 @@
 //      NVIC_DisableIRQ( ENET_IRQn );
 //  }
 //  portEXIT_CRITICAL();
-//}
\ No newline at end of file
+//}
+