Exemple #1
0
    for (e = qs->first_window; e != NULL; e = e->next_window) {
        if (e->b == b) {
            e->offset = error_offset;
        }
    }

    /* CG: Should remove popups, sidepanes, helppanes... */

    /* go to the error */
    do_load(s, filename);
    do_goto_line(s, line_num);
}

/* specific shell commands */
static CmdDef shell_commands[] = {
    CMD0( KEY_CTRL('o'), KEY_NONE, "shell-toggle-input", do_shell_toggle_input)
    CMD1( '\r', KEY_NONE, "shell-return", shell_write_char, '\r')
    /* CG: should send s->kbs */
    CMD1( 127, KEY_NONE, "shell-backward-delete-char", shell_write_char, 127)
    CMD1( KEY_CTRL('c'), KEY_NONE, "shell-intr", shell_write_char, 3)
    CMD1( KEY_CTRL('d'), KEY_DELETE, "shell-delete-char", shell_write_char, 4)
    CMD1( KEY_CTRL('i'), KEY_NONE, "shell-tabulate", shell_write_char, 9)
    CMD1( KEY_CTRL('k'), KEY_NONE, "shell-kill-line", shell_write_char, 11)
    CMD1( KEY_CTRL('y'), KEY_NONE, "shell-yank", shell_write_char, 25)
    CMD_DEF_END,
};

/* compilation commands */
static CmdDef compile_commands[] = {
    CMD_( KEY_CTRLXRET('\r'), KEY_NONE, "shell", do_shell, "i")
    CMD_( KEY_CTRLX(KEY_CTRL('e')), KEY_NONE, "compile", do_compile,
Exemple #2
0
{
    BufedState *bs = s->mode_data;

    free_strings(&bs->items);

    list_mode.mode_close(s);
}

/* specific bufed commands */
static CmdDef bufed_commands[] = {
    CMD1( KEY_RET, KEY_RIGHT,
          "bufed-select", bufed_select, 0)
    /* bufed-abort should restore previous buffer in right-window */
    CMD1( KEY_CTRL('g'), KEY_NONE,
          "bufed-abort", do_delete_window, 0)
    CMD0( ' ', KEY_CTRL('t'),
          "bufed-toggle-selection", list_toggle_selection)
    /* BS should go back to previous item and unmark it */
    //CMD1( 'u', KEY_NONE, "bufed-unmark", bufed_mark, ' ')
    CMD0( '~', KEY_NONE,
          "bufed-clear-modified", bufed_clear_modified)
    CMD0( '%', KEY_NONE,
          "bufed-toggle-read-only", bufed_toggle_read_only)
    CMD1( 'a', KEY_NONE,
          "bufed-toggle-all-visible", bufed_refresh, 1)
    CMD1( 'n', KEY_NONE,
          "next-line", do_up_down, 1)
    CMD1( 'p', KEY_NONE,
          "previous-line", do_up_down, -1)
    CMD1( 'r', 'g',
          "bufed-refresh", bufed_refresh, 0)
    CMD0( 'k', KEY_F8,
Exemple #3
0
int SD_card_init(void)
{
//-- SD controller & card initialize
    int i;

    /* Important notice for MMC test condition */
    /* Cmd & Data lines must be enabled by pull up resister */

    rSDIPRE=PCLK/(INICLK)-1;	// 400KHz
	Uart_Printf("Init. Frequency is %dHz\n",(PCLK/(rSDIPRE+1)));

	rSDICON=(1<<4)|1;	// Type B, clk enable
	rSDIFSTA=rSDIFSTA|(1<<16);	//YH 040223 FIFO reset
    rSDIBSIZE=0x200;		// 512byte(128word)
    rSDIDTIMER=0x7fffff;		// Set timeout count

    for(i=0;i<0x1000;i++);  // Wait 74SDCLK for MMC card

    CMD0();
    Uart_Printf("In idle\n");

    //-- Check MMC card OCR
    if(Chk_MMC_OCR())
    {
	Uart_Printf("In MMC ready\n");
	MMC=1;
	goto RECMD2;
    }

    Uart_Printf("MMC check end!!\n");
    //-- Check SD card OCR
    if(Chk_SD_OCR())
        Uart_Printf("In SD ready\n");

    else
    {
		Uart_Printf("Initialize fail\nNo Card assertion\n");
        return 0;
    }

RECMD2:
    //-- Check attaced cards, it makes card identification state
    rSDICARG=0x0;   // CMD2(stuff bit)
    rSDICCON=(0x1<<10)|(0x1<<9)|(0x1<<8)|0x42; //lng_resp, wait_resp, start, CMD2

    //-- Check end of CMD2
    if(!Chk_CMDend(2, 1))
	goto RECMD2;
    rSDICSTA=0xa00;	// Clear cmd_end(with rsp)

    Uart_Printf("End id\n");

RECMD3:
    //--Send RCA
    rSDICARG=MMC<<16;	    // CMD3(MMC:Set RCA, SD:Ask RCA-->SBZ)
    rSDICCON=(0x1<<9)|(0x1<<8)|0x43;	// sht_resp, wait_resp, start, CMD3

    //-- Check end of CMD3
    if(!Chk_CMDend(3, 1))
	goto RECMD3;
    rSDICSTA=0xa00;	// Clear cmd_end(with rsp)

    //--Publish RCA
    if(MMC) {
	RCA=1;
        rSDIPRE=(PCLK/MMCCLK)-1;
        Uart_Printf("MMC Frequency is %dHz\n",(PCLK/(rSDIPRE+1)));
    	}
    else
    	{
			RCA=( rSDIRSP0 & 0xffff0000 )>>16;
		    Uart_Printf("RCA=0x%x\n",RCA);

			rSDIPRE=PCLK/(SDCLK)-1;	// Normal clock=25MHz
			Uart_Printf("SD Frequency is %dHz\n",(PCLK/(rSDIPRE+1)));
    	}	    //--State(stand-by) check
    if( rSDIRSP0 & 0x1e00!=0x600 )  // CURRENT_STATE check
	goto RECMD3;

    Uart_Printf("In stand-by\n");


    Card_sel_desel(1);	// Select

    if(!MMC)
	Set_4bit_bus();
    else
	Set_1bit_bus();

    return 1;
}
Exemple #4
0
int SD_card_init(void)
{
//-- SD controller & card initialize 
	int i;

	/* Important notice for MMC test condition */
	/* Cmd & Data lines must be enabled by pull up resister */

	SDIPRE=PCLK/(INICLK)-1;	// 400KHz
	//Uart_Printf("Init. Frequency is %dHz\n",(PCLK/(SDIPRE+1)));
    
	SDICON=(1<<4)|1;	// Type B, clk enable
	SDIFSTA=SDIFSTA|(1<<16);	//YH 040223 FIFO reset
	SDIBSIZE=0x200;		// 512byte(128word)
	SDIDTIMER=0x7fffff;		// Set timeout count

	for(i=0;i<0x1000;i++);  // Wait 74SDCLK for MMC card

	CMD0();
	//Uart_Printf("In idle\n");

	//-- Check SD card OCR
	if(!Chk_SD_OCR())
	{
		// fail
		GPBDAT = (~(2<<5));	 	// 点亮LED2
		//Uart_Printf("Initialize fail\nNo Card assertion\n");
		return 0;
	}

//	Uart_Printf("In SD ready\n");
	GPBDAT = (~(1<<5));	 	// 点亮LED1

	do
	{
		//-- Check attaced cards, it makes card identification state
		SDICARG = 0x0; // CMD2(stuff bit)
		SDICCON = (0x1 << 10) | (0x1 << 9) | (0x1 << 8) | (MAGIC_NUMBER | 2); //lng_resp, wait_resp, start, CMD2

		//-- Check end of CMD2
	} while (!Chk_CMDend(2, 1));

	SDICSTA=0xa00;	// Clear cmd_end(with rsp)

	//Uart_Printf("End id\n");

	do
	{
		//--Send RCA
		SDICARG = MMC << 16; // CMD3(MMC:Set RCA, SD:Ask RCA-->SBZ)
		SDICCON = (0x1 << 9) | (0x1 << 8) | (MAGIC_NUMBER | 3); // sht_resp, wait_resp, start, CMD3

		//-- Check end of CMD3
		if (!Chk_CMDend(3, 1))
			continue;
		SDICSTA = 0xa00; // Clear cmd_end(with rsp)

		//--Publish RCA
		RCA = (SDIRSP0 & 0xffff0000) >> 16;
		//Uart_Printf("RCA=0x%x\n",RCA);
		SDIPRE = PCLK / (SDCLK) - 1; // Normal clock=25MHz
		//Uart_Printf("SD Frequency is %dHz\n",(PCLK/(SDIPRE+1)));

		//--State(stand-by) check
		if (SDIRSP0 & 0x1e00 != 0x600) // CURRENT_STATE check
			continue;

	} while (0);
    
	//Uart_Printf("In stand-by\n");
    
	Card_sel_desel(1);	// Select

	Set_4bit_bus();

	return 1;
}
Exemple #5
0
}

/* specific hex commands */
static CmdDef hex_commands[] = {
    CMD1( KEY_CTRL_LEFT, KEY_NONE,
          "decrease-width", do_incr_width, -1)
    CMD1( KEY_CTRL_RIGHT, KEY_NONE,
          "increase-width", do_incr_width, 1)
    CMD2( KEY_NONE, KEY_NONE,
          "set-width", do_set_width, ESi,
          "ui{Width: }")
    CMD3( KEY_META('g'), KEY_NONE,
          "goto-byte", do_goto, ESsi, 'b',
          "us{Goto byte: }"
          "v")
    CMD0( KEY_NONE, KEY_NONE,
          "toggle-hex", do_toggle_hex)
    CMD_DEF_END,
};

static int ascii_mode_init(EditState *s, ModeSavedData *saved_data)
{
    QEFont *font;
    QEStyleDef style;
    int num_width;
    int ret;

    ret = text_mode_init(s, saved_data);
    if (ret)
        return ret;

    /* get typical number width */
Exemple #6
0
                                NULL /* completion */, 
                                latex_cmd_run, (void *)&latex_funcs[i]);
            } else {
                latex_cmd_run((void *)&latex_funcs[i], buf);
            }
            break;
        }
    }
    if(latex_funcs[i].name == 0)
        put_status(e, "%s: No match", buf);
    free(bname);
}

/* specific LaTeX commands */
static CmdDef latex_commands[] = {
    CMD0('\"', KEY_NONE, "tex-insert-quote", do_tex_insert_quote)
    /* this should actually be KEY_CTRLC(KEY_CTRL('c')), ie C-c C-c */
    CMD( KEY_CTRL('c'), KEY_NONE, "TeX-command-master\0s{Command: (default LaTeX) }[latex]|latex|", do_latex)
    CMD_DEF_END,
};

static int latex_init(void)
{
    /* LaTeX mode is almost like the text mode, so we copy and patch it */
    memcpy(&latex_mode, &text_mode, sizeof(ModeDef));
    latex_mode.name = "LaTeX";
    latex_mode.mode_probe = latex_mode_probe;
    latex_mode.mode_init = latex_mode_init;

    qe_register_mode(&latex_mode);
    qe_register_cmd_table(latex_commands, "LaTeX");
Exemple #7
0
    return 0;
}

static void bufed_mode_close(EditState *s)
{
    BufedState *hs;
    hs = s->mode_data;
    free_strings(&hs->items);

    list_mode.mode_close(s);
}

/* specific bufed commands */
static CmdDef bufed_commands[] = {
    CMD0( KEY_RET, KEY_RIGHT, "bufed-select", bufed_select)
    CMD1( KEY_CTRL('g'), KEY_NONE, "delete-window", do_delete_window, 0)
    CMD0( ' ', KEY_CTRL('t'), "bufed-toggle_selection", list_toggle_selection)
    CMD0( KEY_F8, KEY_NONE, "bufed-kill-buffer", bufed_kill_buffer)
    CMD_DEF_END,
};

static CmdDef bufed_global_commands[] = {
    CMD0( KEY_CTRLX(KEY_CTRL('b')), KEY_NONE, "list-buffers", do_list_buffers)
    CMD_DEF_END,
};

static int bufed_init(void)
{
    /* inherit from list mode */
    memcpy(&bufed_mode, &list_mode, sizeof(ModeDef));