• 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)
  • 相关阅读:
    jquery设置多个css样式
    html中设置透明遮罩层的兼容性代码
    在html中显示Flash的代码
    js setTimeout()
    jquery live hover
    leetcode第16题--3Sum Closest
    leetcode第15题--3Sum
    leetcode第14题--Longest Common Prefix
    leetcode第13题--Roman to Integer
    leetcode第12题--Integer to Roman
  • 原文地址:https://www.cnblogs.com/jiangzhaowei/p/9264388.html
Copyright © 2020-2023  润新知