|
回调函数
- /**
- * @brief IP address change call back
- * @param ip_instance: NX_IP instance registered for this callback
- * @param ptr: VOID * optional user data
- * @retval none
- */
- static VOID ip_address_change_notify_callback(NX_IP *ip_instance, VOID *ptr)
- {
- tx_semaphore_put(&Semaphore);
- }
复制代码
注册和等待:
- /* register the IP address change callback */
- ret = nx_ip_address_change_notify(&IpInstance, ip_address_change_notify_callback, NULL);
- if (ret != NX_SUCCESS)
- {
- Error_Handler();
- }
- /* start the DHCP client */
- ret = nx_dhcp_start(&DHCPClient);
- if (ret != NX_SUCCESS)
- {
- Error_Handler();
- }
- /* wait until an IP address is ready */
- if(tx_semaphore_get(&Semaphore, TX_WAIT_FOREVER) != TX_SUCCESS)
- {
- Error_Handler();
- }
复制代码
|
|