• Renesas APIs ***


    一个线程,强行结束另外一个线程,并将其挂起:

    static void SuspendTask(TX_THREAD *thread)
    {
        UINT status = 0;
        UINT state;
    
        status = tx_thread_terminate(thread);
        if(status != TX_SUCCESS)
            return ;
        do
        {
            tx_thread_sleep(1);
            status = tx_thread_info_get(thread, NULL, &state, NULL, NULL, NULL, NULL, NULL, NULL);
            if (status != TX_SUCCESS)
            {
                xp_log("can not get clean thread status (0x%02x)
    ", status);
                break;
            }
        } while (!(state & (TX_COMPLETED | TX_TERMINATED)));
        tx_thread_reset(thread);
    }

    启动

    static void StartRawTask(void)
    {
        UINT status = 0;
        UINT state;
    
        status = tx_thread_info_get(&rawThread, NULL, &state, NULL, NULL, NULL, NULL, NULL, NULL);
        if(status == TX_SUCCESS)
        {
            if(state == TX_SUSPENDED)
                tx_thread_resume(&rawThread);
        }
        else
            tx_thread_create(&rawThread, (CHAR *) "raw thread", RawThreadCallback, (ULONG)(&MaterialBoxTempT3), &raw_stack, COMMON_THREAD_STACK, 6, 6, 0, TX_AUTO_START);
    }

    nx_api.h

    nx_ip_address_get

    nx_packet_pool_create

    nx_packet_pool_info_get

    nx_tcp_socket_bytes_available

    nx_tcp_socket_info_get

    nx_tcp_socket_mss_get

    系统重启

    NVIC_SystemReset

    static ULONG _get_time(void)
    {
        ULONG seconds, milliseconds;
        UINT status;
    
        /* Get local time as set by SNTP client */
        status = nx_sntp_client_get_local_time(&g_sntp_client, &seconds, &milliseconds, NX_NULL);
        if (status != NX_SUCCESS)
            return 0;
    
        /* Convert to Unix epoch */
        seconds -= UNIX_TO_NTP_EPOCH_SECS;
    
        return seconds;
    }

    TCP/UDP

    nx_tcp_client_socket_bind
    nx_tcp_server_socket_accept
    nx_tcp_server_socket_listen
    nx_tcp_socket_create
    /* APIs for packet pool. */ 
    /* APIs for packet pool. */
    #define nx_packet_allocate                              _nxe_packet_allocate
    #define nx_packet_copy                                  _nxe_packet_copy
    #define nx_packet_data_append                           _nxe_packet_data_append
    #define nx_packet_data_extract_offset                   _nxe_packet_data_extract_offset
    #define nx_packet_data_retrieve                         _nxe_packet_data_retrieve
    #define nx_packet_length_get                            _nxe_packet_length_get
    #define nx_packet_pool_create(p, n, l, m, s)            _nxe_packet_pool_create(p, n, l, m, s, sizeof(NX_PACKET_POOL))
    #define nx_packet_pool_delete                           _nxe_packet_pool_delete
    #define nx_packet_pool_info_get                         _nxe_packet_pool_info_get
    #define nx_packet_pool_low_watermark_set                _nxe_packet_pool_low_watermark_set
    #define nx_packet_release(p)                            _nxe_packet_release(&p)
    #define nx_packet_transmit_release(p)                   _nxe_packet_transmit_release(&p)
  • 相关阅读:
    WINCE6.0新建工程编译出错的问题
    单片机C语言中的data,idata,xdata,pdata,code
    WinCE 6.0学习笔记一
    Visual Studio 2005 学习笔记一 入门
    Zigbee系列 学习笔记六(设置项)
    Zigbee系列 学习笔记五(信道选择)
    Zigbee系列 学习笔记四(睡眠及唤醒)
    Zigbee系列 学习笔记三(初始化程序解析)
    Zigbee调试问题 IAR编译出现 Fatal Error[e72]: Segment BANKED_CODE must be defined in a segment definition option (-Z, -b or -P)
    关于懒设计
  • 原文地址:https://www.cnblogs.com/jiangzhaowei/p/9264388.html
Copyright © 2020-2023  润新知