Enscript Output

extractedLnx/linux/drivers/video/atafb.c___initfunc.c

__initfunc(void atari_video_setup( char *options, int *ints ))
{
    char *this_opt;
    int temp;
    char ext_str[80], int_str[100];
    char mcap_spec[80];
    char user_mode[80];

	ext_str[0]          =
	int_str[0]          =
	mcap_spec[0]        =
	user_mode[0]        =
	fb_info.fontname[0] = '\0';

    if (!options || !*options)
		return;
     
    for(this_opt=strtok(options,","); this_opt; this_opt=strtok(NULL,",")) {
	if (!*this_opt) continue;
	if ((temp=get_video_mode(this_opt)))
		default_par=temp;
	else if (! strcmp(this_opt, "inverse"))
		inverse=1;
	else if (!strncmp(this_opt, "font:", 5))
	   strcpy(fb_info.fontname, this_opt+5);
	else if (! strncmp(this_opt, "hwscroll_",9)) {
		hwscroll=simple_strtoul(this_opt+9, NULL, 10);
		if (hwscroll < 0)
			hwscroll = 0;
		if (hwscroll > 200)
			hwscroll = 200;
	}
	else if (! strncmp(this_opt, "sw_",3)) {
		if (! strcmp(this_opt+3, "acia"))
			ovsc_switchmode = SWITCH_ACIA;
		else if (! strcmp(this_opt+3, "snd6"))
			ovsc_switchmode = SWITCH_SND6;
		else if (! strcmp(this_opt+3, "snd7"))
			ovsc_switchmode = SWITCH_SND7;
		else ovsc_switchmode = SWITCH_NONE;
	}
#ifdef ATAFB_EXT
	else if (!strcmp(this_opt,"mv300")) {
		external_bitspercol = 8;
		external_card_type = IS_MV300;
	}
	else if (!strncmp(this_opt,"external:",9))
		strcpy(ext_str, this_opt+9);
#endif
	else if (!strncmp(this_opt,"internal:",9))
		strcpy(int_str, this_opt+9);
#ifdef ATAFB_FALCON
	else if (!strncmp(this_opt, "eclock:", 7)) {
		fext.f = simple_strtoul(this_opt+7, NULL, 10);
		/* external pixelclock in kHz --> ps */
		fext.t = 1000000000/fext.f;
		fext.f *= 1000;
	}
	else if (!strncmp(this_opt, "monitorcap:", 11))
		strcpy(mcap_spec, this_opt+11);
#endif
	else if (!strcmp(this_opt, "keep"))
		DontCalcRes = 1;
	else if (!strncmp(this_opt, "R", 1))
		strcpy(user_mode, this_opt+1);
    }

    if (*int_str) {
	/* Format to config extended internal video hardware like OverScan:
	"<switch-type>,internal:<xres>;<yres>;<xres_max>;<yres_max>;<offset>"
	Explanation:
	<switch-type> type to switch on higher resolution
			sw_acia : via keyboard ACIA
			sw_snd6 : via bit 6 of the soundchip port
			sw_snd7 : via bit 7 of the soundchip port
	<xres>: x-resolution 
	<yres>: y-resolution
	The following are only needed if you have an overscan which
	needs a black border:
	<xres_max>: max. length of a line in pixels your OverScan hardware would allow
	<yres_max>: max. number of lines your OverScan hardware would allow
	<offset>: Offset from physical beginning to visible beginning
		  of screen in bytes
	*/
	int xres;
	char *p;

	if (!(p = strtoke(int_str, ";")) ||!*p) goto int_invalid;
	xres = simple_strtoul(p, NULL, 10);
	if (!(p = strtoke(NULL, ";")) || !*p) goto int_invalid;
	sttt_xres=xres;
	tt_yres=st_yres=simple_strtoul(p, NULL, 10);
	if ((p=strtoke(NULL, ";")) && *p) {
		sttt_xres_virtual=simple_strtoul(p, NULL, 10);
	}
	if ((p=strtoke(NULL, ";")) && *p) {
		sttt_yres_virtual=simple_strtoul(p, NULL, 0);
	}
	if ((p=strtoke(NULL, ";")) && *p) {
		ovsc_offset=simple_strtoul(p, NULL, 0);
	}

	if (ovsc_offset || (sttt_yres_virtual != st_yres))
		use_hwscroll=0;
    }
    else 
      int_invalid:	ovsc_switchmode = SWITCH_NONE;

#ifdef ATAFB_EXT
    if (*ext_str) {
	int		xres, xres_virtual, yres, depth, planes;
	unsigned long addr, len;
	char *p;

	/* Format is: <xres>;<yres>;<depth>;<plane organ.>;
	 *            <screen mem addr>
	 *	      [;<screen mem length>[;<vgaiobase>[;<bits-per-col>[;<colorreg-type>
	 *	      [;<xres-virtual>]]]]]
	 *
	 * 09/23/97	Juergen
	 * <xres_virtual>:	hardware's x-resolution (f.e. ProMST)
	 *
	 * Even xres_virtual is available, we neither support panning nor hw-scrolling!
	 */
	if (!(p = strtoke(ext_str, ";")) ||!*p) goto ext_invalid;
	xres_virtual = xres = simple_strtoul(p, NULL, 10);
	if (xres <= 0) goto ext_invalid;

	if (!(p = strtoke(NULL, ";")) ||!*p) goto ext_invalid;
	yres = simple_strtoul(p, NULL, 10);
	if (yres <= 0) goto ext_invalid;

	if (!(p = strtoke(NULL, ";")) ||!*p) goto ext_invalid;
	depth = simple_strtoul(p, NULL, 10);
	if (depth != 1 && depth != 2 && depth != 4 && depth != 8 &&
		depth != 16 && depth != 24) goto ext_invalid;

	if (!(p = strtoke(NULL, ";")) ||!*p) goto ext_invalid;
	if (*p == 'i')
		planes = FB_TYPE_INTERLEAVED_PLANES;
	else if (*p == 'p')
		planes = FB_TYPE_PACKED_PIXELS;
	else if (*p == 'n')
		planes = FB_TYPE_PLANES;
	else if (*p == 't')
		planes = -1; /* true color */
	else
		goto ext_invalid;


	if (!(p = strtoke(NULL, ";")) ||!*p) goto ext_invalid;
	addr = simple_strtoul(p, NULL, 0);

	if (!(p = strtoke(NULL, ";")) ||!*p)
		len = xres*yres*depth/8;
	else
		len = simple_strtoul(p, NULL, 0);

	if ((p = strtoke(NULL, ";")) && *p) {
		external_vgaiobase=simple_strtoul(p, NULL, 0);
	}

	if ((p = strtoke(NULL, ";")) && *p) {
		external_bitspercol = simple_strtoul(p, NULL, 0);
		if (external_bitspercol > 8)
			external_bitspercol = 8;
		else if (external_bitspercol < 1)
			external_bitspercol = 1;
	}
	
	if ((p = strtoke(NULL, ";")) && *p) {
		if (!strcmp(p, "vga"))
			external_card_type = IS_VGA;
		if (!strcmp(p, "mv300"))
			external_card_type = IS_MV300;
	}

	if ((p = strtoke(NULL, ";")) && *p) {
		xres_virtual = simple_strtoul(p, NULL, 10);
		if (xres_virtual < xres)
			xres_virtual = xres;
		if (xres_virtual*yres*depth/8 > len)
			len=xres_virtual*yres*depth/8;
	}

	external_xres  = xres;
	external_xres_virtual  = xres_virtual;
	external_yres  = yres;
	external_depth = depth;
	external_pmode = planes;
	external_addr  = addr;
	external_len   = len;
		
	if (external_card_type == IS_MV300)
	  switch (external_depth) {
	    case 1:
	      MV300_reg = MV300_reg_1bit;
	      break;
	    case 4:
	      MV300_reg = MV300_reg_4bit;
	      break;
	    case 8:
	      MV300_reg = MV300_reg_8bit;
	      break;
	    }

      ext_invalid:
	;
    }
#endif /* ATAFB_EXT */

#ifdef ATAFB_FALCON
    if (*mcap_spec) {
	char *p;
	int vmin, vmax, hmin, hmax;

	/* Format for monitor capabilities is: <Vmin>;<Vmax>;<Hmin>;<Hmax>
	 * <V*> vertical freq. in Hz
	 * <H*> horizontal freq. in kHz
	 */
	if (!(p = strtoke(mcap_spec, ";")) || !*p) goto cap_invalid;
	vmin = simple_strtoul(p, NULL, 10);
	if (vmin <= 0) goto cap_invalid;
	if (!(p = strtoke(NULL, ";")) || !*p) goto cap_invalid;
	vmax = simple_strtoul(p, NULL, 10);
	if (vmax <= 0 || vmax <= vmin) goto cap_invalid;
	if (!(p = strtoke(NULL, ";")) || !*p) goto cap_invalid;
	hmin = 1000 * simple_strtoul(p, NULL, 10);
	if (hmin <= 0) goto cap_invalid;
	if (!(p = strtoke(NULL, "")) || !*p) goto cap_invalid;
	hmax = 1000 * simple_strtoul(p, NULL, 10);
	if (hmax <= 0 || hmax <= hmin) goto cap_invalid;

	vfmin = vmin;
	vfmax = vmax;
	hfmin = hmin;
	hfmax = hmax;
      cap_invalid:
	;
    }
#endif

	if (*user_mode) {
		/* Format of user defined video mode is: <xres>;<yres>;<depth>
		 */
		char *p;
		int xres, yres, depth, temp;

		if (!(p = strtoke(user_mode, ";")) || !*p) goto user_invalid;
		xres = simple_strtoul(p, NULL, 10);
		if (!(p = strtoke(NULL, ";")) || !*p) goto user_invalid;
		yres = simple_strtoul(p, NULL, 10);
		if (!(p = strtoke(NULL, "")) || !*p) goto user_invalid;
		depth = simple_strtoul(p, NULL, 10);
		if ((temp=get_video_mode("user0"))) {
			default_par=temp;
			atari_fb_predefined[default_par-1].xres = xres;
			atari_fb_predefined[default_par-1].yres = yres;
			atari_fb_predefined[default_par-1].bits_per_pixel = depth;
		}

	  user_invalid:
		;
	}
}

Generated by GNU enscript 1.6.4.