void fbcon_vga_planes_putc(struct vc_data *conp, struct display *p, int c, int yy, int xx) { int fg = attr_fgcol(p,c); int bg = attr_bgcol(p,c); int y; u8 *cdat = p->fontdata + (c & p->charmask) * fontheight(p); char *where = p->screen_base + xx + yy * p->line_length * fontheight(p); setmode(2); setop(0); setsr(0xf); setcolor(fg); selectmask(); setmask(0xff); writeb(bg, where); rmb(); readb(where); /* fill latches */ setmode(3); wmb(); for (y = 0; y < fontheight(p); y++, where += p->line_length) writeb(cdat[y], where); wmb(); }
void fbcon_vga_planes_clear(struct vc_data *conp, struct display *p, int sy, int sx, int height, int width) { int line_ofs = p->line_length - width; char *where; int x; setmode(0); setop(0); setsr(0xf); setcolor(attr_bgcol_ec(p, conp)); selectmask(); setmask(0xff); sy *= fontheight(p); height *= fontheight(p); where = p->screen_base + sx + sy * p->line_length; while (height--) { for (x = 0; x < width; x++) { writeb(0, where); where++; } where += line_ofs; } }
void fbcon_ega_planes_putc(struct vc_data *conp, struct display *p, int c, int yy, int xx) { int fg = attr_fgcol(p,c); int bg = attr_bgcol(p,c); int y; u8 *cdat = p->fontdata + (c & p->charmask) * fontheight(p); char *where = p->screen_base + xx + yy * p->line_length * fontheight(p); setmode(0); setop(0); setsr(0xf); setcolor(bg); selectmask(); setmask(0xff); for (y = 0; y < fontheight(p); y++, where += p->line_length) rmw(where); where -= p->line_length * y; setcolor(fg); selectmask(); for (y = 0; y < fontheight(p); y++, where += p->line_length) if (cdat[y]) { setmask(cdat[y]); rmw(where); } }
int main() { int fd=0; void *pr; volatile unsigned int * p; p=initgpio(&fd,pr); setop(p,4); cleangpio(fd,(void*)p); return 0; }
void vga16_set_pixel(int x, int y, unsigned long c) { volatile char *where; setmode(0); setop(0); setcolor(c); selectmask(); setmask(0x80 >> (x % 8)); where = fb_mem + y * 80 + x/8; rmw(where); }
void fbcon_vga_planes_revc(struct display *p, int xx, int yy) { char *where = p->screen_base + xx + yy * p->line_length * fontheight(p); int y; setmode(0); setop(0x18); setsr(0xf); setcolor(0xf); selectmask(); setmask(0xff); for (y = 0; y < fontheight(p); y++) { rmw(where); where += p->line_length; } }
void fbcon_vga_planes_bmove(struct display *p, int sy, int sx, int dy, int dx, int height, int width) { char *src; char *dest; int line_ofs; int x; setmode(1); setop(0); setsr(0xf); sy *= fontheight(p); dy *= fontheight(p); height *= fontheight(p); if (dy < sy || (dy == sy && dx < sx)) { line_ofs = p->line_length - width; dest = p->screen_base + dx + dy * p->line_length; src = p->screen_base + sx + sy * p->line_length; while (height--) { for (x = 0; x < width; x++) { readb(src); writeb(0, dest); dest++; src++; } src += line_ofs; dest += line_ofs; } } else { line_ofs = p->line_length - width; dest = p->screen_base + dx + width + (dy + height - 1) * p->line_length; src = p->screen_base + sx + width + (sy + height - 1) * p->line_length; while (height--) { for (x = 0; x < width; x++) { dest--; src--; readb(src); writeb(0, dest); } src -= line_ofs; dest -= line_ofs; } } }
void vga16_putc(unsigned char *cdat, int yy, int xx, int fg, int bg) { int y; char *where = fb_mem + xx/8 + yy * fb_line_length; setmode(2); setop(0); setsr(0xf); setcolor(fg); selectmask(); setmask(0xff); *where = bg; rmb(); *(volatile char*)where; /* fill latches */ setmode(3); wmb(); *(volatile char*)where; /* fill latches */ setmode(3); wmb(); for (y = 0; y < 16; y++, where += fb_line_length) *where = cdat[y]; wmb(); }
/* 6.96 in my test */ void fbcon_vga_planes_putcs(struct vc_data *conp, struct display *p, const unsigned short *s, int count, int yy, int xx) { int fg = attr_fgcol(p,*s); int bg = attr_bgcol(p,*s); char *where; int n; setmode(2); setop(0); setsr(0xf); setcolor(fg); selectmask(); setmask(0xff); where = p->screen_base + xx + yy * p->line_length * fontheight(p); writeb(bg, where); rmb(); readb(where); /* fill latches */ setmode(3); wmb(); for (n = 0; n < count; n++) { int y; int c = *s++ & p->charmask; u8 *cdat = p->fontdata + (c & p->charmask) * fontheight(p); for (y = 0; y < fontheight(p); y++, cdat++) { writeb (*cdat, where); where += p->line_length; } where += 1 - p->line_length * fontheight(p); } wmb(); }
/* 28.50 in my test */ void fbcon_ega_planes_putcs(struct vc_data *conp, struct display *p, const unsigned short *s, int count, int yy, int xx) { int fg = attr_fgcol(p,scr_readw(s)); int bg = attr_bgcol(p,scr_readw(s)); char *where; int n; setmode(2); setop(0); selectmask(); setmask(0xff); where = p->screen_base + xx + yy * p->line_length * fontheight(p); writeb(bg, where); rmb(); readb(where); /* fill latches */ wmb(); selectmask(); for (n = 0; n < count; n++) { int c = scr_readw(s++) & p->charmask; u8 *cdat = p->fontdata + c * fontheight(p); u8 *end = cdat + fontheight(p); while (cdat < end) { outb(*cdat++, GRAPHICS_DATA_REG); wmb(); writeb(fg, where); where += p->line_length; } where += 1 - p->line_length * fontheight(p); } wmb(); }
void get_option( char *param ) { int len; switch( param[ 1 ] ) { case 'i' : // dump preprocessed file if ( setop( param, &_dump_cpp ) ) return; break; case 'e' : // dump errors to file if ( setop( param, &_dump_err ) ) return; else strupr( strncpy( name_exe, param + 2, _MAX_PATH ) ); break; case 'l' : // dump listing file if ( setop( param, &_dump_lst ) ) return; break; case 'A' : // disable extensions if ( setop( param, &_ansi ) ) return; break; case 'm' : // gen map file if ( setop( param, &_map_file ) ) return; break; case 'n' : // no default lib if ( setop( param, &_nodef_lib ) ) return; break; case 'v' : // debug info if ( setop( param, &_debug ) ) return; break; case 'K' : // keep response files if ( setop( param, &_keep_rsp ) ) return; break; case 'k' : // keep generate files if ( setop( param, &_keep_gen ) ) return; break; case 'B' : // building all if ( setop( param, &_build_all ) ) return; break; case 'M' : // run make, else ONLY generate MAKEFILE. if ( setop( param, &_make_run ) ) return; break; case 'a' : if ( param[2] == '\0' ) { _compile = TRUE; _assemble = _link = FALSE; return; } break; case 'c' : if ( param[2] == '\0' ) { _compile = _assemble = TRUE; _link = FALSE; return; } break; case '?' : case 'h' : case 'H' : help(); /* Not return ! */ case 'D' : // define ParamAdd( &l_def, param + 2 ); return; case 'I' : // include path ParamAdd( &l_inc, param + 2 ); return; case 'L' : // lib path strupr( strncpy( path_lib, param + 2, _MAX_PATH ) ); len = strlen( path_lib ); if ( len > 0 && path_lib[ len - 1 ] == '\\' ) path_lib[ len - 1 ] = '\0'; return; case 'o' : // output obj path strupr( strncpy( path_obj, param + 2, _MAX_PATH ) ); len = strlen( path_obj ); if ( len > 0 && path_obj[ len - 1 ] == '\\' ) path_obj[ len - 1 ] = '\0'; return; case 'w' : case 'C' : case 'E' : case 'O' : ParamAdd( &l_cc386, param ); return; case 'T' : if ( param[3] == '\0' ) if ( param[2] == 'p' || param[2] == 'l' || \ param[2] == 'w' || param[2] == 'd' ) { _output = param[2]; return; } break; } fprintf( stderr, "Warning! Parameter error : %s\n", param ); }
int misc_init_r(void) { char *cmdline, *p1; int i, ddr_size = 0, cpu; u32 base, size; u32 max_preferred_freq = 0, max_freq = 0, maxfreqflg = 0; #ifdef CONFIG_RAMDUMP char *s; int ramdump; #endif if (pxa_is_warm_reset()) setenv("bootdelay", "-1"); #if defined(CONFIG_MMP_DISP) if (!fastboot) show_logo(); #endif cmdline = malloc(COMMAND_LINE_SIZE); strncpy(cmdline, getenv("bootargs"), COMMAND_LINE_SIZE); remove_cmdline_param(cmdline, "ddr_mode="); sprintf(cmdline + strlen(cmdline), " ddr_mode=%d", ddr_mode); /* set the cma range, we can change it according to * system configuration */ remove_cmdline_param(cmdline, "cma="); remove_cmdline_param(cmdline, "cgourp_disable="); remove_cmdline_param(cmdline, "androidboot.low_ram="); for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { if (gd->bd->bi_dram[i].size == 0) break; ddr_size += gd->bd->bi_dram[i].size; } /* ION reserved here for uboot running for EMMD protection */ if (ddr_size > SZ_512M + SZ_256M) { sprintf(cmdline + strlen(cmdline), " cma=112M"); /* * cgroup will only enabled for low_ram case, * for high ram case disable cgroup function */ sprintf(cmdline + strlen(cmdline), " cgroup_disable=memory"); } else sprintf(cmdline + strlen(cmdline), " cma=64M androidboot.low_ram=true"); remove_cmdline_param(cmdline, "ioncarv="); base = CONFIG_SYS_TEXT_BASE; size = SZ_16M; if (((base + size) > ddr_size)) printf("ERROR: wrong ION setting!!"); sprintf(cmdline + strlen(cmdline), " ioncarv=%dM@0x%08x", size >> 20, base); #ifdef CONFIG_RAMDUMP rd_mems[0].start = CONFIG_TZ_HYPERVISOR_SIZE; rd_mems[0].end = base; rd_mems[1].start = base + size; rd_mems[1].end = ddr_size; #endif /* if there's new maxfreq request, add it to bootargs */ max_preferred_freq = get_sku_max_freq(); if (max_preferred_freq) { if (max_preferred_freq <= 1183) max_preferred_freq = 1183; else max_preferred_freq = 1248; remove_cmdline_param(cmdline, "max_freq="); sprintf(cmdline + strlen(cmdline), " max_freq=%u", max_preferred_freq); max_freq = max_preferred_freq; maxfreqflg = 1; } else { /* check whether there is sku setting for max_freq previously */ p1 = strstr(cmdline, "max_freq="); if (p1) { p1 = strchr(p1, '='); if (p1) { p1++; max_freq = simple_strtoul(p1, NULL, 10); } if (max_freq) maxfreqflg = 1; } } setenv("bootargs", cmdline); /* if there's new maxfreq request, save env to later boots */ if (max_preferred_freq) saveenv(); free(cmdline); p_recovery_reg_funcs = &helandkb_recovery_reg_funcs; /* set op according to setting by selected, unless by default */ if (maxfreqflg) { set_plat_max_corefreq(max_freq); printf("max_freq is selected as %u\n", max_freq); } pxa988_fc_init(ddr_mode); if (pwr_chg_enable) setop(1); else setop(3); #if defined(CONFIG_MMP_DISP) calculate_dsi_clk(&mmp_mipi_info_saved); #endif for (cpu = 0; cpu < CONFIG_NR_CPUS; cpu++) set_idle_count(cpu, 0); helandkb_touch_detect(); /* * bus 2 is used by pmic, set here for debug with * "i2c probe", this should be the called just before exit, * in case the default bus number is changed */ i2c_set_bus_num(2); /* for fastboot */ setenv("fbenv", "mmc2"); #ifdef CONFIG_RAMDUMP if (fastboot) { s = getenv("ramdump"); if (!s) { setenv("ramdump", "0"); s = getenv("ramdump"); } ramdump = (int)simple_strtol(s, NULL, 10); if (!ramdump && (0x1 != emmd_page->dump_style)) { #ifdef CONFIG_RAMDUMP_TFFS show_ramdump_logo(RAMDUMP_SD_DUMP); if (run_command("ramdump 0 0 0 2", 0)) { printf("SD dump fail, enter fastboot mode\n"); show_ramdump_logo(RAMDUMP_USB_DUMP); run_command("fb", 0); } else { run_command("reset", 0); } #endif } else { printf("ready to enter fastboot mode\n"); show_ramdump_logo(RAMDUMP_USB_DUMP); run_command("fb", 0); } } #endif return 0; }
typename util::detail::algorithm_result<ExPolicy, OutIter>::type set_operation(ExPolicy policy, RanIter1 first1, RanIter1 last1, RanIter2 first2, RanIter2 last2, OutIter dest, F && f, Combiner && combiner, SetOp && setop) { typedef typename std::iterator_traits<RanIter1>::difference_type difference_type1; typedef typename std::iterator_traits<RanIter2>::difference_type difference_type2; // allocate intermediate buffers difference_type1 len1 = std::distance(first1, last1); difference_type2 len2 = std::distance(first2, last2); typedef typename set_operations_buffer<OutIter>::type buffer_type; boost::shared_array<buffer_type> buffer( new buffer_type[combiner(len1, len2)]); typedef typename ExPolicy::executor_type executor_type; std::size_t cores = executor_information_traits<executor_type>:: processing_units_count(policy.executor(), policy.parameters()); std::size_t step = (len1 + cores - 1) / cores; boost::shared_array<set_chunk_data> chunks(new set_chunk_data[cores]); // fill the buffer piecewise return parallel::util::partitioner<ExPolicy, OutIter, void>::call( policy, chunks.get(), cores, // first step, is applied to all partitions [=](set_chunk_data* curr_chunk, std::size_t part_size) { HPX_ASSERT(part_size == 1); // find start in sequence 1 std::size_t start1 = (curr_chunk - chunks.get()) * step; std::size_t end1 = (std::min)(start1 + step, std::size_t(len1)); bool first_partition = (start1 == 0); bool last_partition = (end1 == std::size_t(len1)); // all but the last chunk require special handling if (!last_partition) { // this chunk will be handled by the next one if all // elements of this partition are equal if (!f(first1[start1], first1[end1 + 1])) return; // move backwards to find earliest element which is equal to // the last element of the current chunk while (end1 != 0 && !f(first1[end1 - 1], first1[end1])) --end1; } // move backwards to find earliest element which is equal to // the first element of the current chunk while (start1 != 0 && !f(first1[start1 - 1], first1[start1])) --start1; // find start and end in sequence 2 std::size_t start2 = 0; if (!first_partition) { start2 = std::lower_bound( first2, first2 + len2, first1[start1], f ) - first2; } std::size_t end2 = len2; if (!last_partition) { end2 = std::lower_bound( first2 + start2, first2 + len2, first1[end1], f ) - first2; } // perform requested set-operation into the proper place of the // intermediate buffer curr_chunk->start = combiner(start1, start2); auto buffer_dest = buffer.get() + curr_chunk->start; curr_chunk->len = setop(first1 + start1, first1 + end1, first2 + start2, first2 + end2, buffer_dest, f ) - buffer_dest; }, // second step, is executed after all partitions are done running [buffer, chunks, cores, dest](std::vector<future<void> >&&) -> OutIter { // accumulate real length set_chunk_data* chunk = chunks.get(); chunk->start_index = 0; for (size_t i = 1; i != cores; ++i) { set_chunk_data* curr_chunk = chunk++; chunk->start_index = curr_chunk->start_index + curr_chunk->len; } // finally, copy data to destination parallel::util::foreach_partitioner< hpx::parallel::parallel_execution_policy >::call(par, chunks.get(), cores, [buffer, dest]( set_chunk_data* chunk, std::size_t, std::size_t) { std::copy(buffer.get() + chunk->start, buffer.get() + chunk->start + chunk->len, dest + chunk->start_index); }, [](set_chunk_data* last) -> set_chunk_data* { return last; }); return dest; }); }