static void draw_mode12 (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect) { int pattern,x,y,yy,xx,name,charcode; UINT8 fg,bg,*patternptr; const pen_t *pens; rectangle rt; pens = screen->machine().pens; fg = pens[tms.Regs[7] / 16]; bg = pens[tms.Regs[7] & 15]; /* colours at sides must be reset */ rt.min_y = 0; rt.max_y = 191; rt.min_x = 0; rt.max_x = 7; bitmap_fill (bitmap, &rt, bg); rt.min_y = 0; rt.max_y = 191; rt.min_x = 248; rt.max_x = 255; bitmap_fill (bitmap, &rt, bg); name = 0; for (y=0;y<24;y++) { for (x=0;x<40;x++) { charcode = (tms.vMem[tms.nametbl+name]+(y/8)*256)&tms.patternmask; name++; patternptr = tms.vMem + tms.pattern + (charcode*8); for (yy=0;yy<8;yy++) { pattern = *patternptr++; for (xx=0;xx<6;xx++) { *BITMAP_ADDR16(bitmap, y*8+yy, 8+x*6+xx) = (pattern & 0x80) ? fg : bg; pattern *= 2; } } } } }
static void __init test_fill_set(void) { DECLARE_BITMAP(bmap, 1024); /* Known way to clear all bits */ memset(bmap, 0x00, 128); expect_eq_pbl("", bmap, 23); expect_eq_pbl("", bmap, 1024); /* single-word bitmaps */ bitmap_set(bmap, 0, 9); expect_eq_pbl("0-8", bmap, 1024); bitmap_fill(bmap, 35); expect_eq_pbl("0-63", bmap, 1024); /* cross boundaries operations */ bitmap_set(bmap, 79, 19); expect_eq_pbl("0-63,79-97", bmap, 1024); bitmap_fill(bmap, 115); expect_eq_pbl("0-127", bmap, 1024); /* Zeroing entire area */ bitmap_fill(bmap, 1024); expect_eq_pbl("0-1023", bmap, 1024); }
int CHD44352::video_update(bitmap_t &bitmap, const rectangle &cliprect) { UINT8 cw = info.m_char_width; bitmap_fill(&bitmap, &cliprect, 0); if (info.m_control_lines&0x80 && info.m_lcd_on) { for (int a=0; a<2; a++) for (int py=0; py<4; py++) for (int px=0; px<16; px++) if (BIT(info.m_cursor_status, 4) && px == info.m_cursor_x && py == info.m_cursor_y && a == info.m_cursor_lcd) { //draw the cursor for (int c=0; c<cw; c++) { UINT8 d = compute_newval((info.m_cursor_status>>5) & 0x07, info.m_video_ram[a][py*16*cw + px*cw + c + info.m_scroll * 48], info.m_cursor[c]); for (int b=0; b<8; b++) { *BITMAP_ADDR16(&bitmap, py*8 + b, a*cw*16 + px*cw + c) = BIT(d, 7-b); } } } else { for (int c=0; c<cw; c++) { UINT8 d = info.m_video_ram[a][py*16*cw + px*cw + c + info.m_scroll * 48]; for (int b=0; b<8; b++) { *BITMAP_ADDR16(&bitmap, py*8 + b, a*cw*16 + px*cw + c) = BIT(d, 7-b); } } } }
/* VIDEO GOODS */ static SCREEN_UPDATE( lgp ) { lgp_state *state = screen->machine().driver_data<lgp_state>(); int charx, chary; /* make color 0 transparent */ palette_set_color(screen->machine(), 0, MAKE_ARGB(0,0,0,0)); /* clear */ bitmap_fill(bitmap, cliprect, 0); /* Draw tiles */ for (charx = 0; charx < 32; charx++) { for (chary = 0; chary < 32; chary++) { int current_screen_character = (chary*32) + charx; /* Somewhere there's a flag that offsets the tilemap by 0x100*x */ /* Palette is likely set somewhere as well (tile_control_ram?) */ drawgfx_transpen(bitmap, cliprect, screen->machine().gfx[0], state->m_tile_ram[current_screen_character], 0, 0, 0, charx*8, chary*8, 0); } } return 0; }
static SCREEN_UPDATE(galaxi) { galaxi_state *state = screen->machine().driver_data<galaxi_state>(); int layers_ctrl = -1; #ifdef MAME_DEBUG if (screen->machine().input().code_pressed(KEYCODE_R)) // remapped due to inputs changes. { int msk = 0; if (screen->machine().input().code_pressed(KEYCODE_T)) msk |= 1; if (screen->machine().input().code_pressed(KEYCODE_Y)) msk |= 2; if (screen->machine().input().code_pressed(KEYCODE_U)) msk |= 4; if (screen->machine().input().code_pressed(KEYCODE_I)) msk |= 8; if (screen->machine().input().code_pressed(KEYCODE_O)) msk |= 16; if (msk != 0) layers_ctrl &= msk; } #endif if (layers_ctrl & 1) tilemap_draw(bitmap, cliprect, state->m_bg1_tmap, TILEMAP_DRAW_OPAQUE, 0); else bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine())); if (layers_ctrl & 2) tilemap_draw(bitmap, cliprect, state->m_bg2_tmap, 0, 0); if (layers_ctrl & 4) tilemap_draw(bitmap, cliprect, state->m_bg3_tmap, 0, 0); if (layers_ctrl & 8) tilemap_draw(bitmap, cliprect, state->m_bg4_tmap, 0, 0); if (layers_ctrl & 16) tilemap_draw(bitmap, cliprect, state->m_fg_tmap, 0, 0); return 0; }
static SCREEN_UPDATE( dunhuang ) { dunhuang_state *state = screen->machine().driver_data<dunhuang_state>(); int layers_ctrl = -1; #if DUNHUANG_DEBUG if (input_code_pressed(screen->machine(), KEYCODE_Z)) { int msk = 0; if (input_code_pressed(screen->machine(), KEYCODE_Q)) msk |= 1; if (input_code_pressed(screen->machine(), KEYCODE_W)) msk |= 2; if (msk != 0) layers_ctrl &= msk; } #endif bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine())); switch (state->m_layers) { case 0x04: // girl select: bg over fg if (layers_ctrl & 2) tilemap_draw(bitmap,cliprect, state->m_tmap2, TILEMAP_DRAW_OPAQUE, 0); if (layers_ctrl & 1) tilemap_draw(bitmap,cliprect, state->m_tmap, 0, 0); break; case 0x05: // dips: must hide fg if (layers_ctrl & 1) tilemap_draw(bitmap,cliprect, state->m_tmap, TILEMAP_DRAW_OPAQUE, 0); break; case 0x07: // game,demo: fg over bg default: if (layers_ctrl & 1) tilemap_draw(bitmap,cliprect, state->m_tmap, TILEMAP_DRAW_OPAQUE, 0); if (layers_ctrl & 2) tilemap_draw(bitmap,cliprect, state->m_tmap2, 0, 0); break; } return 0; }
static SCREEN_UPDATE( m20 ) { m20_state *state = screen->machine().driver_data<m20_state>(); int x,y,i; UINT8 pen; UINT32 count; bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine())); count = (0); for(y=0;y<256;y++) { for(x=0;x<256;x+=16) { for (i = 0; i < 16; i++) { pen = (state->m_vram[count]) >> (15 - i) & 1; if ((x + i) <= screen->visible_area().max_x && (y + 0) < screen->visible_area().max_y) *BITMAP_ADDR32(bitmap, y, x + i) = screen->machine().pens[pen]; } count++; } } return 0; }
static struct mlx4_db_pgdir *mlx4_alloc_db_pgdir(struct device *dma_device, int numa_node) { struct mlx4_db_pgdir *pgdir; pgdir = kzalloc_node(sizeof *pgdir, GFP_KERNEL, numa_node); if (!pgdir) pgdir = kzalloc(sizeof *pgdir, GFP_KERNEL); if (!pgdir) return NULL; bitmap_fill(pgdir->order1, MLX4_DB_PER_PAGE / 2); pgdir->bits[0] = pgdir->order0; pgdir->bits[1] = pgdir->order1; pgdir->db_page = dma_alloc_coherent(dma_device, PAGE_SIZE, &pgdir->db_dma, GFP_KERNEL); if (!pgdir->db_page) { kfree(pgdir); return NULL; } return pgdir; }
static int __devinit request_irqs(struct platform_device *pdev) { struct resource *res; int ret; ret = 0; bitmap_fill(pm8058_chg.enabled_irqs, PMIC_CHG_MAX_INTS); res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "CHGVAL"); if (res == NULL) { dev_err(pm8058_chg.dev, "%s:couldnt find resource CHGVAL\n", __func__); goto err_out; } else { ret = request_any_context_irq(res->start, pm8058_chg_chgval_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, res->name, NULL); if (ret < 0) { dev_err(pm8058_chg.dev, "%s:couldnt request %d %d\n", __func__, res->start, ret); goto err_out; } else { pm8058_chg.pmic_chg_irq[CHGVAL_IRQ] = res->start; } } return 0; err_out: free_irqs(); return -EINVAL; }
int smu_feature_init_dpm(struct smu_context *smu) { struct smu_feature *feature = &smu->smu_feature; int ret = 0; uint32_t unallowed_feature_mask[SMU_FEATURE_MAX/32]; if (!smu->pm_enabled) return ret; mutex_lock(&feature->mutex); bitmap_fill(feature->allowed, SMU_FEATURE_MAX); mutex_unlock(&feature->mutex); ret = smu_get_unallowed_feature_mask(smu, unallowed_feature_mask, SMU_FEATURE_MAX/32); if (ret) return ret; mutex_lock(&feature->mutex); bitmap_andnot(feature->allowed, feature->allowed, (unsigned long *)unallowed_feature_mask, feature->feature_num); mutex_unlock(&feature->mutex); return ret; }
int idr_pre_get(struct idr *idr, gfp_t gfp_mask) { struct idr_layer *il, *iln; struct idr_layer *head; int need; mtx_lock(&idr->lock); for (;;) { need = idr->layers + 1; for (il = idr->free; il != NULL; il = il->ary[0]) need--; mtx_unlock(&idr->lock); if (need <= 0) break; for (head = NULL; need; need--) { iln = malloc(sizeof(*il), M_IDR, M_ZERO | gfp_mask); if (iln == NULL) break; bitmap_fill(&iln->bitmap, IDR_SIZE); if (head != NULL) { il->ary[0] = iln; il = iln; } else head = il = iln; } if (head == NULL) return (0); mtx_lock(&idr->lock); il->ary[0] = idr->free; idr->free = head; } return (1); }
static SCREEN_UPDATE(hotblock) { hotblock_state *state = screen->machine().driver_data<hotblock_state>(); int y, x, count; int i; static const int xxx = 320, yyy = 204; bitmap_fill(bitmap, 0, get_black_pen(screen->machine())); for (i = 0; i < 256; i++) { int dat = (state->m_pal[i * 2 + 1] << 8) | state->m_pal[i * 2]; palette_set_color_rgb(screen->machine(), i, pal5bit(dat >> 0), pal5bit(dat >> 5), pal5bit(dat >> 10)); } count = 0; for (y = 0; y < yyy; y++) { for(x = 0; x < xxx; x++) { if (state->m_port0 & 0x40) *BITMAP_ADDR16(bitmap, y, x) = state->m_vram[count]; count++; } } return 0; }
static VIDEO_UPDATE(calchase) { int x,y,count,i; bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); count = (0); for(y=0;y<256;y++) { for(x=0;x<320;x+=32) { for (i=0;i<32;i++) { UINT32 color; color = (vga_vram[count])>>(32-i) & 0x1; if((x+i)<video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y) *BITMAP_ADDR32(bitmap, y, x+(32-i)) = screen->machine->pens[color]; } count++; } } return 0; }
static void draw_bombs( running_machine &machine, bitmap_t *bitmap, const rectangle* cliprect ) { canyon_state *state = machine.driver_data<canyon_state>(); int i; for (i = 0; i < 2; i++) { int sx = 254 - state->m_videoram[0x3d0 + 2 * i + 0x5]; int sy = 246 - state->m_videoram[0x3d0 + 2 * i + 0xc]; rectangle rect; rect.min_x = sx; rect.min_y = sy; rect.max_x = sx + 1; rect.max_y = sy + 1; if (rect.min_x < cliprect->min_x) rect.min_x = cliprect->min_x; if (rect.min_y < cliprect->min_y) rect.min_y = cliprect->min_y; if (rect.max_x > cliprect->max_x) rect.max_x = cliprect->max_x; if (rect.max_y > cliprect->max_y) rect.max_y = cliprect->max_y; bitmap_fill(bitmap, &rect, 1 + 2 * i); } }
void zx8301_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect) { if (!m_dispoff) { UINT32 da = m_base << 15; for (int y = 0; y < 256; y++) { if (m_mode8) { draw_line_mode8(bitmap, y, da); } else { draw_line_mode4(bitmap, y, da); } da += 128; } } else { bitmap_fill(bitmap, cliprect, get_black_pen(m_machine)); } }
static SCREEN_UPDATE(murogem) { murogem_state *state = screen->machine().driver_data<murogem_state>(); int xx,yy,count; count = 0x000; bitmap_fill(bitmap, cliprect, 0); for (yy=0;yy<32;yy++) { for(xx=0;xx<32;xx++) { int tileno = state->m_videoram[count]&0x3f; int attr = state->m_videoram[count+0x400]&0x0f; drawgfx_transpen(bitmap,cliprect,screen->machine().gfx[0],tileno,attr,0,0,xx*8,yy*8,0); count++; } } return 0; }
static int collision_check_s1s2(running_machine &machine) { starcrus_state *state = machine.driver_data<starcrus_state>(); int org_x, org_y; int sx, sy; rectangle clip; clip.min_x=0; clip.max_x=15; clip.min_y=0; clip.max_y=15; bitmap_fill(state->m_ship1_vid, &clip, 0); bitmap_fill(state->m_ship2_vid, &clip, 0); /* origin is with respect to ship1 */ org_x = state->m_s1_x; org_y = state->m_s1_y; /* Draw ship 1 */ drawgfx_opaque(state->m_ship1_vid, &clip, machine.gfx[8+((state->m_s1_sprite&0x04)>>2)], (state->m_s1_sprite&0x03)^0x03, 0, (state->m_s1_sprite&0x08)>>3, (state->m_s1_sprite&0x10)>>4, state->m_s1_x-org_x, state->m_s1_y-org_y); /* Draw ship 2 */ drawgfx_opaque(state->m_ship2_vid, &clip, machine.gfx[10+((state->m_s2_sprite&0x04)>>2)], (state->m_s2_sprite&0x03)^0x03, 0, (state->m_s2_sprite&0x08)>>3, (state->m_s2_sprite&0x10)>>4, state->m_s2_x-org_x, state->m_s2_y-org_y); /* Now check for collisions */ for (sy=0;sy<16;sy++) for (sx=0;sx<16;sx++) /* Condition 1 - ship 1 = ship 2 */ if ((*BITMAP_ADDR16(state->m_ship1_vid, sy, sx) == 1) && (*BITMAP_ADDR16(state->m_ship2_vid, sy, sx) == 1)) return 1; return 0; }
static WRITE16_HANDLER( fifo_clear_w ) { sliver_state *state = space->machine().driver_data<sliver_state>(); bitmap_fill(state->m_bitmap_fg, 0,0); state->m_fptr=0; state->m_tmp_counter=0; }
static VIDEO_UPDATE( trvmadns ) { bitmap_fill(bitmap,cliprect,0xd); tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); return 0; }
static VIDEO_UPDATE(jchan) { int x,y; UINT16* src1; UINT16* src2; UINT16* dst; UINT16 pixdata1; UINT16 pixdata2; bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine)); VIDEO_UPDATE_CALL(jchan_view2); bitmap_fill(sprite_bitmap_1, cliprect, 0x0000); bitmap_fill(sprite_bitmap_2, cliprect, 0x0000); skns_draw_sprites(screen->machine, sprite_bitmap_1, cliprect, jchan_sprite_ram32_1, 0x4000, memory_region(screen->machine,"gfx1"), memory_region_length (screen->machine, "gfx1"), jchan_sprite_regs32_1 ); skns_draw_sprites(screen->machine, sprite_bitmap_2, cliprect, jchan_sprite_ram32_2, 0x4000, memory_region(screen->machine,"gfx2"), memory_region_length (screen->machine, "gfx2"), jchan_sprite_regs32_2 ); // ignoring priority bits for now - might use alpha too, check 0x8000 of palette writes for (y=0;y<240;y++) { src1 = BITMAP_ADDR16(sprite_bitmap_1, y, 0); src2 = BITMAP_ADDR16(sprite_bitmap_2, y, 0); dst = BITMAP_ADDR16(bitmap, y, 0); for (x=0;x<320;x++) { pixdata1 = src1[x]; pixdata2 = src2[x]; if (pixdata2 & 0x3fff) { dst[x] = (pixdata2 & 0x3fff)|0x4000; } if (pixdata1 & 0x3fff) { dst[x] = (pixdata1 & 0x3fff)|0x4000; } } } return 0; }
static VIDEO_UPDATE( astron ) { bitmap_fill(bitmap, cliprect, 0); astron_draw_characters(screen->machine, bitmap, cliprect); astron_draw_sprites(bitmap, cliprect); return 0; }
static SCREEN_UPDATE( tonton ) { tonton_state *state = screen->machine().driver_data<tonton_state>(); bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine())); copybitmap(bitmap, state->m_vdp0_bitmap, 0, 0, 0, 0, cliprect); return 0; }
/** * phylink_create() - create a phylink instance * @ndev: a pointer to the &struct net_device * @fwnode: a pointer to a &struct fwnode_handle describing the network * interface * @iface: the desired link mode defined by &typedef phy_interface_t * @ops: a pointer to a &struct phylink_mac_ops for the MAC. * * Create a new phylink instance, and parse the link parameters found in @np. * This will parse in-band modes, fixed-link or SFP configuration. * * Returns a pointer to a &struct phylink, or an error-pointer value. Users * must use IS_ERR() to check for errors from this function. */ struct phylink *phylink_create(struct net_device *ndev, struct fwnode_handle *fwnode, phy_interface_t iface, const struct phylink_mac_ops *ops) { struct phylink *pl; int ret; pl = kzalloc(sizeof(*pl), GFP_KERNEL); if (!pl) return ERR_PTR(-ENOMEM); mutex_init(&pl->state_mutex); INIT_WORK(&pl->resolve, phylink_resolve); pl->netdev = ndev; pl->phy_state.interface = iface; pl->link_interface = iface; if (iface == PHY_INTERFACE_MODE_MOCA) pl->link_port = PORT_BNC; else pl->link_port = PORT_MII; pl->link_config.interface = iface; pl->link_config.pause = MLO_PAUSE_AN; pl->link_config.speed = SPEED_UNKNOWN; pl->link_config.duplex = DUPLEX_UNKNOWN; pl->link_config.an_enabled = true; pl->ops = ops; __set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state); timer_setup(&pl->link_poll, phylink_fixed_poll, 0); bitmap_fill(pl->supported, __ETHTOOL_LINK_MODE_MASK_NBITS); linkmode_copy(pl->link_config.advertising, pl->supported); phylink_validate(pl, pl->supported, &pl->link_config); ret = phylink_parse_mode(pl, fwnode); if (ret < 0) { kfree(pl); return ERR_PTR(ret); } if (pl->link_an_mode == MLO_AN_FIXED) { ret = phylink_parse_fixedlink(pl, fwnode); if (ret < 0) { kfree(pl); return ERR_PTR(ret); } } ret = phylink_register_sfp(pl, fwnode); if (ret < 0) { kfree(pl); return ERR_PTR(ret); } return pl; }
static SCREEN_UPDATE( galaxygame ) { galaxygame_state *state = screen->machine().driver_data<galaxygame_state>(); bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine())); for (int i = 0; i < state->m_point_display_list_index; i++ ) { *BITMAP_ADDR16(bitmap, state->m_point_display_list[i].x >> 7, state->m_point_display_list[i].y >> 7) = 1; } return 0; }
static VIDEO_UPDATE(cabaret) { bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine)); tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0); return 0; }
static SCREEN_UPDATE( madalien ) { madalien_state *state = screen->machine->driver_data<madalien_state>(); int flip = BIT(input_port_read(screen->machine, "DSW"), 6) && BIT(*state->video_control, 0); // bits #0 and #1 define scrolling mode // // mode 0 - cycle over map section A // mode 1 - cycle over map section B // // mode 2 - transition from B to A // mode 3 - transition from A to B int scroll_mode = *state->scroll & 3; bitmap_fill(bitmap, cliprect, 0); draw_edges(screen->machine, bitmap, cliprect, flip, scroll_mode); draw_foreground(screen->machine, bitmap, cliprect, flip); /* highlight section A (outside of tunnels). * also, bit 1 of the state->video_flags register (6A) is * combined with the headlight signal through NOR gate 1A, * which is used to light up the tunnel when an alien explodes */ if (scroll_mode != 1 || *state->video_flags & 2) { int x; int y; int min_x = 0; int max_x = 0xff; if (!(*state->video_flags & 2)) { if (scroll_mode == 2) min_x = (*state->scroll & 0xfc); else if (scroll_mode == 3) max_x = (*state->scroll & 0xfc) - 1; } if (flip) { int max_x_save = max_x; max_x = 0xff - min_x; min_x = 0xff - max_x_save; } for (y = cliprect->min_y; y <= cliprect->max_y ; y++) for (x = min_x; x <= max_x; x++) if ((x >= cliprect->min_x) && (x <= cliprect->max_x)) *BITMAP_ADDR16(bitmap, y, x) |= 8; } draw_headlight(screen->machine, bitmap, cliprect, flip); return 0; }
static SCREEN_UPDATE( apricot ) { apricot_state *state = screen->machine().driver_data<apricot_state>(); if (!state->m_display_on) state->m_mc6845->update( bitmap, cliprect); else bitmap_fill(bitmap, cliprect, 0); return 0; }
static SCREEN_UPDATE(cabaret) { cabaret_state *state = screen->machine().driver_data<cabaret_state>(); bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine())); tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, 0, 0); tilemap_draw(bitmap, cliprect, state->m_fg_tilemap, 0, 0); return 0; }
static VIDEO_UPDATE( panicr) { bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine)); tilemap_mark_all_tiles_dirty( txttilemap ); tilemap_set_scrollx( bgtilemap,0, ((scrollram[0x02]&0x0f)<<12)+((scrollram[0x02]&0xf0)<<4)+((scrollram[0x04]&0x7f)<<1)+((scrollram[0x04]&0x80)>>7) ); tilemap_draw(bitmap,cliprect,bgtilemap,0,0); draw_sprites(screen->machine,bitmap,cliprect); tilemap_draw(bitmap,cliprect,txttilemap,0,0); return 0; }
void pandora_eof( device_t *device ) { kaneko_pandora_state *pandora = get_safe_token(device); assert(pandora->spriteram != NULL); // the games can disable the clearing of the sprite bitmap, to leave sprite trails if (pandora->clear_bitmap) bitmap_fill(pandora->sprites_bitmap, &pandora->screen->visible_area(), pandora->bg_pen); pandora_draw(device, pandora->sprites_bitmap, &pandora->screen->visible_area()); }