Porting GT202 IAR demo app for FRDM-K22 to be used instead with CW10.6 and K60

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Porting GT202 IAR demo app for FRDM-K22 to be used instead with CW10.6 and K60

1,423 次查看
chinniwhites
Contributor II

Here is an example of porting the web_hvac MQX demo app to use GT202.

https://community.freescale.com/docs/DOC-102702


I wish to instead to do similar with K60 and CW10.6


Goal is to use same webpages that fuel Ethernet jack to also for wifi also.  I had gotten the Athero_4100P and Ethenet jack to host same pages using TWR-K60 and TWR-ATH-4100P with the help of a Freescale FAE.  I made my custom K60 board with GT202 instead of Atheros_4100P as the latter was EOL.


Has someone accomplished similar and tell me whether this is possible with the current GT202 MQX4.1 drivers?


Help launching web servers on both interfaces would also be appreciated.  Here is my current HTTP_Task


void HTTP_task(uint32_t initial_data)

{

    int32                               error;

    uint32                              server[BSP_ENET_DEVICE_COUNT];

    extern const HTTPSRV_CGI_LINK_STRUCT cgi_lnk_tbl[];

    extern const TFS_DIR_ENTRY           tfs_data[];

    HTTPSRV_PARAM_STRUCT                 params[BSP_ENET_DEVICE_COUNT];

    uint32                              ip_addr[BSP_ENET_DEVICE_COUNT];   

    uint32                              i = 0;

    char*                                indexes[BSP_ENET_DEVICE_COUNT];

    uint8                                  n_devices = BSP_ENET_DEVICE_COUNT;

   

    #if !HTTP_USE_ONE_SERVER

    uint_8 n_servers = BSP_ENET_DEVICE_COUNT;

    #else

    uint8 n_servers = 1;

    #endif

   

    /* Install ramdisk - MFS init */

    //Ram_disk_start();

 

    /* RTCS init */

    rtcs_init();

    ip_addr[0] = ENET_IPADDR;

   

    /* Start HTTP server on each interface */

       for (i = 0; (i < n_devices) && (n_devices != 0); i++)

       {

           indexes[i] = (char*) _mem_alloc_zero(sizeof("\\index_x.html"));

           if (indexes[i] == NULL)

           {

               printf("\n Failed to allocate memory.");

               _task_block();

           }

       }

      

       /* Install trivial file system. HTTP server pages are stored there. */

       error = _io_tfs_install("tfs:", tfs_data);

      

       /* Start HTTP server on each interface */

       for (i = 0; i < n_servers; i++)

       {

           _mem_zero(&params[i], sizeof(HTTPSRV_PARAM_STRUCT));

           params[i].af = HTTP_INET_AF;  //IPv4, IPv6 or from config.h

           #if RTCSCFG_ENABLE_IP6

           /* Set interface number here. Zero is any. */

           params[i].ipv6_scope_id = HTTP_SCOPE_ID;

           #endif

           sprintf(indexes[i], "\\index.html", i);

           params[i].root_dir = "tfs:";

           params[i].index_page = indexes[i];

           params[i].auth_table = auth_realms;

           printf("Starting http server No.%d on IP", i);

           /*

           ** If there is only one server listen on any IP address

           ** so address can change in runtime (DHCP etc.).

           ** Otherwise we will use static IP for server.

           */

           if (HTTP_INET_AF & AF_INET)

           {

               #if RTCSCFG_ENABLE_IP4

               if ((i == 0) && (n_servers == 1))

               {

                   params[i].ipv4_address.s_addr = INADDR_ANY;

               }

               else

               {

                   params[i].ipv4_address.s_addr = ip_addr[i];

               }

               /* Print active IPv4 address */

               printf(" %d.%d.%d.%d", IPBYTES(ip_addr[i]));

               #endif

           }

           if (HTTP_INET_AF & AF_INET6)

           {

               #if RTCSCFG_ENABLE_IP6

               IPCFG6_GET_ADDR_DATA data;

               char prn_addr6[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];

              

               ipcfg6_get_addr_info_n(0, 0, &data);

               if(inet_ntop(AF_INET6, &(data.ip_addr), prn_addr6, sizeof(prn_addr6)))

               {

                   /* Print active IPv6 address */

                   printf("%s %s", (HTTP_INET_AF & AF_INET) ? " and" : "", prn_addr6);

               }

               #endif

           }

           /*

           ** Maximum default number of available sockets in RTCS is six.

           ** Maximum of two are used for HTTP server as listening sockets (one for IPv4 and one for IPv6).

           ** So we take two of sockets and use them for sessions.

           */

           params[i].max_ses = 2;

           params[i].cgi_lnk_tbl = (HTTPSRV_CGI_LINK_STRUCT*) cgi_lnk_tbl;

           /* There are a lot of static data in CGIs so we have to set large enough stack for script handler */

           params[i].script_stack = 2000;

           server[i] = HTTPSRV_init(&params[i]);

          

           printf("...");

           if (server[i] == RTCS_ERROR)

           {

               printf("[FAIL]\n");

           }

           else

           {

               printf("[OK]\n");

           }

       }  

   /*******************************

   *

   * START YOUR CODING HERE

   *

   ********************************/  

        

   for (;;) 

   {

       //_task_destroy(t1);

       //_sched_yield();

       _task_block();

      

       /*

       for(;;){

       

       }

       */

   }

}

标签 (1)
标记 (4)
0 项奖励
回复
1 回复

511 次查看
soledad
NXP Employee
NXP Employee

Hello,

Please check the below links:

Qualcomm Atheros: TWR-WIFI-AR4100 802.11n Wi-Fi module

MQX4.0 and TWR-WIFI-AR4100 patch?

Problems with AR4100 integration


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复