/* Includes ------------------------------------------------------------------*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

/* 标准C库头文件. */
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>
#include <termios.h>
#include <unistd.h>
#include <signal.h>
#include <poll.h>

#include "ca_hardware.h"

/* Private define ------------------------------------------------------------*/



void *_hd_manage_thread(void *args)
{
    
    while (1)
    {
        sleep(1);
    }
}

int _hd_handle_init_common()
{
    struct sched_param param;
    pthread_attr_t attr;
    pthread_t pid;
    int32_t rv = 0;
    
    /* 配置线程RR调度, 优先级72 */
    pthread_attr_init(&attr);
    param.sched_priority = 74;
    pthread_attr_setschedpolicy(&attr, SCHED_RR);
    pthread_attr_setschedparam(&attr, &param);
    pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
    rv = pthread_create(&pid, &attr, _hd_manage_thread, NULL);
    if (rv != 0)
    {
        log_err(LOG_NETWORK, "PD can't create _network_manage_thread %d!", rv);
        return E_ERROR;
    }
    else
    {
        thread_m_add("CA_HARDWARE", pid);
    }
    pthread_attr_destroy(&attr);

    return E_NONE;
}


/* Interface functions -------------------------------------------------------*/
/* 4G模块初始化. */
int hd_handle_init(void)
{
    
    /* 初始化模块. */
    LD_E_RETURN(DBG_M_CA_NETWORK_ERR, _hd_handle_init_common());
    
    return E_NONE;
}

