コード例 #1
0
M4U_STATUS_ENUM MTKM4UDrv::m4u_insert_wrapped_range(M4U_MODULE_ID_ENUM eModuleID, 
                                  M4U_PORT_ID_ENUM portID, 
								  const unsigned int MVAStart, 
								  const unsigned int MVAEnd)
{
    M4U_WRAP_DES_T m4u_wrap;
    m4u_wrap.eModuleID = eModuleID;
    m4u_wrap.ePortID = portID;
    m4u_wrap.MVAStart = MVAStart;
    m4u_wrap.MVAEnd = MVAEnd;
	      

    if(!m4u_check_m4u_en(eModuleID))
    {
        return M4U_STATUS_OK;
    }

    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_insert_wrapped_range failed \n");
        m4u_dump_backtrace();
        return M4U_STATUS_INVALID_HANDLE;
    }
    if(ioctl(mFileDescriptor, MTK_M4U_T_INSERT_TLB_RANGE, &m4u_wrap))
    {
        M4UMSG(" ioctl MTK_M4U_T_INSERT_TLB_RANGE fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
        m4u_dump_backtrace();
        return M4U_STATUS_KERNEL_FAULT;
    }
    else
    {
        return M4U_STATUS_OK;
    }	
}
コード例 #2
0
int MTKM4UDrv::m4u_dump_pagetable(M4U_PORT_ID port,
                                  const unsigned long BufAddr,
                                  const unsigned int BufSize,
                                  unsigned int MVAStart)
{


    M4U_MOUDLE_STRUCT m4u_module;
    m4u_module.port = port;
    m4u_module.BufAddr = BufAddr;
    m4u_module.BufSize = BufSize;
    m4u_module.MVAStart = MVAStart;

    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_dump_pagetable failed \n");
        m4u_dump_backtrace();
        return -1;
    }
    if(ioctl(mFileDescriptor, MTK_M4U_T_DUMP_PAGETABLE, &m4u_module) < 0)
    {
        M4UMSG(" ioctl MTK_M4U_T_DUMP_PAGETABLE fail! %d, %s \n", errno, strerror(errno));
        m4u_dump_backtrace();
        return -1;
    }
    else
    {
        return 0;
    }
}
コード例 #3
0
M4U_STATUS_ENUM MTKM4UDrv::m4u_cache_flush_all(M4U_MODULE_ID_ENUM eModuleID)
{


    if(!m4u_check_m4u_en(eModuleID))
    {
        return M4U_STATUS_OK;
    }

    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_cache_sync failed \n");
        m4u_dump_backtrace();
        return M4U_STATUS_INVALID_HANDLE;
    }
	        
    if(ioctl(mFileDescriptor, MTK_M4U_T_CACHE_FLUSH_ALL, NULL))
    {
        M4UMSG(" ioctl MTK_M4U_T_CACHE_FLUSH_ALL fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
        m4u_dump_backtrace();
        return M4U_STATUS_KERNEL_FAULT;
    }
    else
    {
        return M4U_STATUS_OK;
    }
}
コード例 #4
0
int MTKM4UDrv::m4u_cache_sync(M4U_PORT_ID port,
                              M4U_CACHE_SYNC_ENUM eCacheSync,
                              unsigned long va,
                              unsigned int size,
                              unsigned int mva)
{
    M4U_CACHE_STRUCT m4u_cache;

    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_cache_sync failed \n");
        m4u_dump_backtrace();
        return -1;
    }

    m4u_cache.port = port;
    m4u_cache.eCacheSync = eCacheSync;
    m4u_cache.va = va;
    m4u_cache.size = size;
    m4u_cache.mva = mva;

    if(ioctl(mFileDescriptor, MTK_M4U_T_CACHE_SYNC, &m4u_cache) < 0)
    {
        M4UMSG(" ioctl MTK_M4U_T_CACHE_SYNC fail! %d, %s \n", errno, strerror(errno));
        m4u_dump_backtrace();
        return -1;
    }
    else
    {
        return 0;
    }
}
コード例 #5
0
///> native
int MTKM4UDrv::m4u_config_port(M4U_PORT_STRUCT* pM4uPort)
{

    if(NULL==pM4uPort)
    {
        M4UMSG("m4u_config_port failed, input M4U_PORT_STRUCT* is null! \n");
        m4u_dump_backtrace();
        return -1;
    }

    if(mFileDescriptor<0)
    {
        M4UMSG("m4u_config_port failed \n");
        m4u_dump_backtrace();
        return -1;
    }
    if(ioctl(mFileDescriptor, MTK_M4U_T_CONFIG_PORT, pM4uPort) < 0)
    {
        M4UMSG(" ioctl MTK_M4U_T_CONFIG_PORT fail! %d, %s \n", errno, strerror(errno));
        m4u_dump_backtrace();
        return -1;
    }
    else
    {
        return 0;
    }
}
コード例 #6
0
M4U_STATUS_ENUM MTKM4UDrv::m4u_invalid_tlb_range(M4U_MODULE_ID_ENUM eModuleID,
										  unsigned int MVAStart, 
										  unsigned int MVAEnd)
{
    M4U_MOUDLE_STRUCT m4u_module;
    m4u_module.eModuleID = eModuleID;
    m4u_module.MVAStart = MVAStart;
    m4u_module.MVAEnd = MVAEnd;


    if(!m4u_check_m4u_en(eModuleID))
    {
        return M4U_STATUS_OK;
    }

    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_invalid_tlb_range failed \n");
        m4u_dump_backtrace();
        return M4U_STATUS_INVALID_HANDLE;
    }
    if(ioctl(mFileDescriptor, MTK_M4U_T_INVALID_TLB_RANGE, &m4u_module))
    {
        M4UMSG(" ioctl MTK_M4U_T_INVALID_TLB_RANGE fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
        m4u_dump_backtrace();
        return M4U_STATUS_KERNEL_FAULT;
    }
    else
    {
        return M4U_STATUS_OK;
    }
}
コード例 #7
0
/**
 * @brief : 
 * @param 
 * @return 
 */
M4U_STATUS_ENUM MTKM4UDrv::m4u_dump_info(M4U_MODULE_ID_ENUM eModuleID)
{

    if(!m4u_check_m4u_en(eModuleID))
    {
        return M4U_STATUS_OK;
    }


    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_dump_info failed \n");
        m4u_dump_backtrace();
        return M4U_STATUS_INVALID_HANDLE;
    }

    if(ioctl(mFileDescriptor, MTK_M4U_T_DUMP_INFO, &eModuleID))
    {
        M4UMSG(" ioctl MTK_M4U_T_DUMP_INFO fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
        m4u_dump_backtrace();
        return M4U_STATUS_KERNEL_FAULT;
    }
    else
    {
        return M4U_STATUS_OK;
    }

}
コード例 #8
0
/**
 * @brief :             
 * @param 
 * @return 
 */
M4U_STATUS_ENUM MTKM4UDrv::m4u_monitor_stop(M4U_PORT_ID_ENUM PortID)
{
    M4U_MODULE_ID_ENUM eModuleID = m4u_get_module_by_port(PortID);

    if(!m4u_check_m4u_en(eModuleID))
    {
        return M4U_STATUS_OK;
    }


    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_monitor_stop failed \n");
        m4u_dump_backtrace();
        return M4U_STATUS_INVALID_HANDLE;
    }

    if(ioctl(mFileDescriptor, MTK_M4U_T_MONITOR_STOP, &PortID))
    {
        M4UMSG(" ioctl MTK_M4U_T_MONITOR_STOP fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
        m4u_dump_backtrace();
        return M4U_STATUS_KERNEL_FAULT;
    }
    else
    {
        return M4U_STATUS_OK;
    }
}
コード例 #9
0
/**
 * @brief : 
 * @param 
 * @return 
 */
M4U_STATUS_ENUM MTKM4UDrv::m4u_dump_reg(M4U_MODULE_ID_ENUM eModuleID)
{

    if(!m4u_check_m4u_en(eModuleID))
    {
        return M4U_STATUS_OK;
    }

    
    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_dump_reg failed \n");
        m4u_dump_backtrace();
        return M4U_STATUS_INVALID_HANDLE;
    }

    //M4UMSG("before m4u_dump_reg, module=%d", eModuleID);
    if(ioctl(mFileDescriptor, MTK_M4U_T_DUMP_REG, &eModuleID))
    {
        M4UMSG(" ioctl MTK_M4U_T_DUMP_REG fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
        m4u_dump_backtrace();
        return M4U_STATUS_KERNEL_FAULT;
    }
    else
    {
        //M4UMSG("after m4u_dump_reg, module=%d", eModuleID);
        return M4U_STATUS_OK;
    }
}
コード例 #10
0
/**
 * @brief :             
 * @param 
 * @return 
 */
M4U_STATUS_ENUM MTKM4UDrv::m4u_reset_mva_release_tlb(M4U_MODULE_ID_ENUM eModuleID)
{

    if(!m4u_check_m4u_en(eModuleID))
    {
        return M4U_STATUS_OK;
    }

    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_reset_mva_release_tlb failed \n");
        m4u_dump_backtrace();
        return M4U_STATUS_INVALID_HANDLE;
    }

    if(ioctl(mFileDescriptor, MTK_M4U_T_RESET_MVA_RELEASE_TLB, &eModuleID))
    {
        M4UMSG(" ioctl MTK_M4U_T_RESET_MVA_RELEASE_TLB fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
        m4u_dump_backtrace();
        return M4U_STATUS_KERNEL_FAULT;
    }
    else
    {
        return M4U_STATUS_OK;
    }
}
コード例 #11
0
M4U_STATUS_ENUM MTKM4UDrv::m4u_config_port_rotator(M4U_PORT_STRUCT_ROTATOR* pM4uPort)
{

    M4U_MODULE_ID_ENUM eModuleID = m4u_get_module_by_port(pM4uPort->ePortID);
    if(!m4u_check_m4u_en(eModuleID))
    {
        return M4U_STATUS_OK;
    }

    if(NULL==pM4uPort)
    {
        M4UMSG("m4u_config_port_rotator failed, input M4U_PORT_STRUCT_ROTATOR* is null! \n");
        m4u_dump_backtrace();
        return M4U_STATUS_INVALID_HANDLE;
    }
	        	        
    if(mFileDescriptor<0)
    {
        M4UMSG("m4u_config_port_rotator failed \n");
        m4u_dump_backtrace();
        return M4U_STATUS_INVALID_HANDLE;
    }
    if(ioctl(mFileDescriptor, MTK_M4U_T_CONFIG_PORT_ROTATOR, pM4uPort))
    {
        M4UMSG(" ioctl MTK_M4U_T_CONFIG_PORT_ROTATOR fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
        m4u_dump_backtrace();
        return M4U_STATUS_KERNEL_FAULT;
    }
    else
    {
        return M4U_STATUS_OK;
    }	
}
コード例 #12
0
int MTKM4UDrv::m4u_dealloc_mva(M4U_PORT_ID port,
                               unsigned long va, unsigned int size,
                               unsigned int mva)
{
    M4U_MOUDLE_STRUCT m4u_module;
    m4u_module.port = port;
    m4u_module.MVAStart = mva;

    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_dealloc_mva failed \n");
        m4u_dump_backtrace();
        return -1;
    }
    if(ioctl(mFileDescriptor, MTK_M4U_T_DEALLOC_MVA, &m4u_module) < 0)
    {
        M4UMSG(" ioctl MTK_M4U_T_DEALLOC_MVA fail! %d, %s \n", errno, strerror(errno));
        m4u_dump_backtrace();
        //munlock((void*)va, size);
        return -1;
    }
    else
    {
        //munlock((void*)va,size);
        return 0;
    }
}
コード例 #13
0
M4U_STATUS_ENUM MTKM4UDrv::m4u_dump_pagetable(M4U_MODULE_ID_ENUM eModuleID, 
								  const unsigned int BufAddr, 
								  const unsigned int BufSize, 
								  unsigned int MVAStart)
{


    if(!m4u_check_m4u_en(eModuleID))
    {
        return M4U_STATUS_OK;
    }

    M4U_MOUDLE_STRUCT m4u_module;
    m4u_module.eModuleID = eModuleID;
    m4u_module.BufAddr = BufAddr;
    m4u_module.BufSize = BufSize;
    m4u_module.MVAStart = MVAStart;
 	        
    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_dump_pagetable failed \n");
        m4u_dump_backtrace();
        return M4U_STATUS_INVALID_HANDLE;
    }
    if(ioctl(mFileDescriptor, MTK_M4U_T_DUMP_PAGETABLE, &m4u_module))
    {
        M4UMSG(" ioctl MTK_M4U_T_DUMP_PAGETABLE fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
        m4u_dump_backtrace();
        return M4U_STATUS_KERNEL_FAULT;
    }
    else
    {
        return M4U_STATUS_OK;
    }
}
コード例 #14
0
int MTKM4UDrv::m4u_config_port_array(struct m4u_port_array * port_array)
{
    if(mFileDescriptor<0)
    {
        M4UMSG("m4u_config_port failed \n");
        m4u_dump_backtrace();
        return -1;
    }
    if(ioctl(mFileDescriptor, MTK_M4U_T_CONFIG_PORT_ARRAY, port_array) < 0)
    {
        M4UMSG(" ioctl MTK_M4U_T_CONFIG_PORT fail! %d, %s \n", errno, strerror(errno));
        m4u_dump_backtrace();
        return -1;
    }
    else
    {
        return 0;
    }
}
コード例 #15
0
M4U_STATUS_ENUM MTKM4UDrv::m4u_manual_insert_entry(M4U_MODULE_ID_ENUM eModuleID,
									unsigned int EntryMVA, 
									bool Lock)	
{


    if(!m4u_check_m4u_en(eModuleID))
    {
        return M4U_STATUS_OK;
    }

    M4U_MOUDLE_STRUCT m4u_module;

    if(0)
    {
        m4u_module.eModuleID = eModuleID;
        m4u_module.EntryMVA = EntryMVA;
        m4u_module.Lock = Lock;
    	        
        if(mFileDescriptor<0 )
        {
            M4UMSG("m4u_insert_entry failed \n");
            m4u_dump_backtrace();
            return M4U_STATUS_INVALID_HANDLE;
        }
        if(ioctl(mFileDescriptor, MTK_M4U_T_MANUAL_INSERT_ENTRY, &m4u_module))
        {
            M4UMSG(" ioctl MTK_M4U_T_MANUAL_INSERT_ENTRY fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
            m4u_dump_backtrace();
            return M4U_STATUS_KERNEL_FAULT;
        }
        else
        {
            return M4U_STATUS_OK;
        }	
    }
    else
    {
        return M4U_STATUS_OK;
    }
}
コード例 #16
0
/**
 * @brief :
 * @param
 * @return
 */
int MTKM4UDrv::m4u_power_off(M4U_PORT_ID port)
{

    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_power_off failed \n");
        m4u_dump_backtrace();
        return -1;
    }

    if(ioctl(mFileDescriptor, MTK_M4U_T_POWER_OFF, &port) < 0)
    {
        M4UMSG(" ioctl MTK_M4U_T_POWER_OFF fail! %d, %s \n", errno, strerror(errno));
        m4u_dump_backtrace();
        return -1;
    }
    else
    {
        return 0;
    }
}
コード例 #17
0
/**
 * @brief :
 * @param
 * @return
 */
int MTKM4UDrv::m4u_monitor_stop(M4U_PORT_ID PortID)
{

    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_monitor_stop failed \n");
        m4u_dump_backtrace();
        return -1;
    }

    if(ioctl(mFileDescriptor, MTK_M4U_T_MONITOR_STOP, &PortID) < 0)
    {
        M4UMSG(" ioctl MTK_M4U_T_MONITOR_STOP fail! %d, %s \n", errno, strerror(errno));
        m4u_dump_backtrace();
        return -1;
    }
    else
    {
        return 0;
    }
}
コード例 #18
0
int MTKM4UDrv::m4u_cache_flush_all(M4U_PORT_ID port)
{

    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_cache_sync failed \n");
        m4u_dump_backtrace();
        return -1;
    }

    if(ioctl(mFileDescriptor, MTK_M4U_T_CACHE_FLUSH_ALL, NULL) < 0)
    {
        M4UMSG(" ioctl MTK_M4U_T_CACHE_FLUSH_ALL fail! %d, %s \n", errno, strerror(errno));
        m4u_dump_backtrace();
        return -1;
    }
    else
    {
        return 0;
    }
}
コード例 #19
0
int MTKM4UDrv::m4u_config_mau(M4U_PORT_ID port, unsigned int mva, unsigned int size,
                              bool write, bool enable, bool force)
{
    M4U_MAU_STRUCT mau;
    mau.port = port;
    mau.mva = mva;
    mau.size = size;
    mau.write = write;
    mau.enable = enable;
    mau.force = force;

    char value[PROPERTY_VALUE_MAX];
    int u4Enable = 0;

    property_get("mtk.m4u.mau.enable", value, "0");
    u4Enable = atoi(value);
    if(u4Enable == 0)
    {
        M4UMSG("mtk.m4u.mau.enable: %d\n", u4Enable);
        return -1;
    }

    if(mFileDescriptor<0)
    {
        M4UMSG("m4u_config_mau failed \n");
        m4u_dump_backtrace();
        return -1;
    }
    if(ioctl(mFileDescriptor, MTK_M4U_T_CONFIG_MAU, &mau) < 0)
    {
        M4UMSG(" ioctl MTK_M4U_T_CONFIG_MAU fail! %d, %s \n", errno, strerror(errno));
        m4u_dump_backtrace();
        return -1;
    }
    else
    {
        return 0;
    }

}
コード例 #20
0
int MTKM4UDrv::m4u_alloc_mva(M4U_PORT_ID port,
                             unsigned long va, unsigned int size,
                             unsigned int prot, unsigned int flags,
                             unsigned int *pMva)
{
    M4U_MOUDLE_STRUCT m4u_module;
    m4u_module.port = port;
    m4u_module.BufAddr = va;
    m4u_module.BufSize = size;
    m4u_module.prot = prot;
    m4u_module.flags = flags;

    m4u_module.MVAStart = *pMva;

    if(mlock((void*)va, size))
    {
        M4UMSG("mlock fail! %d, %s \n", errno, strerror(errno));
        *pMva = 0;
        return -1;
    }

    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_alloc_mva failed fd=%d\n", mFileDescriptor);
        m4u_dump_backtrace();
        return -1;
    }
    if(ioctl(mFileDescriptor, MTK_M4U_T_ALLOC_MVA, &m4u_module) < 0)
    {
        M4UMSG(" ioctl MTK_M4U_T_ALLOC_MVA fail! %d, %s \n", errno, strerror(errno));
        m4u_dump_backtrace();
        *pMva = 0;
        return -1;
    }
    else
    {
        *pMva = m4u_module.MVAStart;
        return 0;
    }
}
コード例 #21
0
M4U_STATUS_ENUM MTKM4UDrv::m4u_register_buffer(M4U_MODULE_ID_ENUM eModuleID, 
								  const unsigned int BufAddr, 
								  const unsigned int BufSize,
								  int security,
								  int cache_coherent,
								  unsigned int *pRetMVAAddr)
{


    if(!m4u_check_m4u_en(eModuleID))
    {
        return M4U_STATUS_OK;
    }

    M4U_MOUDLE_STRUCT m4u_module;
    m4u_module.eModuleID = eModuleID;
    m4u_module.BufAddr = BufAddr;
    m4u_module.BufSize = BufSize;
    m4u_module.security = security;
    m4u_module.cache_coherent = cache_coherent;
 	        
    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_register_buffer failed \n");
        m4u_dump_backtrace();
        return M4U_STATUS_INVALID_HANDLE;
    }
    if(ioctl(mFileDescriptor, MTK_M4U_T_REGISTER_BUFFER, &m4u_module))
    {
        M4UMSG(" ioctl MTK_M4U_T_REGISTER_BUFFER fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
        m4u_dump_backtrace();
        return M4U_STATUS_KERNEL_FAULT;
    }
    else
    {
        *pRetMVAAddr = 0;
        return M4U_STATUS_OK;
    }
}
コード例 #22
0
MTKM4UDrv::MTKM4UDrv(void)
{

    mFileDescriptor = -1;
 
    mFileDescriptor = open("/proc/M4U_device", O_RDONLY);
    if(mFileDescriptor<0)
    {
        M4UMSG("Open file failed mFileDescriptor=%d, error=%d :%s", mFileDescriptor, errno, strerror(errno));
        m4u_dump_backtrace();
    }
    else
    {
        if(ioctl(mFileDescriptor, MTK_M4U_T_M4UDrv_CONSTRUCT, NULL))
        {
            M4UMSG(" ioctl MTK_M4U_T_M4UDrv_CONSTRUCT fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
            m4u_dump_backtrace();
        }
        M4UINFO("MTKM4UDrv fd = %d, obj=0x%x\n", mFileDescriptor, (unsigned int)&mFileDescriptor);
    }

}
コード例 #23
0
MTKM4UDrv::MTKM4UDrv(void)
{

    mFileDescriptor = -1;

    mFileDescriptor = open("/proc/m4u", O_RDONLY);
    if(mFileDescriptor<0)
    {
        mFileDescriptor = -1;
        M4UMSG("Open file failed mFileDescriptor=%d, error=%d :%s", mFileDescriptor, errno, strerror(errno));
        m4u_dump_backtrace();
    }
}
コード例 #24
0
int MTKM4UDrv::m4u_dump_info(M4U_PORT_ID port)
{


    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_dump_info failed \n");
        m4u_dump_backtrace();
        return -1;
    }

    if(ioctl(mFileDescriptor, MTK_M4U_T_DUMP_INFO, &port) < 0)
    {
        M4UMSG(" ioctl MTK_M4U_T_DUMP_INFO fail! %d, %s \n", errno, strerror(errno));
        m4u_dump_backtrace();
        return -1;
    }
    else
    {
        return 0;
    }

}
コード例 #25
0
M4U_STATUS_ENUM MTKM4UDrv::m4u_insert_tlb_range(M4U_MODULE_ID_ENUM eModuleID, 
										unsigned int MVAStart, 
										const unsigned int MVAEnd, 
										M4U_RANGE_PRIORITY_ENUM ePriority,
										unsigned int entryCount) 
{
    M4U_MOUDLE_STRUCT m4u_module;
    m4u_module.eModuleID = eModuleID;
    m4u_module.MVAStart = MVAStart;
    m4u_module.MVAEnd = MVAEnd;
    m4u_module.ePriority = ePriority;
    m4u_module.entryCount = entryCount;  


    if(!m4u_check_m4u_en(eModuleID))
    {
        return M4U_STATUS_OK;
    }
	      
    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_insert_tlb_range failed \n");
        m4u_dump_backtrace();
        return M4U_STATUS_INVALID_HANDLE;
    }
    if(ioctl(mFileDescriptor, MTK_M4U_T_INSERT_TLB_RANGE, &m4u_module))
    {
        M4UMSG(" ioctl MTK_M4U_T_INSERT_TLB_RANGE fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
        m4u_dump_backtrace();
        return M4U_STATUS_KERNEL_FAULT;
    }
    else
    {
        return M4U_STATUS_OK;
    }

}
コード例 #26
0
M4U_STATUS_ENUM MTKM4UDrv::m4u_cache_sync(M4U_MODULE_ID_ENUM eModuleID,
	                                    M4U_CACHE_SYNC_ENUM eCacheSync,
		                                  unsigned int BufAddr, 
		                                  unsigned int BufSize)
{

    if(!m4u_check_m4u_en(eModuleID))
    {
        return M4U_STATUS_OK;
    }


    M4U_CACHE_STRUCT m4u_cache;
    
    if(mFileDescriptor<0 )
    {
        M4UMSG("m4u_cache_sync failed \n");
        m4u_dump_backtrace();
        return M4U_STATUS_INVALID_HANDLE;
    }
	        
    m4u_cache.eModuleID = eModuleID;
    m4u_cache.eCacheSync = eCacheSync;
    m4u_cache.BufAddr = BufAddr;
    m4u_cache.BufSize = BufSize;
    if(ioctl(mFileDescriptor, MTK_M4U_T_CACHE_SYNC, &m4u_cache))
    {
        M4UMSG(" ioctl MTK_M4U_T_CACHE_SYNC fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
        m4u_dump_backtrace();
        return M4U_STATUS_KERNEL_FAULT;
    }
    else
    {
        return M4U_STATUS_OK;
    }
}
コード例 #27
0
int MTKM4UDrv::m4u_enable_tf(M4U_PORT_ID port, bool enable)
{
    M4U_TF_STRUCT rM4UTF;
    rM4UTF.port = port;
    rM4UTF.fgEnable = enable;

    if(mFileDescriptor<0)
    {
        M4UMSG("m4u_enable_tf failed \n");
        m4u_dump_backtrace();
        return -1;
    }
    if(ioctl(mFileDescriptor, MTK_M4U_T_CONFIG_TF, &rM4UTF) < 0)
    {
        M4UMSG(" ioctl MTK_M4U_T_CONFIG_TF fail! %d, %s \n", errno, strerror(errno));
        m4u_dump_backtrace();
        return -1;
    }
    else
    {
        return 0;
    }

}
コード例 #28
0
MTKM4UDrv::~MTKM4UDrv(void)
{    
    if(-1!=mFileDescriptor)
    {
        if(ioctl(mFileDescriptor, MTK_M4U_T_M4UDrv_DECONSTRUCT, NULL))
        {
            M4UMSG(" ioctl MTK_M4U_T_M4UDrv_DECONSTRUCT fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
            m4u_dump_backtrace();
        }
        M4UINFO("~MTKM4UDrv close m4u fd=%d, obj=0x%x\n", mFileDescriptor, (unsigned int)&mFileDescriptor);
    	close(mFileDescriptor);
    }
    else
    {
        M4UMSG("warning: ~MTKM4UDrv fd=%d, obj=0x%x\n", mFileDescriptor, (unsigned int)&mFileDescriptor);
    }
    mFileDescriptor = -1;
}
コード例 #29
0
M4U_STATUS_ENUM MTKM4UDrv::m4u_alloc_mva(M4U_MODULE_ID_ENUM eModuleID, 
								  const unsigned int BufAddr, 
								  const unsigned int BufSize,
								  int security,
								  int cache_coherent,
								  unsigned int *pRetMVAAddr)
{
    M4U_MOUDLE_STRUCT m4u_module;
    m4u_module.eModuleID = eModuleID;
    m4u_module.BufAddr = BufAddr;
    m4u_module.BufSize = BufSize;
    m4u_module.security = security;
    m4u_module.cache_coherent = cache_coherent;


    if(!m4u_check_m4u_en(eModuleID))
    {
        //just work around, tell kernel it's pmem, and use wrap layer!!
        m4u_module.MVAStart = -1;
        if(mFileDescriptor<0 )
        {
            M4UMSG("m4u_alloc_mva failed \n");
            m4u_dump_backtrace();
            return M4U_STATUS_INVALID_HANDLE;
        }
        if(ioctl(mFileDescriptor, MTK_M4U_T_ALLOC_MVA, &m4u_module))
        {
            M4UMSG(" ioctl MTK_M4U_T_ALLOC_MVA fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
            m4u_dump_backtrace();
            return M4U_STATUS_KERNEL_FAULT;
        }
        else
        {
            *pRetMVAAddr = m4u_module.MVAStart;
            return M4U_STATUS_OK;
        }

        return M4U_STATUS_OK;
    }
    else
    {
        m4u_module.MVAStart = 0;

        if(mFileDescriptor<0 )
        {
            M4UMSG("m4u_alloc_mva failed \n");
            m4u_dump_backtrace();
            return M4U_STATUS_INVALID_HANDLE;
        }

        //mlock this buffer
        if(mlock((void*)BufAddr, BufSize))
        {
            M4UMSG("mlock fail! va=0x%x, size=%d, err=%d, %s \n",
                BufAddr, BufSize, errno, strerror(errno));
            *pRetMVAAddr = 0;
            m4u_dump_backtrace();
            return M4U_STATUS_INVALID_PARAM;
        }
        
        if(ioctl(mFileDescriptor, MTK_M4U_T_ALLOC_MVA, &m4u_module))
        {
            M4UMSG(" ioctl MTK_M4U_T_ALLOC_MVA fail! fd=%d, %d, %s \n", mFileDescriptor, errno, strerror(errno));
            m4u_dump_backtrace();
            return M4U_STATUS_KERNEL_FAULT;
        }
        else
        {
            *pRetMVAAddr = m4u_module.MVAStart;
            return M4U_STATUS_OK;
        }
    }
}