Пример #1
0
static int read_nogui_flag(void)
{
    int ret;
    struct nve_info_user user_info;
    int nogui_flag = 0;

    user_info.nv_operation = 1;
    user_info.nv_number = 206;
    user_info.valid_size = 1;
    strcpy(user_info.nv_name, "NOGUI");
    ret = nve_direct_access(&user_info);
    if (ret)
    {
        printk(KERN_ERR "nve_direct_access read error(%d)\n", ret);
        return -1;
    }
    nogui_flag = user_info.nv_data[0];
    printk("[read_nogui_flag]: nogui_flag = %d.\n", nogui_flag);
    if (nogui_flag == 1)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}
Пример #2
0
int  ddr_protect_nv_read()
{
    int ret=0;
    struct nve_info_user nvinfo;
    nvinfo.nv_operation = NV_READ;
    nvinfo.nv_number=NVE_HIMNTN_NUM;
    nvinfo.valid_size=HIMNTN_VALID_SIZE;
    strcpy(nvinfo.nv_name,"HIMNTN");

    ret=nve_direct_access(&nvinfo);
    if (1)
    {
        if(nvinfo.nv_data[HTMNTN_DDR_PROTECT]  == '0')
        {
            pr_info("[bsp_config_ddr_protect_mntn] nve access failed!\n");
            return 0;
        }
        else if (nvinfo.nv_data[HTMNTN_DDR_PROTECT] == '1')
        {
            pr_info("[bsp_config_ddr_protect_mntn] nve access success!\n");
            return 1;
        }
    }

}
Пример #3
0
BSP_S32 DRV_NVE_ACCESS(NVE_INFO_S *nve)
{
#ifdef CONFIG_K3V2_NVE
    int ret;	
    struct nve_info_user  info;	

    if (!nve) {
    	printk(KERN_ERR "BSP_NVE_DirectAccess input is null!");
    	return BSP_ERROR;
    }    
    
    info.nv_operation = nve->nv_operation;
    info.nv_number = nve->nv_number;
    info.valid_size = nve->valid_size;
    memcpy(info.nv_name,nve->nv_name,BSP_NVE_NAME_LENGTH);
    
    /*write operation*/
    if (!nve->nv_operation)
        memcpy(info.nv_data,nve->nv_data,nve->valid_size);
        
    ret = nve_direct_access((struct nve_info_user *)&info);	        
    
    if (!ret) {
    	/*read operation*/
        if (nve->nv_operation)
            memcpy(nve->nv_data,info.nv_data,nve->valid_size);
            
        return BSP_OK;
    }
    else
        return BSP_ERROR;
#else
    return BSP_ERROR;
#endif
}
Пример #4
0
int k3v2_wifi_get_mac_addr(unsigned char *buf)
{
    struct nve_info_user  info;
    int ret = -1;
    int sum = 0;

    if (NULL == buf) {
        pr_err("%s: k3v2_wifi_get_mac_addr failed\n", __func__);
        return -1;
    }

    memset(buf, 0, WLAN_MAC_LEN );

    memset(&info, 0, sizeof(info));
    info.nv_number  = NV_WLAN_NUM;   //nve item
    strcpy( info.nv_name, "MACWLAN" );
    info.valid_size = NV_WLAN_VALID_SIZE;
    info.nv_operation = NV_READ;

    if (0 != g_wifimac[0] || 0 != g_wifimac[1] || 0 != g_wifimac[2] || 0 != g_wifimac[3]
       || 0 != g_wifimac[4] || 0 != g_wifimac[5])
    {
        read_from_global_buf(buf);
        return 0;
    }

    ret = nve_direct_access( &info );

    if (!ret)
    {
        sum = char2byte(info.nv_data, buf );
        if (0 != sum)
        {
            printk("get MAC from NV: mac=%02x:%02x:%02x:%02x:%02x:%02x\n",buf[0],buf[1],buf[2],buf[3],buf[4],buf[5]);
            memcpy(g_wifimac,buf,WLAN_MAC_LEN);
            return 0;
        }
    }
    //read buf from mac-file or random mac
    return read_from_file(buf);
}