Пример #1
0
void demo(void *fdt, uint32_t el)
{
	int nodeoffset;
	char *fbparam;
	uint64_t base;
	uint64_t size;
	uint32_t color;
	const char *cmdline;
	extern void *image_start;
	extern void *image_end;

	/*
	 * Parse /chosen/bootargs for the real base
	 * of tegra framebuffer.
	 */
	nodeoffset = fdt_path_offset(fdt,
				     "/chosen");
	if (nodeoffset < 0) {
		goto cont;
	}

	cmdline = fdt_getprop(fdt, nodeoffset,
			      "bootargs", NULL);
	if (cmdline == NULL) {
		goto cont;
	}
	fbparam = strstr(cmdline, "tegra_fbmem=");
	if (parse_memloc(fbparam + 12, &size, &base) == 0) {
		fb_base = (void *) base;
	}

cont:
	video_init(fb_base);
	printk("We are at EL%u\n", el);
	printk("We are 0x%lx bytes at %p\n",
	       (uint64_t) &image_end -
	       (uint64_t) &image_start,
	       &image_start);

	/*
	 * Draw some lines diagonal lines in the bottom half of screen.
	 *
	 * Green: we're at EL2.
	 * White: we're at EL1.
	 */
	color = el == 2 ? 0xff00ff00 : 0xffffffff;
	bres(0, FB_ROWS / 2, FB_COLS - 1, FB_ROWS - 1, color);
	bres(FB_COLS - 1, FB_ROWS / 2, 0, FB_ROWS - 1, color);
	bres(1, FB_ROWS / 2, FB_COLS - 1, FB_ROWS - 2, color);
	bres(FB_COLS - 2, FB_ROWS / 2, 0, FB_ROWS - 2, color);
}
Пример #2
0
static void	draw_point_x(t_all *all)
{
	int		x;
	int		y;
	float	tmp_x1;
	float	tmp_x2;
	float	tmp_y1;

	y = -1;
	while (MAP[++y])
	{
		x = -1;
		tmp_x1 = ECART;
		while (MAP[y][++x] && MAP[y][x + 1])
		{
			tmp_x2 = tmp_x1 + ECART;
			tmp_y1 = y * ECART + ECART;
			all->apoint->x1 = (tmp_x1 - tmp_y1) + SW;
			all->apoint->x2 = (tmp_x2 - tmp_y1) + SW;
			all->apoint->y1 = ((tmp_x1 + tmp_y1) / 2 + SH) * COEFY - Z1;
			all->apoint->y2 = ((tmp_x2 + tmp_y1) / 2 + SH) * COEFY - Z2X;
			choose_color(all, Z1, Z2X);
			bres(all);
			tmp_x1 = tmp_x2;
		}
	}
}
Пример #3
0
static void	draw_point_y(t_all *all)
{
	int		x;
	int		y;
	float	tmp_x1;
	float	tmp_y1;
	float	tmp_y2;

	y = -1;
	tmp_y1 = ECART;
	while (MAP[++y] && MAP[y + 1])
	{
		x = -1;
		tmp_y2 = tmp_y1 + ECART;
		while (MAP[y][++x] && MAP[y + 1][x])
		{
			tmp_x1 = x * ECART + ECART;
			all->apoint->x1 = (tmp_x1 - tmp_y1) + SW;
			all->apoint->x2 = (tmp_x1 - tmp_y2) + SW;
			all->apoint->y1 = ((tmp_x1 + tmp_y1) / 2 + SH) * COEFY - Z1;
			all->apoint->y2 = ((tmp_x1 + tmp_y2) / 2 + SH) * COEFY - Z2Y;
			choose_color(all, Z1, Z2Y);
			bres(all);
		}
		tmp_y1 = tmp_y2;
	}
}