AzureMXChip/MXCHIPAZ3166/core/lib/netxduo/samples/demo_netxduo_multihome_dhcp_client.c
void    tx_application_define(void *first_unused_memory)
{

UINT    status;


    /* Setup the working pointer.  */
    pointer = (CHAR *) first_unused_memory;

    /* Create the client thread.  */
    tx_thread_create(&client_thread, "thread client", client_thread_entry, 0,  
            pointer, DEMO_STACK_SIZE, 
            4, 4, TX_NO_TIME_SLICE, TX_AUTO_START);
    pointer = pointer + DEMO_STACK_SIZE;

    /* Initialize the NetX system.  */
    nx_system_initialize();

    /* Create the client packet pool.  */
    status = nx_packet_pool_create(&client_pool, "NetX Main Packet Pool", 1024, pointer, NX_PACKET_POOL_SIZE);
    pointer = pointer + NX_PACKET_POOL_SIZE;

    /* Check for pool creation error.  */
    if (status)
        return;

    /* Create an IP instance for the DHCP Client.  */
    status = nx_ip_create(&client_ip, "DHCP Client", IP_ADDRESS(0, 0, 0, 0), 0xFFFFFF00UL, &client_pool, _nx_ram_network_driver, pointer, 2048, 1);
    pointer = pointer + 2048;

    /* Check for IP create errors.  */
    if (status)
        return;

    /* Enable ARP and supply ARP cache memory for DHCP Client IP.  */
    status = nx_arp_enable(&client_ip, (void *) pointer, 1024);
    pointer = pointer + 1024;

    /* Check for ARP enable errors.  */
    if (status)
        return;

    /* Enable UDP traffic.  */
    status = nx_udp_enable(&client_ip);

    /* Check for UDP enable errors.  */
    if (status)
        return;

    /* Enable TCP traffic.  */
    status = nx_tcp_enable(&client_ip);

    /* Check for TCP enable errors.  */
    if (status)
        return;

    /* Enable ICMP.  */
    status = nx_icmp_enable(&client_ip);

    /* Check for errors.  */
    if (status)
        return;
}
/* Define what the initial system looks like.  */
Define what the initial system looks like.
Define what the initial system looks like .
void    tx_application_define(void *first_unused_memory)
{
UINT    status;
    pointer = (CHAR *) first_unused_memory;
    tx_thread_create(&client_thread, "thread client", client_thread_entry, 0,  
            pointer, DEMO_STACK_SIZE, 
            4, 4, TX_NO_TIME_SLICE, TX_AUTO_START);
    pointer = pointer + DEMO_STACK_SIZE;
    nx_system_initialize();
    status = nx_packet_pool_create(&client_pool, "NetX Main Packet Pool", 1024, pointer, NX_PACKET_POOL_SIZE);
    pointer = pointer + NX_PACKET_POOL_SIZE;
    if (status)
        return;
    status = nx_ip_create(&client_ip, "DHCP Client", IP_ADDRESS(0, 0, 0, 0), 0xFFFFFF00UL, &client_pool, _nx_ram_network_driver, pointer, 2048, 1);
    pointer = pointer + 2048;
    if (status)
        return;
    status = nx_arp_enable(&client_ip, (void *) pointer, 1024);
    pointer = pointer + 1024;
    if (status)
        return;
    status = nx_udp_enable(&client_ip);
    if (status)
        return;
    status = nx_tcp_enable(&client_ip);
    if (status)
        return;
    status = nx_icmp_enable(&client_ip);
    if (status)
        return;
}
void tx_application_define ( void * first_unused_memory ) { UINT status ; pointer = ( CHAR * ) first_unused_memory ; tx_thread_create ( & client_thread , " " , client_thread_entry , 0 , pointer , DEMO_STACK_SIZE , 4 , 4 , TX_NO_TIME_SLICE , TX_AUTO_START ) ; pointer = pointer + DEMO_STACK_SIZE ; nx_system_initialize ( ) ; status = nx_packet_pool_create ( & client_pool , " " , 1024 , pointer , NX_PACKET_POOL_SIZE ) ; pointer = pointer + NX_PACKET_POOL_SIZE ; if ( status ) return ; status = nx_ip_create ( & client_ip , " " , IP_ADDRESS ( 0 , 0 , 0 , 0 ) , 0xFFFFFF00UL , & client_pool , _nx_ram_network_driver , pointer , 2048 , 1 ) ; pointer = pointer + 2048 ; if ( status ) return ; status = nx_arp_enable ( & client_ip , ( void * ) pointer , 1024 ) ; pointer = pointer + 1024 ; if ( status ) return ; status = nx_udp_enable ( & client_ip ) ; if ( status ) return ; status = nx_tcp_enable ( & client_ip ) ; if ( status ) return ; status = nx_icmp_enable ( & client_ip ) ; if ( status ) return ; }
Define what the initial system looks like.
Define what the initial system looks like .
/* Setup the working pointer.  */ /* Create the client thread.  */ /* Initialize the NetX system.  */ /* Create the client packet pool.  */ /* Check for pool creation error.  */ /* Create an IP instance for the DHCP Client.  */ /* Check for IP create errors.  */ /* Enable ARP and supply ARP cache memory for DHCP Client IP.  */ /* Check for ARP enable errors.  */ /* Enable UDP traffic.  */ /* Check for UDP enable errors.  */ /* Enable TCP traffic.  */ /* Check for TCP enable errors.  */ /* Enable ICMP.  */ /* Check for errors.  */