Changeset 152 for uKadecot/trunk/ecnl_ssp/echonet_uip_task.c
- Timestamp:
- Jan 14, 2016, 1:17:21 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uKadecot/trunk/ecnl_ssp/echonet_uip_task.c
r108 r152 108 108 if ( a_rcv_pkt.t_esv->ecn_hdr.ehd1 != ECN_EDH1_ECHONET_LITE /* ECHONET Lite規格 */ 109 109 || a_rcv_pkt.t_esv->ecn_hdr.ehd2 != ECN_EDH2_FORMAT_1 /* 電文形式1 */) { 110 ECN_DBG_PUT "[UDP ECHO SRV] illegal type (0x%02X,0x%02X)", a_rcv_pkt.t_esv->ecn_hdr.ehd1, a_rcv_pkt.t_esv->ecn_hdr.ehd2 ECN_DBG_END;110 ECN_DBG_PUT("[UDP ECHO SRV] illegal type (0x%02X,0x%02X)", a_rcv_pkt.t_esv->ecn_hdr.ehd1, a_rcv_pkt.t_esv->ecn_hdr.ehd2); 111 111 return E_PAR; 112 112 } … … 118 118 a_ret = _ecn_fbs_cre(fa_len, &a_fbs_id); 119 119 if (a_ret != E_OK) { 120 ECN_DBG_PUT "[UDP ECHO SRV] _ecn_fbs_cre() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;120 ECN_DBG_PUT("[UDP ECHO SRV] _ecn_fbs_cre() result = %d:%s", a_ret, itron_strerror(a_ret)); 121 121 return a_ret; 122 122 } 123 123 a_ret = _ecn_fbs_add_data_ex(a_fbs_id, buffer, fa_len); 124 124 if (a_ret) { 125 ECN_DBG_PUT "[UDP ECHO SRV] _ecn_fbs_add_data_ex() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;125 ECN_DBG_PUT("[UDP ECHO SRV] _ecn_fbs_add_data_ex() result = %d:%s", a_ret, itron_strerror(a_ret)); 126 126 goto lb_except; 127 127 } … … 133 133 a_enod_id = udp_get_id((T_EDATA *)a_fbs_id.ptr, dst->ipaddr, dst->portno); 134 134 if (a_enod_id < 0 || tnum_enodadr <= a_enod_id) { 135 ECN_DBG_PUT 136 ip2str(NULL, dst->ipaddr) ECN_DBG_END;135 ECN_DBG_PUT("[UDP ECHO SRV] udp src(%s) echonet-node not found.", 136 ip2str(NULL, dst->ipaddr)); 137 137 } else { 138 138 /* 送信元ECHONETノードを記録 */ … … 144 144 a_ret = psnd_dtq(ecn_svc_mailboxid, (intptr_t)a_fbs_id.ptr); 145 145 if (a_ret != E_OK) { 146 ECN_DBG_PUT "[UDP ECHO SRV] psnd_dtq(ecn_svc_mailboxid) result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;146 ECN_DBG_PUT("[UDP ECHO SRV] psnd_dtq(ecn_svc_mailboxid) result = %d:%s", a_ret, itron_strerror(a_ret)); 147 147 goto lb_except; 148 148 } … … 185 185 186 186 uip_gethostaddr(a_src); 187 ECN_DBG_PUT 187 ECN_DBG_PUT("[UDP TSK:%d] started, IP Address: %s ether_max_len: %u", 188 188 ecn_udp_taskid, 189 189 ip2str(NULL, a_src), 190 UIP_BUFSIZE ECN_DBG_END;190 UIP_BUFSIZE); 191 191 uip_ipaddr_copy(enodadrb_table[ENOD_LOCAL_ID].ipaddr, a_src); 192 192 193 193 UDP_CEPID = udp_acre_cep(&ccep); 194 194 if (UDP_CEPID == NULL) { 195 ECN_DBG_PUT "udp_acre_cep()" ECN_DBG_END;195 ECN_DBG_PUT("udp_acre_cep()"); 196 196 PT_EXIT(&pt); 197 197 } … … 200 200 a_ret = sta_cyc(ecn_udp_cychdrid); 201 201 if (a_ret != E_OK) { 202 ECN_DBG_PUT "sta_cyc() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;202 ECN_DBG_PUT("sta_cyc() result = %d:%s", a_ret, itron_strerror(a_ret)); 203 203 PT_EXIT(&pt); 204 204 } … … 206 206 a_ret = act_tsk(ecn_svc_taskid); 207 207 if (a_ret != E_OK) { 208 ECN_DBG_PUT "act_tsk() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;208 ECN_DBG_PUT("act_tsk() result = %d:%s", a_ret, itron_strerror(a_ret)); 209 209 PT_EXIT(&pt); 210 210 } … … 212 212 a_ret = get_tim(&a_now); 213 213 if (a_ret != E_OK) { 214 ECN_DBG_PUT "get_tim() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;214 ECN_DBG_PUT("get_tim() result = %d:%s", a_ret, itron_strerror(a_ret)); 215 215 PT_EXIT(&pt); 216 216 } … … 226 226 || ((a_ret = timer_expired(&timer) ? E_TMOUT : E_WBLK) == E_TMOUT))); 227 227 if ((a_ret != E_OK) && (a_ret != E_TMOUT)) { 228 ECN_DBG_PUT "trcv_dtq() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;228 ECN_DBG_PUT("trcv_dtq() result = %d:%s", a_ret, itron_strerror(a_ret)); 229 229 PT_EXIT(&pt); 230 230 } … … 232 232 a_ret2 = get_tim(&a_now); 233 233 if (a_ret2 != E_OK) { 234 ECN_DBG_PUT "get_tim() result = %d:%s", a_ret2, itron_strerror(a_ret2) ECN_DBG_END;234 ECN_DBG_PUT("get_tim() result = %d:%s", a_ret2, itron_strerror(a_ret2)); 235 235 PT_EXIT(&pt); 236 236 } … … 243 243 a_snd_len = _ecn_fbs_get_datalen(a_mdt.fbs_id); 244 244 245 ECN_DBG_PUT "[UDP TSK] trcv_dtq() mbx recv (%d byte)", a_snd_len ECN_DBG_END;245 ECN_DBG_PUT("[UDP TSK] trcv_dtq() mbx recv (%d byte)", a_snd_len); 246 246 247 247 if (0 < a_snd_len) { … … 289 289 ret = _ecn_fbs_cre(1, &req); 290 290 if (ret != E_OK) { 291 ECN_DBG_PUT "_ecn_udp_cre_req_fbs() : _ecn_fbs_cre() result = %d:%s", ret, itron_strerror(ret) ECN_DBG_END;291 ECN_DBG_PUT("_ecn_udp_cre_req_fbs() : _ecn_fbs_cre() result = %d:%s", ret, itron_strerror(ret)); 292 292 return ret; 293 293 } … … 296 296 if (ret != E_OK) { 297 297 _ecn_fbs_del(req); 298 ECN_DBG_PUT "_ecn_udp_cre_req_fbs() : _ecn_fbs_add_data() result = %d:%s", ret, itron_strerror(ret) ECN_DBG_END;298 ECN_DBG_PUT("_ecn_udp_cre_req_fbs() : _ecn_fbs_add_data() result = %d:%s", ret, itron_strerror(ret)); 299 299 return ret; 300 300 } … … 318 318 ret = _ecn_fbs_cre(1, &res); 319 319 if (ret != E_OK) { 320 ECN_DBG_PUT "_ecn_udp_cre_res_fbs() : _ecn_fbs_cre() result = %d:%s", ret, itron_strerror(ret) ECN_DBG_END;320 ECN_DBG_PUT("_ecn_udp_cre_res_fbs() : _ecn_fbs_cre() result = %d:%s", ret, itron_strerror(ret)); 321 321 return ret; 322 322 } … … 325 325 if (ret != E_OK) { 326 326 _ecn_fbs_del(res); 327 ECN_DBG_PUT "_ecn_udp_cre_res_fbs() : _ecn_fbs_add_data() result = %d:%s", ret, itron_strerror(ret) ECN_DBG_END;327 ECN_DBG_PUT("_ecn_udp_cre_res_fbs() : _ecn_fbs_add_data() result = %d:%s", ret, itron_strerror(ret)); 328 328 return ret; 329 329 } … … 353 353 a_ret = _ecn_fbs_get_data(fbs_id, &cmd, 1, &len); 354 354 if (a_ret != E_OK) { 355 ECN_DBG_PUT "[UDP TSK] _ecn_fbs_get_data() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;355 ECN_DBG_PUT("[UDP TSK] _ecn_fbs_get_data() result = %d:%s", a_ret, itron_strerror(a_ret)); 356 356 return; 357 357 } … … 368 368 a_ret = _ecn_fbs_get_data(fbs_id, &msg, sizeof(msg), &a_snd_len); 369 369 if (a_ret != E_OK) { 370 ECN_DBG_PUT "[UDP TSK] _ecn_fbs_get_data() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;370 ECN_DBG_PUT("[UDP TSK] _ecn_fbs_get_data() result = %d:%s", a_ret, itron_strerror(a_ret)); 371 371 } 372 372 … … 384 384 if (a_ret != E_OK) { 385 385 _ecn_fbs_del(buf); 386 ECN_DBG_PUT "_ecn_int_msg() : _ecn_fbs_add_data_ex() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;386 ECN_DBG_PUT("_ecn_int_msg() : _ecn_fbs_add_data_ex() result = %d:%s", a_ret, itron_strerror(a_ret)); 387 387 return; 388 388 } … … 391 391 if (a_ret != E_OK) { 392 392 _ecn_fbs_del(buf); 393 ECN_DBG_PUT "_ecn_int_msg() : _ecn_fbs_add_data_ex() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;393 ECN_DBG_PUT("_ecn_int_msg() : _ecn_fbs_add_data_ex() result = %d:%s", a_ret, itron_strerror(a_ret)); 394 394 return; 395 395 } … … 398 398 if (a_ret != E_OK) { 399 399 _ecn_fbs_del(buf); 400 ECN_DBG_PUT "_ecn_int_msg() : psnd_dtq() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;400 ECN_DBG_PUT("_ecn_int_msg() : psnd_dtq() result = %d:%s", a_ret, itron_strerror(a_ret)); 401 401 return; 402 402 } … … 414 414 if (a_ret != E_OK) { 415 415 _ecn_fbs_del(buf); 416 ECN_DBG_PUT "_ecn_int_msg() : _ecn_fbs_add_data_ex() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;416 ECN_DBG_PUT("_ecn_int_msg() : _ecn_fbs_add_data_ex() result = %d:%s", a_ret, itron_strerror(a_ret)); 417 417 return; 418 418 } … … 421 421 if (a_ret != E_OK) { 422 422 _ecn_fbs_del(buf); 423 ECN_DBG_PUT "_ecn_int_msg() : psnd_dtq() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;423 ECN_DBG_PUT("_ecn_int_msg() : psnd_dtq() result = %d:%s", a_ret, itron_strerror(a_ret)); 424 424 return; 425 425 } … … 443 443 a_ret = udp_get_ip(&a_dst, fbs_id.ptr->hdr.target); 444 444 if (!a_ret) { 445 ECN_DBG_PUT 445 ECN_DBG_PUT("[UDP TSK] echonet-node 0x%02X-0x%02X-0x%02X → udp dest(%s)", 446 446 ((T_EDATA *)fbs_id.ptr)->hdr.edata.deoj.eojx1, 447 447 ((T_EDATA *)fbs_id.ptr)->hdr.edata.deoj.eojx2, 448 448 ((T_EDATA *)fbs_id.ptr)->hdr.edata.deoj.eojx3, 449 ip2str(NULL, a_dst.ipaddr) ECN_DBG_END;449 ip2str(NULL, a_dst.ipaddr)); 450 450 451 451 /* fbsから出力領域にデータを抽出 */ … … 453 453 a_ret = _ecn_fbs_get_data(fbs_id, buffer, sizeof(buffer), &a_snd_len); 454 454 if (a_ret != E_OK) { 455 ECN_DBG_PUT "[UDP TSK] _ecn_fbs_get_data() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;455 ECN_DBG_PUT("[UDP TSK] _ecn_fbs_get_data() result = %d:%s", a_ret, itron_strerror(a_ret)); 456 456 } 457 457 else if(uip_ipaddr_cmp(a_dst.ipaddr, localhost)) { 458 458 /* 送信先が127.0.0.1 → mbxに転送 */ 459 ECN_DBG_PUT 460 ((T_EDATA *)fbs_id.ptr)->hdr.edata.esv ECN_DBG_END;459 ECN_DBG_PUT("redirect ecn_udp_mailboxid → ecn_svc_mailboxid (esv:0x%02X)", 460 ((T_EDATA *)fbs_id.ptr)->hdr.edata.esv); 461 461 462 462 a_ret = _ecn_udp2mbx((const uint8_t *)buffer, a_snd_len, &a_dst); … … 466 466 } 467 467 else { 468 ECN_DBG_PUT 469 ip2str(NULL, a_dst.ipaddr), a_snd_len ECN_DBG_END;468 ECN_DBG_PUT("[UDP TSK] udp_snd_dat() to:%s %ubyte(s)", 469 ip2str(NULL, a_dst.ipaddr), a_snd_len); 470 470 #ifdef ECN_DBG_PUT_ENA 471 471 _ecn_dbg_bindmp((const uint8_t *)buffer, a_snd_len); … … 474 474 a_ret = udp_snd_dat(UDP_CEPID, &a_dst, buffer, a_snd_len); 475 475 if (a_ret < 0) { 476 ECN_DBG_PUT "[UDP TSK] send, error: %s", itron_strerror(a_ret) ECN_DBG_END;476 ECN_DBG_PUT("[UDP TSK] send, error: %s", itron_strerror(a_ret)); 477 477 } 478 478 } … … 480 480 /* データが長すぎて1パケットに収まらなかった場合 */ 481 481 if (_ecn_fbs_exist_data(fbs_id)) { 482 ECN_DBG_PUT "[UDP TSK] send, data so long: %dbyte(s)", _ecn_fbs_get_datalen(fbs_id) ECN_DBG_END;482 ECN_DBG_PUT("[UDP TSK] send, data so long: %dbyte(s)", _ecn_fbs_get_datalen(fbs_id)); 483 483 } 484 484 } else { 485 ECN_DBG_PUT 485 ECN_DBG_PUT("[UDP TSK] echonet-node 0x%02X-0x%02X-0x%02X not found.", 486 486 ((T_EDATA *)fbs_id.ptr)->hdr.edata.deoj.eojx1, 487 487 ((T_EDATA *)fbs_id.ptr)->hdr.edata.deoj.eojx2, 488 ((T_EDATA *)fbs_id.ptr)->hdr.edata.deoj.eojx3 ECN_DBG_END;488 ((T_EDATA *)fbs_id.ptr)->hdr.edata.deoj.eojx3); 489 489 } 490 490 } … … 505 505 PT_BEGIN(&s.pt); 506 506 507 /* ECN_CAP_PUT "[UDP ECHO SRV] callback_nblk_udp() recv: %u", *(int *)p_parblk ECN_CAP_END; */507 /* ECN_CAP_PUT("[UDP ECHO SRV] callback_nblk_udp() recv: %u", *(int *)p_parblk); */ 508 508 memset(buffer, 0, sizeof(buffer)); 509 509 … … 519 519 } 520 520 #endif 521 ECN_CAP_PUT 522 ip2str(NULL, dst.ipaddr), dst.portno, a_len, buffer ECN_CAP_END;521 ECN_CAP_PUT("[UDP ECHO SRV] recv, addr: %s:%d, len: %d, msg: '%s'", 522 ip2str(NULL, dst.ipaddr), dst.portno, a_len, buffer); 523 523 if ((int)sizeof(buffer) <= a_len) 524 524 a_len = (int)sizeof(buffer) - 1; … … 583 583 break; 584 584 } 585 ECN_DBG_PUT "is_match(): ecn_itr_nxt() result: epc=0x%02X, pdc=%d", epc, pdc ECN_DBG_END;585 ECN_DBG_PUT("is_match(): ecn_itr_nxt() result: epc=0x%02X, pdc=%d", epc, pdc); 586 586 /* インスタンスリスト通知または自ノードインスタンスリストS以外は除外 */ 587 587 if ((epc != 0xD5) && (epc != 0xD6)) { … … 641 641 continue; 642 642 643 ECN_CAP_PUT 644 i - ENOD_REMOTE_ID, ip2str(NULL, ipaddr) ECN_CAP_END;643 ECN_CAP_PUT("udp_get_id(): ip-found remote(%d) = %s", 644 i - ENOD_REMOTE_ID, ip2str(NULL, ipaddr)); 645 645 return (ECN_ENOD_ID)i; 646 646 } … … 660 660 uip_ipaddr_copy(ea->ipaddr, ipaddr); 661 661 662 ECN_CAP_PUT 663 i - ENOD_REMOTE_ID, ip2str(NULL, ipaddr) ECN_CAP_END;662 ECN_CAP_PUT("udp_get_id(): enod-found remote(%d) = %s", 663 i - ENOD_REMOTE_ID, ip2str(NULL, ipaddr)); 664 664 return (ECN_ENOD_ID)i; 665 665 } … … 673 673 uip_ipaddr_copy(ea->ipaddr, ipaddr); 674 674 675 ECN_CAP_PUT 676 i - ENOD_REMOTE_ID, ip2str(NULL, ipaddr) ECN_CAP_END;675 ECN_CAP_PUT("udp_get_id(): empty-found remote(%d) = %s", 676 i - ENOD_REMOTE_ID, ip2str(NULL, ipaddr)); 677 677 return (ECN_ENOD_ID)i; 678 678 } … … 732 732 if (a_ret != E_OK) { 733 733 _ecn_fbs_del(req); 734 ECN_DBG_PUT "ecn_udp_get_ipaddr() : _ecn_fbs_add_data_ex() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;734 ECN_DBG_PUT("ecn_udp_get_ipaddr() : _ecn_fbs_add_data_ex() result = %d:%s", a_ret, itron_strerror(a_ret)); 735 735 return a_ret; 736 736 } … … 739 739 if (a_ret != E_OK) { 740 740 _ecn_fbs_del(req); 741 ECN_DBG_PUT "ecn_udp_get_ipaddr() : _ecn_fbs_add_data_ex() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;741 ECN_DBG_PUT("ecn_udp_get_ipaddr() : _ecn_fbs_add_data_ex() result = %d:%s", a_ret, itron_strerror(a_ret)); 742 742 return a_ret; 743 743 } … … 746 746 if (a_ret != E_OK) { 747 747 _ecn_fbs_del(req); 748 ECN_DBG_PUT "ecn_udp_get_ipaddr() : _ecn_fbs_add_data_ex() result = %d:%s", a_ret, itron_strerror(a_ret) ECN_DBG_END;748 ECN_DBG_PUT("ecn_udp_get_ipaddr() : _ecn_fbs_add_data_ex() result = %d:%s", a_ret, itron_strerror(a_ret)); 749 749 return a_ret; 750 750 }
Note:
See TracChangeset
for help on using the changeset viewer.