static void workDirtyRect(RECT rect) { if (g_bDirtyRect) { IMAGERECT imgRect = {NULL, &rect}; // NULL(GPE BUFFER), rect(DIRTY RECT) EnterCriticalSection(&g_CS); S1d13521DrvEscape(DRVESC_IMAGE_UPDATE, sizeof(IMAGERECT), (PVOID)&imgRect, 0, NULL); LeaveCriticalSection(&g_CS); } if (g_bDirtyRectNotify) { DIRTYRECTINFO dri = {0,}; DWORD dwFlags = 0; // MSGQUEUE_MSGALERT; memcpy(&dri.rect, &rect, sizeof(rect)); dri.time = GetTickCount(); if (FALSE == WriteMsgQueue(g_hMQ, (LPVOID)&dri, sizeof(dri), 0, dwFlags)) { DWORD dwError = GetLastError(); MYERR((_T("[S1D13521_ERR] WriteMsgQueue() == %d, "), dwError)); switch (dwError) { case ERROR_OUTOFMEMORY: MYERR((_T("ERROR_OUTOFMEMORY\r\n"))); break; case ERROR_INSUFFICIENT_BUFFER: MYERR((_T("ERROR_INSUFFICIENT_BUFFER\r\n"))); break; case ERROR_PIPE_NOT_CONNECTED: MYERR((_T("ERROR_PIPE_NOT_CONNECTED. Notify Stop.\r\n"))); g_bDirtyRectNotify = FALSE; break; case ERROR_TIMEOUT: MYERR((_T("ERROR_TIMEOUT\r\n"))); break; default: MYERR((_T("ERROR_UNKNOWN ???\r\n"))); break; } } } if (g_dwDebugLevel) { RETAILMSG((DRVESC_SET_DIRTYRECT==g_dwDebugLevel || DRVESC_GET_DIRTYRECT==g_dwDebugLevel), (_T("%d workDirtyRect(%d, %d, %d, %d)\r\n"), g_bDirtyRect, rect.left, rect.top, rect.right, rect.bottom)); } }
int main(int argc, char* argv[]) { FILE* fp = fopen("/etc/passwd", "w"); if (!fp) { /* puts("Shucks, couldn't write /etc/passwd"); show_errno(); perror("main (write /etc/passwd)"); perror("NULL"); perror(""); */ MYERR(stderr,""); } show_errno(); testerror(); show_errno(); /* show_errno(); if(chdir("/does/not/exist")){ // myerror(stderr,__FUNCTION__,"chdir dne"); //__FUNCTION__ always resolves to current function we are in MYERR(stderr, "chdir dne"); } show_errno(); if (chdir("..")) { perror("main (chdir dne)"); } show_errno(); */ return 0; }
void DispDrvrInitialize(void) { PHYSICAL_ADDRESS ioPhysicalBase = {0,0}; ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_SROMCON; g_pSROMReg = (volatile S3C6410_SROMCON_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_SROMCON_REG), FALSE); if (NULL == g_pSROMReg) { MYERR((_T("[S1D13521_ERR] pSROMregs = MmMapIoSpace()\r\n"))); return; } g_pSROMReg->SROM_BW = (g_pSROMReg->SROM_BW & ~(0xF<<16)) | (0<<19) | // nWBE/nBE(for UB/LB) control for Memory Bank1(0=Not using UB/LB, 1=Using UB/LB) (0<<18) | // Wait enable control for Memory Bank1 (0=WAIT disable, 1=WAIT enable) (1<<16); // Data bus width control for Memory Bank1 (0=8-bit, 1=16-bit) g_pSROMReg->SROM_BC4 = (0x7<<28) | // Tacs (0x7<<24) | // Tcos (0xF<<16) | // Tacc (0x7<<12) | // Tcoh (0x7<< 8) | // Tah (0x7<< 4) | // Tacp (0x0<< 0); // PMC ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_GPIO; g_pGPIOPReg = (volatile S3C6410_GPIO_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_GPIO_REG), FALSE); if (NULL == g_pGPIOPReg) { MYERR((_T("[S1D13521_ERR] g_pGPIOPReg = MmMapIoSpace()\r\n"))); return; } // GPN[8] : EPD_HRDY(8) g_pGPIOPReg->GPNCON = (g_pGPIOPReg->GPNCON & ~(0x3<<16)) | (0x0<<16); // input mode g_pGPIOPReg->GPNPUD = (g_pGPIOPReg->GPNPUD & ~(0x3<<16)) | (0x0<<16); // pull-up/down disable ioPhysicalBase.LowPart = S1D13521_BASE_PA; g_pS1D13521Reg = (volatile S1D13521_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S1D13521_REG), FALSE); if (NULL == g_pS1D13521Reg) { MYERR((_T("[S1D13521_ERR] g_pS1D13521Reg != MmMapIoSpace()\r\n"))); return; } for (int i=0, j=0, v=0; i<DispDrvr_palSize; i++) { #if (LCD_BPP == 4) v = i * 0x11; #elif (LCD_BPP == 8) v = i; #endif DispDrvr_palette[i].rgbRed = DispDrvr_palette[i].rgbGreen = DispDrvr_palette[i].rgbBlue = v; DispDrvr_palette[i].rgbReserved = 0; } InitializeCriticalSection(&g_CS); g_hDirtyRect = DirtyRect_Init(workDirtyRect); S1d13521Initialize((void *)g_pS1D13521Reg, (void *)g_pGPIOPReg); MSGQUEUEOPTIONS msgopts; memset(&msgopts, 0, sizeof(msgopts)); msgopts.dwSize = sizeof(msgopts); msgopts.dwFlags = 0; //MSGQUEUE_ALLOW_BROKEN; msgopts.dwMaxMessages = 0; // no max number of messages msgopts.cbMaxMessage = sizeof(DIRTYRECTINFO); // max size of each msg msgopts.bReadAccess = FALSE; g_hMQ = CreateMsgQueue(MSGQUEUE_NAME, &msgopts); MYMSG((_T("[S1D13521_MSG] CreateMsgQueue(Write) == 0x%X\r\n"), g_hMQ)); }
void testerror(void) { if (chdir("/does/not/exist")) { MYERR(stderr, "chdir dne"); } }