Esempio n. 1
0
static void tty_native_scroll_up(tty_t t)
{
        if(!t->type==TTY_TYPE_MONO && !t->type==TTY_TYPE_COLOR)
                return;
        /* Bytes per row */
        int bpr = CONSOLE_COLS * 2;
        /* Rows on the screen */
        int rows = CONSOLE_ROWS;
        /* Back buffer */
        char* buffer = t->buffer;

        int x;
        for(x = rows - 1;x > 0;x--)
        {
                char* dst_row = buffer + (x * bpr);
                char* src_row = dst_row - bpr;
                memmove(dst_row, src_row, bpr);
        }
        /* Unset the first line */
        memset(buffer, 0, bpr);

        /* If this tty is active, print this immediatly. */
        if(t->active)
                tty_print_screen(t, t->buffer);
}
Esempio n. 2
0
static void tty_refresh_screen(tty_t t)
{
	if(t->type != TTY_TYPE_COLOR) return;

	int x;
	for(x = 0;x < (CONSOLE_ROWS * CONSOLE_COLS) - 1;x++)
	{
		/* Update back buffer */
			char* vid_addr = t->buffer
				+ (t->cursor_pos * 2);
			*(vid_addr + 1) = t->sgr.color;
	}

	if(t->active)
		tty_print_screen(t, t->buffer);
}
Esempio n. 3
0
void get_config()
{
	int flag = 0, sflag = 0, i, prt = 0;
        int reprint_screen = 0;
	ulong page;
#if NMOD_FRAMEBUFFER > 0
	stop_record();
#endif
	popup();
	wait_keyup();
	while(!flag) {
		cprint(POP_Y+1,  POP_X+2, "Configuration:");
		cprint(POP_Y+3,  POP_X+6, "(1) Test Selection");
		cprint(POP_Y+4,  POP_X+6, "(2) Address Range");
		cprint(POP_Y+5,  POP_X+6, "(3) Memory Sizing");
		cprint(POP_Y+6,  POP_X+6, "(4) Error Summary");
		cprint(POP_Y+7,  POP_X+6, "(5) Error Report Mode");
		cprint(POP_Y+8,  POP_X+6, "(6) ECC Mode"); 
		cprint(POP_Y+9,  POP_X+6, "(7) Restart");
		cprint(POP_Y+10, POP_X+6, "(8) Refresh Screen");
		cprint(POP_Y+11, POP_X+6, "(9) Adv. Options");
		cprint(POP_Y+12,POP_X+6,"(0) Continue");

		/* Wait for key release */
		/* Fooey! This nuts'es up the serial input. */
		sflag = 0;
		switch(get_key()) {
		case 2:
			/* 1 - Test Selection */
			popclear();
			cprint(POP_Y+1, POP_X+2, "Test Selection:");
			cprint(POP_Y+3, POP_X+6, "(1) Default Tests");
			cprint(POP_Y+4, POP_X+6, "(2) Skip Current Test");
			cprint(POP_Y+5, POP_X+6, "(3) Select Test");
			cprint(POP_Y+6, POP_X+6, "(4) Select Bit Fade Test");
			cprint(POP_Y+7, POP_X+6, "(0) Continue");
			if (v->testsel < 0) {
				cprint(POP_Y+3, POP_X+5, ">");
			} else {
				cprint(POP_Y+5, POP_X+5, ">");
			}
			wait_keyup();
			while (!sflag) {
				switch(get_key()) {
				case 2:
					/* Default */
					if (v->testsel == 9) {
						bail++;
					}
					v->testsel = -1;
					find_ticks();
					sflag++;
					cprint(LINE_INFO, COL_TST, "Std");
					break;
				case 3:
					/* Skip test */
					bail++;
					sflag++;
					break;
				case 4:
					/* Select test */
					popclear();
					cprint(POP_Y+1, POP_X+3,
						"Test Selection:");
					cprint(POP_Y+4, POP_X+5,
						"Test Number [0-9]: ");
					i = getval(POP_Y+4, POP_X+24, 0);
					if (i <= 9) {
						if (i != v->testsel) {
							v->pass = -1;
							v->test = -1;
						}
						v->testsel = i;
					}
					find_ticks();
					sflag++;
					bail++;
					cprint(LINE_INFO, COL_TST, "#");
					dprint(LINE_INFO, COL_TST+1, i, 2, 1);
					break;
				case 5:
					if (v->testsel != 9) {
						v->pass = -1;
						v->test = -1;
					}
					v->testsel = 9;
                                        find_ticks();
                                        sflag++;
                                        bail++;
                                        cprint(LINE_INFO, COL_TST, "#");
                                        dprint(LINE_INFO, COL_TST+1, 9, 2, 1);
                                        break;
				case 11:
				case 57:
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 3:
			/* 2 - Address Range */
			popclear();
			cprint(POP_Y+1, POP_X+2, "Test Address Range:");
			cprint(POP_Y+3, POP_X+6, "(1) Set Lower Limit");
			cprint(POP_Y+4, POP_X+6, "(2) Set Upper Limit");
			cprint(POP_Y+5, POP_X+6, "(3) Test All Memory");
			cprint(POP_Y+6, POP_X+6, "(0) Continue");
			wait_keyup();
			while (!sflag) {
				switch(get_key()) {
				case 2:
					/* Lower Limit */
					popclear();
					cprint(POP_Y+2, POP_X+4,
						"Lower Limit: ");
					cprint(POP_Y+4, POP_X+4,
						"Current: ");
					aprint(POP_Y+4, POP_X+13, v->plim_lower);
					cprint(POP_Y+6, POP_X+4,
						"New: ");
					page = getval(POP_Y+6, POP_X+9, 12);
					if (page + 1 <= v->plim_upper) {
						v->plim_lower = page;
						bail++;
					}
					adj_mem();
					find_ticks();
					sflag++;
					break;
				case 3:
					/* Upper Limit */
					popclear();
					cprint(POP_Y+2, POP_X+4,
						"Upper Limit: ");
					cprint(POP_Y+4, POP_X+4,
						"Current: ");
					aprint(POP_Y+4, POP_X+13, v->plim_upper);
					cprint(POP_Y+6, POP_X+4,
						"New: ");
					page = getval(POP_Y+6, POP_X+9, 12);
					if  (page - 1 >= v->plim_lower) {
						v->plim_upper = page;
						bail++;
					}
					adj_mem();
					find_ticks();
					sflag++;
					break;
				case 4:
					/* All of memory */
					v->plim_lower = 0;
					v->plim_upper = v->pmap[v->msegs - 1].end;
					bail++;
					adj_mem();
					find_ticks();
					sflag++;
					break;
				case 11:
				case 57:
					/* 0/CR - Continue */
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 4:
			/* 3 - Memory Sizing */
			popclear();
			cprint(POP_Y+1, POP_X+2, "Memory Sizing:");
			cprint(POP_Y+3, POP_X+6, "(1) BIOS - Std");
			if (e820_nr) {
				cprint(POP_Y+4, POP_X+6, "(2) BIOS - All");
				cprint(POP_Y+5, POP_X+6, "(3) Probe");
				cprint(POP_Y+6, POP_X+6, "(0) Continue");
				cprint(POP_Y+2+memsz_mode, POP_X+5, ">");
			} else {
				cprint(POP_Y+4, POP_X+6, "(3) Probe");
				cprint(POP_Y+5, POP_X+6, "(0) Continue");
				if (memsz_mode == SZ_MODE_BIOS) {
					cprint(POP_Y+3, POP_X+5, ">");
				} else {
					cprint(POP_Y+4, POP_X+5, ">");
				}
			}
			wait_keyup();
			while (!sflag) {
				switch(get_key()) {
				case 2:
					memsz_mode = SZ_MODE_BIOS;
					wait_keyup();
					restart();
/*
					mem_size();
					v->test = 0;
					v->pass = 0;
					v->total_ticks = 0;
					bail++;
					sflag++;
*/
					break;
				case 3:
					memsz_mode = SZ_MODE_BIOS_RES;
					wait_keyup();
					restart();
/*
					mem_size();
					v->test = 0;
					v->pass = 0;
					v->total_ticks = 0;
					bail++;
					sflag++;
*/
					break;
				case 4:
					memsz_mode = SZ_MODE_PROBE;
					wait_keyup();
					restart();
/*
					mem_size();
					v->test = 0;
					v->pass = 0;
					v->total_ticks = 0;
					bail++;
					sflag++;
*/
					break;
				case 11:
				case 57:
					/* 0/CR - Continue */
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 5:
			/* 4 - Show error summary */
			popclear();
			for (i=0; tseq[i].msg != NULL; i++) {
				cprint(POP_Y+1+i, POP_X+2, "Test:");
				dprint(POP_Y+1+i, POP_X+8, i, 2, 1);
				cprint(POP_Y+1+i, POP_X+12, "Errors:");
				dprint(POP_Y+1+i, POP_X+20, tseq[i].errors,
					5, 1);
			}
			wait_keyup();
			while (get_key() == 0);
			popclear();
			break;
		case 6:
			/* 5 - Printing Mode */
			popclear();
			cprint(POP_Y+1, POP_X+2, "Printing Mode:");
			cprint(POP_Y+3, POP_X+6, "(1) Individual Errors");
			cprint(POP_Y+4, POP_X+6, "(2) BadRAM Patterns");
			cprint(POP_Y+5, POP_X+6, "(3) Error Counts Only");
			cprint(POP_Y+6, POP_X+6, "(0) Continue");
			cprint(POP_Y+3+v->printmode, POP_X+5, ">");
			wait_keyup();
			while (!sflag) {
				switch(get_key()) {
				case 2:
					/* Separate Addresses */
					v->printmode=PRINTMODE_ADDRESSES;
					v->eadr = 0;
					sflag++;
					break;
				case 3:
					/* BadRAM Patterns */
					v->printmode=PRINTMODE_PATTERNS;
					sflag++;
					prt++;
					break;
				case 4:
					/* Error Counts Only */
					v->printmode=PRINTMODE_NONE;
					sflag++;
					break;
				case 11:
				case 57:
					/* 0/CR - Continue */
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 7:
			/* 6 - ECC Polling Mode */
			popclear();
			cprint(POP_Y+1, POP_X+2, "ECC Polling Mode:");
			cprint(POP_Y+3, POP_X+6, "(1) Recommended");
			cprint(POP_Y+4, POP_X+6, "(2) On");
			cprint(POP_Y+5, POP_X+6, "(3) Off");
			cprint(POP_Y+6, POP_X+6, "(0) Continue");
			wait_keyup();
			while(!sflag) {
				switch(get_key()) {
				case 2:
					set_ecc_polling(-1);
					sflag++;
					break;
				case 3:
					set_ecc_polling(1);
					sflag++;
					break;
				case 4:
					set_ecc_polling(0);
					sflag++;
					break;
				case 11:
				case 57:
					/* 0/CR - Continue */
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 8:
			wait_keyup();
			restart();
			break;
		case 9:
			reprint_screen = 1;
			flag++;
			break;
                case 10:
			get_menu();
			break;
		case 11:
		case 57:
		case 28:
			/* 0/CR/SP - Continue */
			flag++;
			break;
		}
	}
	popdown();
	if (prt) {
		printpatn();
	}
        if (reprint_screen){
            tty_print_screen();
        }
}
void get_config()
{
	int flag = 0, sflag = 0, i, prt = 0;
        int reprint_screen = 0;
	ulong page;

	popup();
	wait_keyup();
	while(!flag) {
		cprint(POP_Y+1,  POP_X+2, "Settings:");
		cprint(POP_Y+3,  POP_X+6, "(1) Test Selection");
		cprint(POP_Y+4,  POP_X+6, "(2) Address Range");
		cprint(POP_Y+5,  POP_X+6, "(3) Memory Sizing");
		cprint(POP_Y+6,  POP_X+6, "(4) Error Report Mode");
		cprint(POP_Y+7,  POP_X+6, "(5) Show DMI Memory Info");
		cprint(POP_Y+8,  POP_X+6, "(6) ECC Mode"); 
		cprint(POP_Y+9,  POP_X+6, "(7) Restart");
		cprint(POP_Y+10, POP_X+6, "(8) Refresh Screen");
		//cprint(POP_Y+11, POP_X+6, "(9) Display SPD Data");
		cprint(POP_Y+11,  POP_X+6, "(9) Display Consecutive");
		cprint(POP_Y+12,  POP_X+6, "    Failing Address Data");
		cprint(POP_Y+13, POP_X+6, "(0) Continue");

		/* Wait for key release */
		/* Fooey! This nuts'es up the serial input. */
		sflag = 0;
		switch(get_key()) {
		case 2:
			/* 1 - Test Selection */
			popclear();
			cprint(POP_Y+1, POP_X+2, "Test Selection:");
			cprint(POP_Y+3, POP_X+6, "(1) Default Tests");
			cprint(POP_Y+4, POP_X+6, "(2) Skip Current Test");
			cprint(POP_Y+5, POP_X+6, "(3) Select Test");
			cprint(POP_Y+6, POP_X+6, "(4) Select Bit Fade Test");
			//cprint(POP_Y+7, POP_X+6, "(5) Select Uncached Test");
			cprint(POP_Y+8, POP_X+6, "(0) Continue");
			if (v->testsel < 0) {
				cprint(POP_Y+3, POP_X+5, ">");
			} else {
				cprint(POP_Y+5, POP_X+5, ">");
			}
			wait_keyup();
			while (!sflag) {
				switch(get_key()) {
				case 2:
					/* Default */
					if (v->testsel >= 9) {
						bail++;
					}
					v->testsel = -1;
					find_ticks_for_pass();
					sflag++;
					cprint(LINE_INFO, COL_TST, "Std");
					break;
				case 3:
					/* Skip test */
					bail++;
					sflag++;
					break;
				case 4:
					/* Select test */
					popclear();
					cprint(POP_Y+1, POP_X+3,
						"Test Selection:");
					cprint(POP_Y+4, POP_X+5,
						"Test Number [0-9]: ");
					i = getval(POP_Y+4, POP_X+24, 0);
					if (i <= 9) {
						if (i != v->testsel) {
							v->pass = -1;
							v->test = -1;
						}
						v->testsel = i;
					}
					find_ticks_for_pass();
					sflag++;
					bail++;
					cprint(LINE_INFO, COL_TST, "#");
					dprint(LINE_INFO, COL_TST+1, i, 2, 1);
					break;
				case 5:
					if (v->testsel != 9) {
						v->pass = -1;
						v->test = -1;
					}
					v->testsel = 9;
					find_ticks_for_pass();
					sflag++;
					bail++;
					cprint(LINE_INFO, COL_TST, "#");
					dprint(LINE_INFO, COL_TST+1, 9, 3, 1);
					break;
/*
				case 6:
					if (v->testsel != 10) {
						v->pass = -1;
						v->test = -1;
					}
					v->testsel = 9+1;
					find_ticks_for_pass();
					sflag++;
					bail++;
					cprint(LINE_INFO, COL_TST, "#");
					dprint(LINE_INFO, COL_TST+1, 10, 3, 1);
					break;
*/					
				case 11:
				case 57:
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 3:
			/* 2 - Address Range */
			popclear();
			cprint(POP_Y+1, POP_X+2, "Test Address Range:");
			cprint(POP_Y+3, POP_X+6, "(1) Set Lower Limit");
			cprint(POP_Y+4, POP_X+6, "(2) Set Upper Limit");
			cprint(POP_Y+5, POP_X+6, "(3) Test All Memory");
			cprint(POP_Y+6, POP_X+6, "(0) Continue");
			wait_keyup();
			while (!sflag) {
				switch(get_key()) {
				case 2:
					/* Lower Limit */
					popclear();
					cprint(POP_Y+2, POP_X+4,
						"Lower Limit: ");
					cprint(POP_Y+4, POP_X+4,
						"Current: ");
					aprint(POP_Y+4, POP_X+13, v->plim_lower);
					cprint(POP_Y+6, POP_X+4,
						"New: ");
					page = getval(POP_Y+6, POP_X+9, 12);
					if (page + 1 <= v->plim_upper) {
						v->plim_lower = page;
						v->test--;
						bail++;
					}
					adj_mem();
					find_ticks_for_pass();
					sflag++;
					break;
				case 3:
					/* Upper Limit */
					popclear();
					cprint(POP_Y+2, POP_X+4,
						"Upper Limit: ");
					cprint(POP_Y+4, POP_X+4,
						"Current: ");
					aprint(POP_Y+4, POP_X+13, v->plim_upper);
					cprint(POP_Y+6, POP_X+4,
						"New: ");
					page = getval(POP_Y+6, POP_X+9, 12);
					if  (page - 1 >= v->plim_lower) {
						v->plim_upper = page;
						v->test--;
						bail++;
					}
					adj_mem();
					find_ticks_for_pass();
					sflag++;
					break;
				case 4:
					/* All of memory */
					v->plim_lower = 0;
					v->plim_upper = v->pmap[v->msegs - 1].end;
					v->test--;
					bail++;
					adj_mem();
					find_ticks_for_pass();
					sflag++;
					break;
				case 11:
				case 57:
					/* 0/CR - Continue */
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 4:
			/* 3 - Memory Sizing */
			popclear();
			cprint(POP_Y+1, POP_X+2, "Memory Sizing:");
			cprint(POP_Y+3, POP_X+6, "(1) BIOS - Std");
				cprint(POP_Y+4, POP_X+6, "(2) Probe");
				cprint(POP_Y+5, POP_X+6, "(0) Continue");
			if(!e820_nr){
				if (memsz_mode == SZ_MODE_BIOS) {
					cprint(POP_Y+3, POP_X+5, ">");
				} else {
					cprint(POP_Y+4, POP_X+5, ">");
				}
			}
			wait_keyup();
			while (!sflag) {
				switch(get_key()) {
				case 2:
					memsz_mode = SZ_MODE_BIOS;
					wait_keyup();
					restart();

					break;
				case 3:
					memsz_mode = SZ_MODE_PROBE;
					wait_keyup();
					restart();

					break;
				case 11:
				case 57:
					/* 0/CR - Continue */
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 5:
			/* 4 - Show error Mode */
			popclear();
			cprint(POP_Y+1, POP_X+2, "Printing Mode:");
			cprint(POP_Y+3, POP_X+6, "(1) Error Summary");
			cprint(POP_Y+4, POP_X+6, "(2) Individual Errors");
			cprint(POP_Y+5, POP_X+6, "(3) BadRAM Patterns");
			cprint(POP_Y+6, POP_X+6, "(4) Error Counts Only");
			cprint(POP_Y+7, POP_X+6, "(5) DMI Device Name");
			cprint(POP_Y+8, POP_X+6, "(6) Beep on Error");
			cprint(POP_Y+10, POP_X+6, "(0) Cancel");
			cprint(POP_Y+3+v->printmode, POP_X+5, ">");
			if (beepmode) { cprint(POP_Y+8, POP_X+5, ">"); }
			wait_keyup();
			while (!sflag) {
								switch(get_key()) {
				case 2:
					/* Error Summary */
					v->printmode=PRINTMODE_SUMMARY;
					v->erri.eadr = 0;
					v->erri.hdr_flag = 0;
					sflag++;
					break;
				case 3:
					/* Separate Addresses */
					v->printmode=PRINTMODE_ADDRESSES;
					v->erri.eadr = 0;
					v->erri.hdr_flag = 0;
					v->msg_line = LINE_SCROLL-1;
					sflag++;
					break;
				case 4:
					/* BadRAM Patterns */
					v->printmode=PRINTMODE_PATTERNS;
					v->erri.hdr_flag = 0;
					sflag++;
					prt++;
					break;
				case 5:
					/* Error Counts Only */
					v->printmode=PRINTMODE_NONE;
					v->erri.hdr_flag = 0;
					sflag++;
					break;
				case 6:
					/* Error Counts Only */
					v->printmode=PRINTMODE_DMI;
					v->erri.hdr_flag = 0;
					sflag++;
					break;
				case 7:
					/* Set Beep On Error mode */
					beepmode = !beepmode;
					sflag++;
					break;					
				case 11:
				case 57:
					/* 0/CR - Continue */
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 6:
			/* Display DMI Memory Info */
			pop2up();
      print_dmi_info();
			pop2down();
      break;
		case 7:
			/* 6 - ECC Polling Mode */
			popclear();
			cprint(POP_Y+1, POP_X+2, "ECC Polling Mode:");
			cprint(POP_Y+3, POP_X+6, "(1) Recommended");
			cprint(POP_Y+4, POP_X+6, "(2) On");
			cprint(POP_Y+5, POP_X+6, "(3) Off");
			cprint(POP_Y+6, POP_X+6, "(0) Continue");
			wait_keyup();
			while(!sflag) {
				switch(get_key()) {
				case 2:
					set_ecc_polling(-1);
					sflag++;
					break;
				case 3:
					set_ecc_polling(1);
					sflag++;
					break;
				case 4:
					set_ecc_polling(0);
					sflag++;
					break;
				case 11:
				case 57:
					/* 0/CR - Continue */
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 8:
			wait_keyup();
			restart();
			break;
		case 9:
			reprint_screen = 1;
			flag++;
			break;
		case 10:
            //XXX was spddata
			//popdown();
			//show_spd();
			//popup();
			//sflag++;
            //XXX was spddata ^

            //Display Failing Address Data
			popclear();
			wait_keyup();
            int err_idx = 0;
			cprint(POP_Y+1, POP_X+2, "Consecutive Failing Addresses:");
			cprint(POP_Y+3, POP_X+14, " of ");
			dprint(POP_Y+3, POP_X+19, v->err_range.size,4,0);
			cprint(POP_Y+5, POP_X+6, "Errors in range: ");
			cprint(POP_Y+6, POP_X+6, "Range Stride: ");
			cprint(POP_Y+7, POP_X+6, "High Address: 0x");
			cprint(POP_Y+8, POP_X+6, "Low Address:  0x");
			cprint(POP_Y+9, POP_X+6, "Histogram of faulty bits: <-bit 31, bit 0 ->");

			cprint(POP_Y+12, POP_X+6, "Hit 1 to Continue, 0 to quit"); //option 1
			//cprint(POP_Y+12, POP_X+6, "Hit a key to Continue"); //option 2

            i = 1;
            int j = 0;
            int mag;
            ulong h;
            //loop through all records
            while ((i==1) && (err_idx<v->err_range.size)){
                dprint(POP_Y+3, POP_X+6, err_idx+1,8,0);//number
                hprint(POP_Y+5, POP_X+22, v->err_range.ranges[err_idx].count_per_range);//err count per range
                hprint(POP_Y+6, POP_X+22, v->err_range.ranges[err_idx].range_stride);//stride per range
                hprint(POP_Y+7, POP_X+22, v->err_range.ranges[err_idx].high_addr);//high addr
                hprint(POP_Y+8, POP_X+22, v->err_range.ranges[err_idx].low_addr);//low addr
                //print histogram
                for (j=0;j<32;j++){
                    mag = 0;
                    h = v->err_range.ranges[err_idx].hist[j];
                    while (h>0){
                        mag++;
                        h = h>>1;
                    }
                    dprint(POP_Y+10, POP_X+6+(j*5), mag,4,0);
                }
                i = getval(POP_Y+12, POP_X+34, 0); //option 1
			    //wait_keyup(); //option 2
                err_idx++;
            }
			//popup();
			popclear();
			sflag++;

			break;
		case 11:
		case 57:
		case 28:
			/* 0/CR/SP - Continue */
			flag++;
			break;
		}
	}
	popdown();
	if (prt) {
		printpatn();
	}
	if (reprint_screen){
		tty_print_screen();
	}
}
Esempio n. 5
0
void get_config()
{
	int flag = 0, sflag = 0, i, j, k, n, m, prt = 0;
  int reprint_screen = 0;
  char cp[64];
	ulong page;

	popup();
	wait_keyup();
	while(!flag) {
		cprint(POP_Y+1,  POP_X+2, "Settings:");
		cprint(POP_Y+3,  POP_X+4, "(1) Select wat MEMEZ to test");
		cprint(POP_Y+4,  POP_X+4, "(2) Address Range");
		cprint(POP_Y+5,  POP_X+4, "(3) O NOES ERRORZ Mode");
		cprint(POP_Y+6,  POP_X+4, "(4) Select with COREZ 2 test");
		cprint(POP_Y+7,  POP_X+4, "(5) Refresh Screen");
		cprint(POP_Y+8,  POP_X+4, "(6) DISPLYUZ DMI DATUZ");
		cprint(POP_Y+9,  POP_X+4, "(7) such RAM much SPD");
		cprint(POP_Y+11, POP_X+4,	"(0) Continue rowHAMMER TIME");

		/* Wait for key release */
		/* Fooey! This nuts'es up the serial input. */
		sflag = 0;
		switch(get_key()) {
		case 2:
			/* 1 - Test Selection */
			popclear();
			cprint(POP_Y+1, POP_X+2, "Test Selection:");
			cprint(POP_Y+3, POP_X+6, "(1) Default Tests");
			cprint(POP_Y+4, POP_X+6, "(2) Skip Current Test");
			cprint(POP_Y+5, POP_X+6, "(3) Select Test");
		  cprint(POP_Y+6, POP_X+6, "(4) Enter Test List");
			cprint(POP_Y+7, POP_X+6, "(0) Cancel");
			if (v->testsel < 0) {
				cprint(POP_Y+3, POP_X+5, ">");
			} else {
				cprint(POP_Y+5, POP_X+5, ">");
			}
			wait_keyup();
			while (!sflag) {
				switch(get_key()) {
				case 2:
					/* Default - All tests */
					i = 0;
					while (tseq[i].cpu_sel) {
					    tseq[i].sel = 1;
					    i++;
					}
					find_ticks_for_pass();
					sflag++;
					break;
				case 3:
					/* Skip test */
					bail++;
					sflag++;
					break;
				case 4:
					/* Select test */
					popclear();
					cprint(POP_Y+1, POP_X+3,
						"Test Selection:");
					cprint(POP_Y+4, POP_X+5,
						"Test Number [1-11]: ");
					n = getval(POP_Y+4, POP_X+24, 0) - 1;
					if (n <= 11) 
						{
					    /* Deselect all tests */
					    i = 0;
					    while (tseq[i].cpu_sel) {
					        tseq[i].sel = 0;
					        i++;
					    }
					    /* Now set the selection */
					    tseq[n].sel = 1;
					    v->pass = -1;
					    test = n;
					    find_ticks_for_pass();
					    sflag++;
          		bail++;
						}
					break;
				case 5:
					/* Enter a test list */
					popclear();
					cprint(POP_Y+1, POP_X+3,
				"Enter a comma separated list");
					cprint(POP_Y+2, POP_X+3,
				"of tests to execute:");
					cprint(POP_Y+5, POP_X+5, "List: ");
					/* Deselect all tests */
					k = 0;
					while (tseq[k].cpu_sel) {
					    tseq[k].sel = 0;
					    k++;
					}

					/* Get the list */
					for (i=0; i<64; i++) cp[i] = 0;
					get_list(POP_Y+5, POP_X+10, 64, cp);

					/* Now enable all of the tests in the
					 * list */
					i = j = m = 0;
					while (1) {
					    if (isdigit(cp[i])) {
						n = cp[i]-'0';
						j = j*10 + n;
						i++;
						if (cp[i] == ',' || cp[i] == 0){
						    if (j < k) {
							tseq[j].sel = 1;
							m++;
						    }
						    if (cp[i] == 0) break;
						    j = 0;
						    i++;
						}
					    }
					}

					/* If we didn't select at least one
					 * test turn them all back on */
					if (m == 0) {
					    k = 0;
					    while (tseq[k].cpu_sel) {
					        tseq[k].sel = 1;
					        k++;
					    }
					}
					v->pass = -1;
					test = n;
					find_ticks_for_pass();
					sflag++;
          bail++;
					break;
				case 11:
				case 57:
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 3:
			/* 2 - Address Range */
			popclear();
			cprint(POP_Y+1, POP_X+2, "rowHAMMER TIME Address Range:");
			cprint(POP_Y+3, POP_X+6, "(1) Set Lower Limit");
			cprint(POP_Y+4, POP_X+6, "(2) Set Upper Limit");
			cprint(POP_Y+5, POP_X+6, "(3) Test All Memory");
			cprint(POP_Y+6, POP_X+6, "(0) Cancel");
			wait_keyup();
			while (!sflag) {
				switch(get_key()) {
				case 2:
					/* Lower Limit */
					popclear();
					cprint(POP_Y+2, POP_X+4,
						"Lower Limit: ");
					cprint(POP_Y+4, POP_X+4,
						"Current: ");
					aprint(POP_Y+4, POP_X+13, v->plim_lower);
					cprint(POP_Y+6, POP_X+4,
						"New: ");
					page = getval(POP_Y+6, POP_X+9, 12);
					if (page + 1 <= v->plim_upper) {
						v->plim_lower = page;
						test--;
						bail++;
					}
					adj_mem();
					find_chunks();
					find_ticks_for_pass();
					sflag++;
					break;
				case 3:
					/* Upper Limit */
					popclear();
					cprint(POP_Y+2, POP_X+4,
						"Upper Limit: ");
					cprint(POP_Y+4, POP_X+4,
						"Current: ");
					aprint(POP_Y+4, POP_X+13, v->plim_upper);
					cprint(POP_Y+6, POP_X+4,
						"New: ");
					page = getval(POP_Y+6, POP_X+9, 12);
					if  (page - 1 >= v->plim_lower) {
						v->plim_upper = page;
						bail++;
						test--;
					}
					adj_mem();
					find_chunks();
					find_ticks_for_pass();
					sflag++;
					break;
				case 4:
					/* All of memory */
					v->plim_lower = 0;
					v->plim_upper =
						v->pmap[v->msegs - 1].end;
					test--;
					bail++;
					adj_mem();
					find_chunks();
					find_ticks_for_pass();
					sflag++;
					break;
				case 11:
				case 57:
					/* 0/CR - Continue */
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 4:
			/* Error Mode */
			popclear();
			cprint(POP_Y+1, POP_X+2, "Printing Mode:");
			cprint(POP_Y+3, POP_X+6, "(1) O NOES ALL ERRORZ");
			cprint(POP_Y+4, POP_X+6, "(2) O NOES ONE ERRORZ");
			cprint(POP_Y+5, POP_X+6, "(3) BadRAM Patterns. BADRAM");
			cprint(POP_Y+6, POP_X+6, "(4) O NOES HOW MANYZ ERRORZ");
			cprint(POP_Y+7, POP_X+6, "(5) BEEP BEEP BEEP ERRORZ");
			cprint(POP_Y+8, POP_X+6, "(0) GTFO");
			cprint(POP_Y+3+v->printmode, POP_X+5, ">");
			if (beepmode) { cprint(POP_Y+7, POP_X+5, ">"); }
			wait_keyup();
			while (!sflag) {
				switch(get_key()) {
				case 2:
					/* Error Summary */
					v->printmode=PRINTMODE_SUMMARY;
					v->erri.eadr = 0;
					v->erri.hdr_flag = 0;
					sflag++;
					break;
				case 3:
					/* Separate Addresses */
					v->printmode=PRINTMODE_ADDRESSES;
					v->erri.eadr = 0;
					v->erri.hdr_flag = 0;
					v->msg_line = LINE_SCROLL-1;
					sflag++;
					break;
				case 4:
					/* BadRAM Patterns */
					v->printmode=PRINTMODE_PATTERNS;
					v->erri.hdr_flag = 0;
					sflag++;
					prt++;
					break;
				case 5:
					/* Error Counts Only */
					v->printmode=PRINTMODE_NONE;
					v->erri.hdr_flag = 0;
					sflag++;
					break;
				case 6:
					/* Set Beep On Error mode */
					beepmode = !beepmode;
					sflag++;
					break;						
				case 11:
				case 57:
					/* 0/CR - Continue */
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 5:
    			/* CPU Mode */
    	reprint_screen = 1;
			popclear();
			cprint(POP_Y+1, POP_X+2, "BRAINE Selection Mode:");
			cprint(POP_Y+3, POP_X+6, "(1) Parallel (All)");
			cprint(POP_Y+4, POP_X+6, "(2) Round Robin Hood (RRbH)");
			cprint(POP_Y+5, POP_X+6, "(3) Sequential (Seq)");
			cprint(POP_Y+6, POP_X+6, "(0) NOPE BYE");
			cprint(POP_Y+2+cpu_mode, POP_X+5, ">");
			wait_keyup();
			while(!sflag) {
				switch(get_key()) {
				case 2:
					if (cpu_mode != CPM_ALL) bail++;
					cpu_mode = CPM_ALL;
					sflag++;
					popdown();
					cprint(9,34,"All");
					popup();
					break;
				case 3:
					if (cpu_mode != CPM_RROBIN) bail++;
					cpu_mode = CPM_RROBIN;
					sflag++;
					popdown();
					cprint(9,34,"RRb");
					popup();
					break;
				case 4:
					if (cpu_mode != CPM_SEQ) bail++;
					cpu_mode = CPM_SEQ;
					sflag++;
					popdown();
					cprint(9,34,"Seq");
					popup();
					break;
				case 11:
				case 57:
					/* 0/CR - Continue */
					sflag++;
					break;
				}
			}
			popclear();
			break;
		case 6:
			reprint_screen = 1;
			flag++;
			break;
		case 7:
			/* Display DMI Memory Info */
			pop2up();
      print_dmi_info();
			pop2down();			
			break;
		case 8:
			/* Display SPD Data */			
			popdown();
			show_spd();
			popup();
			sflag++;
			break;
		case 11:
		case 57:
		case 28:
			/* 0/CR/SP - Continue */
			flag++;
			break;
		}
	}
	popdown();
	if (prt) {
		printpatn();
	}
        if (reprint_screen){
            tty_print_screen();
        }
}