AzureMXChip/MXCHIPAZ3166/core/lib/netxduo/samples/demo_netxduo_dhcpv6_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.  */
    status = tx_thread_create(&thread_client, "Client thread", thread_client_entry, 0,  
                              pointer, DEMO_STACK_SIZE, 8, 8, TX_NO_TIME_SLICE, TX_AUTO_START);

    /* Check for IP create errors.  */
    if (status)
    {
        error_counter++;
        return;
    }

    pointer =  pointer + DEMO_STACK_SIZE;

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

    /* Create a packet pool.  */
    status =  nx_packet_pool_create(&pool_0, "NetX Main Packet Pool", 1024,  pointer, PACKET_POOL_SIZE);

    pointer = pointer + PACKET_POOL_SIZE;

    /* Check for pool creation error.  */
    if (status)
    {
        error_counter++;
        return;
    }

    /* Create a Client IP instance.  */
    status = nx_ip_create(&client_ip, "Client IP", IP_ADDRESS(0, 0, 0, 0), 
                          0xFFFFFF00UL, &pool_0, _nx_ram_network_driver,
                          pointer, 2048, 1);

    pointer =  pointer + 2048;

    /* Check for IP create errors.  */
    if (status)
    {
        error_counter++;
        return;
    }

    /* Enable UDP traffic for sending DHCPv6 messages.  */
    status =  nx_udp_enable(&client_ip);

    /* Check for UDP enable errors.  */
    if (status)
    {
        error_counter++;
        return;
    }

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

    /* Check for ICMP enable errors.  */
    if (status)
    {
        error_counter++;
        return;
    }

    /* Create the DHCPv6 Client. */
    status =  nx_dhcpv6_client_create(&dhcp_client, &client_ip, "DHCPv6 Client", 
                                      &pool_0, pointer, 2048, dhcpv6_state_change_notify, 
                                      dhcpv6_server_error_handler);

    /* Check for errors.  */
    if (status)
    {
        error_counter++;
        return;
    }

    /* Update the stack pointer because we need it again. */
    pointer = pointer + 2048;

    /* Yield control to DHCPv6 threads and ThreadX. */
    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;
    status = tx_thread_create(&thread_client, "Client thread", thread_client_entry, 0,  
                              pointer, DEMO_STACK_SIZE, 8, 8, TX_NO_TIME_SLICE, TX_AUTO_START);
    if (status)
    {
        error_counter++;
        return;
    }
    pointer =  pointer + DEMO_STACK_SIZE;
    nx_system_initialize();
    status =  nx_packet_pool_create(&pool_0, "NetX Main Packet Pool", 1024,  pointer, PACKET_POOL_SIZE);
    pointer = pointer + PACKET_POOL_SIZE;
    if (status)
    {
        error_counter++;
        return;
    }
    status = nx_ip_create(&client_ip, "Client IP", IP_ADDRESS(0, 0, 0, 0), 
                          0xFFFFFF00UL, &pool_0, _nx_ram_network_driver,
                          pointer, 2048, 1);
    pointer =  pointer + 2048;
    if (status)
    {
        error_counter++;
        return;
    }
    status =  nx_udp_enable(&client_ip);
    if (status)
    {
        error_counter++;
        return;
    }
    status =  nx_icmp_enable(&client_ip);
    if (status)
    {
        error_counter++;
        return;
    }
    status =  nx_dhcpv6_client_create(&dhcp_client, &client_ip, "DHCPv6 Client", 
                                      &pool_0, pointer, 2048, dhcpv6_state_change_notify, 
                                      dhcpv6_server_error_handler);
    if (status)
    {
        error_counter++;
        return;
    }
    pointer = pointer + 2048;
    return;
}
void tx_application_define ( void * first_unused_memory ) { UINT status ; pointer = ( CHAR * ) first_unused_memory ; status = tx_thread_create ( & thread_client , " " , thread_client_entry , 0 , pointer , DEMO_STACK_SIZE , 8 , 8 , TX_NO_TIME_SLICE , TX_AUTO_START ) ; if ( status ) { error_counter ++ ; return ; } pointer = pointer + DEMO_STACK_SIZE ; nx_system_initialize ( ) ; status = nx_packet_pool_create ( & pool_0 , " " , 1024 , pointer , PACKET_POOL_SIZE ) ; pointer = pointer + PACKET_POOL_SIZE ; if ( status ) { error_counter ++ ; return ; } status = nx_ip_create ( & client_ip , " " , IP_ADDRESS ( 0 , 0 , 0 , 0 ) , 0xFFFFFF00UL , & pool_0 , _nx_ram_network_driver , pointer , 2048 , 1 ) ; pointer = pointer + 2048 ; if ( status ) { error_counter ++ ; return ; } status = nx_udp_enable ( & client_ip ) ; if ( status ) { error_counter ++ ; return ; } status = nx_icmp_enable ( & client_ip ) ; if ( status ) { error_counter ++ ; return ; } status = nx_dhcpv6_client_create ( & dhcp_client , & client_ip , " " , & pool_0 , pointer , 2048 , dhcpv6_state_change_notify , dhcpv6_server_error_handler ) ; if ( status ) { error_counter ++ ; return ; } pointer = pointer + 2048 ; return ; }
Define what the initial system looks like.
Define what the initial system looks like .
/* Setup the working pointer.  */ /* Create the Client thread.  */ /* Check for IP create errors.  */ /* Initialize the NetX system.  */ /* Create a packet pool.  */ /* Check for pool creation error.  */ /* Create a Client IP instance.  */ /* Check for IP create errors.  */ /* Enable UDP traffic for sending DHCPv6 messages.  */ /* Check for UDP enable errors.  */ /* Enable ICMP.  */ /* Check for ICMP enable errors.  */ /* Create the DHCPv6 Client. */ /* Check for errors.  */ /* Update the stack pointer because we need it again. */ /* Yield control to DHCPv6 threads and ThreadX. */