static int
roverp5p_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
{
	/* Silently ignore Vpp, output enable, speaker enable. */
	debug_func ("Reset:%d Vcc:%d\n", (state->flags & SS_RESET) ? 1 : 0,
		    state->Vcc);

	roverp5p_pcmcia_hw_rst (state->flags & SS_RESET);

	/* Apply socket voltage */
	switch (state->Vcc) {
	case 0:
		SET_ROVERP5P_GPIO (CF_PWR_ON, 1);
		SET_ROVERP5P_GPIO (CF_BUS_nON, 1);
		/*GPIO_CLR (GPIO_NR_ROVERP5P_CF_PWR_ON);
		GPIO_CLR (GPIO_NR_ROVERP5P_CF_BUS_nON);*/
		break;
	case 50:
		/*GPIO_SET (GPIO_NR_ROVERP5P_CF_PWR_ON);
		break;*/
	case 33:
		/* Apply power to socket */
		SET_ROVERP5P_GPIO (CF_PWR_ON, 0);
		SET_ROVERP5P_GPIO (CF_BUS_nON, 0);
		/*GPIO_SET (GPIO_NR_ROVERP5P_CF_PWR_ON);
		GPIO_SET (GPIO_NR_ROVERP5P_CF_BUS_nON);*/
		break;
	default:
		printk (KERN_ERR "%s: Unsupported Vcc:%d\n",
			__FUNCTION__, state->Vcc);
	}

	return 0;
}
Beispiel #2
0
static int aximx5_lcd_set_power (struct lcd_device *ld, int state)
{
	struct mediaq11xx_base *mq_base = class_get_devdata (&ld->class_dev);
	int lcdfp_state = mq_base->get_power (mq_base, MEDIAQ_11XX_FP_DEVICE_ID) ? 1 : 0;
	int fpctl_state = mq_base->get_power (mq_base, MEDIAQ_11XX_FB_DEVICE_ID) ? 1 : 0;

	int new_lcdfp_state = (state < 1) ? 1 : 0;
	int new_fpctl_state = (state < 4) ? 1 : 0;

	debug_func ("state:%d\n", state);

	if (new_lcdfp_state != lcdfp_state)
		mq_base->set_power (mq_base, MEDIAQ_11XX_FP_DEVICE_ID, new_lcdfp_state);
	if (new_fpctl_state != fpctl_state)
		mq_base->set_power (mq_base, MEDIAQ_11XX_FB_DEVICE_ID, new_fpctl_state);

	if (new_lcdfp_state)
		/* MediaQ GPIO 1 seems connected to flat-panel power */
		mq_base->set_GPIO (mq_base, GPIO_NR_AXIMX5_MQ1132_FP_ENABLE, MQ_GPIO_OUT1);
	else
		/* Output '0' to MQ1132 GPIO 1 */
		mq_base->set_GPIO (mq_base, GPIO_NR_AXIMX5_MQ1132_FP_ENABLE, MQ_GPIO_OUT0);

	return 0;
}
Beispiel #3
0
static int
aximx5_lcd_set_contrast (struct lcd_device *ld, int contrast)
{
	struct mediaq11xx_base *mq_base = class_get_devdata (&ld->class_dev);
	u32 x;

	debug_func ("contrast:%d\n", contrast);

	/* Well... this is kind of tricky but here's how it works:
	 * On 24-bit TFT panels the R,G,B channels are output via
	 * the FD0..FD23 MQ1132' outputs. There are separate enable
	 * bits for these pins in FP07R, which we will use.
	 * Basically we just mask out (setting them to '1')
	 * the lowest 1..8 bits of every color component thus
	 * effectively reducing the number of bits for them.
	 */
	if (contrast > 7)
		contrast = 7;
	contrast = 7 ^ contrast;

	x = (1 << contrast) - 1;

	mq_base->regs->FP.pin_output_data |= 0x00ffffff;
	mq_base->regs->FP.pin_output_select_1 =
		(mq_base->regs->FP.pin_output_select_1 & 0xff000000) |
		x | (x << 8) | (x << 16);

	return 0;
}
Beispiel #4
0
static int aximx5_lcd_remove(struct platform_device *dev)
{
	debug_func ("\n");

	lcd_device_unregister (mqfb_lcd_device);

	return 0;
}
static void roverp5p_pcmcia_hw_rst (int state)
{
	debug_func ("\n");
	SET_ROVERP5P_GPIO (CF_RESET, state);
/*	if (state)
		GPIO_SET (GPIO_NR_ROVERP5P_CF_RESET);
	else
		GPIO_CLR (GPIO_NR_ROVERP5P_CF_RESET);*/
}
Beispiel #6
0
static int roverp5p_fp_remove (struct device *dev)
{
	debug_func ("\n");

	backlight_device_unregister (mqfb_backlight_device);
	lcd_device_unregister (mqfb_lcd_device);

        return 0;
}
Beispiel #7
0
static int 
roverp5p_backlight_get_power (struct backlight_device *bd)
{
	struct mediaq11xx_base *mq_base = class_get_devdata (&bd->class_dev);

	debug_func ("\n");

	return mq_base->get_GPIO (mq_base, 64) ? 0 : 4;
}
void main()
{
	if ( DEBUG )
	{
		debug_func();
		return;
	}

	Polygon_2 poly;

	int numOfPoints;
	double x,y;
	std::fstream myfile;
	myfile.open ("out.txt");
	myfile >> numOfPoints;

	std::vector<int> rArray(numOfPoints);
	int r;

	for (int i=0; i<numOfPoints; ++i)
	{
		  myfile >> x >> y >> r;
		  poly.push_back( Point_2(x,y) );
		  rArray [i] = r;
	 }

	myfile.close();

	Shor shor;
	shor.load_polygon (poly);
	shor.load_rArray (rArray);
	shor.play();
	shor.build_triangulation();
	shor.simplify_triangulation();

	std::ofstream out("outC.txt");
    std::streambuf *coutbuf = std::cout.rdbuf(); //save old buf
	std::cout.rdbuf(out.rdbuf()); //redirect std::cout to out.txt!

	for ( int i = 0 , len = (int)shor.triangulated.size(); i < len ; ++i )
	{
		std::cout  << shor.triangulated[i][0][0] << " " << shor.triangulated[i][0][1] <<std::endl;

		std::cout  << shor.triangulated[i][1][0] << " " << shor.triangulated[i][1][1] <<std::endl;
														
		std::cout  << shor.triangulated[i][2][0] << " " << shor.triangulated[i][2][1] <<std::endl;

	}

	
	//system("pause");

}
Beispiel #9
0
static int
aximx5_lcd_get_contrast (struct lcd_device *ld)
{
	struct mediaq11xx_base *mq_base = class_get_devdata (&ld->class_dev);
	u32 c, x;

	debug_func ("\n");

	x = (mq_base->regs->FP.pin_output_select_1 & 0x7f);
	for (c = 7; x; x >>= 1, c--)
		;
	return c;
}
Beispiel #10
0
static int
roverp5p_backlight_get_brightness (struct backlight_device *bd)
{
        u32 x, y;

	debug_func ("\n");

	x = PWM_PWDUTY0 & 0x3ff;
	y = PWM_PERVAL0 & 0x3ff;
	// To avoid division, we'll approximate y to nearest 2^n-1.
	// PocketPC is using 0xfe as PERVAL0 and we're using 0x3ff.
	x <<= (10 - fls (y));
	return x;
}
Beispiel #11
0
static int aximx5_lcd_get_power (struct lcd_device *ld)
{
	struct mediaq11xx_base *mq_base = class_get_devdata (&ld->class_dev);
	int lcdfp_state = mq_base->get_power (mq_base, MEDIAQ_11XX_FP_DEVICE_ID);
	int fpctl_state = mq_base->get_power (mq_base, MEDIAQ_11XX_FB_DEVICE_ID);

	debug_func ("\n");

	if (lcdfp_state == 0) {
		if (fpctl_state == 0)
			return 4;
		else
			return 2;
	}
	return 0;
}
Beispiel #12
0
static int 
roverp5p_backlight_set_power (struct backlight_device *bd, int state)
{
	struct mediaq11xx_base *mq_base = class_get_devdata (&bd->class_dev);

	debug_func ("state:%d\n", state);

	/* Turn off backlight power */
	if (state == 0) {
		mq_base->set_GPIO (mq_base, 64, MQ_GPIO_IN | MQ_GPIO_OUT1);
		if (PWM_PWDUTY0 & 0x3ff)
			CKEN |= CKEN0_PWM0;
		else
			CKEN &= ~CKEN0_PWM0;
	} else {
		CKEN &= ~CKEN0_PWM0;
		mq_base->set_GPIO (mq_base, 64, MQ_GPIO_IN | MQ_GPIO_OUT0);
	}
	return 0;
}
Beispiel #13
0
static int
roverp5p_backlight_set_brightness (struct backlight_device *bd, int brightness)
{
	debug_func ("brightness:%d\n", brightness);

	if (brightness > 0x3ff)
		brightness = 0x3ff;

	/* LCD brightness on Dell Axim is driven by PWM0.
	 * We'll set the pre-scaler to 8, and the period to 1024, this
	 * means the backlight refresh rate will be 3686400/(8*1024) =
	 * 450 Hz which is quite enough.
	 */
	PWM_CTRL0 = 7; /* pre-scaler */
	PWM_PWDUTY0 = brightness; /* duty cycle */
	PWM_PERVAL0 = 0x3ff; /* period */

	if (brightness)
		CKEN |= CKEN0_PWM0;
	else
		CKEN &= ~CKEN0_PWM0;

        return 0;
}
Beispiel #14
0
static int aximx5_lcd_suspend(struct platform_device *dev, pm_message_t state)
{
	debug_func ("\n");
	return 0;
}
/*
 * Disable card status IRQs on suspend.
 */
static void roverp5p_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
{
	debug_func ("\n");
	roverp5p_pcmcia_hw_rst(1);
	soc_pcmcia_disable_irqs(skt, cd_irqs, ARRAY_SIZE(cd_irqs));
}
Beispiel #16
0
static int roverp5p_fp_suspend (struct device *dev, u32 state, u32 level)
{
	debug_func ("\n");
        return 0;
}
Beispiel #17
0
static int roverp5p_fp_resume (struct device *dev, u32 level)
{
	debug_func ("\n");
	return 0;
}
/*
 * Enable card status IRQs on (re-)initialisation.  This can
 * be called at initialisation, power management event, or
 * pcmcia event.
 */
static void roverp5p_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
	debug_func ("\n");
	soc_pcmcia_enable_irqs (skt, cd_irqs, ARRAY_SIZE(cd_irqs));
}
Beispiel #19
0
static int __init
roverp5p_fp_init(void)
{
	debug_func ("\n");
	return driver_register (&roverp5p_fp_device_driver);
}
Beispiel #20
0
static void __exit
roverp5p_fp_exit(void)
{
	debug_func ("\n");
	driver_unregister (&roverp5p_fp_device_driver);
}
Beispiel #21
0
static void __exit
aximx5_lcd_exit(void)
{
	debug_func ("\n");
	platform_driver_unregister(&aximx5_lcd_driver);
}
Beispiel #22
0
static int __init
aximx5_lcd_init(void)
{
	debug_func ("\n");
	return platform_driver_register(&aximx5_lcd_driver);
}
Beispiel #23
0
static int aximx5_lcd_resume(struct platform_device *dev)
{
	debug_func ("\n");
	return 0;
}