SaErrorT snmp_rsa_set_power_state(void *hnd, SaHpiResourceIdT id, SaHpiHsPowerStateT state) { gchar *oid; int rtn_code = SA_OK; struct snmp_value set_value; struct oh_handler_state *handle = (struct oh_handler_state *)hnd; struct snmp_rsa_hnd *custom_handle = (struct snmp_rsa_hnd *)handle->data; SaHpiRptEntryT *res = oh_get_resource_by_id(handle->rptcache, id); if(res == NULL) { return SA_ERR_HPI_NOT_PRESENT; } struct RSA_ResourceInfo *s = (struct RSA_ResourceInfo *)oh_get_resource_data(handle->rptcache, id); if(s == NULL) { return -1; } if(s->mib.OidPowerOnOff == NULL) { return SA_ERR_HPI_INVALID_CMD; } oid = snmp_derive_objid(res->ResourceEntity, s->mib.OidPowerOnOff); if(oid == NULL) { dbg("NULL SNMP OID returned for %s\n",s->mib.OidPowerOnOff); return -1; } set_value.type = ASN_INTEGER; set_value.str_len = 1; switch (state) { case SAHPI_HS_POWER_OFF: set_value.integer = 0; if((snmp_set(custom_handle->ss, oid, set_value) != 0)) { dbg("SNMP could not set %s; Type=%d.\n",s->mib.OidPowerOnOff,set_value.type); rtn_code = SA_ERR_HPI_NO_RESPONSE; } break; case SAHPI_HS_POWER_ON: set_value.integer = 1; if((snmp_set(custom_handle->ss, oid, set_value) != 0)) { dbg("SNMP could not set %s; Type=%d.\n",s->mib.OidPowerOnOff,set_value.type); rtn_code = SA_ERR_HPI_NO_RESPONSE; } break; case SAHPI_HS_POWER_CYCLE: { SaHpiResetActionT act = SAHPI_COLD_RESET; rtn_code=snmp_rsa_set_reset_state(hnd, id, act); } break; default: dbg("Invalid Power Action Type - %d\n", state); rtn_code = SA_ERR_HPI_INVALID_PARAMS; } g_free(oid); return rtn_code; }
void save_kbm_conf() { if (kbm_widget == NULL) { fprintf(stderr, "save_kbm_conf: kbm_widget is NULL!\n"); return; } int idx = gtk_combo_box_get_active (GTK_COMBO_BOX (opt_kbm_opts)); int idx_selkeys = gtk_combo_box_get_active (GTK_COMBO_BOX (opt_selkeys)); pho_candicate_col_N = (int) gtk_spin_button_get_value(GTK_SPIN_BUTTON(spinner_pho_candicate_col_N)); if (pho_candicate_col_N > strlen(selkeys[idx_selkeys].kstr)) pho_candicate_col_N = strlen(selkeys[idx_selkeys].kstr); dbg("pho_candicate_col_N %d\n", pho_candicate_col_N); char tt[128]; sprintf(tt, "%s %s %d %d", kbm_sel[idx].kbm, selkeys[idx_selkeys].kstr, pho_candicate_col_N, selkeys[idx_selkeys].RL); char phokbm_name[128]; get_hime_conf_fstr(PHONETIC_KEYBOARD, phokbm_name, ""); if (strcmp(phokbm_name, tt)) { save_hime_conf_str(PHONETIC_KEYBOARD_BAK, phokbm_name); } save_hime_conf_str(PHONETIC_KEYBOARD, tt); save_tsin_eng_pho_key(); save_hime_conf_int(TSIN_SPACE_OPT, tsin_space_options[new_select_idx_tsin_space_opt].key); save_hime_conf_int(TSIN_PHRASE_PRE_SELECT, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_tsin_phrase_pre_select))); save_hime_conf_int(PHONETIC_CHAR_DYNAMIC_SEQUENCE, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_phonetic_char_dynamic_sequence))); save_hime_conf_int(PHO_HIDE_ROW2, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_pho_hide_row2))); save_hime_conf_int(PHO_IN_ROW1, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_pho_in_row1))); save_hime_conf_int(PHONETIC_HUGE_TAB, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_phonetic_huge_tab))); save_hime_conf_int(TSIN_TONE_CHAR_INPUT, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_tsin_tone_char_input))); save_hime_conf_int(TSIN_USE_PHO_NEAR, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_tsin_use_pho_near))); save_hime_conf_int(TSIN_TAB_PHRASE_END, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_tsin_tab_phrase_end))); save_hime_conf_int(TSIN_TAIL_SELECT_KEY, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_tsin_tail_select_key))); save_hime_conf_int(TSIN_BUFFER_EDITING_MODE, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_button_tsin_buffer_editing_mode))); tsin_buffer_size = (int) gtk_spin_button_get_value(GTK_SPIN_BUTTON(spinner_tsin_buffer_size)); save_hime_conf_int(TSIN_BUFFER_SIZE, tsin_buffer_size); #if 0 gchar *cstr; cstr = gtk_color_selection_palette_to_string(&tsin_phrase_line_gcolor, 1); dbg("color %s\n", cstr); save_hime_conf_str(TSIN_PHRASE_LINE_COLOR, cstr); g_free(cstr); #endif save_omni_config(); /* caleb- does found where "reload kbm" is used. * caleb- think the send_hime_message() here does nothing. */ send_hime_message(GDK_DISPLAY(), "reload kbm"); }
HRESULT IDXGISwapChainNew::Present(UINT SyncInterval,UINT Flags) { if(newbb11) dbg("dxgi_sc: BB11 Present %d %d", SyncInterval, newbb11); else if(newbb10) dbg("dxgi_sc: BB10 Present %d %d", SyncInterval, newbb10); if(!newbb10 && !newbb11) { // Not multihead mode, plain old present dbg("dxgi_sc: Not multihead, just plain present"); return dxgsc->Present(SyncInterval, Flags); } #if defined(SOFTTHMAIN) || defined(D3D11) if(dev11) { D3D11_TEXTURE2D_DESC dt, ds; dbg("dxgi_sc: realbbdesc11... %d", realbb11); realbb11->GetDesc(&dt); newbb11->GetDesc(&ds); dbg("dxgi_sc: Source : %dx%d ms%d %s", ds.Width, ds.Height, ds.SampleDesc.Count, getFormatDXGI(ds.Format)); dbg("dxgi_sc: Primary Head : %dx%d ms%d %s", dt.Width, dt.Height, dt.SampleDesc.Count, getFormatDXGI(dt.Format)); // Copy and Present the Primary Head HEAD *h = config.getPrimaryHead(); D3D11_BOX sb = {h->sourceRect.left, h->sourceRect.top, 0, h->sourceRect.right, h->sourceRect.bottom, 1}; ID3D11DeviceContext *dev11context; dev11->GetImmediateContext(&dev11context); dev11context->CopySubresourceRegion(realbb11, 0, 0, 0, 0, newbb11, 0, &sb); /*if(GetKeyState('O') < 0) D3DX11SaveTextureToFile(realbb10, D3DX10_IFF_JPG, "d:\\pelit\\_realbb.jpg"); if(GetKeyState('P') < 0) D3DX11SaveTextureToFile(newbb10, D3DX10_IFF_JPG, "d:\\pelit\\_newbb.jpg");*/ // If we have non-local adapters, stage a copy of the buffer for non-local access /*if (has_nonlocal) { // Copy from the main backbuffer to the main staged texture dev11context->CopyResource(newbb11staged,newbb11); // Map the main staged texture D3D11_MAPPED_SUBRESOURCE submain; dev11context->Map(newbb11staged, 0, D3D11_MAP_READ, 0, &submain); }*/ // Copy and Present Secondary Heads for(int i=0;i<numDevs;i++) { OUTDEVICE11 *o = &outDevs11[i]; STAGINGOUT11 *so = &stagingOuts11[i]; o->localSurf->GetDesc(&dt); dbg("dxgi_sc: Secondary Head %d : %dx%d ms%d %s", i+1, dt.Width, dt.Height, dt.SampleDesc.Count, getFormatDXGI(dt.Format)); sb = {o->cfg->sourceRect.left, o->cfg->sourceRect.top, 0, o->cfg->sourceRect.right, o->cfg->sourceRect.bottom, 1}; // Check if the head is local and copy accordingly if (o->cfg->transportMethod == OUTMETHOD_LOCAL) { // Local head (on the primary video adapter) // - just copy the region directly to the head's localSurf dbg("dxgi_sc: Local head: CopySubresourceRegion"); dev11context->CopySubresourceRegion(o->localSurf, 0, 0, 0, 0, newbb11, 0, &sb); } else { // Non-local head (on a secondary adapter dbg("dxgi_sc: Non-local head: Map/Unmap"); // Copy from the main backbuffer to the main staged texture dev11context->CopySubresourceRegion(so->stagingSurf, 0, 0, 0, 0, newbb11, 0, &sb); // Map the main staged texture D3D11_MAPPED_SUBRESOURCE submain; if (dev11context->Map(so->stagingSurf, 0, D3D11_MAP_READ, 0, &submain) != S_OK) dbg("Mapping Main staging surface failed!"); // Map the head's staged texture D3D11_MAPPED_SUBRESOURCE subhead; if (o->output->devContext->Map(o->output->stagingSurface, 0, D3D11_MAP_WRITE, 0, &subhead) != S_OK) dbg("Mapping Head %d staging surface failed!",i+1); // Copy from the main staged texture to the head's staged texture memcpy(subhead.pData, submain.pData, dt.Width*dt.Height*4); // Unmap the head's staged texture o->output->devContext->Unmap(o->output->stagingSurface, 0); // Unmap the main staged texture dev11context->Unmap(so->stagingSurf, 0); // Copy from head's staged texture to the head's localSurf o->output->devContext->CopyResource(o->localSurf, o->output->stagingSurface); //o->output->devContext->CopySubresourceRegion(o->localSurf, 0, 0, 0, 0, o->output->stagingSurface, 0, NULL); // Release the main staged texture //so->stagingSurf->Release(); } /*if (has_nonlocal) { // Unmap the main staged texture dev11context->Unmap(newbb11staged, 0); }*/ // Flush the main render pipeline (full SoftTH buffer) dev11context->Flush(); // DOESN'T APPEAR TO BE A NEED TO DO THIS MANUALLY!!! // Draw each secondary output o->output->present(); } } #endif #ifdef SOFTTHMAIN else #endif #if defined(SOFTTHMAIN) || defined(D3D10) if(dev10_1) { D3D10_TEXTURE2D_DESC dt, ds; dbg("dxgi_sc: realbbdesc10.1 ... %d", realbb10); realbb10->GetDesc(&dt); newbb10->GetDesc(&ds); dbg("dxgi_sc: Source: %dx%d ms%d %s", ds.Width, ds.Height, ds.SampleDesc.Count, getFormatDXGI(ds.Format)); dbg("dxgi_sc: Target: %dx%d ms%d %s", dt.Width, dt.Height, dt.SampleDesc.Count, getFormatDXGI(dt.Format)); HEAD *h = config.getPrimaryHead(); D3D10_BOX sb = {h->sourceRect.left, h->sourceRect.top, 0, h->sourceRect.right, h->sourceRect.bottom, 1}; dev10_1->CopySubresourceRegion(realbb10, 0, 0, 0, 0, newbb10, 0, &sb); /*if(GetKeyState('O') < 0) D3DX10SaveTextureToFile(realbb10, D3DX10_IFF_JPG, "d:\\pelit\\_realbb.jpg"); if(GetKeyState('P') < 0) D3DX10SaveTextureToFile(newbb10, D3DX10_IFF_JPG, "d:\\pelit\\_newbb.jpg");*/ // Copy & Present secondary heads for(int i=0;i<numDevs;i++) { OUTDEVICE10 *o = &outDevs10[i]; D3D10_BOX sb = {o->cfg->sourceRect.left, o->cfg->sourceRect.top, 0, o->cfg->sourceRect.right, o->cfg->sourceRect.bottom, 1}; dev10_1->CopySubresourceRegion(o->localSurf, 0, 0, 0, 0, newbb10, 0, &sb); dev10_1->Flush(); o->output->present(); } } #endif // defined #ifdef SOFTTHMAIN else #endif #if defined(SOFTTHMAIN) || defined(D3D10) if(dev10) { D3D10_TEXTURE2D_DESC dt, ds; dbg("dxgi_sc: realbbdesc10... %d", realbb10); realbb10->GetDesc(&dt); newbb10->GetDesc(&ds); dbg("dxgi_sc: Source: %dx%d ms%d %s", ds.Width, ds.Height, ds.SampleDesc.Count, getFormatDXGI(ds.Format)); dbg("dxgi_sc: Target: %dx%d ms%d %s", dt.Width, dt.Height, dt.SampleDesc.Count, getFormatDXGI(dt.Format)); HEAD *h = config.getPrimaryHead(); D3D10_BOX sb = {h->sourceRect.left, h->sourceRect.top, 0, h->sourceRect.right, h->sourceRect.bottom, 1}; dev10->CopySubresourceRegion(realbb10, 0, 0, 0, 0, newbb10, 0, &sb); /*if(GetKeyState('O') < 0) D3DX10SaveTextureToFile(realbb10, D3DX10_IFF_JPG, "d:\\pelit\\_realbb.jpg"); if(GetKeyState('P') < 0) D3DX10SaveTextureToFile(newbb10, D3DX10_IFF_JPG, "d:\\pelit\\_newbb.jpg");*/ // Copy & Present secondary heads for(int i=0;i<numDevs;i++) { OUTDEVICE10 *o = &outDevs10[i]; D3D10_BOX sb = {o->cfg->sourceRect.left, o->cfg->sourceRect.top, 0, o->cfg->sourceRect.right, o->cfg->sourceRect.bottom, 1}; dev10->CopySubresourceRegion(o->localSurf, 0, 0, 0, 0, newbb10, 0, &sb); dev10->Flush(); o->output->present(); } } #endif // defined HRESULT ret = dxgsc->Present(SyncInterval, Flags); if(ret != S_OK) dbg("dxgi_sc: IDXGISwapChainNew::Present: Failed"); return ret; }
void c_haship_addr::print(ostream &ostr) const { string_as_hex dbg( string_as_bin(*this) ); ostr << "hip:" << dbg.get(); }
static void cp210x_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios) { unsigned int cflag, old_cflag; unsigned int baud = 0, bits; unsigned int modem_ctl[4]; dbg("%s - port %d", __func__, port->number); if (!tty) return; tty->termios->c_cflag &= ~CMSPAR; cflag = tty->termios->c_cflag; old_cflag = old_termios->c_cflag; baud = cp210x_quantise_baudrate(tty_get_baud_rate(tty)); /* If the baud rate is to be updated*/ if (baud != tty_termios_baud_rate(old_termios) && baud != 0) { dbg("%s - Setting baud rate to %d baud", __func__, baud); if (cp210x_set_config_single(port, CP210X_SET_BAUDDIV, ((BAUD_RATE_GEN_FREQ + baud/2) / baud))) { dbg("Baud rate requested not supported by device"); baud = tty_termios_baud_rate(old_termios); } } /* Report back the resulting baud rate */ tty_encode_baud_rate(tty, baud, baud); /* If the number of data bits is to be updated */ if ((cflag & CSIZE) != (old_cflag & CSIZE)) { cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2); bits &= ~BITS_DATA_MASK; switch (cflag & CSIZE) { case CS5: bits |= BITS_DATA_5; dbg("%s - data bits = 5", __func__); break; case CS6: bits |= BITS_DATA_6; dbg("%s - data bits = 6", __func__); break; case CS7: bits |= BITS_DATA_7; dbg("%s - data bits = 7", __func__); break; case CS8: bits |= BITS_DATA_8; dbg("%s - data bits = 8", __func__); break; /*case CS9: bits |= BITS_DATA_9; dbg("%s - data bits = 9", __func__); break;*/ default: dbg("cp210x driver does not " "support the number of bits requested," " using 8 bit mode\n"); bits |= BITS_DATA_8; break; } if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) dbg("Number of data bits requested " "not supported by device\n"); } if ((cflag & (PARENB|PARODD)) != (old_cflag & (PARENB|PARODD))) { cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2); bits &= ~BITS_PARITY_MASK; if (cflag & PARENB) { if (cflag & PARODD) { bits |= BITS_PARITY_ODD; dbg("%s - parity = ODD", __func__); } else { bits |= BITS_PARITY_EVEN; dbg("%s - parity = EVEN", __func__); } } if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) dbg("Parity mode not supported " "by device\n"); } if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) { cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2); bits &= ~BITS_STOP_MASK; if (cflag & CSTOPB) { bits |= BITS_STOP_2; dbg("%s - stop bits = 2", __func__); } else { bits |= BITS_STOP_1; dbg("%s - stop bits = 1", __func__); } if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) dbg("Number of stop bits requested " "not supported by device\n"); } if ((cflag & CRTSCTS) != (old_cflag & CRTSCTS)) { cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16); dbg("%s - read modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x", __func__, modem_ctl[0], modem_ctl[1], modem_ctl[2], modem_ctl[3]); if (cflag & CRTSCTS) { modem_ctl[0] &= ~0x7B; modem_ctl[0] |= 0x09; modem_ctl[1] = 0x80; dbg("%s - flow control = CRTSCTS", __func__); } else { modem_ctl[0] &= ~0x7B; modem_ctl[0] |= 0x01; modem_ctl[1] |= 0x40; dbg("%s - flow control = NONE", __func__); } dbg("%s - write modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x", __func__, modem_ctl[0], modem_ctl[1], modem_ctl[2], modem_ctl[3]); cp210x_set_config(port, CP210X_SET_FLOW, modem_ctl, 16); } }
static int s3cmci_setup_data(struct s3cmci_host *host, struct mmc_data *data) { u32 dcon, imsk, stoptries = 3; /* write DCON register */ if (!data) { writel(0, host->base + S3C2410_SDIDCON); return 0; } if ((data->blksz & 3) != 0) { /* We cannot deal with unaligned blocks with more than * one block being transfered. */ if (data->blocks > 1) return -EINVAL; /* No support yet for non-word block transfers. */ return -EINVAL; } while (readl(host->base + S3C2410_SDIDSTA) & (S3C2410_SDIDSTA_TXDATAON | S3C2410_SDIDSTA_RXDATAON)) { dbg(host, dbg_err, "mci_setup_data() transfer stillin progress.\n"); writel(S3C2410_SDIDCON_STOP, host->base + S3C2410_SDIDCON); s3cmci_reset(host); if ((stoptries--) == 0) { dbg_dumpregs(host, "DRF"); return -EINVAL; } } dcon = data->blocks & S3C2410_SDIDCON_BLKNUM_MASK; if (host->dodma) dcon |= S3C2410_SDIDCON_DMAEN; if (host->bus_width == MMC_BUS_WIDTH_4) dcon |= S3C2410_SDIDCON_WIDEBUS; if (!(data->flags & MMC_DATA_STREAM)) dcon |= S3C2410_SDIDCON_BLOCKMODE; if (data->flags & MMC_DATA_WRITE) { dcon |= S3C2410_SDIDCON_TXAFTERRESP; dcon |= S3C2410_SDIDCON_XFER_TXSTART; } if (data->flags & MMC_DATA_READ) { dcon |= S3C2410_SDIDCON_RXAFTERCMD; dcon |= S3C2410_SDIDCON_XFER_RXSTART; } if (host->is2440) { dcon |= S3C2440_SDIDCON_DS_WORD; dcon |= S3C2440_SDIDCON_DATSTART; } writel(dcon, host->base + S3C2410_SDIDCON); /* write BSIZE register */ writel(data->blksz, host->base + S3C2410_SDIBSIZE); /* add to IMASK register */ imsk = S3C2410_SDIIMSK_FIFOFAIL | S3C2410_SDIIMSK_DATACRC | S3C2410_SDIIMSK_DATATIMEOUT | S3C2410_SDIIMSK_DATAFINISH; enable_imask(host, imsk); /* write TIMER register */ if (host->is2440) { writel(0x007FFFFF, host->base + S3C2410_SDITIMER); } else { writel(0x0000FFFF, host->base + S3C2410_SDITIMER); /* FIX: set slow clock to prevent timeouts on read */ if (data->flags & MMC_DATA_READ) writel(0xFF, host->base + S3C2410_SDIPRE); } return 0; }
/** * iowarrior_ioctl */ static long iowarrior_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct iowarrior *dev = NULL; __u8 *buffer; __u8 __user *user_buffer; int retval; int io_res; /* checks for bytes read/written and copy_to/from_user results */ dev = file->private_data; if (dev == NULL) { return -ENODEV; } buffer = kzalloc(dev->report_size, GFP_KERNEL); if (!buffer) return -ENOMEM; /* lock this object */ mutex_lock(&iowarrior_mutex); mutex_lock(&dev->mutex); /* verify that the device wasn't unplugged */ if (!dev->present) { retval = -ENODEV; goto error_out; } dbg("%s - minor %d, cmd 0x%.4x, arg %ld", __func__, dev->minor, cmd, arg); retval = 0; io_res = 0; switch (cmd) { case IOW_WRITE: if (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW24 || dev->product_id == USB_DEVICE_ID_CODEMERCS_IOWPV1 || dev->product_id == USB_DEVICE_ID_CODEMERCS_IOWPV2 || dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW40) { user_buffer = (__u8 __user *)arg; io_res = copy_from_user(buffer, user_buffer, dev->report_size); if (io_res) { retval = -EFAULT; } else { io_res = usb_set_report(dev->interface, 2, 0, buffer, dev->report_size); if (io_res < 0) retval = io_res; } } else { retval = -EINVAL; dev_err(&dev->interface->dev, "ioctl 'IOW_WRITE' is not supported for product=0x%x.\n", dev->product_id); } break; case IOW_READ: user_buffer = (__u8 __user *)arg; io_res = usb_get_report(dev->udev, dev->interface->cur_altsetting, 1, 0, buffer, dev->report_size); if (io_res < 0) retval = io_res; else { io_res = copy_to_user(user_buffer, buffer, dev->report_size); if (io_res) retval = -EFAULT; } break; case IOW_GETINFO: { /* Report available information for the device */ struct iowarrior_info info; /* needed for power consumption */ struct usb_config_descriptor *cfg_descriptor = &dev->udev->actconfig->desc; memset(&info, 0, sizeof(info)); /* directly from the descriptor */ info.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); info.product = dev->product_id; info.revision = le16_to_cpu(dev->udev->descriptor.bcdDevice); /* 0==UNKNOWN, 1==LOW(usb1.1) ,2=FULL(usb1.1), 3=HIGH(usb2.0) */ info.speed = le16_to_cpu(dev->udev->speed); info.if_num = dev->interface->cur_altsetting->desc.bInterfaceNumber; info.report_size = dev->report_size; /* serial number string has been read earlier 8 chars or empty string */ memcpy(info.serial, dev->chip_serial, sizeof(dev->chip_serial)); if (cfg_descriptor == NULL) { info.power = -1; /* no information available */ } else { /* the MaxPower is stored in units of 2mA to make it fit into a byte-value */ info.power = cfg_descriptor->bMaxPower * 2; } io_res = copy_to_user((struct iowarrior_info __user *)arg, &info, sizeof(struct iowarrior_info)); if (io_res) retval = -EFAULT; break; } default: /* return that we did not understand this ioctl call */ retval = -ENOTTY; break; } error_out: /* unlock the device */ mutex_unlock(&dev->mutex); mutex_unlock(&iowarrior_mutex); kfree(buffer); return retval; }
void opengl_endpage(struct _gfxdevice*dev) { dbg("endpage"); }
int opengl_result_save(struct _gfxresult*gfx, const char*filename) { dbg("result:save"); return 0; }
void opengl_fillgradient(struct _gfxdevice*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix) { dbg("fillgradient"); }
void opengl_drawlink(struct _gfxdevice*dev, gfxline_t*line, const char*action) { dbg("link"); }
void opengl_fillbitmap(struct _gfxdevice*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t*matrix, gfxcxform_t*cxform) { dbg("fillbitmap"); internal_t*i = (internal_t*)dev->internal; char running = 0; int len = 0; double*xyz=0; gfxline_t*l=0; glColor4f(1.0,0,0.7,1.0); i->currentz ++; imgopengl_t* txt = addTexture(img); gfxmatrix_t m2; gfxmatrix_invert(matrix, &m2); m2.m00 /= txt->width; m2.m10 /= txt->width; m2.tx /= txt->width; m2.m01 /= txt->height; m2.m11 /= txt->height; m2.ty /= txt->height; glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, txt->texID); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); gluTessBeginPolygon(i->tesselator_tex, NULL); l = line; len = 0; while(l) { len++; l = l->next; } xyz = malloc(sizeof(double)*5*len); l = line; len = 0; while(l) { if(l->type == gfx_moveTo) { if(running) { running = 0; gluTessEndContour(i->tesselator_tex); } } if(!running) { running = 1; gluTessBeginContour(i->tesselator_tex); } xyz[len*5+0] = l->x; xyz[len*5+1] = l->y; xyz[len*5+2] = (i->currentz*ZSTEP); xyz[len*5+3] = 0; xyz[len*5+4] = 0; gfxmatrix_transform(&m2, /*src*/&xyz[len*5+0], /*dest*/&xyz[len*5+3]); gluTessVertex(i->tesselator_tex, &xyz[len*5], &xyz[len*5]); len++; l=l->next; } if(running) { running = 0; gluTessEndContour(i->tesselator_tex); } gluTessEndPolygon(i->tesselator_tex); free(xyz); glDisable(GL_TEXTURE_2D); }
void opengl_endclip(struct _gfxdevice*dev) { dbg("endclip"); }
void opengl_startclip(struct _gfxdevice*dev, gfxline_t*line) { dbg("startclip"); }
static irqreturn_t s3cmci_irq(int irq, void *dev_id) { struct s3cmci_host *host = dev_id; struct mmc_command *cmd; u32 mci_csta, mci_dsta, mci_fsta, mci_dcnt, mci_imsk; u32 mci_cclear, mci_dclear; unsigned long iflags; spin_lock_irqsave(&host->complete_lock, iflags); mci_csta = readl(host->base + S3C2410_SDICMDSTAT); mci_dsta = readl(host->base + S3C2410_SDIDSTA); mci_dcnt = readl(host->base + S3C2410_SDIDCNT); mci_fsta = readl(host->base + S3C2410_SDIFSTA); mci_imsk = readl(host->base + host->sdiimsk); mci_cclear = 0; mci_dclear = 0; if ((host->complete_what == COMPLETION_NONE) || (host->complete_what == COMPLETION_FINALIZE)) { host->status = "nothing to complete"; clear_imask(host); goto irq_out; } if (!host->mrq) { host->status = "no active mrq"; clear_imask(host); goto irq_out; } cmd = host->cmd_is_stop ? host->mrq->stop : host->mrq->cmd; if (!cmd) { host->status = "no active cmd"; clear_imask(host); goto irq_out; } if (!host->dodma) { if ((host->pio_active == XFER_WRITE) && (mci_fsta & S3C2410_SDIFSTA_TFDET)) { disable_imask(host, S3C2410_SDIIMSK_TXFIFOHALF); tasklet_schedule(&host->pio_tasklet); host->status = "pio tx"; } if ((host->pio_active == XFER_READ) && (mci_fsta & S3C2410_SDIFSTA_RFDET)) { disable_imask(host, S3C2410_SDIIMSK_RXFIFOHALF | S3C2410_SDIIMSK_RXFIFOLAST); tasklet_schedule(&host->pio_tasklet); host->status = "pio rx"; } } if (mci_csta & S3C2410_SDICMDSTAT_CMDTIMEOUT) { dbg(host, dbg_err, "CMDSTAT: error CMDTIMEOUT\n"); cmd->error = -ETIMEDOUT; host->status = "error: command timeout"; goto fail_transfer; } if (mci_csta & S3C2410_SDICMDSTAT_CMDSENT) { if (host->complete_what == COMPLETION_CMDSENT) { host->status = "ok: command sent"; goto close_transfer; } mci_cclear |= S3C2410_SDICMDSTAT_CMDSENT; } if (mci_csta & S3C2410_SDICMDSTAT_CRCFAIL) { if (cmd->flags & MMC_RSP_CRC) { if (host->mrq->cmd->flags & MMC_RSP_136) { dbg(host, dbg_irq, "fixup: ignore CRC fail with long rsp\n"); } else { /* note, we used to fail the transfer * here, but it seems that this is just * the hardware getting it wrong. * * cmd->error = -EILSEQ; * host->status = "error: bad command crc"; * goto fail_transfer; */ } } mci_cclear |= S3C2410_SDICMDSTAT_CRCFAIL; } if (mci_csta & S3C2410_SDICMDSTAT_RSPFIN) { if (host->complete_what == COMPLETION_RSPFIN) { host->status = "ok: command response received"; goto close_transfer; } if (host->complete_what == COMPLETION_XFERFINISH_RSPFIN) host->complete_what = COMPLETION_XFERFINISH; mci_cclear |= S3C2410_SDICMDSTAT_RSPFIN; } /* errors handled after this point are only relevant when a data transfer is in progress */ if (!cmd->data) goto clear_status_bits; /* Check for FIFO failure */ if (host->is2440) { if (mci_fsta & S3C2440_SDIFSTA_FIFOFAIL) { dbg(host, dbg_err, "FIFO failure\n"); host->mrq->data->error = -EILSEQ; host->status = "error: 2440 fifo failure"; goto fail_transfer; } } else { if (mci_dsta & S3C2410_SDIDSTA_FIFOFAIL) { dbg(host, dbg_err, "FIFO failure\n"); cmd->data->error = -EILSEQ; host->status = "error: fifo failure"; goto fail_transfer; } } if (mci_dsta & S3C2410_SDIDSTA_RXCRCFAIL) { dbg(host, dbg_err, "bad data crc (outgoing)\n"); cmd->data->error = -EILSEQ; host->status = "error: bad data crc (outgoing)"; goto fail_transfer; } if (mci_dsta & S3C2410_SDIDSTA_CRCFAIL) { dbg(host, dbg_err, "bad data crc (incoming)\n"); cmd->data->error = -EILSEQ; host->status = "error: bad data crc (incoming)"; goto fail_transfer; } if (mci_dsta & S3C2410_SDIDSTA_DATATIMEOUT) { dbg(host, dbg_err, "data timeout\n"); cmd->data->error = -ETIMEDOUT; host->status = "error: data timeout"; goto fail_transfer; } if (mci_dsta & S3C2410_SDIDSTA_XFERFINISH) { if (host->complete_what == COMPLETION_XFERFINISH) { host->status = "ok: data transfer completed"; goto close_transfer; } if (host->complete_what == COMPLETION_XFERFINISH_RSPFIN) host->complete_what = COMPLETION_RSPFIN; mci_dclear |= S3C2410_SDIDSTA_XFERFINISH; } clear_status_bits: writel(mci_cclear, host->base + S3C2410_SDICMDSTAT); writel(mci_dclear, host->base + S3C2410_SDIDSTA); goto irq_out; fail_transfer: host->pio_active = XFER_NONE; close_transfer: host->complete_what = COMPLETION_FINALIZE; clear_imask(host); tasklet_schedule(&host->pio_tasklet); goto irq_out; irq_out: dbg(host, dbg_irq, "csta:0x%08x dsta:0x%08x fsta:0x%08x dcnt:0x%08x status:%s.\n", mci_csta, mci_dsta, mci_fsta, mci_dcnt, host->status); spin_unlock_irqrestore(&host->complete_lock, iflags); return IRQ_HANDLED; }
void* opengl_result_get(struct _gfxresult*gfx, const char*name) { dbg("result:get"); return 0; }
static void finalize_request(struct s3cmci_host *host) { struct mmc_request *mrq = host->mrq; struct mmc_command *cmd = host->cmd_is_stop ? mrq->stop : mrq->cmd; int debug_as_failure = 0; if (host->complete_what != COMPLETION_FINALIZE) return; if (!mrq) return; if (cmd->data && (cmd->error == 0) && (cmd->data->error == 0)) { if (host->dodma && (!host->dma_complete)) { dbg(host, dbg_dma, "DMA Missing!\n"); return; } } /* Read response from controller. */ cmd->resp[0] = readl(host->base + S3C2410_SDIRSP0); cmd->resp[1] = readl(host->base + S3C2410_SDIRSP1); cmd->resp[2] = readl(host->base + S3C2410_SDIRSP2); cmd->resp[3] = readl(host->base + S3C2410_SDIRSP3); writel(host->prescaler, host->base + S3C2410_SDIPRE); if (cmd->error) debug_as_failure = 1; if (cmd->data && cmd->data->error) debug_as_failure = 1; dbg_dumpcmd(host, cmd, debug_as_failure); /* Cleanup controller */ writel(0, host->base + S3C2410_SDICMDARG); writel(S3C2410_SDIDCON_STOP, host->base + S3C2410_SDIDCON); writel(0, host->base + S3C2410_SDICMDCON); writel(0, host->base + host->sdiimsk); if (cmd->data && cmd->error) cmd->data->error = cmd->error; if (cmd->data && cmd->data->stop && (!host->cmd_is_stop)) { host->cmd_is_stop = 1; s3cmci_send_request(host->mmc); return; } /* If we have no data transfer we are finished here */ if (!mrq->data) goto request_done; /* Calulate the amout of bytes transfer if there was no error */ if (mrq->data->error == 0) { mrq->data->bytes_xfered = (mrq->data->blocks * mrq->data->blksz); } else { mrq->data->bytes_xfered = 0; } /* If we had an error while transfering data we flush the * DMA channel and the fifo to clear out any garbage. */ if (mrq->data->error != 0) { if (host->dodma) s3c2410_dma_ctrl(host->dma, S3C2410_DMAOP_FLUSH); if (host->is2440) { /* Clear failure register and reset fifo. */ writel(S3C2440_SDIFSTA_FIFORESET | S3C2440_SDIFSTA_FIFOFAIL, host->base + S3C2410_SDIFSTA); } else { u32 mci_con; /* reset fifo */ mci_con = readl(host->base + S3C2410_SDICON); mci_con |= S3C2410_SDICON_FIFORESET; writel(mci_con, host->base + S3C2410_SDICON); } } request_done: host->complete_what = COMPLETION_NONE; host->mrq = NULL; mmc_request_done(host->mmc, mrq); }
void opengl_result_destroy(struct _gfxresult*gfx) { dbg("result:destroy"); free(gfx); delTextures(); }
/* * iowarrior_write */ static ssize_t iowarrior_write(struct file *file, const char __user *user_buffer, size_t count, loff_t *ppos) { struct iowarrior *dev; int retval = 0; char *buf = NULL; /* for IOW24 and IOW56 we need a buffer */ struct urb *int_out_urb = NULL; dev = file->private_data; mutex_lock(&dev->mutex); /* verify that the device wasn't unplugged */ if (!dev->present) { retval = -ENODEV; goto exit; } dbg("%s - minor %d, count = %zd", __func__, dev->minor, count); /* if count is 0 we're already done */ if (count == 0) { retval = 0; goto exit; } /* We only accept full reports */ if (count != dev->report_size) { retval = -EINVAL; goto exit; } switch (dev->product_id) { case USB_DEVICE_ID_CODEMERCS_IOW24: case USB_DEVICE_ID_CODEMERCS_IOWPV1: case USB_DEVICE_ID_CODEMERCS_IOWPV2: case USB_DEVICE_ID_CODEMERCS_IOW40: /* IOW24 and IOW40 use a synchronous call */ buf = kmalloc(count, GFP_KERNEL); if (!buf) { retval = -ENOMEM; goto exit; } if (copy_from_user(buf, user_buffer, count)) { retval = -EFAULT; kfree(buf); goto exit; } retval = usb_set_report(dev->interface, 2, 0, buf, count); kfree(buf); goto exit; break; case USB_DEVICE_ID_CODEMERCS_IOW56: /* The IOW56 uses asynchronous IO and more urbs */ if (atomic_read(&dev->write_busy) == MAX_WRITES_IN_FLIGHT) { /* Wait until we are below the limit for submitted urbs */ if (file->f_flags & O_NONBLOCK) { retval = -EAGAIN; goto exit; } else { retval = wait_event_interruptible(dev->write_wait, (!dev->present || (atomic_read (&dev-> write_busy) < MAX_WRITES_IN_FLIGHT))); if (retval) { /* we were interrupted by a signal */ retval = -ERESTART; goto exit; } if (!dev->present) { /* The device was unplugged */ retval = -ENODEV; goto exit; } if (!dev->opened) { /* We were closed while waiting for an URB */ retval = -ENODEV; goto exit; } } } atomic_inc(&dev->write_busy); int_out_urb = usb_alloc_urb(0, GFP_KERNEL); if (!int_out_urb) { retval = -ENOMEM; dbg("%s Unable to allocate urb ", __func__); goto error_no_urb; } buf = usb_alloc_coherent(dev->udev, dev->report_size, GFP_KERNEL, &int_out_urb->transfer_dma); if (!buf) { retval = -ENOMEM; dbg("%s Unable to allocate buffer ", __func__); goto error_no_buffer; } usb_fill_int_urb(int_out_urb, dev->udev, usb_sndintpipe(dev->udev, dev->int_out_endpoint->bEndpointAddress), buf, dev->report_size, iowarrior_write_callback, dev, dev->int_out_endpoint->bInterval); int_out_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; if (copy_from_user(buf, user_buffer, count)) { retval = -EFAULT; goto error; } retval = usb_submit_urb(int_out_urb, GFP_KERNEL); if (retval) { dbg("%s submit error %d for urb nr.%d", __func__, retval, atomic_read(&dev->write_busy)); goto error; } /* submit was ok */ retval = count; usb_free_urb(int_out_urb); goto exit; break; default: /* what do we have here ? An unsupported Product-ID ? */ dev_err(&dev->interface->dev, "%s - not supported for product=0x%x\n", __func__, dev->product_id); retval = -EFAULT; goto exit; break; } error: usb_free_coherent(dev->udev, dev->report_size, buf, int_out_urb->transfer_dma); error_no_buffer: usb_free_urb(int_out_urb); error_no_urb: atomic_dec(&dev->write_busy); wake_up_interruptible(&dev->write_wait); exit: mutex_unlock(&dev->mutex); return retval; }
int usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) { struct usbnet *dev; struct net_device *net; struct usb_host_interface *interface; struct driver_info *info; struct usb_device *xdev; int status; const char *name; name = udev->dev.driver->name; info = (struct driver_info *) prod->driver_info; if (!info) { dev_dbg (&udev->dev, "blacklisted by %s\n", name); return -ENODEV; } xdev = interface_to_usbdev (udev); interface = udev->cur_altsetting; usb_get_dev (xdev); status = -ENOMEM; // set up our own records net = alloc_etherdev(sizeof(*dev)); if (!net) { dbg ("can't kmalloc dev"); goto out; } dev = netdev_priv(net); dev->udev = xdev; dev->intf = udev; dev->driver_info = info; dev->driver_name = name; dev->msg_enable = netif_msg_init (msg_level, NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK); skb_queue_head_init (&dev->rxq); skb_queue_head_init (&dev->txq); skb_queue_head_init (&dev->done); skb_queue_head_init(&dev->rxq_pause); dev->bh.func = usbnet_bh; dev->bh.data = (unsigned long) dev; INIT_WORK (&dev->kevent, kevent); init_usb_anchor(&dev->deferred); dev->delay.function = usbnet_bh; dev->delay.data = (unsigned long) dev; init_timer (&dev->delay); mutex_init (&dev->phy_mutex); dev->net = net; strcpy (net->name, "usb%d"); memcpy (net->dev_addr, node_id, sizeof node_id); /* rx and tx sides can use different message sizes; * bind() should set rx_urb_size in that case. */ dev->hard_mtu = net->mtu + net->hard_header_len; #if 0 // dma_supported() is deeply broken on almost all architectures // possible with some EHCI controllers if (dma_supported (&udev->dev, DMA_BIT_MASK(64))) net->features |= NETIF_F_HIGHDMA; #endif net->netdev_ops = &usbnet_netdev_ops; net->watchdog_timeo = TX_TIMEOUT_JIFFIES; net->ethtool_ops = &usbnet_ethtool_ops; // allow device-specific bind/init procedures // NOTE net->name still not usable ... if (info->bind) { status = info->bind (dev, udev); if (status < 0) goto out1; // heuristic: "usb%d" for links we know are two-host, // else "eth%d" when there's reasonable doubt. userspace // can rename the link if it knows better. if ((dev->driver_info->flags & FLAG_ETHER) != 0 && (net->dev_addr [0] & 0x02) == 0) strcpy (net->name, "eth%d"); /* WLAN devices should always be named "wlan%d" */ if ((dev->driver_info->flags & FLAG_WLAN) != 0) strcpy(net->name, "wlan%d"); /* maybe the remote can't receive an Ethernet MTU */ if (net->mtu > (dev->hard_mtu - net->hard_header_len)) net->mtu = dev->hard_mtu - net->hard_header_len; } else if (!info->in || !info->out) status = usbnet_get_endpoints (dev, udev); else { dev->in = usb_rcvbulkpipe (xdev, info->in); dev->out = usb_sndbulkpipe (xdev, info->out); if (!(info->flags & FLAG_NO_SETINT)) status = usb_set_interface (xdev, interface->desc.bInterfaceNumber, interface->desc.bAlternateSetting); else status = 0; } if (status >= 0 && dev->status) status = init_status (dev, udev); if (status < 0) goto out3; if (!dev->rx_urb_size) dev->rx_urb_size = dev->hard_mtu; dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1); SET_NETDEV_DEV(net, &udev->dev); status = register_netdev (net); if (status) goto out3; if (netif_msg_probe (dev)) devinfo (dev, "register '%s' at usb-%s-%s, %s, %pM", udev->dev.driver->name, xdev->bus->bus_name, xdev->devpath, dev->driver_info->description, net->dev_addr); // ok, it's ready to go. usb_set_intfdata (udev, dev); // start as if the link is up netif_device_attach (net); return 0; out3: if (info->unbind) info->unbind (dev, udev); out1: free_netdev(net); out: usb_put_dev(xdev); return status; }
static void omninet_close(struct usb_serial_port *port) { dbg("%s - port %d", __func__, port->number); usb_kill_urb(port->read_urb); }
/* * This is an abbreviated parser for the HID Report Descriptor. We * know what devices we are talking to, so this is by no means meant * to be generic. We can make some safe assumptions: * * - We know there are no LONG tags, all short * - We know that we have no MAIN Feature and MAIN Output items * - We know what the IRQ reports are supposed to look like. * * The main purpose of this is to use the HID report desc to figure * out the mins and maxs of the fields in the IRQ reports. The IRQ * reports for 400/401 change slightly if the max X is bigger than 64K. * */ static void parse_hid_report_descriptor(struct gtco *device, char * report, int length) { int z, x, i = 0; /* Tag primitive vars */ __u8 prefix; __u8 size; __u8 tag; __u8 type; __u8 data = 0; __u16 data16 = 0; __u32 data32 = 0; /* For parsing logic */ int inputnum = 0; __u32 usage = 0; /* Global Values, indexed by TAG */ __u32 globalval[TAG_GLOB_MAX]; __u32 oldval[TAG_GLOB_MAX]; /* Debug stuff */ char maintype = 'x'; char globtype[12]; int indent = 0; char indentstr[10] = ""; for (z=0; z<TAG_GLOB_MAX; z++) oldval[z]=0; dbg("======>>>>>>PARSE<<<<<<======"); /* Walk this report and pull out the info we need */ while (i < length) { prefix = report[i]; /* Skip over prefix */ i++; /* Determine data size and save the data in the proper variable */ size = PREF_SIZE(prefix); switch (size) { case 1: data = report[i]; break; case 2: data16 = get_unaligned_le16(&report[i]); break; case 3: size = 4; data32 = get_unaligned_le32(&report[i]); break; } /* Skip size of data */ i += size; /* What we do depends on the tag type */ tag = PREF_TAG(prefix); type = PREF_TYPE(prefix); switch (type) { case TYPE_MAIN: strcpy(globtype, ""); switch (tag) { case TAG_MAIN_INPUT: /* * The INPUT MAIN tag signifies this is * information from a report. We need to * figure out what it is and store the * min/max values */ maintype = 'I'; if (data == 2) strcpy(globtype, "Variable"); else if (data == 3) strcpy(globtype, "Var|Const"); dbg("::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits", globalval[TAG_GLOB_REPORT_ID], inputnum, globalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]); /* We can assume that the first two input items are always the X and Y coordinates. After that, we look for everything else by local usage value */ switch (inputnum) { case 0: /* X coord */ dbg("GER: X Usage: 0x%x", usage); if (device->max_X == 0) { device->max_X = globalval[TAG_GLOB_LOG_MAX]; device->min_X = globalval[TAG_GLOB_LOG_MIN]; } break; case 1: /* Y coord */ dbg("GER: Y Usage: 0x%x", usage); if (device->max_Y == 0) { device->max_Y = globalval[TAG_GLOB_LOG_MAX]; device->min_Y = globalval[TAG_GLOB_LOG_MIN]; } break; default: /* Tilt X */ if (usage == DIGITIZER_USAGE_TILT_X) { if (device->maxtilt_X == 0) { device->maxtilt_X = globalval[TAG_GLOB_LOG_MAX]; device->mintilt_X = globalval[TAG_GLOB_LOG_MIN]; } } /* Tilt Y */ if (usage == DIGITIZER_USAGE_TILT_Y) { if (device->maxtilt_Y == 0) { device->maxtilt_Y = globalval[TAG_GLOB_LOG_MAX]; device->mintilt_Y = globalval[TAG_GLOB_LOG_MIN]; } } /* Pressure */ if (usage == DIGITIZER_USAGE_TIP_PRESSURE) { if (device->maxpressure == 0) { device->maxpressure = globalval[TAG_GLOB_LOG_MAX]; device->minpressure = globalval[TAG_GLOB_LOG_MIN]; } } break; } inputnum++; break; case TAG_MAIN_OUTPUT: maintype = 'O'; break; case TAG_MAIN_FEATURE: maintype = 'F'; break; case TAG_MAIN_COL_START: maintype = 'S'; if (data == 0) { dbg("======>>>>>> Physical"); strcpy(globtype, "Physical"); } else dbg("======>>>>>>"); /* Indent the debug output */ indent++; for (x = 0; x < indent; x++) indentstr[x] = '-'; indentstr[x] = 0; /* Save global tags */ for (x = 0; x < TAG_GLOB_MAX; x++) oldval[x] = globalval[x]; break; case TAG_MAIN_COL_END: dbg("<<<<<<======"); maintype = 'E'; indent--; for (x = 0; x < indent; x++) indentstr[x] = '-'; indentstr[x] = 0; /* Copy global tags back */ for (x = 0; x < TAG_GLOB_MAX; x++) globalval[x] = oldval[x]; break; } switch (size) { case 1: dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", indentstr, tag, maintype, size, globtype, data); break; case 2: dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", indentstr, tag, maintype, size, globtype, data16); break; case 4: dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", indentstr, tag, maintype, size, globtype, data32); break; } break; case TYPE_GLOBAL: switch (tag) { case TAG_GLOB_USAGE: /* * First time we hit the global usage tag, * it should tell us the type of device */ if (device->usage == 0) device->usage = data; strcpy(globtype, "USAGE"); break; case TAG_GLOB_LOG_MIN: strcpy(globtype, "LOG_MIN"); break; case TAG_GLOB_LOG_MAX: strcpy(globtype, "LOG_MAX"); break; case TAG_GLOB_PHYS_MIN: strcpy(globtype, "PHYS_MIN"); break; case TAG_GLOB_PHYS_MAX: strcpy(globtype, "PHYS_MAX"); break; case TAG_GLOB_UNIT_EXP: strcpy(globtype, "EXP"); break; case TAG_GLOB_UNIT: strcpy(globtype, "UNIT"); break; case TAG_GLOB_REPORT_SZ: strcpy(globtype, "REPORT_SZ"); break; case TAG_GLOB_REPORT_ID: strcpy(globtype, "REPORT_ID"); /* New report, restart numbering */ inputnum = 0; break; case TAG_GLOB_REPORT_CNT: strcpy(globtype, "REPORT_CNT"); break; case TAG_GLOB_PUSH: strcpy(globtype, "PUSH"); break; case TAG_GLOB_POP: strcpy(globtype, "POP"); break; } /* Check to make sure we have a good tag number so we don't overflow array */ if (tag < TAG_GLOB_MAX) { switch (size) { case 1: dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x", indentstr, globtype, tag, size, data); globalval[tag] = data; break; case 2: dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x", indentstr, globtype, tag, size, data16); globalval[tag] = data16; break; case 4: dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x", indentstr, globtype, tag, size, data32); globalval[tag] = data32; break; } } else { dbg("%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d ", indentstr, tag, size); } break; case TYPE_LOCAL: switch (tag) { case TAG_GLOB_USAGE: strcpy(globtype, "USAGE"); /* Always 1 byte */ usage = data; break; case TAG_GLOB_LOG_MIN: strcpy(globtype, "MIN"); break; case TAG_GLOB_LOG_MAX: strcpy(globtype, "MAX"); break; default: strcpy(globtype, "UNKNOWN"); break; } switch (size) { case 1: dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", indentstr, tag, globtype, size, data); break; case 2: dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", indentstr, tag, globtype, size, data16); break; case 4: dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", indentstr, tag, globtype, size, data32); break; } break; } } }
/* * cp210x_get_termios_port * This is the heart of cp210x_get_termios which always uses a &usb_serial_port. */ static void cp210x_get_termios_port(struct usb_serial_port *port, unsigned int *cflagp, unsigned int *baudp) { unsigned int cflag, modem_ctl[4]; unsigned int baud; unsigned int bits; dbg("%s - port %d", __func__, port->number); cp210x_get_config(port, CP210X_GET_BAUDDIV, &baud, 2); /* Convert to baudrate */ if (baud) baud = cp210x_quantise_baudrate((BAUD_RATE_GEN_FREQ + baud/2)/ baud); dbg("%s - baud rate = %d", __func__, baud); *baudp = baud; cflag = *cflagp; cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2); cflag &= ~CSIZE; switch (bits & BITS_DATA_MASK) { case BITS_DATA_5: dbg("%s - data bits = 5", __func__); cflag |= CS5; break; case BITS_DATA_6: dbg("%s - data bits = 6", __func__); cflag |= CS6; break; case BITS_DATA_7: dbg("%s - data bits = 7", __func__); cflag |= CS7; break; case BITS_DATA_8: dbg("%s - data bits = 8", __func__); cflag |= CS8; break; case BITS_DATA_9: dbg("%s - data bits = 9 (not supported, using 8 data bits)", __func__); cflag |= CS8; bits &= ~BITS_DATA_MASK; bits |= BITS_DATA_8; cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); break; default: dbg("%s - Unknown number of data bits, using 8", __func__); cflag |= CS8; bits &= ~BITS_DATA_MASK; bits |= BITS_DATA_8; cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); break; } switch (bits & BITS_PARITY_MASK) { case BITS_PARITY_NONE: dbg("%s - parity = NONE", __func__); cflag &= ~PARENB; break; case BITS_PARITY_ODD: dbg("%s - parity = ODD", __func__); cflag |= (PARENB|PARODD); break; case BITS_PARITY_EVEN: dbg("%s - parity = EVEN", __func__); cflag &= ~PARODD; cflag |= PARENB; break; case BITS_PARITY_MARK: dbg("%s - parity = MARK (not supported, disabling parity)", __func__); cflag &= ~PARENB; bits &= ~BITS_PARITY_MASK; cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); break; case BITS_PARITY_SPACE: dbg("%s - parity = SPACE (not supported, disabling parity)", __func__); cflag &= ~PARENB; bits &= ~BITS_PARITY_MASK; cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); break; default: dbg("%s - Unknown parity mode, disabling parity", __func__); cflag &= ~PARENB; bits &= ~BITS_PARITY_MASK; cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); break; } cflag &= ~CSTOPB; switch (bits & BITS_STOP_MASK) { case BITS_STOP_1: dbg("%s - stop bits = 1", __func__); break; case BITS_STOP_1_5: dbg("%s - stop bits = 1.5 (not supported, using 1 stop bit)", __func__); bits &= ~BITS_STOP_MASK; cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); break; case BITS_STOP_2: dbg("%s - stop bits = 2", __func__); cflag |= CSTOPB; break; default: dbg("%s - Unknown number of stop bits, using 1 stop bit", __func__); bits &= ~BITS_STOP_MASK; cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); break; } cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16); if (modem_ctl[0] & 0x0008) { dbg("%s - flow control = CRTSCTS", __func__); cflag |= CRTSCTS; } else { dbg("%s - flow control = NONE", __func__); cflag &= ~CRTSCTS; } *cflagp = cflag; }
/* * URB callback routine. Called when we get IRQ reports from the * digitizer. * * This bridges the USB and input device worlds. It generates events * on the input device based on the USB reports. */ static void gtco_urb_callback(struct urb *urbinfo) { struct gtco *device = urbinfo->context; struct input_dev *inputdev; int rc; u32 val = 0; s8 valsigned = 0; char le_buffer[2]; inputdev = device->inputdevice; /* Was callback OK? */ if (urbinfo->status == -ECONNRESET || urbinfo->status == -ENOENT || urbinfo->status == -ESHUTDOWN) { /* Shutdown is occurring. Return and don't queue up any more */ return; } if (urbinfo->status != 0) { /* * Some unknown error. Hopefully temporary. Just go and * requeue an URB */ goto resubmit; } /* * Good URB, now process */ /* PID dependent when we interpret the report */ if (inputdev->id.product == PID_1000 || inputdev->id.product == PID_1001 || inputdev->id.product == PID_1002) { /* * Switch on the report ID * Conveniently, the reports have more information, the higher * the report number. We can just fall through the case * statements if we start with the highest number report */ switch (device->buffer[0]) { case 5: /* Pressure is 9 bits */ val = ((u16)(device->buffer[8]) << 1); val |= (u16)(device->buffer[7] >> 7); input_report_abs(inputdev, ABS_PRESSURE, device->buffer[8]); /* Mask out the Y tilt value used for pressure */ device->buffer[7] = (u8)((device->buffer[7]) & 0x7F); /* Fall thru */ case 4: /* Tilt */ /* Sign extend these 7 bit numbers. */ if (device->buffer[6] & 0x40) device->buffer[6] |= 0x80; if (device->buffer[7] & 0x40) device->buffer[7] |= 0x80; valsigned = (device->buffer[6]); input_report_abs(inputdev, ABS_TILT_X, (s32)valsigned); valsigned = (device->buffer[7]); input_report_abs(inputdev, ABS_TILT_Y, (s32)valsigned); /* Fall thru */ case 2: case 3: /* Convert buttons, only 5 bits possible */ val = (device->buffer[5]) & MASK_BUTTON; /* We don't apply any meaning to the bitmask, just report */ input_event(inputdev, EV_MSC, MSC_SERIAL, val); /* Fall thru */ case 1: /* All reports have X and Y coords in the same place */ val = get_unaligned_le16(&device->buffer[1]); input_report_abs(inputdev, ABS_X, val); val = get_unaligned_le16(&device->buffer[3]); input_report_abs(inputdev, ABS_Y, val); /* Ditto for proximity bit */ val = device->buffer[5] & MASK_INRANGE ? 1 : 0; input_report_abs(inputdev, ABS_DISTANCE, val); /* Report 1 is an exception to how we handle buttons */ /* Buttons are an index, not a bitmask */ if (device->buffer[0] == 1) { /* * Convert buttons, 5 bit index * Report value of index set as one, * the rest as 0 */ val = device->buffer[5] & MASK_BUTTON; dbg("======>>>>>>REPORT 1: val 0x%X(%d)", val, val); /* * We don't apply any meaning to the button * index, just report it */ input_event(inputdev, EV_MSC, MSC_SERIAL, val); } break; case 7: /* Menu blocks */ input_event(inputdev, EV_MSC, MSC_SCAN, device->buffer[1]); break; } } /* Other pid class */ if (inputdev->id.product == PID_400 || inputdev->id.product == PID_401) { /* Report 2 */ if (device->buffer[0] == 2) { /* Menu blocks */ input_event(inputdev, EV_MSC, MSC_SCAN, device->buffer[1]); } /* Report 1 */ if (device->buffer[0] == 1) { char buttonbyte; /* IF X max > 64K, we still a bit from the y report */ if (device->max_X > 0x10000) { val = (u16)(((u16)(device->buffer[2] << 8)) | (u8)device->buffer[1]); val |= (u32)(((u8)device->buffer[3] & 0x1) << 16); input_report_abs(inputdev, ABS_X, val); le_buffer[0] = (u8)((u8)(device->buffer[3]) >> 1); le_buffer[0] |= (u8)((device->buffer[3] & 0x1) << 7); le_buffer[1] = (u8)(device->buffer[4] >> 1); le_buffer[1] |= (u8)((device->buffer[5] & 0x1) << 7); val = get_unaligned_le16(le_buffer); input_report_abs(inputdev, ABS_Y, val); /* * Shift the button byte right by one to * make it look like the standard report */ buttonbyte = device->buffer[5] >> 1; } else {
static void atp_complete(struct urb* urb) { int x, y, x_z, y_z, x_f, y_f; int retval, i, j; int key; struct atp *dev = urb->context; switch (urb->status) { case 0: /* success */ break; case -EOVERFLOW: if(!dev->overflowwarn) { printk(KERN_WARNING "appletouch: OVERFLOW with data " "length %d, actual length is %d\n", dev->datalen, dev->urb->actual_length); dev->overflowwarn = 1; } case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: /* This urb is terminated, clean up */ dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status); return; default: dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); goto exit; } /* drop incomplete datasets */ if (dev->urb->actual_length != dev->datalen) { dprintk("appletouch: incomplete data package" " (first byte: %d, length: %d).\n", dev->data[0], dev->urb->actual_length); goto exit; } /* reorder the sensors values */ if (atp_is_geyser_3(dev)) { memset(dev->xy_cur, 0, sizeof(dev->xy_cur)); /* * The values are laid out like this: * -, Y1, Y2, -, Y3, Y4, -, ..., -, X1, X2, -, X3, X4, ... * '-' is an unused value. */ /* read X values */ for (i = 0, j = 19; i < 20; i += 2, j += 3) { dev->xy_cur[i] = dev->data[j + 1]; dev->xy_cur[i + 1] = dev->data[j + 2]; } /* read Y values */ for (i = 0, j = 1; i < 9; i += 2, j += 3) { dev->xy_cur[ATP_XSENSORS + i] = dev->data[j + 1]; dev->xy_cur[ATP_XSENSORS + i + 1] = dev->data[j + 2]; } } else if (atp_is_geyser_2(dev)) { memset(dev->xy_cur, 0, sizeof(dev->xy_cur)); /* * The values are laid out like this: * Y1, Y2, -, Y3, Y4, -, ..., X1, X2, -, X3, X4, -, ... * '-' is an unused value. */ /* read X values */ for (i = 0, j = 19; i < 20; i += 2, j += 3) { dev->xy_cur[i] = dev->data[j]; dev->xy_cur[i + 1] = dev->data[j + 1]; } /* read Y values */ for (i = 0, j = 1; i < 9; i += 2, j += 3) { dev->xy_cur[ATP_XSENSORS + i] = dev->data[j]; dev->xy_cur[ATP_XSENSORS + i + 1] = dev->data[j + 1]; } } else { for (i = 0; i < 8; i++) { /* X values */ dev->xy_cur[i ] = dev->data[5 * i + 2]; dev->xy_cur[i + 8] = dev->data[5 * i + 4]; dev->xy_cur[i + 16] = dev->data[5 * i + 42]; if (i < 2) dev->xy_cur[i + 24] = dev->data[5 * i + 44]; /* Y values */ dev->xy_cur[i + 26] = dev->data[5 * i + 1]; dev->xy_cur[i + 34] = dev->data[5 * i + 3]; } } dbg_dump("sample", dev->xy_cur); if (!dev->valid) { /* first sample */ dev->valid = 1; dev->x_old = dev->y_old = -1; memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old)); if (dev->size_detect_done || atp_is_geyser_3(dev)) /* No 17" Macbooks (yet) */ goto exit; /* 17" Powerbooks have extra X sensors */ for (i = (atp_is_geyser_2(dev) ? 15 : 16); i < ATP_XSENSORS; i++) { if (!dev->xy_cur[i]) continue; printk(KERN_INFO "appletouch: 17\" model detected.\n"); if (atp_is_geyser_2(dev)) input_set_abs_params(dev->input, ABS_X, 0, (20 - 1) * ATP_XFACT - 1, ATP_FUZZ, 0); else input_set_abs_params(dev->input, ABS_X, 0, (ATP_XSENSORS - 1) * ATP_XFACT - 1, ATP_FUZZ, 0); break; } dev->size_detect_done = 1; goto exit; } for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) { /* accumulate the change */ signed char change = dev->xy_old[i] - dev->xy_cur[i]; dev->xy_acc[i] -= change; /* prevent down drifting */ if (dev->xy_acc[i] < 0) dev->xy_acc[i] = 0; } memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old)); dbg_dump("accumulator", dev->xy_acc); x = atp_calculate_abs(dev->xy_acc, ATP_XSENSORS, ATP_XFACT, &x_z, &x_f); y = atp_calculate_abs(dev->xy_acc + ATP_XSENSORS, ATP_YSENSORS, ATP_YFACT, &y_z, &y_f); key = dev->data[dev->datalen - 1] & 1; if (x && y) { if (dev->x_old != -1) { x = (dev->x_old * 3 + x) >> 2; y = (dev->y_old * 3 + y) >> 2; dev->x_old = x; dev->y_old = y; if (debug > 1) printk(KERN_DEBUG "appletouch: X: %3d Y: %3d " "Xz: %3d Yz: %3d\n", x, y, x_z, y_z); input_report_key(dev->input, BTN_TOUCH, 1); input_report_abs(dev->input, ABS_X, x); input_report_abs(dev->input, ABS_Y, y); input_report_abs(dev->input, ABS_PRESSURE, min(ATP_PRESSURE, x_z + y_z)); atp_report_fingers(dev->input, max(x_f, y_f)); } dev->x_old = x; dev->y_old = y; } else if (!x && !y) {
static void s3cmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { struct s3cmci_host *host = mmc_priv(mmc); u32 mci_psc, mci_con; /* Set the power state */ mci_con = readl(host->base + S3C2410_SDICON); switch (ios->power_mode) { case MMC_POWER_ON: case MMC_POWER_UP: s3c2410_gpio_cfgpin(S3C2410_GPE5, S3C2410_GPE5_SDCLK); s3c2410_gpio_cfgpin(S3C2410_GPE6, S3C2410_GPE6_SDCMD); s3c2410_gpio_cfgpin(S3C2410_GPE7, S3C2410_GPE7_SDDAT0); s3c2410_gpio_cfgpin(S3C2410_GPE8, S3C2410_GPE8_SDDAT1); s3c2410_gpio_cfgpin(S3C2410_GPE9, S3C2410_GPE9_SDDAT2); s3c2410_gpio_cfgpin(S3C2410_GPE10, S3C2410_GPE10_SDDAT3); if (host->pdata->set_power) host->pdata->set_power(ios->power_mode, ios->vdd); if (!host->is2440) mci_con |= S3C2410_SDICON_FIFORESET; break; case MMC_POWER_OFF: default: s3c2410_gpio_setpin(S3C2410_GPE5, 0); s3c2410_gpio_cfgpin(S3C2410_GPE5, S3C2410_GPE5_OUTP); if (host->is2440) mci_con |= S3C2440_SDICON_SDRESET; if (host->pdata->set_power) host->pdata->set_power(ios->power_mode, ios->vdd); break; } /* Set clock */ for (mci_psc = 0; mci_psc < 255; mci_psc++) { host->real_rate = host->clk_rate / (host->clk_div*(mci_psc+1)); if (host->real_rate <= ios->clock) break; } if (mci_psc > 255) mci_psc = 255; host->prescaler = mci_psc; writel(host->prescaler, host->base + S3C2410_SDIPRE); /* If requested clock is 0, real_rate will be 0, too */ if (ios->clock == 0) host->real_rate = 0; /* Set CLOCK_ENABLE */ if (ios->clock) mci_con |= S3C2410_SDICON_CLOCKTYPE; else mci_con &= ~S3C2410_SDICON_CLOCKTYPE; writel(mci_con, host->base + S3C2410_SDICON); if ((ios->power_mode == MMC_POWER_ON) || (ios->power_mode == MMC_POWER_UP)) { dbg(host, dbg_conf, "running at %lukHz (requested: %ukHz).\n", host->real_rate/1000, ios->clock/1000); } else { dbg(host, dbg_conf, "powered down.\n"); } host->bus_width = ios->bus_width; }
IDXGISwapChainNew::~IDXGISwapChainNew() { dbg("dxgi_sc: ~IDXGISwapChainNew 0x%08X", this); }
static int __devinit s3cmci_probe(struct platform_device *pdev, int is2440) { struct s3cmci_host *host; struct mmc_host *mmc; int ret; mmc = mmc_alloc_host(sizeof(struct s3cmci_host), &pdev->dev); if (!mmc) { ret = -ENOMEM; goto probe_out; } host = mmc_priv(mmc); host->mmc = mmc; host->pdev = pdev; host->is2440 = is2440; host->pdata = pdev->dev.platform_data; if (!host->pdata) { pdev->dev.platform_data = &s3cmci_def_pdata; host->pdata = &s3cmci_def_pdata; } spin_lock_init(&host->complete_lock); tasklet_init(&host->pio_tasklet, pio_tasklet, (unsigned long) host); if (is2440) { host->sdiimsk = S3C2440_SDIIMSK; host->sdidata = S3C2440_SDIDATA; host->clk_div = 1; } else { host->sdiimsk = S3C2410_SDIIMSK; host->sdidata = S3C2410_SDIDATA; host->clk_div = 2; } host->dodma = 0; host->complete_what = COMPLETION_NONE; host->pio_active = XFER_NONE; host->dma = S3CMCI_DMA; host->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!host->mem) { dev_err(&pdev->dev, "failed to get io memory region resouce.\n"); ret = -ENOENT; goto probe_free_host; } host->mem = request_mem_region(host->mem->start, RESSIZE(host->mem), pdev->name); if (!host->mem) { dev_err(&pdev->dev, "failed to request io memory region.\n"); ret = -ENOENT; goto probe_free_host; } host->base = ioremap(host->mem->start, RESSIZE(host->mem)); if (host->base == 0) { dev_err(&pdev->dev, "failed to ioremap() io memory region.\n"); ret = -EINVAL; goto probe_free_mem_region; } host->irq = platform_get_irq(pdev, 0); if (host->irq == 0) { dev_err(&pdev->dev, "failed to get interrupt resouce.\n"); ret = -EINVAL; goto probe_iounmap; } if (request_irq(host->irq, s3cmci_irq, 0, DRIVER_NAME, host)) { dev_err(&pdev->dev, "failed to request mci interrupt.\n"); ret = -ENOENT; goto probe_iounmap; } /* We get spurious interrupts even when we have set the IMSK * register to ignore everything, so use disable_irq() to make * ensure we don't lock the system with un-serviceable requests. */ disable_irq(host->irq); host->irq_cd = s3c2410_gpio_getirq(host->pdata->gpio_detect); if (host->irq_cd >= 0) { if (request_irq(host->irq_cd, s3cmci_irq_cd, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, DRIVER_NAME, host)) { dev_err(&pdev->dev, "can't get card detect irq.\n"); ret = -ENOENT; goto probe_free_irq; } } else { dev_warn(&pdev->dev, "host detect has no irq available\n"); s3c2410_gpio_cfgpin(host->pdata->gpio_detect, S3C2410_GPIO_INPUT); } if (host->pdata->gpio_wprotect) s3c2410_gpio_cfgpin(host->pdata->gpio_wprotect, S3C2410_GPIO_INPUT); if (s3c2410_dma_request(S3CMCI_DMA, &s3cmci_dma_client, NULL) < 0) { dev_err(&pdev->dev, "unable to get DMA channel.\n"); ret = -EBUSY; goto probe_free_irq_cd; } host->clk = clk_get(&pdev->dev, "sdi"); if (IS_ERR(host->clk)) { dev_err(&pdev->dev, "failed to find clock source.\n"); ret = PTR_ERR(host->clk); host->clk = NULL; goto probe_free_host; } ret = clk_enable(host->clk); if (ret) { dev_err(&pdev->dev, "failed to enable clock source.\n"); goto clk_free; } host->clk_rate = clk_get_rate(host->clk); mmc->ops = &s3cmci_ops; mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; mmc->caps = MMC_CAP_4_BIT_DATA; mmc->f_min = host->clk_rate / (host->clk_div * 256); mmc->f_max = host->clk_rate / host->clk_div; if (host->pdata->ocr_avail) mmc->ocr_avail = host->pdata->ocr_avail; mmc->max_blk_count = 4095; mmc->max_blk_size = 4095; mmc->max_req_size = 4095 * 512; mmc->max_seg_size = mmc->max_req_size; mmc->max_phys_segs = 128; mmc->max_hw_segs = 128; dbg(host, dbg_debug, "probe: mode:%s mapped mci_base:%p irq:%u irq_cd:%u dma:%u.\n", (host->is2440?"2440":""), host->base, host->irq, host->irq_cd, host->dma); ret = mmc_add_host(mmc); if (ret) { dev_err(&pdev->dev, "failed to add mmc host.\n"); goto free_dmabuf; } platform_set_drvdata(pdev, mmc); dev_info(&pdev->dev, "initialisation done.\n"); return 0; free_dmabuf: clk_disable(host->clk); clk_free: clk_put(host->clk); probe_free_irq_cd: if (host->irq_cd >= 0) free_irq(host->irq_cd, host); probe_free_irq: free_irq(host->irq, host); probe_iounmap: iounmap(host->base); probe_free_mem_region: release_mem_region(host->mem->start, RESSIZE(host->mem)); probe_free_host: mmc_free_host(mmc); probe_out: return ret; }
void IDXGISwapChainNew::preUpdateBB(UINT *width, UINT *height) { dbg("dxgi_sc: preUpdateBB"); int rrx = config.main.renderResolution.x; int rry = config.main.renderResolution.y; if(*width == rrx && *height == rry) { dbg("dxgi_sc: Multihead swapchain mode detected"); HEAD *h = config.getPrimaryHead(); *width = h->screenMode.x; *height = h->screenMode.y; // Set mouse hook on application focus window ihGlobal.setHWND(win); SoftTHActive++; h->hwnd = win; // Create new backbuffer dbg("dxgi_sc: Creating new backbuffer"); // TODO: format #if defined(SOFTTHMAIN) || defined(D3D11) if(dev11) { // Create the full backbuffer render texture dbg("dxgi_sc: Creating FULL backbuffer for D3D11 Device"); //CD3D10_TEXTURE2D_DESC d(DXGI_FORMAT_R8G8B8A8_UNORM, rrx, rry, 1, 1, D3D10_BIND_RENDER_TARGET, D3D10_USAGE_DEFAULT, NULL); CD3D11_TEXTURE2D_DESC d(DXGI_FORMAT_R8G8B8A8_UNORM, rrx, rry, 1, 1, D3D11_BIND_RENDER_TARGET, D3D11_USAGE_DEFAULT, NULL); newbbDesc11 = d; if(dev11->CreateTexture2D(&newbbDesc11, NULL, &newbb11) != S_OK) dbg("dxgi_sc: CreateTexture2D failed :("), exit(0); // Initialize outputs numDevs = config.getNumAdditionalHeads(); dbg("dxgi_sc: Initializing %d outputs", numDevs); int logoStopTime = GetTickCount() + 4000; bool fpuPreserve = true; // TODO: does this exist in d3d10? outDevs11 = new OUTDEVICE11[numDevs]; stagingOuts11 = new STAGINGOUT11[numDevs]; for(int i=0;i<numDevs;i++) { OUTDEVICE11 *o = &outDevs11[i]; STAGINGOUT11 *so = &stagingOuts11[i]; so->headID = i+1; so->devID = h->devID; so->stagingSurf = NULL; // Create the output device HEAD *h = config.getHead(i); dbg("dxgi_sc: Initializing Head %d (DevID: %d)",i+1,h->devID); o->output = new outDirect3D11(h->devID, h->screenMode.x, h->screenMode.y, h->transportRes.x, h->transportRes.y, win); o->cfg = h; bool local = h->transportMethod==OUTMETHOD_LOCAL; if (!local) has_nonlocal = true; dbg("dxgi_sc: Head %d is %s", i+1, local?"local":"non-local"); // Create a main staging buffer sized for this head if non-local if (!local) { dbg("dxgi_sc: Creating a main non-local staging buffer for Head %d (DevID %d)", i + 1, h->devID); CD3D11_TEXTURE2D_DESC dss(DXGI_FORMAT_R8G8B8A8_UNORM, h->transportRes.x, h->transportRes.y, 1, 1, 0, D3D11_USAGE_STAGING, D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE, 1, 0, 0); /*DWORD32 *fillbuf = new DWORD32[h->transportRes.x*h->transportRes.y]; for (int ii = 0; ii < h->transportRes.y; ii++) for (int jj = 0; jj < h->transportRes.x; jj++) { if ((ii&32)==(jj&32)) fillbuf[ii*h->transportRes.x + jj] = (DWORD32) 0x0000ff00; else fillbuf[ii*h->transportRes.x + jj] = (DWORD32) 0xffffffff; } D3D11_SUBRESOURCE_DATA fillsr; ZeroMemory(&fillsr, sizeof(fillsr)); fillsr.pSysMem = (void *)fillbuf; fillsr.SysMemPitch = h->transportRes.x * 4; fillsr.SysMemSlicePitch = h->transportRes.x * h->transportRes.y * 4; if (dev11->CreateTexture2D(&dss, &fillsr, &so->stagingSurf) != S_OK) {*/ if (dev11->CreateTexture2D(&dss, NULL, &so->stagingSurf) != S_OK) { dbg("dxgi_sc: CreateTexture2D staged for Head %d (DevID %d) failed :(",i+1,h->devID), exit(0); } } // Create shared surfaces HANDLE sha = o->output->GetShareHandle(); if(sha) { o->localSurf = NULL; { // Open surfA share handle ID3D11Resource *tr; if (o->cfg->transportMethod == OUTMETHOD_LOCAL) { // Local output if (dev11->OpenSharedResource(sha, __uuidof(ID3D11Resource), (void**)(&tr)) != S_OK) dbg("dxgi_sc: Local OpenSharedResource A failed!"), exit(0); } else { // Non-local output if (o->output->dev->OpenSharedResource(sha, __uuidof(ID3D11Resource), (void**)(&tr)) != S_OK) dbg("dxgi_sc: Non-local OpenSharedResource A failed!"), exit(0); } if(tr->QueryInterface(__uuidof(ID3D11Texture2D), (void**)(&o->localSurf)) != S_OK) dbg("dxgi_sc: Shared surface QueryInterface failed!"), exit(0); tr->Release(); } dbg("dxgi_sc: Opened share handles"); } else dbg("dxgi_sc: ERROR: Head %d: No share handle!", i+1), exit(0); } // Create the full backbuffer staged texture if we have non-local head /*if (has_nonlocal) { CD3D11_TEXTURE2D_DESC ds(DXGI_FORMAT_R8G8B8A8_UNORM, rrx, rry, 1, 1, NULL, D3D11_USAGE_STAGING, D3D11_CPU_ACCESS_READ, 1, 0, D3D11_RESOURCE_MISC_SHARED); newbbDesc11staged = ds; if(dev11->CreateTexture2D(&newbbDesc11staged, NULL, &newbb11staged) != S_OK) dbg("dxgi_sc: CreateTexture2D staged failed :("), exit(0); }*/ } #endif #ifdef SOFTTHMAIN else #endif #if defined(SOFTTHMAIN) || defined(D3D10_1) if(dev10_1) { dbg("dxgi_sc: Creating backbuffer for D3D10.1 Device"); CD3D10_TEXTURE2D_DESC d(DXGI_FORMAT_R8G8B8A8_UNORM, rrx, rry, 1, 1, D3D10_BIND_RENDER_TARGET, D3D10_USAGE_DEFAULT, NULL); newbbDesc10 = d; if(dev10_1->CreateTexture2D(&newbbDesc10, NULL, &newbb10) != S_OK) dbg("dxgi_sc: CreateTexture2D failed :("), exit(0); // Initialize outputs numDevs = config.getNumAdditionalHeads(); dbg("dxgi_sc: Initializing %d outputs", numDevs); int logoStopTime = GetTickCount() + 4000; bool fpuPreserve = true; // TODO: does this exist in d3d10? outDevs10 = new OUTDEVICE10[numDevs]; for(int i=0;i<numDevs;i++) { OUTDEVICE10 *o = &outDevs10[i]; // Create the output device HEAD *h = config.getHead(i); bool local = h->transportMethod==OUTMETHOD_LOCAL; dbg("dxgi_sc: Initializing head %d (DevID: %d, %s)...", i+1, h->devID, local?"local":"non-local"); o->output = new outDirect3D10(h->devID, h->screenMode.x, h->screenMode.y, h->transportRes.x, h->transportRes.y, win); o->cfg = h; // Create shared surfaces HANDLE sha = o->output->GetShareHandle(); if(sha) { o->localSurf = NULL; { // Open surfA share handle ID3D10Resource *tr; if(dev10_1->OpenSharedResource(sha, __uuidof(ID3D10Resource), (void**)(&tr)) != S_OK) dbg("dxgi_sc: OpenSharedResource A failed!"), exit(0); if(tr->QueryInterface(__uuidof(ID3D10Texture2D), (void**)(&o->localSurf)) != S_OK) dbg("dxgi_sc: Shared surface QueryInterface failed!"), exit(0); tr->Release(); } dbg("dxgi_sc: Opened share handles"); } else dbg("dxgi_sc: ERROR: Head %d: No share handle!", i+1), exit(0); } } #endif #ifdef SOFTTHMAIN else #endif #if defined(SOFTTHMAIN) || defined(D3D10) if(dev10) { dbg("dxgi_sc: Creating backbuffer for D3D10 Device"); CD3D10_TEXTURE2D_DESC d(DXGI_FORMAT_R8G8B8A8_UNORM, rrx, rry, 1, 1, D3D10_BIND_RENDER_TARGET, D3D10_USAGE_DEFAULT, NULL); newbbDesc10 = d; if(dev10->CreateTexture2D(&newbbDesc10, NULL, &newbb10) != S_OK) dbg("dxgi_sc: CreateTexture2D failed :("), exit(0); // Initialize outputs numDevs = config.getNumAdditionalHeads(); dbg("dxgi_sc: Initializing %d outputs", numDevs); int logoStopTime = GetTickCount() + 4000; bool fpuPreserve = true; // TODO: does this exist in d3d10? outDevs10 = new OUTDEVICE10[numDevs]; for(int i=0;i<numDevs;i++) { OUTDEVICE10 *o = &outDevs10[i]; // Create the output device HEAD *h = config.getHead(i); bool local = h->transportMethod==OUTMETHOD_LOCAL; dbg("dxgi_sc: Initializing head %d (DevID: %d, %s)...", i+1, h->devID, local?"local":"non-local"); o->output = new outDirect3D10(h->devID, h->screenMode.x, h->screenMode.y, h->transportRes.x, h->transportRes.y, win); o->cfg = h; // Create shared surfaces HANDLE sha = o->output->GetShareHandle(); if(sha) { o->localSurf = NULL; { // Open surfA share handle ID3D10Resource *tr; if(dev10->OpenSharedResource(sha, __uuidof(ID3D10Resource), (void**)(&tr)) != S_OK) dbg("dxgi_sc: OpenSharedResource A failed!"), exit(0); if(tr->QueryInterface(__uuidof(ID3D10Texture2D), (void**)(&o->localSurf)) != S_OK) dbg("dxgi_sc: Shared surface QueryInterface failed!"), exit(0); tr->Release(); } dbg("dxgi_sc: Opened share handles"); } else dbg("dxgi_sc: ERROR: Head %d: No share handle!", i+1), exit(0); } } #endif } else { dbg("dxgi_sc: Singlehead swapchain mode"); SoftTHActive--; if(dev11) { if(newbb11) SAFE_RELEASE_LAST(newbb11); newbb11 = NULL; } else if(dev10 || dev10_1) { if(newbb10) SAFE_RELEASE_LAST(newbb10); newbb10 = NULL; } } }
SaErrorT snmp_bc_discover_rsa(struct oh_handler_state *handle, SaHpiEntityPathT *ep_root) { int i; SaErrorT err; struct oh_event *e; struct snmp_value get_value; struct ResourceInfo *res_info_ptr; struct snmp_bc_hnd *custom_handle; if (!handle || !ep_root) { dbg("Invalid parameter."); return(SA_ERR_HPI_INVALID_PARAMS); } custom_handle = (struct snmp_bc_hnd *)handle->data; if (!custom_handle) { dbg("Invalid parameter."); return(SA_ERR_HPI_INVALID_PARAMS); } /****************** * Discover chassis ******************/ err = snmp_bc_snmp_get(custom_handle, SNMP_BC_PLATFORM_OID_RSA, &get_value, SAHPI_TRUE); if (err || get_value.type != ASN_INTEGER) { dbg("Cannot get OID=%s; Received Type=%d; Error=%s.", SNMP_BC_PLATFORM_OID_RSA, get_value.type, oh_lookup_error(err)); if (err) { return(err); } else { return(SA_ERR_HPI_INTERNAL_ERROR); } } e = snmp_bc_alloc_oh_event(); if (e == NULL) { dbg("Out of memory."); return(SA_ERR_HPI_OUT_OF_SPACE); } e->resource = snmp_bc_rpt_array_rsa[RSA_RPT_ENTRY_CHASSIS].rpt; e->resource.ResourceEntity = *ep_root; e->resource.ResourceId = oh_uid_from_entity_path(&(e->resource.ResourceEntity)); snmp_bc_create_resourcetag(&(e->resource.ResourceTag), snmp_bc_rpt_array_rsa[RSA_RPT_ENTRY_CHASSIS].comment, ep_root->Entry[0].EntityLocation); trace("Discovered resource=%s.", e->resource.ResourceTag.Data); /* Create platform-specific info space to add to infra-structure */ res_info_ptr = g_memdup(&(snmp_bc_rpt_array_rsa[RSA_RPT_ENTRY_CHASSIS].res_info), sizeof(struct ResourceInfo)); if (!res_info_ptr) { dbg("Out of memory."); g_free(e); return(SA_ERR_HPI_OUT_OF_SPACE); } res_info_ptr->cur_state = SAHPI_HS_STATE_ACTIVE; /* Get UUID and convert to GUID */ err = snmp_bc_get_guid(custom_handle, e, res_info_ptr); /* Add resource to temporary event cache/queue */ err = oh_add_resource(handle->rptcache, &(e->resource), res_info_ptr, 0); if (err) { dbg("Failed to add resource. Error=%s.", oh_lookup_error(err)); g_free(e); return(err); } /* Find resource's events, sensors, controls, etc. */ snmp_bc_discover_res_events(handle, &(e->resource.ResourceEntity), res_info_ptr); snmp_bc_discover_sensors(handle, snmp_bc_chassis_sensors_rsa, e); snmp_bc_discover_controls(handle, snmp_bc_chassis_controls_rsa, e); snmp_bc_discover_inventories(handle, snmp_bc_chassis_inventories_rsa, e); /* ---------------------------------------- */ /* Construct .event of struct oh_event */ /* ---------------------------------------- */ snmp_bc_set_resource_add_oh_event(e, res_info_ptr); e->hid = handle->hid; oh_evt_queue_push(handle->eventq, e); /*************** * Discover CPUs ***************/ for (i=0; i<RSA_MAX_CPU; i++) { e = snmp_bc_alloc_oh_event(); if (e == NULL) { dbg("Out of memory."); return(SA_ERR_HPI_OUT_OF_SPACE); } e->resource = snmp_bc_rpt_array_rsa[RSA_RPT_ENTRY_CPU].rpt; oh_concat_ep(&(e->resource.ResourceEntity), ep_root); oh_set_ep_location(&(e->resource.ResourceEntity), SAHPI_ENT_PROCESSOR, i + SNMP_BC_HPI_LOCATION_BASE); /* See if CPU exists */ if (!rdr_exists(custom_handle, &(e->resource.ResourceEntity), 0, SNMP_BC_CPU_OID_RSA, 0, 0 )) { snmp_bc_free_oh_event(e); continue; } e->resource.ResourceId = oh_uid_from_entity_path(&(e->resource.ResourceEntity)); snmp_bc_create_resourcetag(&(e->resource.ResourceTag), snmp_bc_rpt_array_rsa[RSA_RPT_ENTRY_CPU].comment, i + SNMP_BC_HPI_LOCATION_BASE); trace("Discovered resource=%s.", e->resource.ResourceTag.Data); /* Create platform-specific info space to add to infra-structure */ res_info_ptr = g_memdup(&(snmp_bc_rpt_array_rsa[RSA_RPT_ENTRY_CPU].res_info), sizeof(struct ResourceInfo)); if (!res_info_ptr) { dbg("Out of memory."); snmp_bc_free_oh_event(e); return(SA_ERR_HPI_OUT_OF_SPACE); } res_info_ptr->cur_state = SAHPI_HS_STATE_ACTIVE; /* Get UUID and convert to GUID */ err = snmp_bc_get_guid(custom_handle, e, res_info_ptr); /* Add resource to temporary event cache/queue */ err = oh_add_resource(handle->rptcache, &(e->resource), res_info_ptr, 0); if (err) { dbg("Failed to add resource. Error=%s.", oh_lookup_error(err)); snmp_bc_free_oh_event(e); return(err); } /* Find resource's events, sensors, controls, etc. */ snmp_bc_discover_res_events(handle, &(e->resource.ResourceEntity), res_info_ptr); snmp_bc_discover_sensors(handle, snmp_bc_cpu_sensors_rsa, e); snmp_bc_discover_controls(handle, snmp_bc_cpu_controls_rsa, e); snmp_bc_discover_inventories(handle, snmp_bc_cpu_inventories_rsa, e); /* ---------------------------------------- */ /* Construct .event of struct oh_event */ /* ---------------------------------------- */ snmp_bc_set_resource_add_oh_event(e, res_info_ptr); e->hid = handle->hid; oh_evt_queue_push(handle->eventq, e); } /**************** * Discover DASDs ****************/ for (i=0; i<RSA_MAX_DASD; i++) { e = snmp_bc_alloc_oh_event(); if (e == NULL) { dbg("Out of memory."); return(SA_ERR_HPI_OUT_OF_SPACE); } e->resource = snmp_bc_rpt_array_rsa[RSA_RPT_ENTRY_DASD].rpt; oh_concat_ep(&(e->resource.ResourceEntity), ep_root); oh_set_ep_location(&(e->resource.ResourceEntity), SAHPI_ENT_DISK_BAY, i + SNMP_BC_HPI_LOCATION_BASE); /* See if DASD exists */ if (!rdr_exists(custom_handle, &(e->resource.ResourceEntity), 0, SNMP_BC_DASD_OID_RSA, 0, 0 )) { snmp_bc_free_oh_event(e); continue; } e->resource.ResourceId = oh_uid_from_entity_path(&(e->resource.ResourceEntity)); snmp_bc_create_resourcetag(&(e->resource.ResourceTag), snmp_bc_rpt_array_rsa[RSA_RPT_ENTRY_DASD].comment, i + SNMP_BC_HPI_LOCATION_BASE); trace("Discovered resource=%s.", e->resource.ResourceTag.Data); /* Create platform-specific info space to add to infra-structure */ res_info_ptr = g_memdup(&(snmp_bc_rpt_array_rsa[RSA_RPT_ENTRY_DASD].res_info), sizeof(struct ResourceInfo)); if (!res_info_ptr) { dbg("Out of memory."); snmp_bc_free_oh_event(e); return(SA_ERR_HPI_OUT_OF_SPACE); } res_info_ptr->cur_state = SAHPI_HS_STATE_ACTIVE; /* Get UUID and convert to GUID */ err = snmp_bc_get_guid(custom_handle, e, res_info_ptr); /* Add resource to temporary event cache/queue */ err = oh_add_resource(handle->rptcache, &(e->resource), res_info_ptr, 0); if (err) { dbg("Failed to add resource. Error=%s.", oh_lookup_error(err)); snmp_bc_free_oh_event(e); return(err); } /* Find resource's events, sensors, controls, etc. */ snmp_bc_discover_res_events(handle, &(e->resource.ResourceEntity), res_info_ptr); snmp_bc_discover_sensors(handle, snmp_bc_dasd_sensors_rsa, e); snmp_bc_discover_controls(handle, snmp_bc_dasd_controls_rsa, e); snmp_bc_discover_inventories(handle, snmp_bc_dasd_inventories_rsa, e); /* ---------------------------------------- */ /* Construct .event of struct oh_event */ /* ---------------------------------------- */ snmp_bc_set_resource_add_oh_event(e, res_info_ptr); e->hid = handle->hid; oh_evt_queue_push(handle->eventq, e); } /*************** * Discover Fans ***************/ for (i=0; i<RSA_MAX_FAN; i++) { e = snmp_bc_alloc_oh_event(); if (e == NULL) { dbg("Out of memory."); return(SA_ERR_HPI_OUT_OF_SPACE); } e->resource = snmp_bc_rpt_array_rsa[RSA_RPT_ENTRY_FAN].rpt; oh_concat_ep(&(e->resource.ResourceEntity), ep_root); oh_set_ep_location(&(e->resource.ResourceEntity), SAHPI_ENT_FAN, i + SNMP_BC_HPI_LOCATION_BASE); /* See if fan exists */ if (!rdr_exists(custom_handle, &(e->resource.ResourceEntity), 0, SNMP_BC_FAN_OID_RSA, 0, 0 )) { snmp_bc_free_oh_event(e); continue; } e->resource.ResourceId = oh_uid_from_entity_path(&(e->resource.ResourceEntity)); snmp_bc_create_resourcetag(&(e->resource.ResourceTag), snmp_bc_rpt_array_rsa[RSA_RPT_ENTRY_FAN].comment, i + SNMP_BC_HPI_LOCATION_BASE); trace("Discovered resource=%s.", e->resource.ResourceTag.Data); /* Create platform-specific info space to add to infra-structure */ res_info_ptr = g_memdup(&(snmp_bc_rpt_array_rsa[RSA_RPT_ENTRY_FAN].res_info), sizeof(struct ResourceInfo)); if (!res_info_ptr) { dbg("Out of memory."); snmp_bc_free_oh_event(e); return(SA_ERR_HPI_OUT_OF_SPACE); } res_info_ptr->cur_state = SAHPI_HS_STATE_ACTIVE; /* Get UUID and convert to GUID */ err = snmp_bc_get_guid(custom_handle, e, res_info_ptr); /* Add resource to temporary event cache/queue */ err = oh_add_resource(handle->rptcache, &(e->resource), res_info_ptr, 0); if (err) { dbg("Failed to add resource. Error=%s.", oh_lookup_error(err)); snmp_bc_free_oh_event(e); return(err); } /* Find resource's events, sensors, controls, etc. */ snmp_bc_discover_res_events(handle, &(e->resource.ResourceEntity), res_info_ptr); snmp_bc_discover_sensors(handle, snmp_bc_fan_sensors_rsa, e); snmp_bc_discover_controls(handle, snmp_bc_fan_controls_rsa, e); snmp_bc_discover_inventories(handle, snmp_bc_fan_inventories_rsa, e); /* ---------------------------------------- */ /* Construct .event of struct oh_event */ /* ---------------------------------------- */ snmp_bc_set_resource_add_oh_event(e, res_info_ptr); e->hid = handle->hid; oh_evt_queue_push(handle->eventq, e); } return(SA_OK); }