Example #1
0
void free_seq()
{
	free_pdata(&curr_seq.seq);
	free_pdata(&curr_seq.bnk);
	free_pdata(curr_seq.war + 0);
	free_pdata(curr_seq.war + 1);
	free_pdata(curr_seq.war + 2);
	free_pdata(curr_seq.war + 3);
}
Example #2
0
void PlaySeqNDS(const char* ndsFile, const u32 SSEQOffset, const u32 SSEQSize, const u32 BANKOffset, const u32 BANKSize, const u32 WAVEARC1Offset, const u32 WAVEARC1Size, const u32 WAVEARC2Offset, const u32 WAVEARC2Size, const u32 WAVEARC3Offset, const u32 WAVEARC3Size, const u32 WAVEARC4Offset, const u32 WAVEARC4Size)
{
	StopSeq();
	swiWaitForVBlank();
	swiWaitForVBlank();
	//free_seq();
	curr_seq.msg = SNDSYS_PLAYSEQ;

	if((SSEQOffset==curr_seq_offset[0])&&(SSEQSize==curr_seq_size[0]))
	{
		iprintf("SSEQ Already Loaded.\n");
	}
	else
	{
		free_pdata(&curr_seq.seq);
		curr_seq_offset[0]=SSEQOffset;
		curr_seq_size[0]=SSEQSize;
		iprintf("Loading SSEQ.\n");
		LoadNDS(&curr_seq.seq, ndsFile, SSEQOffset, SSEQSize);
	}

	if((BANKOffset==curr_seq_offset[1])&&(BANKSize==curr_seq_size[1]))
	{
		iprintf("BANK Already Loaded.\n");
	}
	else
	{
		free_pdata(&curr_seq.bnk);
		curr_seq_offset[1]=BANKOffset;
		curr_seq_size[1]=BANKSize;
		iprintf("Loading BANK.\n");
		LoadNDS(&curr_seq.bnk, ndsFile, BANKOffset, BANKSize);
	}

	if((WAVEARC1Offset==curr_seq_offset[2])&&(WAVEARC1Size==curr_seq_size[2]))
	{
		if(WAVEARC1Offset != 0)
			iprintf("WAVEARC1 Already Loaded\n");
	}
	else
	{
		free_pdata(curr_seq.war + 0);
		curr_seq_offset[2]=WAVEARC1Offset;
		curr_seq_size[2]=WAVEARC1Size;
		if(WAVEARC1Offset != 0)
		{
			iprintf("Loading WAVEARC1.\n");
			LoadNDS(curr_seq.war + 0, ndsFile, WAVEARC1Offset, WAVEARC1Size);
		}
	}
	
	if((WAVEARC2Offset==curr_seq_offset[3])&&(WAVEARC2Size==curr_seq_size[3]))
	{
		if(WAVEARC2Offset != 0)
			iprintf("WAVEARC2 Already Loaded\n");
	}
	else
	{
		free_pdata(curr_seq.war + 1);
		curr_seq_offset[3]=WAVEARC2Offset;
		curr_seq_size[3]=WAVEARC2Size;
		if(WAVEARC2Offset != 0)
		{
			iprintf("Loading WAVEARC2.\n");
			LoadNDS(curr_seq.war + 1, ndsFile, WAVEARC2Offset, WAVEARC2Size);
		}
	}

	if((WAVEARC3Offset==curr_seq_offset[4])&&(WAVEARC3Size==curr_seq_size[4]))
	{
		if(WAVEARC3Offset != 0)
			iprintf("WAVEARC3 Already Loaded\n");
	}
	else
	{
		free_pdata(curr_seq.war + 2);
		curr_seq_offset[4]=WAVEARC3Offset;
		curr_seq_size[4]=WAVEARC3Size;
		if(WAVEARC3Offset != 0)
		{
			iprintf("Loading WAVEARC3.\n");
			LoadNDS(curr_seq.war + 2, ndsFile, WAVEARC3Offset, WAVEARC3Size);
		}
	}

	if((WAVEARC4Offset==curr_seq_offset[5])&&(WAVEARC4Size==curr_seq_size[5]))
	{
		if(WAVEARC4Offset != 0)
			iprintf("WAVEARC4 Already Loaded\n");
	}
	else
	{
		free_pdata(curr_seq.war + 3);
		curr_seq_offset[5]=WAVEARC4Offset;
		curr_seq_size[5]=WAVEARC4Size;
		if(WAVEARC4Offset != 0)
		{
			iprintf("Loading WAVEARC4.\n");
			LoadNDS(curr_seq.war + 3, ndsFile, WAVEARC4Offset, WAVEARC4Size);
		}
	}

	fifoSendDatamsg(FIFO_SNDSYS, sizeof(curr_seq), (u8*) &curr_seq);
}
Example #3
0
static int hisi_ion_probe(struct platform_device *pdev)
{
	struct ion_platform_data *pdata;
	int err = -1;
	int i;

	hisi_ion_get_heap();

	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
	if (IS_ERR_OR_NULL(pdata)) {
		err = PTR_ERR(pdata);
		goto out;
	}

	pdata->nr = ARRAY_SIZE(hisi_ion_heaps);
	pdata->heaps = hisi_ion_heaps;

	num_heaps = pdata->nr;
	dev_info(&pdev->dev, "num_heaps: %d\n", num_heaps);

	heaps = kcalloc(pdata->nr, sizeof(struct ion_heap *), GFP_KERNEL);

	if (!heaps) {
		err = -ENOMEM;
		free_pdata(pdata);
		goto out;
	}

	idev = ion_device_create(hisi_ion_custom_ioctl);
	if (IS_ERR_OR_NULL(idev)) {
		err = PTR_ERR(idev);
		goto freeheaps;
	}
	dev_info(&pdev->dev, "idev: %p\n", idev);

	/* create the heaps as specified in the board file */
	for (i = 0; i < num_heaps; i++) {
		struct ion_platform_heap *heap_data = &pdata->heaps[i];

		dev_info(&pdev->dev, "create heap %d "
			" ---> type: %d, id: %d, name: %s,"
			" base: 0x%lx, size: 0%x\n", i,
			heap_data->type, heap_data->id, heap_data->name,
			heap_data->base, heap_data->size);

		heaps[i] = ion_heap_create(heap_data);
		if (IS_ERR_OR_NULL(heaps[i])) {
			heaps[i] = 0;
			continue;
		} else {
			if (heap_data->size)
				pr_info("ION heap %s created at %lx "
					"with size %x\n", heap_data->name,
							  heap_data->base,
							  heap_data->size);
			else
				pr_info("ION heap %s created\n",
							  heap_data->name);
		}

		ion_device_add_heap(idev, heaps[i]);
	}

	free_pdata(pdata);

	platform_set_drvdata(pdev, idev);
	return 0;

freeheaps:
	kfree(heaps);
	free_pdata(pdata);
out:
	return err;
}