/** Open LCD panel driver This function should be called before calling any other functions during initial LCD driver, public function for global use @param lcddeviceobj initial value by upper layer @param psizeDisplay initial LCD size by upper layer */ void OpenPanel(LCD_DEVICE_OBJ *lcddeviceobj, LCDSIZE *psizeDisplay) { UINT32 i; LCD_DeviceObj = *lcddeviceobj; //Check Mode Valid pMode = NULL; for(i=0;i<sizeof(tMode)/sizeof(tLCD_PARAM);i++) { if(tMode[i].Panel.LCDMode==LCD_DeviceObj.uiLCDMode) { pMode = &tMode[i]; break; } } if(pMode==NULL) { debug_err(("g_LCDCtrlObj.uiLCDMode=%d not support\r\n",LCD_DeviceObj.uiLCDMode)); return; } LCD_DeviceObj.fIDEDstCLK = pMode->Panel.DCLK; DeviceOpen(psizeDisplay); }
void OpenPanel(LCD_DEVICE_OBJ *lcddeviceobj, LCDSIZE *psizeDisplay) { UINT32 i; LCD_DeviceObj = *lcddeviceobj; LCD_DeviceObj.uiLCDMode = pinmux_getDispMode(PINMUX_FUNC_ID_LCD); //Check Mode Valid pMode = NULL; for(i=0;i<sizeof(tMode)/sizeof(tLCD_PARAM);i++) { if(tMode[i].Panel.LCDMode==LCD_DeviceObj.uiLCDMode) { pMode = (tLCD_PARAM*)&tMode[i]; break; } } if(pMode==NULL) { debug_err(("g_LCDCtrlObj.uiLCDMode=%d not support\r\n",LCD_DeviceObj.uiLCDMode)); return; } LCD_DeviceObj.fIDEDstCLK = pMode->Panel.DCLK; DeviceOpen(psizeDisplay); ide_fillGamma((UINT8*)gamma); }
// Called by PollLoop() and CDVDgetTrayStatus() s32 DeviceTrayStatus() { s32 s32result; errno = 0; #ifdef VERBOSE_FUNCTION_DEVICE PrintLog("CDVD device: DeviceTrayStatus()"); #endif /* VERBOSE_FUNCTION_DEVICE */ if (devicehandle == -1) return (-1); // ENDIF- Someone forget to open the device? if ((devicecapability & CDC_DRIVE_STATUS) != 0) { s32result = ioctl(devicehandle, CDROM_DRIVE_STATUS); if (s32result < 0) { #ifdef VERBOSE_WARNINGS PrintLog("CDVD device: Trouble reading Drive Status!"); PrintLog("CDVD device: Error: (%i) %i:%s", s32result, errno, strerror(errno)); #endif /* VERBOSE_WARNINGS */ s32result = CDS_TRAY_OPEN; } // ENDIF- Failure to get status? Assume it's open. errno = 0; } else { s32result = ioctl(devicehandle, CDROM_DISC_STATUS); if (errno != 0) { #ifdef VERBOSE_WARNINGS PrintLog("CDVD device: Trouble detecting Disc Status presense!"); PrintLog("CDVD device: Error: (%i) %i:%s", s32result, errno, strerror(errno)); #endif /* VERBOSE_WARNINGS */ s32result = CDS_TRAY_OPEN; errno = 0; } // ENDIF- Trouble? if (s32result == CDS_NO_DISC) s32result = CDS_TRAY_OPEN; // ENDIF- Is there no disc in the device? Guess the tray is open } // ENDIF- Can we poll the tray directly? (Or look at disc status instead?) if (s32result == CDS_TRAY_OPEN) { traystatus = CDVD_TRAY_OPEN; if (disctype != CDVD_TYPE_NODISC) { DeviceClose(); // Kind of severe way of flushing all buffers. DeviceOpen(); InitDisc(); } // ENDIF- Tray just opened... clear disc info } else { traystatus = CDVD_TRAY_CLOSE; if (disctype == CDVD_TYPE_NODISC) DeviceGetDiskType(); // ENDIF- Tray just closed? Get disc information } // ENDIF- Do we detect an open tray? return (traystatus); } // END CDVD_getTrayStatus()
gint MainBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data) { const char *tempdevice; int retval; MainBoxUnfocus(); tempdevice = gtk_entry_get_text(GTK_ENTRY(mainbox.device)); strcpy(conf.devicename, tempdevice); // Temporarily put in new device name tempdevice = NULL; if(*(conf.devicename) != 0) { retval = DeviceOpen(); // Test by opening the device. DeviceClose(); // Failed or not, close it. if(retval != 0) { MainBoxRefocus(); return(TRUE); } // ENDIF- Not an ISO file? Message and Stop here. } // ENDIF- Is there an ISO file to check out? SaveConf(); MainBoxCancelEvent(widget, event, data); return(TRUE); } // END MainBoxOKEvent()
s32 CALLBACK CDVDopen(const char* pTitleFilename) { s32 s32result; #ifdef VERBOSE_FUNCTION PrintLog("CDVD interface: CDVDopen()"); #endif /* VERBOSE_FUNCTION */ InitBuffer(); LoadConf(); errno = 0; s32result = DeviceOpen(); if(s32result != 0) return(s32result); if(errno != 0) return(-1); return(0); } // END CDVDopen();
void MainBoxOKEvent() { int retval; MainBoxUnfocus(); GetDlgItemText(mainboxwindow, IDC_0202, conf.devicename, 256); retval = DeviceOpen(); DeviceClose(); if (retval != 0) { MainBoxRefocus(); MessageBox(mainboxwindow, "Could not open the device", "CDVDlinuz Message", MB_OK | MB_ICONWARNING | MB_SETFOREGROUND); return; } // ENDIF- Trouble opening device? Abort here. SaveConf(); MainBoxCancelEvent(); return; } // END MainBoxOKEvent()
s32 CALLBACK CDVDtest() { s32 s32result; errno = 0; if(devicehandle != -1) { #ifdef VERBOSE_WARNINGS PrintLog("CDVD interface: Device already open"); #endif /* VERBOSE_WARNINGS */ return(0); } // ENDIF- Is the CD/DVD already in use? That's fine. #ifdef VERBOSE_FUNCTION PrintLog("CDVD driver: CDVDtest()"); #endif /* VERBOSE_FUNCTION */ s32result = DeviceOpen(); DeviceClose(); return(s32result); } // END CDVDtest()
// 자주사용되는 함수들.. // bool KPmacC::Open( int num ) // num < 0, num > 7 : 디바이스 선택, 7 >= num >= 0 : 열기시도 { // Pmac OpenRuntimeLink의 핸들을 얻어온다. if(m_hLink == NULL) { m_hLink = OpenRuntimeLink(); //Pmac Dll Load if(m_hLink == NULL) { DebugLog(_T("Lib Load Error")); return false; } } else return false; if ((num >= 0) && (num <= 7)) m_nDevice = num; if ((m_nDevice < 0) || (m_nDevice > 7)) m_nDevice = SelectDevice(0); if ((m_nDevice >= 0) && (m_nDevice <= 7)) m_bConnected = DeviceOpen((UINT)m_nDevice); //OpenPmacDevice((DWORD)m_nDevice); else m_bConnected = FALSE; if (m_bConnected) { GetPmacType(); GetFirmwareVersion(); GetFirmwareDate(); GetServoCycle(); } else { DebugLog(_T("Open Comm Error")); return false; } return true; }
/******* FLASH设备初始化函数 ********/ void init_flash(void) { if(MX251608D_Init(FlashMutexPrio) == 0) //设备A初始化 互斥量优先级9 { debug(Debug_None,"初始化Flash失败\r\n"); SysTaskSuspend(SYS_PRIO_SELF); } else { debug(Debug_Notify,"初始化flash成功!\r\n"); } MX251608D_Dev = DeviceOpen(BLOCK_DATAFLASH,0,&err); //设备打开 if(err != HVL_NO_ERR) { debug(Debug_Notify,"Flash设备打开失败\r\n"); } else { debug(Debug_Notify,"flash设备打开成功!\r\n"); } }
s32 DeviceTrayStatus() { BOOL boolresult; if(devicehandle == NULL) return(-1); if(devicehandle == INVALID_HANDLE_VALUE) return(-1); #ifdef VERBOSE_FUNCTION_DEVICE PrintLog("CDVDlinuz device: DeviceTrayStatus()"); #endif /* VERBOSE_FUNCTION_DEVICE */ switch(traystatusmethod) { case 1: boolresult = DeviceTrayStatusStorage(); break; case 2: boolresult = DeviceTrayStatusCDRom(); break; case 3: boolresult = DeviceTrayStatusDisk(); break; default: boolresult = FALSE; break; } // ENDSWITCH traystatusmethod- One method already working? Try it again. if(boolresult == FALSE) { traystatusmethod = 0; boolresult = DeviceTrayStatusStorage(); if(boolresult == TRUE) { traystatusmethod = 1; } else { boolresult = DeviceTrayStatusCDRom(); if(boolresult == TRUE) { traystatusmethod = 2; } else { boolresult = DeviceTrayStatusDisk(); if(boolresult == TRUE) traystatusmethod = 3; } // ENDIF- Did we succeed with CDRom? } // ENDIF- Did we succeed with Storage? } // Single call to already working test just failed? Test them all. if(boolresult == FALSE) { if(traystatus == CDVD_TRAY_CLOSE) { #ifdef VERBOSE_FUNCTION_DEVICE PrintLog("CDVDlinuz device: Tray just opened!"); #endif /* VERBOSE_FUNCTION_DEVICE */ traystatus = CDVD_TRAY_OPEN; DeviceClose(); DeviceOpen(); InitDisc(); } // ENDIF- Just opened? clear disc info return(traystatus); } // ENDIF- Still failed? Assume no disc in drive then. if(traystatus == CDVD_TRAY_OPEN) { traystatus = CDVD_TRAY_CLOSE; #ifdef VERBOSE_FUNCTION_DEVICE PrintLog("CDVDlinuz device: Tray just closed!"); #endif /* VERBOSE_FUNCTION_DEVICE */ DeviceGetDiskType(); return(traystatus); } // ENDIF- Just closed? Get disc information return(traystatus); } // END DeviceTrayStatus()
gint DeviceBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data) { char templine[256]; u8 tempbuffer[2352]; struct IsoFile *tofile; const char *tempdevice; s32 retval; cdvdTD cdvdtd; int stop; int compressmethod; int multi; int imagetype; int i; DeviceBoxUnfocus(); tempdevice = gtk_entry_get_text(GTK_ENTRY(devicebox.device)); strcpy(conf.devicename, tempdevice); // Temporarily put in new device name tempdevice = NULL; retval = DeviceOpen(); if (retval != 0) { DeviceClose(); MessageBoxShow("Could not open the device", 2); return (TRUE); } // ENDIF- Trouble opening device? Abort here. DeviceTrayStatus(); retval = DiscInserted(); if (retval != 0) { DeviceClose(); MessageBoxShow("No disc in the device\r\nPlease put a disc in and try again.", 2); return (TRUE); } // ENDIF- Trouble opening device? Abort here. retval = DeviceGetTD(0, &cdvdtd); // Fish for Ending Sector if (retval < 0) { DeviceClose(); MessageBoxShow("Could not retrieve disc sector size", 2); return (TRUE); } // ENDIF- Trouble getting disc sector count? compressmethod = gtk_combo_box_get_active(GTK_COMBO_BOX(devicebox.compress)); if (compressmethod > 0) compressmethod += 2; multi = 0; if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(devicebox.multi)) == TRUE) multi = 1; imagetype = 0; if ((disctype != CDVD_TYPE_PS2DVD) && (disctype != CDVD_TYPE_DVDV)) imagetype = 8; tofile = IsoFileOpenForWrite(gtk_entry_get_text(GTK_ENTRY(devicebox.file)), imagetype, multi, compressmethod); if (tofile == NULL) { DeviceClose(); MessageBoxShow("Could not create the new ISO file", 2); return (TRUE); } // ENDIF- Trouble opening the ISO file? // Open Progress Bar sprintf(templine, "%s -> %s", gtk_entry_get_text(GTK_ENTRY(devicebox.device)), tofile->name); ProgressBoxStart(templine, (off64_t) cdvdtd.lsn); tofile->cdvdtype = disctype; for (i = 0; i < 2048; i++) tofile->toc[i] = tocbuffer[i]; stop = 0; mainbox.stop = 0; progressbox.stop = 0; while ((stop == 0) && (tofile->sectorpos < cdvdtd.lsn)) { if (imagetype == 0) { retval = DeviceReadTrack((u32) tofile->sectorpos, CDVD_MODE_2048, tempbuffer); } else { retval = DeviceReadTrack((u32) tofile->sectorpos, CDVD_MODE_2352, tempbuffer); } // ENDIF- Are we reading a DVD sector? (Or a CD sector?) if (retval < 0) { for (i = 0; i < 2352; i++) tempbuffer[i] = 0; // NEXT i- Zeroing the buffer } // ENDIF- Trouble reading next block? retval = IsoFileWrite(tofile, tempbuffer); if (retval < 0) { MessageBoxShow("Trouble writing new file", 3); stop = 1; } // ENDIF- Trouble writing out the next block? ProgressBoxTick(tofile->sectorpos); while (gtk_events_pending()) gtk_main_iteration(); if (mainbox.stop != 0) stop = 2; if (progressbox.stop != 0) stop = 2; } // ENDWHILE- No reason found to stop... ProgressBoxStop(); if (stop == 0) { if (tofile->multi == 1) tofile->name[tofile->multipos] = '0'; // First file strcpy(templine, tofile->name); } // ENDIF- Did we succeed with the transfer? DeviceClose(); if (stop == 0) { IsoSaveTOC(tofile); tofile = IsoFileClose(tofile); gtk_entry_set_text(GTK_ENTRY(mainbox.file), templine); } else tofile = IsoFileCloseAndDelete(tofile); // ENDIF- (Failed to complete writing file? Get rid of the garbage files.) if (stop != 1) DeviceBoxRefocus(); if (stop == 0) DeviceBoxCancelEvent(widget, event, data); return (TRUE); } // END DeviceBoxOKEvent()
void DeviceBoxOKEvent() { char templine[256]; u8 tempbuffer[2352]; struct IsoFile *tofile; s32 retval; cdvdTD cdvdtd; int stop; HWND tempitem; int compressmethod; int multi; int imagetype; int i; DeviceBoxUnfocus(); GetDlgItemText(deviceboxwindow, IDC_0302, conf.devicename, 256); retval = DeviceOpen(); if(retval != 0) { DeviceClose(); DeviceBoxRefocus(); MessageBox(deviceboxwindow, "Could not open the device", "CDVDisoEFP Message", MB_OK | MB_ICONWARNING | MB_SETFOREGROUND); return; } // ENDIF- Trouble opening device? Abort here. DeviceTrayStatus(); retval = DiscInserted(); if(retval != 0) { DeviceClose(); DeviceBoxRefocus(); MessageBox(deviceboxwindow, "No disc in the device\r\nPlease put a disc in and try again.", "CDVDisoEFP Message", MB_OK | MB_ICONWARNING | MB_SETFOREGROUND); return; } // ENDIF- Trouble opening device? Abort here. retval = DeviceGetTD(0, &cdvdtd); // Fish for Ending Sector if(retval < 0) { DeviceClose(); DeviceBoxRefocus(); MessageBox(deviceboxwindow, "Could not retrieve disc sector size", "CDVDisoEFP Message", MB_OK | MB_ICONWARNING | MB_SETFOREGROUND); return; } // ENDIF- Trouble getting disc sector count? tempitem = GetDlgItem(deviceboxwindow, IDC_0309); compressmethod = ComboBox_GetCurSel(tempitem); tempitem = NULL; if(compressmethod > 0) compressmethod += 2; multi = 0; if(IsDlgButtonChecked(deviceboxwindow, IDC_0311)) multi = 1; imagetype = 0; if((disctype != CDVD_TYPE_PS2DVD) && (disctype != CDVD_TYPE_DVDV)) imagetype = 8; GetDlgItemText(deviceboxwindow, IDC_0305, templine, 256); tofile = IsoFileOpenForWrite(templine, imagetype, multi, compressmethod); if(tofile == NULL) { DeviceClose(); DeviceBoxRefocus(); MessageBox(deviceboxwindow, "Could not create the new ISO file", "CDVDisoEFP Message", MB_OK | MB_ICONWARNING | MB_SETFOREGROUND); return; } // ENDIF- Trouble opening the ISO file? // Open Progress Bar sprintf(templine, "%s -> %s", conf.devicename, tofile->name); ProgressBoxStart(templine, (off64_t) cdvdtd.lsn); tofile->cdvdtype = disctype; for(i = 0; i < 2048; i++) tofile->toc[i] = tocbuffer[i]; stop = 0; mainboxstop = 0; progressboxstop = 0; while((stop == 0) && (tofile->sectorpos < cdvdtd.lsn)) { if(imagetype == 0) { retval = DeviceReadTrack((u32) tofile->sectorpos, CDVD_MODE_2048, tempbuffer); } else { retval = DeviceReadTrack((u32) tofile->sectorpos, CDVD_MODE_2352, tempbuffer); } // ENDIF- Are we reading a DVD sector? (Or a CD sector?) if(retval < 0) { for(i = 0; i < 2352; i++) { tempbuffer[i] = 0; } // NEXT i- Zeroing the buffer } // ENDIF- Trouble reading next block? retval = IsoFileWrite(tofile, tempbuffer); if(retval < 0) { MessageBox(deviceboxwindow, "Trouble writing new file", "CDVDisoEFP Message", MB_OK | MB_ICONWARNING | MB_SETFOREGROUND); stop = 1; } // ENDIF- Trouble writing out the next block? ProgressBoxTick(tofile->sectorpos); if(mainboxstop != 0) stop = 2; if(progressboxstop != 0) stop = 2; } // ENDWHILE- No reason found to stop... ProgressBoxStop(); if(stop == 0) { if(tofile->multi == 1) tofile->name[tofile->multipos] = '0'; // First file strcpy(templine, tofile->name); } // ENDIF- Did we succeed with the transfer? DeviceClose(); if(stop == 0) { IsoSaveTOC(tofile); tofile = IsoFileClose(tofile); SetDlgItemText(mainboxwindow, IDC_0202, templine); } else { tofile = IsoFileCloseAndDelete(tofile); } // ENDIF- (Failed to complete writing file? Get rid of the garbage files.) DeviceBoxRefocus(); if(stop == 0) DeviceBoxCancelEvent(); return; } // END DeviceBoxOKEvent()
void MsdcNvtCb_LcdOpen(void* pData) { tMSDCEXT_LCD_CTRL* pCtrl = MsdcNvtCb_LcdGetCtrl(); tMSDCEXT_LCD_DRV_OPEN* pDesc = BEGIN_MSDC_NVT_CB(tMSDCEXT_LCD_DRV_OPEN,pData); if(pDesc==NULL) return; pCtrl->pMode = pDesc->pParam; pCtrl->tDefValues = pDesc->tDefValues; pCtrl->tLCD_DeviceObj = g_LCDCtrlObj; pCtrl->tLCD_DeviceObj.fIDEDstCLK = pCtrl->pMode->Panel.DCLK; switch(pDesc->tDefValues._SETTING_SIF_MODE) { case OPTION_SIF_0000: //Confirmed (AUO,WinTek) pCtrl->sif_clk_init = gpio_setPin; pCtrl->sif_clk_begin = gpio_clearPin; pCtrl->sif_clk_end = gpio_setPin; pCtrl->sif_sen_init = gpio_setPin; pCtrl->sif_sen_begin = gpio_clearPin; pCtrl->sif_sen_end = gpio_setPin; break; case OPTION_SIF_0001: //Not Confirmed pCtrl->sif_clk_init = gpio_clearPin; pCtrl->sif_clk_begin = gpio_setPin; pCtrl->sif_clk_end = gpio_clearPin; pCtrl->sif_sen_init = gpio_setPin; pCtrl->sif_sen_begin = gpio_clearPin; pCtrl->sif_sen_end = gpio_setPin; break; case OPTION_SIF_0010: //Not Confirmed pCtrl->sif_clk_init = gpio_setPin; pCtrl->sif_clk_begin = gpio_clearPin; pCtrl->sif_clk_end = gpio_setPin; pCtrl->sif_sen_init = gpio_clearPin; pCtrl->sif_sen_begin = gpio_setPin; pCtrl->sif_sen_end = gpio_clearPin; break; case OPTION_SIF_0011: //Not Confirmed pCtrl->sif_clk_init = gpio_clearPin; pCtrl->sif_clk_begin = gpio_setPin; pCtrl->sif_clk_end = gpio_clearPin; pCtrl->sif_sen_init = gpio_clearPin; pCtrl->sif_sen_begin = gpio_setPin; pCtrl->sif_sen_end = gpio_clearPin; break; case OPTION_SIF_0100: //Confirmed (Toppoly) pCtrl->sif_clk_init = gpio_clearPin; pCtrl->sif_clk_begin = gpio_setPin; pCtrl->sif_clk_end = gpio_clearPin; pCtrl->sif_sen_init = gpio_setPin; pCtrl->sif_sen_begin = gpio_clearPin; pCtrl->sif_sen_end = gpio_setPin; break; case OPTION_SIF_0101: //Not Confirmed pCtrl->sif_clk_init = gpio_setPin; pCtrl->sif_clk_begin = gpio_clearPin; pCtrl->sif_clk_end = gpio_setPin; pCtrl->sif_sen_init = gpio_setPin; pCtrl->sif_sen_begin = gpio_clearPin; pCtrl->sif_sen_end = gpio_setPin; break; case OPTION_SIF_0110: //Not Confirmed pCtrl->sif_clk_init = gpio_clearPin; pCtrl->sif_clk_begin = gpio_setPin; pCtrl->sif_clk_end = gpio_clearPin; pCtrl->sif_sen_init = gpio_clearPin; pCtrl->sif_sen_begin = gpio_setPin; pCtrl->sif_sen_end = gpio_clearPin; break; case OPTION_SIF_0111: //Not Confirmed pCtrl->sif_clk_init = gpio_setPin; pCtrl->sif_clk_begin = gpio_clearPin; pCtrl->sif_clk_end = gpio_setPin; pCtrl->sif_sen_init = gpio_clearPin; pCtrl->sif_sen_begin = gpio_setPin; pCtrl->sif_sen_end = gpio_clearPin; break; case OPTION_SIF_1000: //Confirmed pCtrl->sif_clk_init = gpio_clearPin; pCtrl->sif_clk_begin = gpio_setPin; pCtrl->sif_clk_end = gpio_clearPin; pCtrl->sif_sen_init = gpio_setPin; pCtrl->sif_sen_begin = gpio_clearPin; pCtrl->sif_sen_end = gpio_setPin; break; } DeviceOpen(&pDesc->tLCDSize); g_LCDSize = pDesc->tLCDSize; //Coordinate Trans between OSD Size and Video Size are not the same, here for init CoordinateTrans_SetSizeOriginal(g_LCDSize.uiWidth,g_LCDSize.uiHeight); CoordinateTrans_SetSizeTarget(g_LCDSize.uiWidth,g_LCDSize.uiHeight); pDesc->tParent.bOK = TRUE; }