Example #1
0
s32_t tele_mntn_common_init (void_t)
{
#ifndef WIN32
    tele_mntn_func_sw = (u64_t *)TELE_MNTN_AXI_PHY_TO_VIRT(TELE_MNTN_ALIGN(CONFIG_TELE_MNTN_ADDR, sizeof(u64_t)), sizeof(u64_t));
#endif
    return TELE_MNTN_OK;
}
Example #2
0
s32_t tele_mntn_init(void_t)
{
    s32_t ret = TELE_MNTN_OK;

    if (TELE_MNTN_INIT_MAGIC == g_tele_mntn_handle.init_flag) {
        ret = TELE_MNTN_ALREADY_INIT;
        TELE_MNTN_TRACE_OUT(ret, 0);
        return ret;
    }

    if(TELE_MNTN_OK != (ret = tele_mntn_common_init()))
    {
        TELE_MNTN_TRACE_OUT(ret, 0);
        return ret;
    }

    if(TELE_MNTN_OK != (ret = tele_mntn_init_cfg()))
    {
        TELE_MNTN_TRACE_OUT(ret, 0);
        return ret;
    }

    TELE_MNTN_MEMSET(&g_tele_mntn_handle, 0x00, sizeof(TELE_MNTN_HANDLE));

    g_tele_mntn_handle.queue.base = g_tele_mntn_cfg_tbl.data_virt_addr
        + TELE_MNTN_ALIGN((TELE_MNTN_HEAD_SIZE + (2*TELE_MNTN_PROTECT_LEN)), TELE_MNTN_ALIGN_SIZE);

    g_tele_mntn_handle.queue.length = g_tele_mntn_cfg_tbl.data_size
        - TELE_MNTN_ALIGN((TELE_MNTN_HEAD_SIZE + (2*TELE_MNTN_PROTECT_LEN)), TELE_MNTN_ALIGN_SIZE)
        - TELE_MNTN_ALIGN((2*TELE_MNTN_PROTECT_LEN), TELE_MNTN_ALIGN_SIZE);

#ifdef TELE_MNTN_DEBUG_SW
    g_tele_mntn_handle.debug.peak_left_size = g_tele_mntn_handle.queue.length;
#endif

    TELE_MNTN_INTLOCK_INIT(&g_tele_mntn_handle.lock);

    g_tele_mntn_handle.init_flag = TELE_MNTN_INIT_MAGIC;

    return ret;
}
Example #3
0
s32_t tele_mntn_write_log(TELE_MNTN_TYPE_ID type_id, u32_t len, void_t * data)
{
    s32_t ret                     = TELE_MNTN_ERRO;
    u32_t data_len                = 0;
    TELE_MNTN_DATA_STRU cur_data  = {0};
    TELE_MNTN_HANDLE *cur_handle  = &g_tele_mntn_handle;
    TELE_MNTN_CFG_STRU *cur_table = &g_tele_mntn_cfg_tbl;
    TELE_MNTN_BUF_TYPE buf_type   = TELE_MNTN_BUF_INCONTROLLABLE;

    if(TELE_MNTN_INIT_MAGIC != cur_handle->init_flag)
    {
        ret = TELE_MNTN_NOT_INIT;
        return ret;
    }

    if(TELE_MNTN_OK != tele_mntn_is_func_on(type_id))
    {
        return TELE_MNTN_OK;
    }

    if(TELE_MNTN_OK == tele_mntn_is_func_on(TELE_MNTN_NVME_LOGCAT))
    {
        buf_type = TELE_MNTN_BUF_CONTROLLABLE;
    }

    if(len > cur_table->user_data_threshold)
    {
        ret = TELE_MNTN_USER_DATA_OVERFLOW;
        return ret;
    }

    TELE_MNTN_INT_LOCK(&cur_handle->lock, cur_handle->flag);
    TELE_MNTN_IPC_SEM_LOCK(cur_table->ipc_sem_num);

    data_len         = TELE_MNTN_ALIGN(len, TELE_MNTN_ALIGN_SIZE);
    cur_data.protect = TELE_MNTN_PROTECT;
    /*lint -e571*/
    cur_data.type_id = (u32_t)type_id;
    /*lint +e571*/
    cur_data.idex    = cur_handle->idex++;
    cur_data.cpu_id  = TELE_MNTN_CUR_CPUID;
    cur_data.rtc     = TELE_MNTN_RTC_TIME_GET();
    cur_data.slice   = TELE_MNTN_SLICE_TIME_GET();
    cur_data.len     = data_len;

    if(TELE_MNTN_OK != (ret = tele_mntn_write_buf(&cur_data, data, data_len, buf_type)))
    {
#ifdef TELE_MNTN_DEBUG_SW
        cur_handle->debug.discard_silce[(cur_handle->debug.discard_num) & (TELE_MNTN_DISCARD_SLICE_BUF_NUM -1)] = TELE_MNTN_SLICE_TIME_GET();
        cur_handle->debug.discard_num++;
#endif
        TELE_MNTN_IPC_SEM_UNLOCK(cur_table->ipc_sem_num);
        TELE_MNTN_INT_UNLOCK(&cur_handle->lock, cur_handle->flag);
        return ret;
    }

    TELE_MNTN_IPC_SEM_UNLOCK(cur_table->ipc_sem_num);
    TELE_MNTN_INT_UNLOCK(&cur_handle->lock, cur_handle->flag);

    return TELE_MNTN_OK;

}