Example #1
0
bool
Eval_If(char *commands[])
{

    STATUS                 eval_err ;
    char                   buffer [128] ;
    char                  *tokptr [12] ;
    register i4            tok_ctr = 0 ;
    i4                     answer = TRUE ;


    for (tok_ctr=0; tok_ctr<12; tok_ctr++) tokptr[tok_ctr] = 0;

    *buffer = EOS;
    for (tok_ctr=2; commands[tok_ctr]; tok_ctr++)
	STcat(buffer, commands[tok_ctr]);	/* Condense the expression. */


    *msg = EOS;

    answer = SEP_Eval_If( buffer, &eval_err, msg);

    if (eval_err != OK)
    {
	testGrade = FAIL;
	if (*msg == EOS)
	{
	    disp_line(STpolycat(4,ErrC,ERx("Evaluate Expresion <"),buffer,
				ERx(">"),msg),0,0);
	}
	else
	{
	    disp_line(msg,0,0);
	}
	append_line(msg,1);
        return(FAIL);
    }

    if (answer == TRUE)
    {
	return (TRUE);
    }
    else
    {
	return (FALSE);
    }

}
Example #2
0
/*
**  create_comment ()
*/
STATUS
create_comment ()
{
    STATUS                 ret_val ;
    FILE                  *tmpf = NULL ;

    if ((ret_val = bld_cmtName(msg)) != OK)
    {
        disp_line(msg, 0, 0);
    }
    else
    {
        if (SIfopen(cmtLoc, ERx("a"), SI_TXT, TERM_LINE, &tmpf) == OK)
        {
            SIclose(tmpf);
        }
        edit_file(cmtName);
        fix_cursor();
        TDclear(curscr);
        TDtouchwin(mainW);
        TDrefresh(mainW);
    }

    return (ret_val);

} /* end of create_comment */
Example #3
0
/* Plot motion vector */
static void mv(int x0, int y0, int16_t dmv[2], int ref, int zoom, char *col)
{
    int dx = dmv[0];
    int dy = dmv[1];
    int i;

    dx = (dx * zoom + 2) >> 2;                     /* Quarter pixel accurate MVs */
    dy = (dy * zoom + 2) >> 2;
    disp_line(0, x0, y0, x0+dx, y0+dy);
    for (i=1; i<ref; i++){
        disp_line(0, x0, y0-i, x0+i, y0);
        disp_line(0, x0+i, y0, x0, y0+i);
        disp_line(0, x0, y0+i, x0-i, y0);
        disp_line(0, x0-i, y0, x0, y0-i);
    }
    disp_setcolor("black");
    disp_point(0, x0, y0);
    disp_setcolor(col);
}
Example #4
0
void printfloat(double i, int row, int col){

     if (row<=TERM_HEIGHT && col<=TERM_WIDTH) disp_at(row, col);
        else printf("chyba"); 
     char buffer[50];
     int cx;
     cx = snprintf (buffer, 50, "%f", i);
     if (row==TERM_HEIGHT && (TERM_WIDTH-col)<strlen(buffer)) printf("chyba");
        else disp_line(buffer);
} 
Example #5
0
void printint(int i, int row, int col){

     if (row<=TERM_HEIGHT && col<=TERM_WIDTH) disp_at(row, col);
        else printf("chyba"); 
     char buffer[7];
     int cx;
     cx = snprintf (buffer, 7, "%d", i);
     if (row==TERM_HEIGHT && (TERM_WIDTH-col)<strlen(buffer)) printf("chyba");
        else disp_line(buffer);
}
Example #6
0
static void scene_show_exif(void)
{
	if (!config.imginfobar
		|| !(config.load_exif && exif_array && exif_array->used > 0)) {
		short b;

		dword top =
			(PSP_SCREEN_HEIGHT - thumb_height) / 2, bottom = top + thumb_height;
		dword thumbl = 0, thumbr = 0, thumbt = 0, thumbb = 0;

		if (paintleft > 0) {
			thumbl = 0;
			thumbr = thumb_width - 1;
		} else {
			thumbl = curleft * thumb_width / width_rotated;
			thumbr =
				(curleft + PSP_SCREEN_WIDTH - 1) * thumb_width / width_rotated;
		}

		if (painttop > 0) {
			thumbt = 0;
			thumbb = thumbb - 1;
		} else {
			thumbt = curtop * thumb_height / height_rotated;
			thumbb = (curtop + imgh - 1) * thumb_height / height_rotated;
		}

		disp_putimage(32, top, thumb_width, thumb_height, 0, 0, thumbimg);
		disp_line(34, bottom, 32 + thumb_width, bottom, 0);
		disp_line(32 + thumb_width, top + 2, 32 + thumb_width, bottom - 1, 0);
		disp_rectangle(33 + thumbl, top + thumbt + 1,
					   33 + thumbr, top + thumbb + 1, 0);
		b = 75 - config.imgbrightness > 0 ? 75 - config.imgbrightness : 0;
		disp_rectangle(32 + thumbl, top + thumbt, 32 + thumbr,
					   top + thumbb, disp_grayscale(COLOR_WHITE, 0, 0, 0, b));
	}
}
Example #7
0
/*
**  bld_cmtName ()
*/
STATUS
bld_cmtName ( char *errmsg )
{
    STATUS                 ret_val = OK ;

    if (!commentNameBuilt)
    {
        if ((ret_val = Create_stf_file(SEP_ME_TAG_NODEL, ERx("ct"),
                                       &cmtFile, &cmtLoc, errmsg)) != OK)
        {
            disp_line(msg,0,0);
        }
        else
        {
            cmtName = STtalloc(SEP_ME_TAG_NODEL, cmtFile);
            commentNameBuilt = TRUE;
        }
    }

    return (ret_val);
}
Example #8
0
/*
** Name: read_fm_command
**
** History:
**	17-Oct-2008 (wanfr01)
**	    Bug 121090
**	    Added new parameter to get_commmand
*/
STATUS
read_fm_command(FILE *aFile)
{
    STATUS                 ioerr ;
    STATUS                 ret_status = OK ;

    ioerr = get_command(aFile, NULL,FALSE);
    if ((ioerr == FAIL)||(ioerr == ENDFILE))
    {
        if (ioerr == FAIL)
        {
            STpolycat(3,ErrF,ERx("reading"),comment,msg);
        }
        else
        {
            STpolycat(3,ErrF,ERx("reading (EOF)"),comment,msg);
        }
        disp_line(msg,0,0);
        ret_status = FAIL;
    }
    return (ret_status);
}
Example #9
0
/*
**  insert_comment ()
*/
STATUS
insert_comment ()
{
    STATUS                 ret_val ;
    OFFSET_TYPE            size ;

    if ((ret_val = bld_cmtName(msg)) != OK)
    {
        disp_line(msg, 0, 0);
    }
    else if (SEP_LOexists(cmtLoc))
    {
        LOsize(cmtLoc, &size);
        if (size > 0)
        {
            append_line(OPEN_COMMENT, 1);
            append_file(cmtName);
            append_line(CLOSE_COMMENT, 1);
        }
        del_floc(cmtLoc);
    }

    return (ret_val);
} /* end of insert_comment */
Example #10
0
/* FIXME: B-type MBs not handled yet properly */
void x264_visualize_show( x264_t *h )
{
    int mb_xy;
    static const stringlist_t mb_types[] = {
        /* Block types marked as NULL will not be drawn */
        { I_4x4   , "red" },
        { I_8x8   , "#ff5640" },
        { I_16x16 , "#ff8060" },
        { I_PCM   , "violet" },
        { P_L0    , "SlateBlue" },
        { P_8x8   , "blue" },
        { P_SKIP  , "green" },
        { B_DIRECT, "yellow" },
        { B_L0_L0 , "yellow" },
        { B_L0_L1 , "yellow" },
        { B_L0_BI , "yellow" },
        { B_L1_L0 , "yellow" },
        { B_L1_L1 , "yellow" },
        { B_L1_BI , "yellow" },
        { B_BI_L0 , "yellow" },
        { B_BI_L1 , "yellow" },
        { B_BI_BI , "yellow" },
        { B_8x8   , "yellow" },
        { B_SKIP  , "yellow" },
    };

    static const int waitkey = 1;     /* Wait for enter after each frame */
    static const int drawbox = 1;     /* Draw box around each block */
    static const int borders = 0;     /* Display extrapolated borders outside frame */
    static const int zoom = 2;        /* Zoom factor */

    static const int pad = 32;
    uint8_t *const frame = h->fdec->plane[0];
    const int width = h->param.i_width;
    const int height = h->param.i_height;
    const int stride = h->fdec->i_stride[0];

    if (borders) {
        disp_gray_zoom(0, frame - pad*stride - pad, width+2*pad, height+2*pad, stride, "fdec", zoom);
    } else {
        disp_gray_zoom(0, frame, width, height, stride, "fdec", zoom);
    }

    for( mb_xy = 0; mb_xy < h->sps->i_mb_width * h->sps->i_mb_height; mb_xy++ )
    {
        visualize_t *const v = (visualize_t*)h->visualize + mb_xy;
        const int mb_y = mb_xy / h->sps->i_mb_width;
        const int mb_x = mb_xy % h->sps->i_mb_width;
        char *const col = GET_STRING(mb_types, v->i_type);
        int x = mb_x*16*zoom;
        int y = mb_y*16*zoom;
        int l = 0;
        unsigned int i, j;

        if (col==NULL) continue;
        if (borders) {
            x += pad*zoom;
            y += pad*zoom;
        }
        disp_setcolor(col);
        if (drawbox) disp_rect(0, x, y, x+16*zoom-1, y+16*zoom-1);

        if (v->i_type==P_L0 || v->i_type==P_8x8 || v->i_type==P_SKIP) {

            /* Predicted (inter) mode, with motion vector */
            if (v->i_partition==D_16x16 || v->i_type==P_SKIP) {
                mv(x+8*zoom, y+8*zoom, v->mv[l][0][0], v->ref[l][0][0], zoom, col);
            }
            if (v->i_partition==D_16x8) {
                if (drawbox) disp_rect(0, x, y, x+16*zoom, y+8*zoom);
                mv(x+8*zoom, y+4*zoom, v->mv[l][0][0], v->ref[l][0][0], zoom, col);
                if (drawbox) disp_rect(0, x, y+8*zoom, x+16*zoom, y+16*zoom);
                mv(x+8*zoom, y+12*zoom, v->mv[l][2][0], v->ref[l][2][0], zoom, col);
            }
            if (v->i_partition==D_8x16) {
                if (drawbox) disp_rect(0, x,          y, x+8*zoom,  y+16*zoom);
                mv(x+4*zoom, y+8*zoom, v->mv[l][0][0], v->ref[l][0][0], zoom, col);
                if (drawbox) disp_rect(0, x+8*zoom,   y, x+16*zoom, y+16*zoom);
                mv(x+12*zoom, y+8*zoom, v->mv[l][0][2], v->ref[l][0][2], zoom, col);
            }
            if (v->i_partition==D_8x8) {
                for (i=0; i<2; i++) for (j=0; j<2; j++) {
                    int sp = v->i_sub_partition[i*2+j];
                    const int x0 = x + j*8*zoom;
                    const int y0 = y + i*8*zoom;
                    l = x264_mb_partition_listX_table[0][sp] ? 0 : 1; /* FIXME: not tested if this works */
                    if (IS_SUB8x8(sp)) {
                        if (drawbox) disp_rect(0, x0, y0, x0+8*zoom, y0+8*zoom);
                        mv(x0+4*zoom, y0+4*zoom, v->mv[l][2*i][2*j], v->ref[l][2*i][2*j], zoom, col);
                    }
                    if (IS_SUB8x4(sp)) {
                        if (drawbox) disp_rect(0, x0, y0, x0+8*zoom, y0+4*zoom);
                        if (drawbox) disp_rect(0, x0, y0+4*zoom, x0+8*zoom, y0+8*zoom);
                        mv(x0+4*zoom, y0+2*zoom, v->mv[l][2*i][2*j], v->ref[l][2*i][2*j], zoom, col);
                        mv(x0+4*zoom, y0+6*zoom, v->mv[l][2*i+1][2*j], v->ref[l][2*i+1][2*j], zoom, col);
                    }
                    if (IS_SUB4x8(sp)) {
                        if (drawbox) disp_rect(0, x0, y0, x0+4*zoom, y0+8*zoom);
                        if (drawbox) disp_rect(0, x0+4*zoom, y0, x0+8*zoom, y0+8*zoom);
                        mv(x0+2*zoom, y0+4*zoom, v->mv[l][2*i][2*j], v->ref[l][2*i][2*j], zoom, col);
                        mv(x0+6*zoom, y0+4*zoom, v->mv[l][2*i][2*j+1], v->ref[l][2*i][2*j+1], zoom, col);
                    }
                    if (IS_SUB4x4(sp)) {
                        if (drawbox) disp_rect(0, x0, y0, x0+4*zoom, y0+4*zoom);
                        if (drawbox) disp_rect(0, x0+4*zoom, y0, x0+8*zoom, y0+4*zoom);
                        if (drawbox) disp_rect(0, x0, y0+4*zoom, x0+4*zoom, y0+8*zoom);
                        if (drawbox) disp_rect(0, x0+4*zoom, y0+4*zoom, x0+8*zoom, y0+8*zoom);
                        mv(x0+2*zoom, y0+2*zoom, v->mv[l][2*i][2*j], v->ref[l][2*i][2*j], zoom, col);
                        mv(x0+6*zoom, y0+2*zoom, v->mv[l][2*i][2*j+1], v->ref[l][2*i][2*j+1], zoom, col);
                        mv(x0+2*zoom, y0+6*zoom, v->mv[l][2*i+1][2*j], v->ref[l][2*i+1][2*j], zoom, col);
                        mv(x0+6*zoom, y0+6*zoom, v->mv[l][2*i+1][2*j+1], v->ref[l][2*i+1][2*j+1], zoom, col);
                    }
                }
            }
        }

        if (IS_INTRA(v->i_type) || v->i_type==I_PCM) {
            /* Intra coded */
            if (v->i_type==I_16x16) {
                switch (v->i_intra16x16_pred_mode) {
                case I_PRED_16x16_V:
                    disp_line(0, x+2*zoom, y+2*zoom, x+14*zoom, y+2*zoom);
                    break;
                case I_PRED_16x16_H:
                    disp_line(0, x+2*zoom, y+2*zoom, x+2*zoom, y+14*zoom);
                    break;
                case I_PRED_16x16_DC:
                case I_PRED_16x16_DC_LEFT:
                case I_PRED_16x16_DC_TOP:
                case I_PRED_16x16_DC_128:
                    disp_line(0, x+2*zoom, y+2*zoom, x+14*zoom, y+2*zoom);
                    disp_line(0, x+2*zoom, y+2*zoom, x+2*zoom, y+14*zoom);
                    break;
                case I_PRED_16x16_P:
                    disp_line(0, x+2*zoom, y+2*zoom, x+8*zoom, y+8*zoom);
                    break;
                }
            }
            if (v->i_type==I_4x4 || v->i_type==I_8x8) {
                const int di = v->i_type==I_8x8 ? 2 : 1;
                const int zoom2 = zoom * di;
                for (i=0; i<4; i+=di) for (j=0; j<4; j+=di) {
                    const int x0 = x + j*4*zoom;
                    const int y0 = y + i*4*zoom;
                    if (drawbox) disp_rect(0, x0, y0, x0+4*zoom2, y0+4*zoom2);
                    switch (v->intra4x4_pred_mode[i][j]) {
                    case I_PRED_4x4_V:		/* Vertical */
                        disp_line(0, x0+0*zoom2, y0+1*zoom2, x0+4*zoom2, y0+1*zoom2);
                        break;
                    case I_PRED_4x4_H:		/* Horizontal */
                        disp_line(0, x0+1*zoom2, y0+0*zoom2, x0+1*zoom2, y0+4*zoom2);
                        break;
                    case I_PRED_4x4_DC:		/* DC, average from top and left sides */
                    case I_PRED_4x4_DC_LEFT:
                    case I_PRED_4x4_DC_TOP:
                    case I_PRED_4x4_DC_128:
                        disp_line(0, x0+1*zoom2, y0+1*zoom2, x0+4*zoom2, y0+1*zoom2);
                        disp_line(0, x0+1*zoom2, y0+1*zoom2, x0+1*zoom2, y0+4*zoom2);
                        break;
                    case I_PRED_4x4_DDL:	/* Topright-bottomleft */
                        disp_line(0, x0+0*zoom2, y0+0*zoom2, x0+4*zoom2, y0+4*zoom2);
                        break;
                    case I_PRED_4x4_DDR:	/* Topleft-bottomright */
                        disp_line(0, x0+0*zoom2, y0+4*zoom2, x0+4*zoom2, y0+0*zoom2);
                        break;
                    case I_PRED_4x4_VR:		/* Mix of topleft-bottomright and vertical */
                        disp_line(0, x0+0*zoom2, y0+2*zoom2, x0+4*zoom2, y0+1*zoom2);
                        break;
                    case I_PRED_4x4_HD:		/* Mix of topleft-bottomright and horizontal */
                        disp_line(0, x0+2*zoom2, y0+0*zoom2, x0+1*zoom2, y0+4*zoom2);
                        break;
                    case I_PRED_4x4_VL:		/* Mix of topright-bottomleft and vertical */
                        disp_line(0, x0+0*zoom2, y0+1*zoom2, x0+4*zoom2, y0+2*zoom2);
                        break;
                    case I_PRED_4x4_HU:		/* Mix of topright-bottomleft and horizontal */
                        disp_line(0, x0+1*zoom2, y0+0*zoom2, x0+2*zoom2, y0+4*zoom2);
                        break;
                    }
                }
            }
        }
    }

    disp_sync();
    if (waitkey) getchar();
}
Example #11
0
/*
**	form_comment
*/
STATUS
form_comment(FILE *aFile)
{
    STATUS                 ret_status ;
    FILE                  *comPtr  = NULL ;

    /*
    ** Find beginning of commment.
    */

    do
    {
        ret_status = read_fm_command(aFile);

    } while ((ret_status == OK)&&
             ((sep_state & BLANK_LINE_STATE)||(sep_state & IN_ENDING_STATE)));

    if (ret_status == OK)
    {
        if ((sep_state & IN_COMMENT_STATE) == 0)
        {
            fromLastRec = 1;
            STcopy(buffer_1, holdBuf);
            ret_status = FAIL;
        }
    }

    /*
    ** create comments file
    */

    if (ret_status == OK)
    {
        if ((ret_status = bld_cmtName(msg)) != OK)
        {
            disp_line(msg,0,0);
        }
        else if ((ret_status = SIfopen(cmtLoc, ERx("w"), SI_TXT, TERM_LINE,
                                       &comPtr)) != OK)
        {
            disp_line(STpolycat(2,ErrOpn,cfile,msg),0,0);
        }
    }

    /*
    ** read in comments
    */

    if (ret_status == OK)
    {
        if ((ret_status = read_in_comments(aFile, comPtr)) == OK)
        {
            /*
            ** close comments file
            */

            if (SIclose(comPtr)!= OK)
            {
                STpolycat(3,ErrC,ERx("close"),cfile,msg);
                disp_line(msg,0,0);
                ret_status = FAIL;
            }
        }
    }

    return(ret_status);

} /* end of form_comment */
Example #12
0
int main()
{
	char pressKey;
	int ret;
	bitmap *bm;
	u_char *w;

	sys_init();
	sleep(2);
	add_dbs_beep(NULL, 0, 1);

	bm = new_bitmap("./test.bmp");
	SetSrceenColor(0xFFFF);

	if (init_fonts() != -1)
	{
		disp_line("123-:+09", 0, 0, disp12_char);
		disp_line("123-:+09", 0, 100, disp36_char);
	}

	char *path_b = gppath(getpid());
	char *path_d = strdup(path_b);
	printf("This program path is: '%s' at '%s'\n", basename(path_b), dirname(path_d));

	u_char dt[7];

	get_bcd_datetime(dt);
	DBG_MEM("BCD datetime:", dt, 7);

/*
	int i;
	for (i=319; i>-320; i--)
	{
		if (i>0)
	{
			disp_bitmap(bm, 0, i, 320-i, 240, 0, 0);
		}
		else
		{
			disp_bitmap(bm, 0, 0, 320+i, 240, 0, -i);
		}
	}
*/
	u_char *buf = NULL;

	u_char factor[8] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
	u_char key[8]    = {0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01};
	u_char m_key[8]  = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};

	int p_len = 0;
	u_long t1, t2;

	cpu_card_data_t *ccd = NULL;
	u_long csn;

	/* alarm test code begin 

		DBG("Syn alarm 4 times...");
		ret = add_syn_beep(&t1, 0, 4);
		DBG("OK, wait 5 sec(ret: %d)\n", ret);
		sleep(5);
		DBG("Syn alarm 4 sec...");
		ret = add_syn_beep(&t2, 4000, 0);
		DBG("OK(ret: %d)\n", ret);

		sleep(1);
		terminate_alarm(t2);

	/* alarm test code end */

	while (1)
    {
    	printf("Press 'b' to test beep\n");
    	printf("Press 'c' to test COM1\n");
    	printf("Press 'g' to test GPRS\n");
    	printf("Press 'p' to test PSAM\n");
    	printf("Press 'm' to test MIFARE\n");
    	printf("Press 'e' to enter test screen\n");

    	pressKey=getchar();

    	switch (pressKey)
    	{
    		case 'b': test_beep(); break;
    		case 'c': test_COM1(); break;
    		case 'g': startup_poll(); break;
    		case 'p':
/*    			pc = new_ty_psam_cos();
    			if (NULL == pc)
    			{
    				DBG("Create psam card fail!\n");
    				break;
    			}

    			DBG("Select file 0x3F00...");
    			ret = psam_select_id(pc, &buf, 0x3F00);
    			if (ret == -1)
    			{
    				DBG("fail!\n");
    				break;
    			}
    			DBG_MEM("ok!\nResponse:", buf, ret);

    			DBG("Select file 0x1001...");
    			ret = psam_select_id(pc, &buf, 0x1001);
    			if (ret == -1)
    			{
    				DBG("fail!\n");
    				break;
    			}
    			DBG_MEM("ok!\nResponse:", buf, ret);
    			
    			t1 = get_tickcount();
    			ret = calc_descrypt1(pc, factor, key, 0x0D);
    			t2 = get_tickcount();
    			if (ret == 0)
    			{
    				DBG("Calcuate descrype OK\n");
    				DBG_MEM("factor:", factor, 8);
    				DBG_MEM("key:", key, 8);
    			}
    			else
    				DBG("Calcuate descrypt fail!\n");
*/
    			DBG("Calculate descrype consumed %d ms.\n", t2-t1);

    			break;
    		case 'm':

/*    			ret = get_card_sn(&buf);
    			DBG("Get card SN ret: %d (buf: %d)\n", ret, malloc_usable_size(buf));
    			if (ret != -1)
    				DBG_MEM("SN:", buf, ret);
    			else
    				break;
    			csn = (u_long)(*buf);

    			if ((buf[4] & 0x20))
    			{
    				DBG("**** CPU Card ****\nReset card ...");

    				ret = reset_cpu_card(&buf);
    				if (ret == -1)
    				{
    					DBG("fail!(%d)\n", ret);
    					break;
    				}
    				DBG_MEM("ok!\nATS:", buf, ret);

    				if (NULL == ccd)
    				{
    					DBG("To create cpu_card_data_t...\n");
    				 	ccd = new_cpu_card_data(6001, 1, 21);
    				 	if (NULL == ccd)
    				 	{
    				 		DBG("fail!\n");
    				 		break;
    				 	}
    				 	else
    				 		DBG("Ok.\n");
    				}


    				init_cpu_card_data(ccd, csn, buf, ret, 8, 8);

    				DBG("Fast debit wallet 0.01...");

    				ret = fast_debit_wallet_PUB1(&fmcos2_opr, ccd, 1);
    				if (-1 == ret)
    				{
    					DBG("fail! ret: %d, errno: %d\n", ret, get_cpu_carderr(ccd));
    					break;
    				}
    				DBG("Ok! Balance: %d.%d\n", get_pub_wallet_balance(ccd)/100, get_pub_wallet_balance(ccd)%100);
*/
    				/*


    				memcpy(factor, buf+ret-8, 8);
    				DBG_MEM("factor:", factor, 8);

    				DBG("\nGet Callagne...");
    				ret = rf_get_challenge(&fmcos2_opr, &buf, 4);
    				if (ret == -1)
    				{
    					DBG("fail!(%d)\n", ret);
    					break;
    				}
    				DBG_MEM("ok!\nResponse:", buf, ret);

    				memcpy(key, buf, 4);
    				memset(key+4, 0, 4);
    				DBG_MEM("key:", key, 8);

    				DBG("Calculate descrypt...");
	    			ret = calc_descrypt1(factor, key, 0x0D);
    				if (ret == -1)
    				{
    					DBG("fail!(%d)\n", ret);
    					break;
    				}
    				DBG_MEM("ok!\nResopnse:", key, 8);
    				DBG("Select ADF1...");
    				ret = rf_select_file_id(&fmcos2_opr, &buf, 0x1001);
    				if (ret == -1)
    				{
    					DBG("fail!(%d)\n", ret);
    					break;
    				}
    				DBG_MEM("ok!\nResopnse:", buf, ret);
    				DBG("Read Person file(id=2)...");
    				ret = rf_read_binary(&fmcos2_opr, &buf, 2, 0, NULL, 0);
    				if (ret == -1)
    				{
    					DBG("fail!(%d)\n", ret);
    					break;
    				}
    				DBG_MEM("ok!\nResponse:", buf, ret);
    				DBG("Read wallet file (id=4)...");
    				ret = rf_read_record(&fmcos2_opr, &buf, 1, 4, NULL, 12);
    				if (ret == -1)
    				{
    					DBG("fail!(%d)\n", ret);
    					break;
    				}
    				DBG_MEM("ok!\nResponse:", buf, ret);
    				DBG("Authenticate Key(id=0x0E)...");
    				ret = rf_extern_authent(&fmcos2_opr, &buf, 0x0E, key);
    				if (ret == -1)
    				{
    					DBG("fail!(%d)\n", ret);
    					break;
    				}
    				DBG_MEM("ok!\nResponse:", buf, ret);
	   				t2 = get_tickcount();
    				printf("CPU card time %dms", t2-t1); */
/*    			}
    			else
    			{
	    			DBG("**** Mifare Card ****\nAuthent sector 1...");
	    			ret = authent_mifare_card(m_key, 3, MIFARE_KEYA);
	    			if (ret != 0)
	    			{
	    				DBG("fail!(%d)\n", ret);
	    				break;
	    			}
	    			DBG("ok!\nRead block 0...");
	    			ret = read_mifare_card(&buf, 0);
	    			if (ret == -1)
	    			{
	    				DBG("fail!(%d)\n", ret);
	    				break;
	    			}
	    			DBG("ok!(%d)\n", ret);
	    			DBG_MEM("Block 0:", buf, ret);
	    			DBG("Write x0FF to block 1...");
	    			memset(buf, 0xff, sizeof(buf));
	    			ret = write_mifare_card(buf, 1);
	    			if (ret != 0)
	    			{
	    				DBG("fail!(%d)\n", ret);
	    				break;
	    			}
	    			DBG("ok!\nRead block 1...");
	    			ret = read_mifare_card(&buf, 1);
	    			if (ret == -1)
	    			{
	    				DBG("fail!(%d)\n", ret);
	    				break;
	    			}
	    			DBG("ok!(%d)\n", ret);
	    			DBG_MEM("Block 1:", buf, ret);
    			}*/
    			break; 
    	}
    	if (pressKey=='e')
    		break;
    }

	
}