当前位置: 首页>>代码示例>>C++>>正文


C++ DCFlushRange函数代码示例

本文整理汇总了C++中DCFlushRange函数的典型用法代码示例。如果您正苦于以下问题:C++ DCFlushRange函数的具体用法?C++ DCFlushRange怎么用?C++ DCFlushRange使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DCFlushRange函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dma_callback

static void dma_callback(void)
{
   gx_audio_t *wa = (gx_audio_t*)gx_audio_data;

   /* Erase last chunk to avoid repeating audio. */
   memset(wa->data[wa->dma_busy], 0, CHUNK_SIZE);

   wa->dma_busy = wa->dma_next;
   wa->dma_next = (wa->dma_next + 1) & (BLOCKS - 1);

   DCFlushRange(wa->data[wa->dma_next], CHUNK_SIZE);
   AIInitDMA((uint32_t)wa->data[wa->dma_next], CHUNK_SIZE);

   OSSignalCond(wa->cond);
}
开发者ID:mprobinson,项目名称:RetroArch,代码行数:15,代码来源:gx_audio.c

示例2: __Disc_SetLowMem

void __Disc_SetLowMem(void)
{
	/* Setup low memory */
	*(vu32 *)0x80000030 = 0x00000000;
	*(vu32 *)0x80000060 = 0x38A00040;
	*(vu32 *)0x800000E4 = 0x80431A80;
	*(vu32 *)0x800000EC = 0x81800000;
	*(vu32 *)0x800000F4 = 0x817E5480;
	*(vu32 *)0x800000F8 = 0x0E7BE2C0;
	*(vu32 *)0x800000FC = 0x2B73A840;

	/* Copy disc ID */
	memcpy((void *)0x80003180, (void *)0x80000000, 4);

	/* Flush cache */
	DCFlushRange((void *)0x80000000, 0x3F00);
}
开发者ID:leoetlino,项目名称:crapwii,代码行数:17,代码来源:disc.c

示例3: load_dol_start

u32 load_dol_start(void *dolstart)
{
	if (dolstart)
	{
		dolfile = (dolheader *)dolstart;
        return dolfile->entry_point;
	} else
	{
		return 0;
	}
	
    memset((void *)dolfile->bss_start, 0, dolfile->bss_size);
    DCFlushRange((void *)dolfile->bss_start, dolfile->bss_size);
	
	phase = 0;
	i = 0;
}
开发者ID:MajorBootman,项目名称:cfg-loader,代码行数:17,代码来源:dol.c

示例4: HIDUpdateRegisters

void HIDUpdateRegisters()
{
	if(*(vu32*)HID_CHANGE == 0)
		return;
	u32 DeviceVID = *(vu32*)HID_CHANGE;
	u32 DevicePID = *(vu32*)HID_CFG_SIZE;

	/* I hope this covers all possible ini files */
	gprintf("Trying to get VID%04x PID%04x\n", DeviceVID, DevicePID);
	char filename[50];
	sprintf(filename, "sd:/controllers/%04X_%04X.ini", DeviceVID, DevicePID);
	FILE *f = fopen(filename, "rb");
	if(f == NULL)
	{
		sprintf(filename, "usb:/controllers/%04X_%04X.ini", DeviceVID, DevicePID);
		f = fopen(filename, "rb");
		if(f == NULL)
		{
			f = fopen("sd:/controller.ini", "rb");
			if(f == NULL)
			{
				fopen("sd:/controller.ini.ini", "rb");
				if(f == NULL)
				{
					f = fopen("usb:/controller.ini", "rb");
					if(f == NULL)
						f = fopen("usb:/controller.ini.ini", "rb");
				}
			}
		}
	}
	if(f != NULL)
	{
		fseek(f, 0, SEEK_END);
		size_t fsize = ftell(f);
		rewind(f);
		fread((void*)HID_CFG_FILE, 1, fsize, f);
		DCFlushRange((void*)HID_CFG_FILE, fsize);
		fclose(f);
		*(vu32*)HID_CFG_SIZE = fsize;
	}
	else
		*(vu32*)HID_CFG_SIZE = 0;
	*(vu32*)HID_CHANGE = 0;
}
开发者ID:AngelSora,项目名称:Nintendont,代码行数:45,代码来源:HID.c

示例5: GX_Text

/**
 * Shameless wrapper around the handy FreeTypeGRRLIB
 */
GX_Texture* GX_Text(const wchar_t *string, uint fontSize, uint color)
{
	unsigned int error = FT_Set_Pixel_Sizes(ftFace, 0, fontSize);
	if (error) {
		/* Failed to set the font size to the requested size. 
		 * You probably should set a default size or something. 
		 * I'll leave that up to the reader. */
	}
	const unsigned int height = fontSize*2;
	const unsigned int tempWidth = 640;
	
	/* Set the font colour, alpha is determined when we blit the glyphs */
	color = color << 8;
	
	/* Create a tempory buffer, 640 pixels wide, for freetype draw the glyphs */
	void *tempTextureBuffer = (void*) malloc(tempWidth * height * 4);
	if (tempTextureBuffer == NULL) {
		/* Oops! Something went wrong! */
		exit(0);
	}
	
	/* Set the RGB pixels in tempTextureBuffer to the requested colour */
	unsigned int *p = (unsigned int*)tempTextureBuffer;
	unsigned int loop = 0;
	for (loop = 0; loop < (tempWidth * height); ++loop) {
		*(p++) = color;	
	}
	/* Render the glyphs on to the temp buffer */
	unsigned int width = DrawText(string, fontSize, tempTextureBuffer);
	width = ((width + 3) / 4) * 4; // round up to the nearest mod 4 number
	
	GX_InvalidateTexAll();
	
	/* Create a new buffer, this time to hold the final texture 
	 * in a format suitable for the Wii */
	void *texture = memalign(32, width * height * 4);
	/* Convert the RGBA temp buffer to a format usuable by GX */
	BitmapTo4x4RGBA((const unsigned char *)tempTextureBuffer,texture, tempWidth, height, width, height);
	DCFlushRange(texture, 640 * (fontSize*2) * 4);
	
	/* The temp buffer is no longer required */
	free(tempTextureBuffer);
	
	return new GX_Texture(width, height, GX_TF_RGBA8, (u8*)texture);
}
开发者ID:PaulWagener,项目名称:WiiVNC,代码行数:48,代码来源:freetype.cpp

示例6: put_text

static void
put_text (void *tileidx, int row, int startcol, unsigned char *text,
	  unsigned int textlen, int offset, int len)
{
  unsigned char *c = tileidx;
  int i;
  
  for (i = 0; i < len; i++)
    {
      int offset2 = offset + i * 4;
      int idx = tex_index (startcol + i, row, TILES_W, 8);
      c[idx] = (offset2 >= 0 && offset2 < textlen)
	         ? ascii_to_char[text[offset2]] : 0;
    }

  DCFlushRange (c, GX_GetTexBufferSize (TILES_W, TILES_H, TILES_FMT, GX_FALSE,
					0));
}
开发者ID:crtc-demos,项目名称:the-scary-demo,代码行数:18,代码来源:greets.c

示例7: reset

static void reset(void)
{
	AUDIO_RegisterDMACallback(NULL);

	while(AUDIO_GetDMABytesLeft() > 0)
		usleep(100);

	playing = false;

	buffer_fill = 0;
	buffer_play = 0;
	buffered = 0;
	for (int counter = 0; counter < BUFFER_COUNT; counter++)
	{
		memset(buffers[counter], 0, BUFFER_SIZE);
		DCFlushRange(buffers[counter], BUFFER_SIZE);
	}
	AUDIO_RegisterDMACallback(switch_buffers);
}
开发者ID:Gamer125,项目名称:wiibrowser,代码行数:19,代码来源:ao_gekko.c

示例8: wipparsebuffer

void wipparsebuffer(u8 *buffer, u32 length)
// The buffer needs a 0 at the end to properly terminate the string functions
{
	int i;
	u32 pos = 0;
	u32 offset;
	char buf[10];
	
	while (pos < length)
	{
		if ( *(char *)(buffer + pos) != '#' && *(char *)(buffer + pos) != ';' && *(char *)(buffer + pos) != 10 && *(char *)(buffer + pos) != 13 && *(char *)(buffer + pos) != 32 && *(char *)(buffer + pos) != 0 )
		{
			memcpy(buf, (char *)(buffer + pos), 8);
			buf[8] = 0;
			offset = strtol(buf,NULL,16);

			pos += (u32)strchr((char *)(buffer + pos), 32)-(u32)(buffer + pos) + 1;
			pos += (u32)strchr((char *)(buffer + pos), 32)-(u32)(buffer + pos) + 1;
			
			while (*(char *)(buffer + pos) != 10 && *(char *)(buffer + pos) != 13 && *(char *)(buffer + pos) != 0)
			{
				memcpy(buf, (char *)(buffer + pos), 2);
				buf[2] = 0;
			
				patchu8(offset, strtol(buf,NULL,16));
				offset++;
				pos +=2;		
			}	
		//	s_printf("\n");
		}
		if (strchr((char *)(buffer + pos), 10) == NULL)
		{
			break;
		} else
		{
			pos += (u32)strchr((char *)(buffer + pos), 10)-(u32)(buffer + pos) + 1;
		}
	}

	for(i=0;i<doltableentries;i++)
		DCFlushRange((void *) doltableoffset[i], doltablelength[i]);
}
开发者ID:granberro,项目名称:uLoader,代码行数:42,代码来源:wip.c

示例9: __ARClearArea

static void __ARClearArea(u32 aramaddr,u32 len)
{
	u32 currlen,curraddr,endaddr;
	static u8 zero_buffer[2048] ATTRIBUTE_ALIGN(32);

	while(!(_dspReg[11]&0x0001));

	memset(zero_buffer,0,2048);
	DCFlushRange(zero_buffer,2048);

	curraddr = aramaddr;
	endaddr = aramaddr+len;
	
	currlen = 2048;
	while(curraddr<endaddr) {
		if((endaddr-curraddr)<currlen) currlen = ((endaddr-curraddr)+31)&~31;
		__ARWriteDMA((u32)zero_buffer,curraddr,currlen);
		curraddr += currlen;
	}
}
开发者ID:comex,项目名称:libogc,代码行数:20,代码来源:aram.c

示例10: min

bool SFont::fromFile(const char *path, u32 size, u32 lspacing, u32 w, u32 idx, const char *fontname)
{
	fSize = min(max(6u, size), 1000u);
	weight = min(w, 32u);
	index = idx = 0;

	lineSpacing = min(max(6u, lspacing), 1000u);

	if(data != NULL)
		free(data);
	data = fsop_ReadFile(path, &dataSize);
	if(data == NULL)
		return false;

	DCFlushRange(data, dataSize);

	memcpy(name, fontname, 127);
	font = new FreeTypeGX();
	font->loadFont(data, dataSize, fSize, weight, index, false);
	return true;
}
开发者ID:CHASECAREY123456789,项目名称:wiiflow,代码行数:21,代码来源:text.cpp

示例11: SNDWiiInit

int SNDWiiInit()
{
    AUDIO_Init(NULL);
    AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);

    soundpos = 0;
    soundlen = 44100 / 60; // 60 for NTSC or 50 for PAL. Initially assume it's going to be NTSC.
    soundtruelen = 48000 / 60;
    truesoundoffset = stereodata16[0];

    memset(stereodata16, 0, SOUNDBUFSIZE);

    issoundmuted = 0;

    AUDIO_RegisterDMACallback(StartDMA);
    AUDIO_InitDMA((u32)stereodata16[soundpos], soundlen * 4);
    DCFlushRange((void *)stereodata16[soundpos], soundlen * 4);
    AUDIO_StartDMA();

    return 0;
}
开发者ID:henke37,项目名称:BizHawk,代码行数:21,代码来源:sndwii.c

示例12: memalign

void OSystem_Wii::initSfx() {
	_mixer = new Audio::MixerImpl(this, 48000);

	sfx_thread_running = false;
	sfx_thread_quit = false;

	sfx_stack = (u8 *) memalign(32, SFX_THREAD_STACKSIZE);

	if (sfx_stack) {
		memset(sfx_stack, 0, SFX_THREAD_STACKSIZE);

		LWP_InitQueue(&sfx_queue);

		s32 res = LWP_CreateThread(&sfx_thread, sfx_thread_func, _mixer, sfx_stack,
									SFX_THREAD_STACKSIZE, SFX_THREAD_PRIO);

		if (res) {
			printf("ERROR creating sfx thread: %d\n", res);
			LWP_CloseQueue(sfx_queue);
			return;
		}

		sfx_thread_running = true;
	}

	for (u32 i = 0; i < SFX_BUFFERS; ++i) {
		sound_buffer[i] = (u8 *) memalign(32, SFX_THREAD_FRAG_SIZE);
		memset(sound_buffer[i], 0, SFX_THREAD_FRAG_SIZE);
		DCFlushRange(sound_buffer[i], SFX_THREAD_FRAG_SIZE);
	}

	_mixer->setReady(true);

	sb_hw = 0;

	AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
	AUDIO_RegisterDMACallback(audio_switch_buffers);
	AUDIO_InitDMA((u32) sound_buffer[sb_hw], SFX_THREAD_FRAG_SIZE);
	AUDIO_StartDMA();
}
开发者ID:0xf1sh,项目名称:scummvm,代码行数:40,代码来源:osystem_sfx.cpp

示例13: AUDIO_Init

static void *gx_audio_init(const char *device, unsigned rate, unsigned latency)
{
   if (g_audio)
      return g_audio;

   AUDIO_Init(NULL);
   AUDIO_RegisterDMACallback(dma_callback);

   if (rate < 33000)
   {
      AUDIO_SetDSPSampleRate(AI_SAMPLERATE_32KHZ);
      g_settings.audio.out_rate = 32000;
   }
   else
   {
      AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
      g_settings.audio.out_rate = 48000;
   }

   if (!g_audio)
   {
      g_audio = memalign(32, sizeof(*g_audio));
      memset(g_audio, 0, sizeof(*g_audio));
      LWP_InitQueue(&g_audio->cond);
   }
   else
   {
      memset(g_audio->data, 0, sizeof(g_audio->data));
      g_audio->dma_busy = g_audio->dma_next = 0;
      g_audio->write_ptr = 0;
      g_audio->nonblock = false;
   }

   g_audio->dma_write = BLOCKS - 1;
   DCFlushRange(g_audio->data, sizeof(g_audio->data));
   AUDIO_InitDMA((u32)g_audio->data[g_audio->dma_next], CHUNK_SIZE);
   AUDIO_StartDMA();

   return g_audio;
}
开发者ID:CatalystG,项目名称:RetroArch,代码行数:40,代码来源:gx_audio.c

示例14: TplFile

void GuiImageData::LoadTPL(const u8 *img, int imgSize)
{
    TplImage TplFile(img, imgSize);

    width = TplFile.GetWidth(0);
    height = TplFile.GetHeight(0);
    format = (u8) TplFile.GetFormat(0);

    const u8 * ImgPtr = TplFile.GetTextureBuffer(0);

    if(ImgPtr)
    {
        int len =  ALIGN32(TplFile.GetTextureSize(0));

        data = (u8 *) memalign(32, len);
        if(!data)
            return;

        memcpy(data, ImgPtr, len);
        DCFlushRange(data, len);
    }
}
开发者ID:djskual,项目名称:savegame-manager-gx,代码行数:22,代码来源:gui_imagedata.cpp

示例15: StartMIOS

s32 StartMIOS (void)
	{
	s32 ret;
	
	SetGCVideoMode ();
	
	tikview view ATTRIBUTE_ALIGN(32);
	
	ret = ES_GetTicketViews(BC, &view, 1);
	if (ret != 0) return -1;

	// Tell DML to boot the game from sd card
	*(u32 *)0x80001800 = 0xB002D105;
	DCFlushRange((void *)(0x80001800), 4);
	ICInvalidateRange((void *)(0x80001800), 4);			
	
	*(volatile unsigned int *)0xCC003024 |= 7;
	
	ret = ES_LaunchTitle(BC, &view);
	
	return -102;
	}
开发者ID:fagensden,项目名称:postloader,代码行数:22,代码来源:dml.c


注:本文中的DCFlushRange函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。