예제 #1
0
uint32_t RIP_init (void)
{ /* Body */
    RIP_CFG_STRUCT_PTR  cfg = RTCS_getcfg(RIP);
    uint32_t err;

    if (RTCS_getcfg(RIP)) return RTCS_OK;
    /* allocate the memory */
    cfg = RTCS_mem_alloc_zero(sizeof(*cfg));
    if (!cfg)  return RTCSERR_OUT_OF_MEMORY;
    /* bind the udp port */
    err = UDP_openbind_internal(IPPORT_RIP, RIP_service, &cfg->UCB);
    if (err){
        _mem_free(cfg);
        return err;
    }

    RTCS_setcfg(RIP, cfg);
    ROUTE_register(&RIP_routefn);

    /* Start the retransmission timer to start sending immediately */
    cfg->TIMER_PERIODIC.TIME    = 0;
    cfg->TIMER_PERIODIC.EVENT   = RIP_expire_periodic;
    cfg->TIMER_PERIODIC.PRIVATE = NULL;
    TCPIP_Event_add(&cfg->TIMER_PERIODIC);

    /* probe all the interfaces now to build the route table faster */
    err = RIP_send_req();

    return RTCS_OK;
} /* Endbody */
예제 #2
0
파일: bootcomm.c 프로젝트: gxliu/MQX_3.8.0
uint_32 BOOT_open
   (
      void (_CODE_PTR_ service)(RTCSPCB_PTR, UCB_STRUCT_PTR)
   )
{ /* Body */
   uint_32 error;

   if (BOOT_count == 0) {
      error = UDP_openbind_internal(IPPORT_BOOTPC, service, &BOOT_port);
      if (error) {
         return error;
      } /* Endif */
   } /* Endif */

   BOOT_count++;
   return RTCS_OK;

} /* Endbody */