static BOOL TSP_VirtualAlloc(VOID) { BOOL bRet = TRUE; TSPMSG((_T("[TSP] ++TSP_VirtualAlloc()\r\n"))); g_pGPIOReg = (S3C6400_GPIO_REG *)DrvLib_MapIoSpace(S3C6400_BASE_REG_PA_GPIO, sizeof(S3C6400_GPIO_REG), FALSE); if (g_pGPIOReg == NULL) { TSPERR((_T("[TSP:ERR] TSP_VirtualAlloc() : g_pGPIOReg Allocation Fail\r\n"))); bRet = FALSE; goto CleanUp; } g_pADCReg = (S3C6400_ADC_REG *)DrvLib_MapIoSpace(S3C6400_BASE_REG_PA_ADC, sizeof(S3C6400_ADC_REG), FALSE); if (g_pADCReg == NULL) { TSPERR((_T("[TSP:ERR] TSP_VirtualAlloc() : g_pADCReg Allocation Fail\r\n"))); bRet = FALSE; goto CleanUp; } g_pVIC0Reg = (S3C6400_VIC_REG *)DrvLib_MapIoSpace(S3C6400_BASE_REG_PA_VIC0, sizeof(S3C6400_VIC_REG), FALSE); if (g_pVIC0Reg == NULL) { TSPERR((_T("[TSP:ERR] TSP_VirtualAlloc() : g_pVIC0Reg Allocation Fail\r\n"))); bRet = FALSE; goto CleanUp; } g_pVIC1Reg = (S3C6400_VIC_REG *)DrvLib_MapIoSpace(S3C6400_BASE_REG_PA_VIC1, sizeof(S3C6400_VIC_REG), FALSE); if (g_pVIC1Reg == NULL) { TSPERR((_T("[TSP:ERR] TSP_VirtualAlloc() : g_pVIC1Reg Allocation Fail\r\n"))); bRet = FALSE; goto CleanUp; } g_pPWMReg = (S3C6400_PWM_REG *)DrvLib_MapIoSpace(S3C6400_BASE_REG_PA_PWM, sizeof(S3C6400_PWM_REG), FALSE); if (g_pPWMReg == NULL) { TSPERR((_T("[TSP:ERR] TSP_VirtualAlloc() : g_pPWMReg Allocation Fail\r\n"))); bRet = FALSE; goto CleanUp; } CleanUp: if (bRet == FALSE) { TSPERR((_T("[TSP:ERR] TSP_VirtualAlloc() : Failed\r\n"))); TSP_VirtualFree(); } TSPMSG((_T("[TSP] --TSP_VirtualAlloc() = %d\r\n"), bRet)); return bRet; }
static BOOL TSP_VirtualAlloc(VOID) { BOOL bRet = TRUE; PHYSICAL_ADDRESS ioPhysicalBase = {0,0}; DEBUGMSG(TSP_ZONE_FUNCTION,(_T("[TSP] ++TSP_VirtualAlloc()\r\n"))); ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_GPIO; g_pGPIOReg = (S3C6410_GPIO_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_GPIO_REG), FALSE); if (g_pGPIOReg == NULL) { RETAILMSG(TSP_ZONE_ERROR,(_T("[TSP:ERR] TSP_VirtualAlloc() : g_pGPIOReg Allocation Fail\r\n"))); bRet = FALSE; goto CleanUp; } ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_ADC; g_pADCReg = (S3C6410_ADC_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_ADC_REG), FALSE); if (g_pADCReg == NULL) { RETAILMSG(TSP_ZONE_ERROR,(_T("[TSP:ERR] TSP_VirtualAlloc() : g_pADCReg Allocation Fail\r\n"))); bRet = FALSE; goto CleanUp; } ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_VIC0; g_pVIC0Reg = (S3C6410_VIC_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_VIC_REG), FALSE); if (g_pVIC0Reg == NULL) { RETAILMSG(TSP_ZONE_ERROR,(_T("[TSP:ERR] TSP_VirtualAlloc() : g_pVIC0Reg Allocation Fail\r\n"))); bRet = FALSE; goto CleanUp; } ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_VIC1; g_pVIC1Reg = (S3C6410_VIC_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_VIC_REG), FALSE); if (g_pVIC1Reg == NULL) { RETAILMSG(TSP_ZONE_ERROR,(_T("[TSP:ERR] TSP_VirtualAlloc() : g_pVIC1Reg Allocation Fail\r\n"))); bRet = FALSE; goto CleanUp; } ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_PWM; g_pPWMReg = (S3C6410_PWM_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_PWM_REG), FALSE); if (g_pPWMReg == NULL) { RETAILMSG(TSP_ZONE_ERROR,(_T("[TSP:ERR] TSP_VirtualAlloc() : g_pPWMReg Allocation Fail\r\n"))); bRet = FALSE; goto CleanUp; } CleanUp: if (bRet == FALSE) { RETAILMSG(TSP_ZONE_ERROR,(_T("[TSP:ERR] TSP_VirtualAlloc() : Failed\r\n"))); TSP_VirtualFree(); } TSPMSG((_T("[TSP] --TSP_VirtualAlloc() = %d\r\n"), bRet)); return bRet; }