コード例 #1
0
ファイル: irq.c プロジェクト: iTOP4418/kernel-3.4.39
/*
 *  cpu irq handler
 */
void __init nxp_cpu_init_irq(void)
{
	pr_debug("%s\n", __func__);

	nxp_cpu_vic_priority();
	nxp_cpu_vic_table();

#ifndef CONFIG_ARM_GIC
	/* VIC to core */
	writel_relaxed(0, GIC_CPUI_BASE);
#endif

	vic_init  (VIC0_INT_BASE ,  0, VIC0_INT_MASK, VIC0_INT_RESUME);	/*  0 ~ 31 */
	vic_init  (VIC1_INT_BASE , 32, VIC1_INT_MASK, VIC1_INT_RESUME);	/* 32 ~ 59 */
	gpio_init (GPIO_INT_BASE , IRQ_GPIO_START, GPIO_INT_MASK, 0);	/* 64 ~ 223 (A,B,C,D,E) */
	alive_init(ALIVE_INT_BASE, IRQ_ALIVE_START, ALIVE_INT_MASK, 0); /* 224 ~ 231 */

#ifdef CONFIG_ARM_GIC
	__gic_init(GIC_DIST_BASE, (void __iomem *)GIC_CPUI_BASE);
#endif

#ifdef CONFIG_FIQ
	init_FIQ();
#endif

	__vic_set_irq_chip();

	/* wake up source from idle */
	irq_set_irq_wake(IRQ_PHY_CLKPWR_ALIVEIRQ, 1);
#if PM_RTC_WAKE
	irq_set_irq_wake(IRQ_PHY_CLKPWR_RTCIRQ, 1);
#endif
}
コード例 #2
0
void __init ep93xx_init_irq(void)
{
	vic_init(EP93XX_VIC1_BASE, 0, EP93XX_VIC1_VALID_IRQ_MASK, 0);
	vic_init(EP93XX_VIC2_BASE, 32, EP93XX_VIC2_VALID_IRQ_MASK, 0);

	ep93xx_gpio_init_irq();
}
コード例 #3
0
ファイル: cpu-8815.c プロジェクト: Blackburn29/PsycoKernel
void __init cpu8815_init_irq(void)
{
	
	vic_init(io_p2v(NOMADIK_IC_BASE + 0x00), IRQ_VIC_START +  0, ~0, 0);
	vic_init(io_p2v(NOMADIK_IC_BASE + 0x20), IRQ_VIC_START + 32, ~0, 0);

	clk_init();
}
コード例 #4
0
void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
{
	printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);

	/* initialise the pair of VICs */
	vic_init(VA_VIC0, IRQ_VIC0_BASE, vic0_valid, IRQ_VIC0_RESUME);
	vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, IRQ_VIC1_RESUME);

	/* add the timer sub-irqs */
	s3c_init_vic_timer_irq(5, IRQ_TIMER0);
}
コード例 #5
0
ファイル: core.c プロジェクト: 0x0f/adam-kernel
/*
 * Interrupts: the U300 platforms have two pl190 ARM PrimeCells connected
 * together so some interrupts are connected to the first one and some
 * to the second one.
 */
void __init u300_init_irq(void)
{
	u32 mask[2] = {0, 0};
	int i;

	for (i = 0; i < NR_IRQS; i++)
		set_bit(i, (unsigned long *) &mask[0]);
	u300_enable_intcon_clock();
	vic_init((void __iomem *) U300_INTCON0_VBASE, 0, mask[0], mask[0]);
	vic_init((void __iomem *) U300_INTCON1_VBASE, 32, mask[1], mask[1]);
}
コード例 #6
0
ファイル: cpu-8815.c プロジェクト: 08opt/linux
void __init cpu8815_init_irq(void)
{
	/* This modified VIC cell has two register blocks, at 0 and 0x20 */
	vic_init(io_p2v(NOMADIK_IC_BASE + 0x00), IRQ_VIC_START +  0, ~0, 0);
	vic_init(io_p2v(NOMADIK_IC_BASE + 0x20), IRQ_VIC_START + 32, ~0, 0);

	/*
	 * Init clocks here so that they are available for system timer
	 * initialization.
	 */
	clk_init();
}
コード例 #7
0
ファイル: irq.c プロジェクト: Asure/Dropad-kernel-2.6.35.7
void __init s5p_init_irq(u32 *vic, u32 num_vic)
{
	struct irq_chip *chip;
	int irq;

	/* initialize the VICs */
	for (irq = 0; irq < num_vic; irq++)
		vic_init(VA_VIC(irq), VIC_BASE(irq), vic[irq], 0);

	s3c_init_vic_timer_irq(IRQ_TIMER0_VIC, IRQ_TIMER0);
	s3c_init_vic_timer_irq(IRQ_TIMER1_VIC, IRQ_TIMER1);
	s3c_init_vic_timer_irq(IRQ_TIMER2_VIC, IRQ_TIMER2);
	s3c_init_vic_timer_irq(IRQ_TIMER3_VIC, IRQ_TIMER3);
	s3c_init_vic_timer_irq(IRQ_TIMER4_VIC, IRQ_TIMER4);

	s3c_init_uart_irqs(uart_irqs, ARRAY_SIZE(uart_irqs));

#ifdef CONFIG_PM
	/* Register wakeup source. */
	for (irq = 0; irq < ARRAY_SIZE(wakeup_source); irq++) {
		chip = get_irq_chip(wakeup_source[irq]);
		chip->set_wake = s3c_irq_wake;
	}
#endif
}
コード例 #8
0
ファイル: common.c プロジェクト: 01org/XenGT-Preview-kernel
void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
{
	/*
	 * FIXME: there is no better place to put this at the moment
	 * (s3c64xx_clk_init needs ioremap and must happen before init_time
	 * samsung_wdt_reset_init needs clocks)
	 */
	s3c64xx_clk_init(NULL, xtal_f, xusbxti_f, soc_is_s3c6400(), S3C_VA_SYS);
	samsung_wdt_reset_init(S3C_VA_WATCHDOG);

	printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);

	/* initialise the pair of VICs */
	vic_init(VA_VIC0, IRQ_VIC0_BASE, vic0_valid, IRQ_VIC0_RESUME);
	vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, IRQ_VIC1_RESUME);
}
コード例 #9
0
void __init versatile_init_irq(void)
{
	unsigned int i;

	vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0);

	set_irq_chained_handler(IRQ_VICSOURCE31, sic_handle_irq);

	/* Do second interrupt controller */
	writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);

	for (i = IRQ_SIC_START; i <= IRQ_SIC_END; i++) {
		if ((PIC_MASK & (1 << (i - IRQ_SIC_START))) == 0) {
			set_irq_chip(i, &sic_chip);
			set_irq_handler(i, handle_level_irq);
			set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
		}
	}

	/*
	 * Interrupts on secondary controller from 0 to 8 are routed to
	 * source 31 on PIC.
	 * Interrupts from 21 to 31 are routed directly to the VIC on
	 * the corresponding number on primary controller. This is controlled
	 * by setting PIC_ENABLEx.
	 */
	writel(PIC_MASK, VA_SIC_BASE + SIC_INT_PIC_ENABLE);
}
コード例 #10
0
ファイル: irq.c プロジェクト: CSCLOG/beaglebone
void __init bcmring_init_irq(void)
{
	vic_init((void __iomem *)MM_IO_BASE_INTC0, &bcmring_irq0_chip,
		 IRQ_INTC0_START, IRQ_INTC0_VALID_MASK);
	vic_init((void __iomem *)MM_IO_BASE_INTC1, &bcmring_irq1_chip,
		 IRQ_INTC1_START, IRQ_INTC1_VALID_MASK);
	vic_init((void __iomem *)MM_IO_BASE_SINTC, &bcmring_irq2_chip,
		 IRQ_SINTC_START, IRQ_SINTC_VALID_MASK);

	/* special cases */
	if (INTCHW_INTC1_GPIO0 & IRQ_INTC1_VALID_MASK) {
		irq_set_handler(IRQ_GPIO0, handle_simple_irq);
	}
	if (INTCHW_INTC1_GPIO1 & IRQ_INTC1_VALID_MASK) {
		irq_set_handler(IRQ_GPIO1, handle_simple_irq);
	}
}
コード例 #11
0
ファイル: irq.c プロジェクト: 0709oNEY/at100-kernel
void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
{
	printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);

	/* initialise the pair of VICs */
	vic_init(VA_VIC0, IRQ_VIC0_BASE, vic0_valid, 0);
	vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, 0);

	/* add the timer sub-irqs */

	s3c_init_vic_timer_irq(IRQ_TIMER0_VIC, IRQ_TIMER0);
	s3c_init_vic_timer_irq(IRQ_TIMER1_VIC, IRQ_TIMER1);
	s3c_init_vic_timer_irq(IRQ_TIMER2_VIC, IRQ_TIMER2);
	s3c_init_vic_timer_irq(IRQ_TIMER3_VIC, IRQ_TIMER3);
	s3c_init_vic_timer_irq(IRQ_TIMER4_VIC, IRQ_TIMER4);

	s3c_init_uart_irqs(uart_irqs, ARRAY_SIZE(uart_irqs));
}
コード例 #12
0
ファイル: sys.c プロジェクト: zolkko/lpc2468-dh-example
void sys_init(void)
{
	pll_init();
	power_init();
	vic_init();
	SYS_SetFastGPIO();
	gpio_init(test_handler);
	i2c_init();

	irq_enable();
}
コード例 #13
0
void __init s5p_init_irq(u32 *vic, u32 num_vic)
{
#ifdef CONFIG_ARM_VIC
	int irq;

	/* initialize the VICs */
	for (irq = 0; irq < num_vic; irq++)
		vic_init(VA_VIC(irq), VIC_BASE(irq), vic[irq], 0);
#endif

	s3c_init_vic_timer_irq(5, IRQ_TIMER0);
}
コード例 #14
0
ファイル: test-vic-funcs.c プロジェクト: xlcteam/vic
static char * all_tests()
{

    vic_init();
    vic_debug(1);

    vic_fn_add("call", &fn_call);

    mu_run_test(test_call);
    mu_run_test(test_set);
    mu_run_test(test_compute);
    return 0;
}
コード例 #15
0
ファイル: shell.c プロジェクト: xlcteam/vic
int main(void)
{
    vic_init((void (*)(char))putchar);
    while (1) {
        char c;
        while ((c = getchar()) != '\n') {
            vic_process(c);
        }
        vic_process('\n');
    }

    return 0;
}
コード例 #16
0
ファイル: test-vic-exec.c プロジェクト: xlcteam/vic
static char * all_tests()
{
    vic_init();
    vic_debug(1);

	mu_run_test(test_simple_exec);
    mu_run_test(test_complicated_exec);

    mu_run_test(test_simple_eval_replace);

    mu_run_test(test_args);
    mu_run_test(test_args_advanced);
    mu_run_test(test_args_ebits);
	return 0;
}
コード例 #17
0
void __init s5p_init_irq(u32 *vic, u32 num_vic)
{
	int irq;

	/* initialize the VICs */
	for (irq = 0; irq < num_vic; irq++)
		vic_init(VA_VIC(irq), VIC_BASE(irq), vic[irq], 0);

	s3c_init_vic_timer_irq(IRQ_TIMER0_VIC, IRQ_TIMER0);
	s3c_init_vic_timer_irq(IRQ_TIMER1_VIC, IRQ_TIMER1);
	s3c_init_vic_timer_irq(IRQ_TIMER2_VIC, IRQ_TIMER2);
	s3c_init_vic_timer_irq(IRQ_TIMER3_VIC, IRQ_TIMER3);
	s3c_init_vic_timer_irq(IRQ_TIMER4_VIC, IRQ_TIMER4);

	s3c_init_uart_irqs(uart_irqs, ARRAY_SIZE(uart_irqs));
}
コード例 #18
0
ファイル: rtos.c プロジェクト: blaaz15/Arm-bike
// Start real time operating system
//  slice ... timeslice in microseconds
void sch_on(unsigned int slice)
{
	int prescale = 4, match[4] = {0, 0, 0, 0},
		interrupt[16] = {timer0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
	voidfuncptr function[16] =
		{sch_int, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
	sch_tst = task_completed;
	sch_idx = 0;
	slice_quantum = slice;
	if(VPBDIV) prescale = VPBDIV;
	prescale = 12 * ((PLLSTAT & msel) + 1) / prescale - 1;
	match[0] = slice_quantum;
	timer0_init(prescale, match, mr0i, timer);	
	vic_init(0, timer0, function, interrupt, 0);
	T0TCR = counter_enable;
}
コード例 #19
0
ファイル: test-vic-var.c プロジェクト: xlcteam/vic
int main(void)
{
    vic_init(NULL);

    char *result = all_tests();

    if (result == 0){
        printf("All tests passed!\n");
    } else {
        printf("%s\n", result);
    }

    printf("Status: %d from %d tests passed\n", tests_passed, tests_count);

    return 0;
}
コード例 #20
0
ファイル: core.c プロジェクト: IngenicC/linux-linaro-natty
void __init versatile_init_irq(void)
{
	vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0);

	writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);

	fpga_irq_init(IRQ_VICSOURCE31, ~PIC_MASK, &sic_irq);

	/*
	 * Interrupts on secondary controller from 0 to 8 are routed to
	 * source 31 on PIC.
	 * Interrupts from 21 to 31 are routed directly to the VIC on
	 * the corresponding number on primary controller. This is controlled
	 * by setting PIC_ENABLEx.
	 */
	writel(PIC_MASK, VA_SIC_BASE + SIC_INT_PIC_ENABLE);
}
コード例 #21
0
ファイル: shell.c プロジェクト: xlcteam/vic
int main(void)
{
    vic_init();
    while(1) {
        char input[256];
        vic_sys_print(VIC_PS1);
        fgets(input, 256, stdin);
        int i;

        for(i = 0; i < strlen(input); i++) {
            vic_process(input[i]);
        }

        vic_process('\n');
    }

    return 0;
}
コード例 #22
0
void __init s5p_init_irq(u32 *vic, u32 num_vic)
{
	struct irq_chip *chip;
	int irq;

#ifdef CONFIG_ARM_VIC
	/* initialize the VICs */
	for (irq = 0; irq < num_vic; irq++)
		vic_init(VA_VIC(irq), VIC_BASE(irq), vic[irq], 0);
#endif

	s3c_init_vic_timer_irq(5, IRQ_TIMER0);

	s3c_init_uart_irqs(uart_irqs, ARRAY_SIZE(uart_irqs));

	/* Register wakeup source. */
	for (irq = 0; irq < ARRAY_SIZE(wakeup_source); irq++) {
		chip = irq_get_chip(wakeup_source[irq]);
		chip->irq_set_wake = s3c_irq_wake;
	}
}
コード例 #23
0
/**
 * @brief   Low level HAL driver initialization.
 *
 * @notapi
 */
void hal_lld_init(void) {

  vic_init();
  VICDefVectAddr = (IOREG32)irq_handler;

}
コード例 #24
0
/* This will initialize vic */
void __init spear3xx_init_irq(void)
{
	vic_init((void __iomem *)VA_SPEAR3XX_ML1_VIC_BASE, 0, ~0, 0);
}
コード例 #25
0
ファイル: spear6xx.c プロジェクト: 15-712/linux-2.6
/* This will initialize vic */
void __init spear6xx_init_irq(void)
{
	vic_init((void __iomem *)VA_SPEAR6XX_CPU_VIC_PRI_BASE, 0, ~0, 0);
	vic_init((void __iomem *)VA_SPEAR6XX_CPU_VIC_SEC_BASE, 32, ~0, 0);
}
コード例 #26
0
ファイル: vic20.c プロジェクト: markjreed/vice-emu
/* VIC20-specific initialization.  */
int machine_specific_init(void)
{
    int delay;

    vic20_log = log_open("VIC20");

    if (mem_load() < 0) {
        return -1;
    }

    event_init();

    /* Setup trap handling.  */
    traps_init();

    if (!video_disabled_mode) {
        joystick_init();
    }

    gfxoutput_init();

    /* Initialize serial traps.  If user does not want them, or if the
       ``drive'' emulation is used, do not install them.  */
    if (serial_init(vic20_serial_traps) < 0) {
        return -1;
    }

    serial_trap_init(0xa4);
    serial_iec_bus_init();

    /* Initialize RS232 handler.  */
    rs232drv_init();
    vic20_rsuser_init();

    /* initialize print devices.  */
    printer_init();

    /* Initialize the tape emulation.  */
    tape_init(&tapeinit);

    /* Initialize the datasette emulation.  */
    datasette_init();

    /* Fire up the hardware-level drive emulation. */
    drive_init();

    disk_image_init();

    /* Initialize autostart.  */
    resources_get_int("AutostartDelay", &delay);
    if (delay == 0) {
        delay = 3; /* default */
    }
    autostart_init((CLOCK)
                   (delay * VIC20_PAL_RFSH_PER_SEC * VIC20_PAL_CYCLES_PER_RFSH),
                   1, 0xcc, 0xd1, 0xd3, 0xd5);

#ifdef USE_BEOS_UI
    /* Pre-init VIC20-specific parts of the menus before vic_init()
       creates a canvas window with a menubar at the top. This could
       also be used by other ports, e.g. GTK+...  */
    vic20ui_init_early();
#endif

    /* Initialize the VIC-I emulation.  */
    if (vic_init() == NULL) {
        return -1;
    }

    via1_init(machine_context.via1);
    via2_init(machine_context.via2);

    ieeevia1_init(machine_context.ieeevia1);
    ieeevia2_init(machine_context.ieeevia2);

#ifndef COMMON_KBD
    /* Load the default keymap file.  */
    if (vic20_kbd_init() < 0) {
        return -1;
    }
#endif

    vic20_monitor_init();

    /* Initialize vsync and register our hook function.  */
    vsync_init(machine_vsync_hook);
    vsync_set_machine_parameter(machine_timing.rfsh_per_sec,
                                machine_timing.cycles_per_sec);

    /* Initialize native sound chip first */
    vic_sound_chip_init();

    /* Initialize the sidcart */
    sidcart_sound_chip_init();

    /* Initialize cartridge based sound chips */
    cartridge_sound_chip_init();

    /* Initialize userport based sound chips */
    userport_dac_sound_chip_init();

    drive_sound_init();
    video_sound_init();

    /* Initialize sound.  Notice that this does not really open the audio
       device yet.  */
    sound_init(machine_timing.cycles_per_sec, machine_timing.cycles_per_rfsh);

    /* Initialize keyboard buffer.  */
    kbdbuf_init(631, 198, 10, (CLOCK)(machine_timing.cycles_per_rfsh * machine_timing.rfsh_per_sec));

    /* Initialize the VIC20-specific part of the UI.  */
    vic20ui_init();

    vic20iec_init();

    cartridge_init();

#ifdef HAVE_MOUSE
    mouse_init();

#ifdef HAVE_LIGHTPEN
    /* Initialize lightpen support and register VIC-I callbacks */
    lightpen_init();
    lightpen_register_timing_callback(vic_lightpen_timing, 0);
    lightpen_register_trigger_callback(vic_trigger_light_pen);
#endif
#endif

    /* Register joystick callback (for lightpen triggering via fire button) */
    joystick_register_machine(via2_check_lightpen);

#ifdef HAVE_MIDI
    midi_init();
#endif

    machine_drive_stub();

#if defined (USE_XF86_EXTENSIONS) && (defined(USE_XF86_VIDMODE_EXT) || defined (HAVE_XRANDR))
    {
        /* set fullscreen if user used `-fullscreen' on cmdline */
        int fs;
        resources_get_int("UseFullscreen", &fs);
        if (fs) {
            resources_set_int("VICFullscreen", 1);
        }
    }
#endif
    return 0;
}
コード例 #27
0
ファイル: vic.c プロジェクト: xlcteam/vic
void vic_init_serial(unsigned long baud, uint8_t serial)
{
    vic_init(baud);
    vic_serial_id = serial;
}
コード例 #28
0
ファイル: vic20.c プロジェクト: martinpiper/VICE
/* VIC20-specific initialization.  */
int machine_specific_init(void)
{
    vic20_log = log_open("VIC20");

    if (mem_load() < 0)
        return -1;

    /* Setup trap handling.  */
    traps_init();

    /* Initialize serial traps.  If user does not want them, or if the
       ``drive'' emulation is used, do not install them.  */
    if (serial_init(vic20_serial_traps) < 0)
        return -1;

    serial_trap_init(0xa4);
    serial_iec_bus_init();

    /* Initialize RS232 handler.  */
    rs232drv_init();
    vic20_rsuser_init();

    /* initialize print devices.  */
    printer_init();

    /* Initialize the tape emulation.  */
    tape_init(&tapeinit);

    /* Initialize the datasette emulation.  */
    datasette_init();

    /* Fire up the hardware-level drive emulation. */
    drive_init();

    /* Initialize autostart.  */
    autostart_init((CLOCK)
                   (3 * VIC20_PAL_RFSH_PER_SEC * VIC20_PAL_CYCLES_PER_RFSH),
                   1, 0xcc, 0xd1, 0xd3, 0xd5);

    /* Initialize the VIC-I emulation.  */
    if (vic_init() == NULL)
        return -1;

    via1_init(machine_context.via1);
    via2_init(machine_context.via2);

    ieeevia1_init(machine_context.ieeevia1);
    ieeevia2_init(machine_context.ieeevia2);

#ifndef COMMON_KBD
    /* Load the default keymap file.  */
    if (vic20_kbd_init() < 0)
        return -1;
#endif

    vic20_monitor_init();

    /* Initialize vsync and register our hook function.  */
    vsync_init(machine_vsync_hook);
    vsync_set_machine_parameter(machine_timing.rfsh_per_sec,
                                machine_timing.cycles_per_sec);

    /* Initialize sound.  Notice that this does not really open the audio
       device yet.  */
    sound_init(machine_timing.cycles_per_sec, machine_timing.cycles_per_rfsh);

    /* Initialize keyboard buffer.  */
    kbdbuf_init(631, 198, 10, (CLOCK)(machine_timing.cycles_per_rfsh
                * machine_timing.rfsh_per_sec));

    /* Initialize the VIC20-specific part of the UI.  */
    vic20ui_init();

    vic20iec_init();

    machine_drive_stub();

    return 0;
}
コード例 #29
0
ファイル: main.c プロジェクト: SamLin95/cs3630
int main (void) 
{
  int ch = 0;
  int i = 0;
  
  // are we ready to relay scribbler output
  // by default we wait until we get a scribbler request from
  // the user before relaying scribbler messages via bluetooth
  int relay_scrib_messages = 0;

  // is the current command a scribbler command
  int scribbler_cmd = 0;

  // are we processing a get_info packet
  int  get_info = 0;


  // setup the directionality of the pins
  setup_pins();
  
  // setup the PLL - 60 MHz
  setup_pll();

  // setup the instruction prefetch
  setup_mam();
  
  // give some time to let everything settle
  msleep(100);
  
  // The scribbler UART(0) is 38400 8N1
  uart0Init(B38400, UART_8N1, UART_FIFO_8); // setup UART 0
  
  // The CM-5 UART (0) is 57600 8N1
  //  uart0Init(B57600, UART_8N1, UART_FIFO_8); // setup UART 0
  // The Robonova UART (0) is 9600 or 115200 8N1
  //  uart0Init(B115200, UART_8N1, UART_FIFO_8); // setup UART 0

  
  // The bluetooth UART(1)
#if (VERSION_OF_BOARD == 3)
  uart1Init(B57600, UART_8N1, UART_FIFO_8); // setup UART 1
#else
  uart1Init(B460800, UART_8N1, UART_FIFO_8); // setup UART 1
#endif
  
  // synchronize with autobaud
  for (i = 1; i < 512; i++)
    {
      uart1Putch(i);
    }  

  // Set up VIC and enable interrupts
  vic_init();
  
  //set timer0 prescalaer to around 1 usec
  TIMER0_PR = 0x39;
  
  // Start timer0 for benchmarking
  TIMER0_TCR = 1;

  // Set up the transmit queue
  uart1_queue_init();

  // setup interrupts for receiving IR messages
  ir_rx_init();

  // set back configurable LED off
  set_led(0);

  // set front LED off
  led_off();

  // turn IR power to 135
  set_ir(135);

  // set external bluetooth to max; internal amplifier is throttled via pskeys
  set_bluetooth(255);
  
  // slow camera down 
  write_camera(OV_CLKRC, 1);
  
  // turn off auto white balance
  //write_camera(OV_COMA, 0x14 & ~(1<<2));
  
  // turn off auto gain and auto exposure
  //write_camera(OV_COMB, 0xA3 & ~(0x3));

  //flush out any old characters
  for (i = 0; i < 200; i++)  
    {
      getch();
    }
  

  /* read in scribbler orientation 
   *
   * - scribbler forward is stored as 0xDF in serial memory to avoid
   *   coincidental settings
   */

  read_mem(0, 0, &scribbler_orientation, 1);  
  if (scribbler_orientation == 0xDF)
    {
      scribbler_orientation = 0;
    }
  else
    {
      scribbler_orientation = 1;
    }
  
  while (1)
    {
      //led_on();
      ch = getch();     
      //led_off();
     	  
      // body of the firmware - process the byte code sent over bluetooth
      if (ch != -1)
	{
	  cur_rqst[rqst_idx] = ch;

	  // process the cmd if its intended for the fluke
	  if (rqst_idx == 0)
	    {
	      scribbler_cmd = 0; 	      
	      if      (ch == SET_WINDOW)           serve_set_window();
	      else if (ch == SET_RLE)              serve_set_rle();
	      else if (ch == GET_RLE)	           serve_rle();
	      else if (ch == GET_BLOB)		   serve_blob();
	      else if (ch == GET_BLOB_WINDOW)	   serve_blob_window();
	      else if (ch == GET_IMAGE)		   serve_image();
	      else if (ch == GET_WINDOW)	   serve_image_window();
	      else if (ch == GET_WINDOW_LIGHT)	   serve_image_window_sum();
	      else if (ch == GET_BATTERY)	   serve_battery();
	      else if (ch == SET_DONGLE_LED_ON)	   led_on();
	      else if (ch == SET_DONGLE_LED_OFF)   led_off();
	      else if (ch == SET_DIMMER_LED)	   serve_back_led();
	      else if (ch == SET_DONGLE_IR)	   serve_ir_power();
	      else if (ch == SET_RESET_SCRIBBLER)  serve_reset_scribbler();
	      else if (ch == SET_RESET_SCRIBBLER2) serve_reset_scribbler2();
	      else if (ch == GET_SERIAL_MEM)	   serve_get_serial_mem();
	      else if (ch == SET_SERIAL_MEM)	   serve_set_serial_mem();
	      else if (ch == SET_SERIAL_ERASE)	   serve_erase_serial_mem();
	      else if (ch == GET_DONGLE_R_IR)	   serve_ir(0x1);
	      else if (ch == GET_DONGLE_L_IR)	   serve_ir(0x2);
	      else if (ch == GET_DONGLE_C_IR)	   serve_ir(0x4);
	      else if (ch == SET_SCRIB_PROGRAM)	   serve_set_scrib_program();
	      else if (ch == SET_SCRIB_BATCH)	   serve_set_scrib_program_batch();
	      else if (ch == GET_SCRIB_PROGRAM)	   serve_get_scrib_program();
	      else if (ch == SET_START_PROGRAM)	   serve_start_scrib_program();
	      else if (ch == SET_START_PROGRAM2)   serve_start_scrib2_program();
	      else if (ch == SET_UART0)		   serve_set_uart0();
	      else if (ch == SET_PASS_BYTE)	   serve_send_byte();
	      else if (ch == SET_PASSTHROUGH)	   serve_set_passthrough();
	      else if (ch == SET_PASS_N_BYTES)	   serve_set_pass_n_bytes();
	      else if (ch == SET_PASSTHROUGH_ON)   relay_scrib_messages = 1;
	      else if (ch == SET_PASSTHROUGH_OFF)  relay_scrib_messages = 0;
	      else if (ch == GET_PASS_N_BYTES)	   serve_get_pass_n_bytes();
	      else if (ch == GET_PASS_BYTES_UNTIL) serve_get_pass_bytes_until();
	      else if (ch == SET_FORWARDNESS)	   serve_set_forwardness();
	      else if (ch == SET_WHITE_BALANCE)	   serve_set_wb();
	      else if (ch == SET_NO_WHITE_BALANCE) serve_unset_wb();
	      else if (ch == GET_CAM_PARAM)	   serve_read_camera();	      
	      else if (ch == SET_CAM_PARAM)	   serve_write_camera();
	      else if (ch == SAVE_EEPROM)	   serve_save_eeprom();
	      else if (ch == RESTORE_EEPROM)	   serve_restore_eeprom(); 
	      else if (ch == UPDATE_FIRMWARE)	   serve_update_firmware();
	      else if (ch == WATCHDOG_RESET)	   serve_fluke_reset();
	      else if (ch == GET_JPEG_GRAY_HEADER) serve_jpeg_gray_header();
	      else if (ch == GET_JPEG_COLOR_HEADER)serve_jpeg_color_header();
	      else if (ch == GET_JPEG_GRAY_SCAN)   serve_jpeg_gray_scan();
	      else if (ch == GET_JPEG_COLOR_SCAN)  serve_jpeg_color_scan();
	      else if (ch == GET_VERSION)          serve_version();
	      else if (ch == GET_IR_MESSAGE)       serve_get_ir_message();
	      else if (ch == SEND_IR_MESSAGE)      serve_send_ir_message();
	      else if (ch == SET_IR_EMITTERS)      serve_set_ir_emitters();
	      else if (ch == GET_ROBOT_ID)         serve_identify_robot();
	      else scribbler_cmd = 1;
	    }
	  
	  if (scribbler_cmd)	    
	    {	      
	      // Flush if this is the first time we have  talked to the scribbler 
	      if (relay_scrib_messages == 0)
		{
		  for (i = 0; i < 100; i++)
		    {
		      uart0Getch();
		    }
		}

	      relay_scrib_messages = 1;
	      
	      // we just got a GET_INFO request; pass it on to the scribbler
	      if ((rqst_idx == 0) && (ch == GET_INFO))
		{
		  get_info = 1;
		}
	      // scribbler should now have the whole GET_INFO request
	      else if ((rqst_idx == 8) && get_info == 1)
		{
		  get_info = 2;
		}
	      
	      // flip motors forward to backwards
	      if ((cur_rqst[0] == SET_MOTORS) && scribbler_orientation && rqst_idx < 3)
		{
		  // now send the packet with left/right swapped
		  if ((rqst_idx == 2))
		    {
		      uart0Putch(cur_rqst[0]);
		      //msleep(10);
		      
		      uart0Putch(200-cur_rqst[2]);
		      //msleep(10);
		      
		      uart0Putch(200-cur_rqst[1]);
		    }
		}
	      // pass on character to the scribbler
	      else
		{
		  uart0Putch(ch);
		}
	     
	      // take care of scribbler packet indexing
	      rqst_idx ++;
	      if (rqst_idx > 8)
		{
		  rqst_idx = 0;
		}
	    }
	} /* end if it received a request */
      
      /*
       * if we are talking to the scribbler see if it has anything
       * for us to relay over the bluetooth link
       */
      if (relay_scrib_messages)
	{
	  ch = uart0Getch();
	  if (ch != -1)
	    {
	      // Process GET_INFO request we got the last character
	      if (get_info > 500 && ch == 0x0A)
		{
		  get_info = 0;
		}

	      // Process GET_INFO we just sent our GET_INFO string
	      if (get_info >= 500 && get_info < 50000)
		{
		  putch(',');
		  get_info = 50000;
		}
	      putch(ch);	      
	    }
	}
      
      
      /* 
       * send our GET_INFO information 
       *
       * the GET_INFO handling is pretty hideous to preserve backward
       * compatibility with other bluetooth serial and serial links.
       */
      
      if (get_info > 1)
	{
	  get_info ++;
	  
	  if (get_info == 400)
	    {
	      putstr(VERSION);
	      get_info = 500;
	    }
	  
	  if (get_info == 100000)
	    {
	      putch(0x0A);
	      get_info = 0;
	    }	  	  
	}

      update_low_battery_light();
    }
}
コード例 #30
0
ファイル: cpu-8815.c プロジェクト: 12019/linux-2.6.34-ts471x
void __init cpu8815_init_irq(void)
{
	/* This modified VIC cell has two register blocks, at 0 and 0x20 */
	vic_init(io_p2v(NOMADIK_IC_BASE + 0x00), IRQ_VIC_START +  0, ~0, 0);
	vic_init(io_p2v(NOMADIK_IC_BASE + 0x20), IRQ_VIC_START + 32, ~0, 0);
}