Exemple #1
0
static BOOL win_pvr_vol_init()
{
	m_volume_index = -1;
	m_pvr_vol_error = 0;
	storage_get_device_info(STORAGE_TYPE_SD);

	if(storage_get_volume_count() == 0)
	{
		set_container_active(&tms_item_con4, FALSE);
		m_pvr_vol_error = -1;
		return FALSE;
	}
	
	m_sto_device_type = sys_data_get_storage_type();
	m_sto_device_sub = sys_data_get_storage_sub_dev();
	m_sto_device_part = sys_data_get_storage_partition();

	// check the system data setting valid.
	m_volume_index = storage_find_volume(m_sto_device_type,m_sto_device_sub,m_sto_device_part);
	if(m_volume_index < 0)
	{
		m_pvr_vol_error = -2;
		libc_printf("cann't find the origial PVR partition(%d:%d:%d)\n",m_sto_device_type,m_sto_device_sub,m_sto_device_part);
		// invalid config, load current pvr setting.
		storage_get_cur_pvr_sto_info(&m_sto_device_type , &m_sto_device_sub, &m_sto_device_part);

		// check it again.
		m_volume_index = storage_find_volume(m_sto_device_type,m_sto_device_sub,m_sto_device_part);
		if(m_volume_index < 0)
		{
			ASSERT(0);
			m_sto_device_type = 0;
			m_sto_device_sub = 0;
			m_sto_device_part = 0;
			m_pvr_vol_error = -3;
			libc_printf("cann't find the new PVR partition(%d:%d:%d)\n",m_sto_device_type,m_sto_device_sub,m_sto_device_part);
			return FALSE;
		}
		libc_printf("find the new PVR partition(%d:%d:%d)\n",m_sto_device_type,m_sto_device_sub,m_sto_device_part);
	}
	return TRUE;
}
static void hddfmt_vol_init()
{
	UINT8 type;
	UINT8 sub_type;
	UINT8 partition;
	int max_volume;
	
	storage_get_device_info(STORAGE_TYPE_ALL);
	max_volume = storage_get_volume_count();
	storage_get_cur_pvr_sto_info(&type, &sub_type, &partition);
	hddfmt_cur_volume = storage_find_volume(type, sub_type, partition);
	if(max_volume >= 1 && hddfmt_cur_volume < 0)
	{
		// cann't fint pvr partition, get the first partition
		hddfmt_cur_volume = 0;
	}
}