Ejemplo n.º 1
0
void cSmartCardVideoGuard2::ReadTiers(void)
{
  static const unsigned char ins2a[5] = { 0xd0,0x2a,0x00,0x00,0x00 };
  if(DoCmd(ins2a)<0 || !Status()) return;
  static unsigned char ins76[5] = { 0xd0,0x76,0x00,0x00,0x00 };
  ins76[3]=0x7f; ins76[4]=2;
  unsigned char buff[270];
  if(!IsoRead(ins76,buff) || !Status()) return;
  ins76[3]=0; ins76[4]=0;
  int num=buff[1];
  if(num>0) {
    infoStr.Strcat("Tier\tExpiry Date\n");
    infoStr.Strcat("----\t-----------\n");
    }
  for(int i=0; i<num; i++) {
    ins76[2]=i;
    if(DoCmd(ins76,0,buff)<0 || !Status()) return;
    if(buff[5+2]==0 && buff[5+3]==0) break;
    int y,m,d,H,M,S;
    RevDateCalc(&buff[5+4],y,m,d,H,M,S);
    char str[100];
    snprintf(str,sizeof(str),"%02x%02x\t%04d/%02d/%02d-%02d:%02d:%02d\n",buff[5+2],buff[5+3],y,m,d,H,M,S);
    infoStr.Strcat(str);
    PRINTF(L_SC_INIT,"Tier %02x%02x expires %04d/%02d/%02d-%02d:%02d:%02d",buff[5+2],buff[5+3],y,m,d,H,M,S);
    }
}
Ejemplo n.º 2
0
int XLibraLP::ProgrammingTovar(XLibraTovar tovar)
{
    unsigned char cmd[512];
    unsigned char *lp_cmd = cmd;

	memcpy(lp_cmd, &(tovar.nomen_num), 4);
    lp_cmd += 4;
	tovar.nomen_num = tovar.nomen_num * 100;
    for (int i(0); i < 6; i++)
    {
		*lp_cmd = tovar.nomen_num % 10;
		tovar.nomen_num = tovar.nomen_num / 10;
        ++lp_cmd;
    }
    memset(lp_cmd, 0x00, 56);
	ConvertText(lp_cmd, tovar.name, 56);
    lp_cmd += 56;
    int price_i = Around_0(tovar.price * 100);
    memcpy(lp_cmd, &price_i, 4);
    lp_cmd += 4;
    memset(lp_cmd, 0x00, 13);
    lp_cmd += 13;

    return DoCmd(0x82, cmd);
}
Ejemplo n.º 3
0
bool cSmartCardVideoGuard2::Update(int pid, int caid, const unsigned char *data)
{
  static unsigned char ins42[5] = { 0xD1,0x42,0x00,0x00,0xFF }; 
  if(MatchEMM(data)) {
    const unsigned char *payloaddata=cParseNDS::PayloadStart(data,cardID); //points to 02 xx yy
    int lenEMM;
    switch(payloaddata[0]) {
      case 2:
        lenEMM=payloaddata[payloaddata[1]+2];
        payloaddata+=3+payloaddata[1]; // skip len specifier
        break;
      default:
//        di(printf("scvg2: ***ERROR***: EMM: bad payload type byte %02x\n",payloaddata[0]));
//        DUMP3("VG2EMM",data,32);
        return false;
      }
//    di(printf("scvg2: EMM: pid %d (%x) caid %d (%x) len %d (%x)\n",pid,pid,caid,caid,lenEMM,lenEMM));
//    DUMP3("VG2EMM",data,32);
    if(lenEMM<=8 || lenEMM>188) {
//      di(printf("scvg2: ***ERROR***: EMM: len %d bad\n",lenEMM));
      return false;
      }
    ins42[4]=lenEMM;
    if(DoCmd(ins42,payloaddata)>0 && Status())
      return true;
    }
  return false;
}
Ejemplo n.º 4
0
/**
*    @fn    FIMGSE2D::BitBlt(PRECTL prclSrc, PRECTL prclDst, ROT_TYPE m_iRotate)
*    @param    prclSrc    Source Rectangle
*    @param    prclDst    Destination Rectangle
*    @param    m_iRotate    Rotatation Degree. See also ROT_TYPE type
*    @note This funciton performs real Bit blit using 2D HW. this functio can handle rotation case.
*            There's predefine macro type for presenting rotation register's setting value
*            G2D_ROTATION
@    @sa    ROT_TYPE    this can be set mixed value.
*/
void FIMGSE2D::BitBlt(PRECTL prclSrc, PRECTL prclDst, ROT_TYPE m_iRotate )
{
    DWORD uCmdRegVal=0;
    RECT    rectDst;            //< If rotation case this value must be corrected.
    
    RETAILMSG(DISP_ZONE_ENTER,(TEXT("[2DHW] BitBlt Entry\r\n")));    

    /// Always LeftTop Coordinate is less than RightBottom for Source and Destination Region
    assert( (prclSrc->left < prclSrc->right) && (prclSrc->top < prclSrc->bottom) );
    assert( (prclDst->left < prclDst->right) && (prclDst->top < prclDst->bottom) );    

    /// Set Destination's Rotation mode
    SetRotationMode(m_iRotate);
    SetCoordinateSrcBlock(prclSrc->left, prclSrc->top, prclSrc->right - 1, prclSrc->bottom - 1);

    if(m_iRotate == ROT_180)        //< origin set to (x2,y2)
    {
        rectDst.left = prclDst->right - 1;                        //< x2
        rectDst.top = prclDst->bottom - 1;                        //< y2
        rectDst.right = 2 * (prclDst->right - 1) - prclDst->left ;        //< x2 + (x2 - x1)
        rectDst.bottom = 2 * (prclDst->bottom -1) - prclDst->top;    //< y2 + (y2 - y1)
    }
    else     if(m_iRotate == ROT_90)        //<In this time, Height and Width are swapped.
    {
        rectDst.left = prclDst->right - 1;                        //< x2
        rectDst.right = prclDst->right - 1 + prclDst->bottom - 1 - prclDst->top;    //< x2 + (y2 - y1)
        rectDst.top = prclDst->top;                                        //< y1
        rectDst.bottom = prclDst->top + prclDst->right - 1 - prclDst->left;        //< y1 + (x2 - x1)
    }
    else     if(m_iRotate == ROT_270)        //<In this time, Height and Width are swapped.
    {
        rectDst.left = prclDst->left;                            //< x1
        rectDst.right = prclDst->left + prclDst->bottom - 1- prclDst->top;        //< x1 + (y2 - y1)
        rectDst.top = prclDst->bottom - 1;                                    //< y2
        rectDst.bottom = prclDst->bottom - 1 + prclDst->right - 1- prclDst->left;    //< y2 + (x2 - x1)
    }
    else        //< ROT_0
    {
        rectDst.left = prclDst->left;
        rectDst.top = prclDst->top;
        rectDst.right = prclDst->right - 1;
        rectDst.bottom = prclDst->bottom - 1;
    }

    SetRotationOrg((WORD)rectDst.left, (WORD)rectDst.top);
    SetCoordinateDstBlock(rectDst.left, rectDst.top, rectDst.right, rectDst.bottom);

    RETAILMSG(DISP_ZONE_2D,(TEXT("ROT:%d, Src:(%d,%d)~(%d,%d), Dst:(%d,%d)~(%d,%d)\r\n"), 
        m_iRotate, prclSrc->left, prclSrc->top, prclSrc->right, prclSrc->bottom, 
        rectDst.left, rectDst.top, rectDst.right, rectDst.bottom));
        
    uCmdRegVal = G2D_NORMAL_BITBLT_BIT;
    
    DoCmd(&(m_pG2DReg->CMDR1), uCmdRegVal, G2D_DEFAULT_RETURN_TYPE);

    RETAILMSG(DISP_ZONE_ENTER,(TEXT("[2DHW] BitBlt Exit\r\n")));            
    /// TODO: Resource Register clearing can be needed.

}
Ejemplo n.º 5
0
int XLibraLP::ClearTovar(int nomen_num)
{
    unsigned char cmd[512];

    memcpy(cmd, &nomen_num, 4);

    return DoCmd(0x8d, cmd);
}
Ejemplo n.º 6
0
bool cSmartCardVideoGuard2::Decode(const cEcmInfo *ecm, const unsigned char *data, unsigned char *cw)
{
  static unsigned char ins40[5] = { 0xD1,0x40,0x40,0x80,0xFF };
  static const unsigned char ins54[5] = { 0xD3,0x54,0x00,0x00,0x00 };
  int posECMpart2=data[6]+7;
  int lenECMpart2=data[posECMpart2]+1;
  unsigned char tbuff[264];
  tbuff[0]=0;
  memcpy(&tbuff[1],&data[posECMpart2+1],lenECMpart2);
  ins40[4]=lenECMpart2;
  if(DoCmd(ins40,tbuff)>0 && Status()) {
    if(DoCmd(ins54)>0 && Status()) {
      if(data[0]&1) memcpy(cw+8,CW1,8);
      else          memcpy(cw+0,CW1,8);
      return true;
      }
    }
  return false;
}
Ejemplo n.º 7
0
extern bool CmdEvent( gui_window * gui, gui_event gui_ev, void * param )
{
    gui_ctl_id  id;
    char        *text;
    char        *cmd;
    int         i;

    cmd = GUIGetExtra( gui );
    switch( gui_ev ) {
    case GUI_INIT_DIALOG:
        GUISetText( gui, CTL_CMD_EDIT, "Hi Lisa!" );
        GUISetFocus( gui, CTL_CMD_EDIT );
        GUIClearList( gui, CTL_CMD_HISTORY );
        for( i = 0; i < ArraySize( Stuff ); ++i ) {
            GUIAddText( gui, CTL_CMD_HISTORY, Stuff[i] );
        }
        GUISetCurrSelect( gui, CTL_CMD_HISTORY, 1 );
        return( TRUE );
    case GUI_KEY_CONTROL:
        GUISetCurrSelect( gui, CTL_CMD_HISTORY, 2 );
        cmd = GUIGetText( gui, CTL_CMD_HISTORY );
        GUISetText( gui, CTL_CMD_EDIT, cmd );
        GUISelectAll( gui, CTL_CMD_EDIT, TRUE );
        GUIMemFree( cmd );
        return( TRUE );
    case GUI_CONTROL_DCLICKED:
    case GUI_CONTROL_CLICKED:
        GUI_GETID( param, id );
        switch( id ) {
        case CTL_CMD_HISTORY:
            text = GUIGetText( gui, CTL_CMD_HISTORY );
            GUISetText( gui, CTL_CMD_EDIT, text );
            GUIMemFree( text );
            if( gui_ev == GUI_CONTROL_CLICKED )
                return( TRUE );
            /* fall through */
        case CTL_CMD_OK:
            text = GUIGetText( gui, CTL_CMD_EDIT );
            if( text != NULL )
                DoCmd( text );
            GUIMemFree( text );
            break;
        case CTL_CMD_CHECK:
            return( FALSE );
        }
        GUICloseDialog( gui );
        /* fall through */
    case GUI_DESTROY:
        WndFree( cmd );
        return( TRUE );
    default:
        return( FALSE );
    }
}
Ejemplo n.º 8
0
void FIMGSE2D::PutPixel(DWORD uPosX, DWORD uPosY, DWORD uColor) //modification
{
    SetRotationMode(ROT_0);    
    
    RequestEmptyFifo(4);
    
    m_pG2DReg->COORD0_X = uPosX;
    m_pG2DReg->COORD0_Y = uPosY;
    m_pG2DReg->FG_COLOR = uColor;

    DoCmd(&(m_pG2DReg->CMDR0), G2D_REND_POINT_BIT, G2D_FASTRETURN);
}
Ejemplo n.º 9
0
BOOL FIMGSE2D::FlipBlt(PRECTL prclSrc, PRECTL prclDst, ROT_TYPE m_iRotate)
{
    DWORD uCmdRegVal=0;
    BOOL bRetVal = FALSE;
    RECTL    rectDst;            //< If rotation case this value must be corrected.    

    RETAILMSG(DISP_ZONE_ENTER,(TEXT("[2DHW] FlipBlt Entry\r\n")));                

    /// Always LeftTop Coordinate is less than RightBottom for Source and Destination Region
    assert( (prclSrc->left < prclSrc->right) && (prclSrc->top < prclSrc->bottom) );
    assert( (prclDst->left < prclDst->right) && (prclDst->top < prclDst->bottom) );

    /// Check Flip Option, we only do care about only flip, don't care about rotation option although it set.
    if(HASBIT_COND(m_iRotate, FLIP_X))
    {
        SetRotationMode(FLIP_X);
        /// Set rotation origin on destination's bottom line.
        rectDst.left = prclDst->left;                    //< x1
        rectDst.right = prclDst->right - 1;                //< x2
        rectDst.top = prclDst->bottom - 1;            //< y2
        rectDst.bottom = prclDst->bottom - 1 + prclDst->bottom - 1 - prclDst->top;    //< y2 + (y2-y1)
    }
    else if(HASBIT_COND(m_iRotate, FLIP_Y))
    {
        SetRotationMode(FLIP_Y);
        /// Set rotation origin on destination's right line.
        rectDst.left = prclDst->right - 1;                //< x2
        rectDst.right = prclDst->right - 1 + prclDst->right - 1 - prclDst->left;        //< x2 + (x2 - x1)
        rectDst.top = prclDst->top;                    //< y1
        rectDst.bottom = prclDst->bottom - 1;            //< y2
    }
    else
    {
        /// Do not need to do Flip operation.
        return FALSE;
    }

    SetCoordinateSrcBlock(prclSrc->left, prclSrc->top, prclSrc->right - 1, prclSrc->bottom - 1);
    SetRotationOrg((WORD)rectDst.left, (WORD)rectDst.top);
    SetCoordinateDstBlock(rectDst.left, rectDst.top, rectDst.right, rectDst.bottom);

    uCmdRegVal = G2D_NORMAL_BITBLT_BIT;

    bRetVal = DoCmd(&(m_pG2DReg->CMDR1), uCmdRegVal, G2D_DEFAULT_RETURN_TYPE);
    
    RETAILMSG(DISP_ZONE_ENTER,(TEXT("[2DHW] FlipBlt Exit\r\n")));            
    /// TODO: Resource Register clearing can be needed.

    return bRetVal;

}
Ejemplo n.º 10
0
void DlgCmd( void )
{
    char        buff[256];

    printf( "DBG>" );
    fflush( stdout );   // not really necessary
    gets( buff );
    if( buff[0] != NULLCHAR && buff[1] == NULLCHAR ) {
        switch( tolower( buff[0] ) ) {
        case 'u':
            WndAsmInspect( GetCodeDot() );
            break;
        case 's':
            DumpSource();
            break;
        case 'l':
            DumpLocals();
            break;
        case 'i':
            RunRequest( REQ_TRACE_INTO );
            break;
        case 'o':
            RunRequest( REQ_TRACE_OVER );
            break;
        case 'g':
            RunRequest( REQ_GO );
            break;
        case 'x':
            if( _IsOn( SW_REMOTE_LINK ) ) {
                printf( "Can't break remote task!\n" );
            } else {
                HMODULE hmod;
                PFN     proc = NULL;

                DosQueryModuleHandle( TrapParms, &hmod );
                DosQueryProcAddr( hmod, 5, 0, &proc );
//                if( proc != NULL )
//                    proc();
            }
            // break the task
            break;
        default:
            printf( "Error - unrecognized command\n" );
        }
    } else {
        DoCmd( DupStr( buff ) );
        DoInput();
    }
}
Ejemplo n.º 11
0
bool xRedisServerBase::ProcessCmd(xRedisConnectorBase *pConnector)
{
    pConnector->activetime = time(NULL);
    int size = pConnector->cmdbuffer.length();
    const char *pData = pConnector->cmdbuffer.c_str();

    if (0 == size) {
        return false;
    }

    pData += pConnector->parsed;
    size -= pConnector->parsed;
    const char *ptr = pData;

    if (pConnector->argnum == 0){
        if (ptr[0] == '*') {
            int num = 0;
            int pos = ParaseLength(ptr, size, num);
            if (0 == pos) {
                return false;
            }
            ptr += pos;
            size -= pos;
            pConnector->parsed += pos;
            pConnector->argnum = num;
            if (pConnector->argv) pConnector->FreeArg();
            pConnector->argv = (sds *)malloc(sizeof(sds*)*(pConnector->argnum));
        } else {
            return false;
        }
    }

    while (pConnector->argnum > 0) {
        int  p = ParaseData(pConnector, ptr, size);
        if (p == 0){
            break;
        }
        ptr += p;
        size -= p;
        pConnector->parsed += p;
    }

    if (pConnector->argnum == 0) {
        DoCmd(pConnector);
        return true;
    }
    return false;
}
Ejemplo n.º 12
0
void DlgCmd( void )
{
    char        buff[256];

    printf( "DBG>" );
    fflush( stdout );
    gets( buff );
    if( buff[0] != NULLCHAR && buff[1] == NULLCHAR ) {
        switch( tolower( buff[0] ) ) {
        case 'u':
            WndAsmInspect( GetCodeDot() );
            break;
        case 's':
            DumpSource();
            break;
        case 'l':
            DumpLocals();
            break;
        case 'i':
            RunRequest( REQ_TRACE_INTO );
            break;
        case 'o':
            RunRequest( REQ_TRACE_OVER );
            break;
        case 'g':
            RunRequest( REQ_GO );
            break;
        case 'x':
            if( _IsOn( SW_REMOTE_LINK ) ) {
                printf( "Can't break remote task!\n" );
            } else {
                HANDLE hmod;
                FARPROC proc;
                hmod = GetModuleHandle( TrapParms );
                proc = GetProcAddress( hmod, (LPSTR)5 );
                if( proc != NULL ) proc();
                CloseHandle( hmod );
            }
            // break the task
            break;
        default:
            printf( "Error - unrecognized command\n" );
        }
    } else {
        DoCmd( DupStr( buff ) );
        DoInput();
    }
}
Ejemplo n.º 13
0
int XLibraLP::SWAdaptor()

{
    unsigned char cmd[512];
    unsigned char *lp_cmd = cmd;
    int libra_num_tmp = ((XCOMConnection *)connection_descriptor)->number;
    short word_tmp;

    for (int i(0); i < 3; i++)
    {
        *lp_cmd = libra_num_tmp % 10;
        libra_num_tmp = libra_num_tmp / 10;
        ++lp_cmd;
    }
    *lp_cmd = 43;   ++lp_cmd;
    *lp_cmd = 8;    ++lp_cmd;
    *lp_cmd = 9;    ++lp_cmd;
    *lp_cmd = 0x30; ++lp_cmd;
    word_tmp = 700;
    memcpy(lp_cmd, &word_tmp, 2);
Ejemplo n.º 14
0
int RunSystemCmd(char *filepath, ...)
{
	va_list argp;
	char *argv[24]={0};
	int status;
	char *para;
	int argno = 0;
	va_start(argp, filepath);

	while (1){ 
		para = va_arg( argp, char*);
		if ( strcmp(para, "") == 0 )
			break;
		argv[argno] = para;
		//printf("Parameter %d is: %s\n", argno, para); 
		argno++;
	} 
	argv[argno+1] = NULL;
	status = DoCmd(argv, filepath);
	va_end(argp);
	return status;
}
Ejemplo n.º 15
0
int main()
{
    ReqHandler handle;
    signal(SIGINT, term_handler);
    signal(SIGSEGV, term_handler);
    signal(SIGQUIT, term_handler);
    signal(SIGILL, term_handler);
    signal(SIGBUS, term_handler);
    signal(SIGTERM, term_handler);
    signal(SIGPIPE, term_handler);

    handle.Init();
    miniemc::EmcController* pCtrl = miniemc::EmcController::Instance();
    pCtrl->SetEmcPath("/home/emc2/");
    pCtrl->Init();
    pCtrl->CreateConfigJSON(emcCFGJson);
    try
    {
        mongoose::options options;
        options.add("document_root", "/home/www/html");
        options.add("listening_ports", "80");
        mongoose::web_server server(options, handle);
        while( !bFinish )
        {
            if( pCtrl->Update() )
            {
                GenerateJson();
                DoCmd();
            }
            usleep(250000);
        }
    }
    catch (std::exception& ex)
    {
        std::cerr << ex.what() << std::endl;
    }
    handle.Exit();
}
Ejemplo n.º 16
0
int main(int argc,char *argv[]) {

char *cp, *ep;
char host[49];
char tmpb[CMD_BUF_SIZE];
int tmo;

#if NEWS
   printf("amptest: See <news> command\n");
   printf("amptest: Type h for help\n");
#endif

   pname = argv[0];
   printf("%s: Compiled %s %s\n",pname,__DATE__,__TIME__);
   printf("%s: %s\n",pname, git_version);

   tmo = 0;
   while (AmpIsBlocked()) {
      usleep(100000);
      if (tmo++ > 50) {
	 printf("Amplifier is blocked by another program\n");
	 if (YesNo("Force","Reservation")) AmpUnBlock();
	 else exit(1);
      }
   }
   AmpBlock();
   printf("Amplifier reservation taken, all other programs blocked\n");


   amp = AmpOpen();
   if (amp == 0) {
      printf("\nWARNING: Could not open driver");
      printf("\n\n");
   } else {
      printf("Driver opened OK\n\n");
   }

   bzero((void *) host,49);
   gethostname(host,48);

   while (True) {

      if (amp) sprintf(prompt,"%s:Amp[%02d]",host,cmdindx+1);
      else     sprintf(prompt,"%s:NoDriver:Amp[%02d]",host,cmdindx+1);

      cmdbuf = &(history[cmdindx][0]);
      if (strlen(cmdbuf)) printf("{%s} ",cmdbuf);
      printf("%s",prompt);

      bzero((void *) tmpb,CMD_BUF_SIZE);
      if (gets(tmpb)==NULL) exit(1);

      cp = &(tmpb[0]);
      if (*cp == '!') {
	 cmdindx = strtoul(++cp,&ep,0) -1; cp = ep;
	 if (cmdindx >= HISTORIES) cmdindx = 0;
	 cmdbuf = &(history[cmdindx][0]);
	 continue;
      } else if (*cp == '.') {
	 printf("Execute:%s\n",cmdbuf); fflush(stdout);
      } else if ((*cp == '\n') || (*cp == '\0')) {
	 cmdindx++;
	 if (cmdindx >= HISTORIES) { printf("\n"); cmdindx = 0; }
	 cmdbuf = &(history[cmdindx][0]);
	 continue;
      } else if (*cp == '?') {
	 printf("History:\n");
	 printf("\t!<1..24> Goto command\n");
	 printf("\tCR       Goto next command\n");
	 printf("\t.        Execute current command\n");
	 printf("\this      Show command history\n");
	 continue;
      } else {
	 cmdindx++; if (cmdindx >= HISTORIES) { printf("\n"); cmdindx = 0; }
	 strcpy(cmdbuf,tmpb);
      }
      bzero((void *) val_bufs,sizeof(val_bufs));
      GetAtoms(cmdbuf);
      DoCmd(0);
   }
}
Ejemplo n.º 17
0
int main(int argc,char *argv[]) {

char *cp, *ep;
char host[49];
char tmpb[CMD_BUF_SIZE];

   printf("vmeiotest: See <news> command\n");
   printf("vmeiotest: Type h for help\n");

   pname = argv[0];
   printf("%s: Compiled %s %s\n",pname,__DATE__,__TIME__);

   bzero((void *) host,49);
   gethostname(host,48);

   if (argc > 1)
      strcat(dev_name,argv[1]);
   else
      strcat(dev_name,"vmeio");

   if ((vmeio[lun] = __vsl_open_name(lun,dev_name)) == NULL) {
      printf("Warning: Can't open support library\n");
      perror(DRV_NAME);
      exit(1);
   }

   memlen = 1024;
   mem = malloc(memlen);
   get_window_parameters(lun);
   read_regs(dev_name);

   while (True) {

      cmdbuf = &(history[cmdindx][0]);
      if (strlen(cmdbuf)) printf("{%s} ",cmdbuf);
      fflush(stdout);

      if (vmeio) sprintf(prompt,"%s:%s[%02d]",host,dev_name,cmdindx+1);
      else     sprintf(prompt,"%s:NoDriver:Vmeio[%02d]",host,cmdindx+1);
      printf("%s",prompt);

      bzero((void *) tmpb,CMD_BUF_SIZE);
      if (fgets(tmpb,CMD_BUF_SIZE,stdin)==NULL) exit(1);

      cp = tmpb;
      if (*cp == '!') {
	 cmdindx = strtoul(++cp,&ep,0) -1;
	 cp = ep;
	 if (cmdindx >= HISTORIES) cmdindx = 0;
	 cmdbuf = &(history[cmdindx][0]);
	 continue;
      } else if (*cp == '.') {
	 printf("Execute:%s\n",cmdbuf); fflush(stdout);
      } else if ((*cp == '\n') || (*cp == '\0')) {
	 cmdindx++;
	 if (cmdindx >= HISTORIES) { printf("\n"); cmdindx = 0; }
	 cmdbuf = &(history[cmdindx][0]);
	 continue;
      } else if (*cp == '?') {
	 printf("History:\n");
	 printf("\t!<1..24> Goto command\n");
	 printf("\tCR       Goto next command\n");
	 printf("\t.        Execute current command\n");
	 printf("\this      Show command history\n");
	 continue;
      } else {
	 cmdindx++; if (cmdindx >= HISTORIES) { printf("\n"); cmdindx = 0; }
	 strcpy(cmdbuf,tmpb);
      }
      bzero((void *) val_bufs,sizeof(val_bufs));
      GetAtoms(cmdbuf);
      DoCmd(0);
   }
}
Ejemplo n.º 18
0
int main(int argc,char *argv[])
{
	int rp, pr, dev;
	char *cp;
	char host[49];
	char tmpb[CMD_BUF_SIZE];

	pname = argv[0];
	printf("%s: Compiled %s %s\n",pname,__DATE__,__TIME__);

	if (argc > 1)
		dev = strtoul(argv[1],&cp,0);

	do_open(dev);
	show_dev(1);

	bzero((void *) host,49);
	gethostname(host,48);

	while (True) {

		sprintf(prompt,"%s:Icv196.%d[%02d]",host,get_lun(),cmdindx+1);
		printf("%s",prompt);

		cmdbuf = &(history[cmdindx][0]);

		bzero((void *) tmpb,CMD_BUF_SIZE);
		if (fgets(tmpb,CMD_BUF_SIZE,stdin) == NULL) break;

		cp = &(tmpb[0]);
		pr = 0;           /* Dont print a history */
		rp = 0;           /* Dont repeat a command */

		while ((*cp == '-')
		||     (*cp == '+')
		||     (*cp == '.')
		||     (*cp == '!')) {

			pr = 1;        /* Print command on */

			if (*cp == '!') {
				cp++;
				cmdindx = strtoul(cp,&cp,0) -1;
				if (cmdindx >= HISTORIES) cmdindx = 0;
				if (cmdindx < 0) cmdindx = HISTORIES -1;
				rp = 1;
				break;
			}

			if (*cp == '-') {
				if (--cmdindx < 0) cmdindx = HISTORIES -1;
				cmdbuf = &(history[cmdindx][0]);
			}

			if (*cp == '+') {
				if (++cmdindx >= HISTORIES) cmdindx = 0;
				cmdbuf = &(history[cmdindx][0]);
			}

			if (*cp == '.') {
				rp = 1;
				break;
			}

			cp++;
		}
		if (pr) {
			printf("{%s}\t ",cmdbuf); fflush(stdout);
			if (!rp) continue;
		}
		if (!rp) strcpy(cmdbuf,tmpb);

		bzero((void *) val_bufs,sizeof(val_bufs));
		GetAtoms(cmdbuf);
		DoCmd(0);

		if ((!rp) && (++cmdindx >= HISTORIES)) cmdindx = 0;
	}
	exit(0);
}
Ejemplo n.º 19
0
void FIMGSE2D::StretchBlt(PRECTL prclSrc, PRECTL prclDst, ROT_TYPE m_iRotate)
{
    WORD usSrcWidth = 0;
    WORD usSrcHeight = 0;
    WORD usDstWidth = 0;
    WORD usDstHeight = 0;
    DWORD uXYIncr = 0;
    DWORD uCmdRegVal=0;

    RECTL    rectDst;            //< If rotation case this value must be corrected.

    RETAILMSG(DISP_ZONE_ENTER,(TEXT("[2DHW] StretchBlt Entry\r\n")));    

    /// Always LeftTop Coordinate is less than RightBottom for Source and Destination Region
    assert( (prclSrc->left < prclSrc->right) && (prclSrc->top < prclSrc->bottom) );
    assert( (prclDst->left < prclDst->right) && (prclDst->top < prclDst->bottom) );    

    /// Set Stretch parameter
    /// Stretch ratio calculation, width and height is not include last line
    usSrcWidth=(WORD) ABS( prclSrc->right  - prclSrc->left);
    usDstWidth=(WORD) ABS( prclDst->right  - prclDst->left);
    usSrcHeight=(WORD) ABS( prclSrc->bottom  - prclSrc->top);
    usDstHeight=(WORD) ABS( prclDst->bottom  - prclDst->top);

    if((m_iRotate == ROT_90) ||(m_iRotate == ROT_270) )
    {
        SWAP(usDstHeight, usDstWidth, WORD);
    }    

    /// When Orthogonally Rotated operation is conducted,     
    if(usSrcWidth == usDstWidth && usSrcHeight == usDstHeight)
    {
        RETAILMSG(DISP_ZONE_2D, (TEXT("This is not stretch or shrink BLT, redirect to BitBlt, R:%d\n"), m_iRotate));
        BitBlt(prclSrc, prclDst, m_iRotate);
        return;
    }
    
    uXYIncr = CalculateXYIncrFormat(usSrcWidth -1, usDstWidth -1);
    SetXIncr(uXYIncr);    
    RETAILMSG(DISP_ZONE_2D,(TEXT("\nXIncr : %d.%x"), (uXYIncr&0x003ff800)>>11, (uXYIncr & 0x000007ff)));    

    uXYIncr = CalculateXYIncrFormat(usSrcHeight -1, usDstHeight -1);
    SetYIncr(uXYIncr);
    RETAILMSG(DISP_ZONE_2D,(TEXT("\nYIncr : %d.%x"), (uXYIncr&0x003ff800)>>11, (uXYIncr & 0x000007ff)));        
    
    SetCoordinateSrcBlock(prclSrc->left, prclSrc->top, prclSrc->right - 1, prclSrc->bottom - 1);    

    if(m_iRotate == ROT_180)        //< origin set to (x2,y2)
    {
        rectDst.left = prclDst->right - 1;                        //< x2
        rectDst.top = prclDst->bottom - 1;                        //< y2
        rectDst.right = 2 * (prclDst->right - 1) - prclDst->left ;        //< x2 + (x2 - x1)
        rectDst.bottom = 2 * (prclDst->bottom -1) - prclDst->top;    //< y2 + (y2 - y1)
    }
    else     if(m_iRotate == ROT_90)        //<In this time, Height and Width are swapped.
    {
        rectDst.left = prclDst->right - 1;                        //< x2
        rectDst.right = prclDst->right - 1 + prclDst->bottom - 1 - prclDst->top;    //< x2 + (y2 - y1)
        rectDst.top = prclDst->top;                                        //< y1
        rectDst.bottom = prclDst->top + prclDst->right - 1 - prclDst->left;        //< y1 + (x2 - x1)
    }
    else     if(m_iRotate == ROT_270)        //<In this time, Height and Width are swapped.
    {
        rectDst.left = prclDst->left;                            //< x1
        rectDst.right = prclDst->left + prclDst->bottom - 1- prclDst->top;        //< x1 + (y2 - y1)
        rectDst.top = prclDst->bottom - 1;                                    //< y2
        rectDst.bottom = prclDst->bottom - 1 + prclDst->right - 1- prclDst->left;    //< y2 + (x2 - x1)
    }
    else        //< ROT_0
    {
        rectDst.left = prclDst->left;
        rectDst.top = prclDst->top;
        rectDst.right = prclDst->right - 1;
        rectDst.bottom = prclDst->bottom - 1;
    }

    /// Set Destination's Rotation mode
    SetRotationMode(m_iRotate);
    SetRotationOrg((WORD)rectDst.left, (WORD)rectDst.top);
    SetCoordinateDstBlock(rectDst.left, rectDst.top, rectDst.right, rectDst.bottom);

    RETAILMSG(DISP_ZONE_2D,(TEXT("ROT:%d, Src:(%d,%d)~(%d,%d), Dst:(%d,%d)~(%d,%d), OC:(%d,%d)\r\n"), 
        m_iRotate, prclSrc->left, prclSrc->top, prclSrc->right, prclSrc->bottom, 
        rectDst.left, rectDst.top, rectDst.right, rectDst.bottom, rectDst.left, rectDst.top));

    uCmdRegVal = G2D_STRETCH_BITBLT_BIT;

    DoCmd(&(m_pG2DReg->CMDR1), uCmdRegVal, G2D_DEFAULT_RETURN_TYPE);

    RETAILMSG(DISP_ZONE_ENTER,(TEXT("[2DHW] StretchBlt Exit\r\n")));            
    /// TODO: Resource Register clearing can be needed.
}
Ejemplo n.º 20
0
bool cSmartCardVideoGuard2::Init(void)
{
  static const unsigned char vg2Hist[] = { 'i',0xff,'J','P' };
  if(atr->histLen<4 || memcmp(&atr->hist[3],vg2Hist,4)) {
    PRINTF(L_SC_INIT,"doesn't look like a VideoGuard2 card");
    return false;
    }

  infoStr.Begin();
  infoStr.Strcat("VideoGuard2 smartcard\n");
  snprintf(idStr,sizeof(idStr),"%s (%c%c.%d)",SC_NAME,atr->hist[10],atr->hist[11],atr->hist[12]);
  
  ResetIdSet();
  delete cmdList; cmdList=0;

  static unsigned char ins7401[] = { 0xD0,0x74,0x01,0x00,0x00 };
  int l;
  if((l=ReadCmdLen(ins7401))<0) {
    PRINTF(L_SC_ERROR,"bogus answer. Now try delayed mode");
    NewCardConfig(&cardCfgDelay);
    if((l=ReadCmdLen(ins7401))<0) return false;
    }
  ins7401[4]=l;
  unsigned char buff[256];
  if(!IsoRead(ins7401,buff) || !Status()) {
    PRINTF(L_SC_ERROR,"failed to read cmd list");
    return false;
    }
  cmdList=new CmdTable(buff,l);

  static const unsigned char ins7416[5] = { 0xD0,0x74,0x16,0x00,0x00 };
  if(DoCmd(ins7416)<0 || !Status()) {
    PRINTF(L_SC_ERROR,"cmd 7416 failed");
    return false;
    }

  static const unsigned char ins36[5] = { 0xD0,0x36,0x00,0x00,0x00 };
  bool boxidOK=false;
  if((l=DoCmd(ins36,0,buff))>0 && Status())
    for(int i=0; i<l ;i++) {
      if(buff[i]==0x00 && buff[i+1]==0xF3) {
        memcpy(&boxID,&buff[i+2],sizeof(boxID));
        boxidOK=true;
        break;
        }
      }
  if(!boxidOK) {
    cSmartCardDataVideoGuard2 cd(dtBoxId);
    cSmartCardDataVideoGuard2 *entry=(cSmartCardDataVideoGuard2 *)smartcards.FindCardData(&cd);
    if(entry) {
      memcpy(&boxID,entry->boxid,sizeof(boxID));
      boxidOK=true;
      }
    }
  if(!boxidOK) {
    PRINTF(L_SC_ERROR,"no boxID available");
    return false;
    }

  static const unsigned char ins4C[5] = { 0xD0,0x4C,0x00,0x00,0x00 }; 
  static unsigned char payload4C[9] = { 0,0,0,0, 3,0,0,2,4 };
  memcpy(payload4C,boxID,4);
  if(DoCmd(ins4C,payload4C)<0 || !Status()) {
    PRINTF(L_SC_ERROR,"sending boxid failed");
    return false;
    }

  static const unsigned char ins58[5] = { 0xD0,0x58,0x00,0x00,0x00 };
  if(DoCmd(ins58,0,buff)<0 || !Status()) {
    PRINTF(L_SC_ERROR,"failed to read card details");
    return false;
    }
  
  unsigned int c=WORD(buff,0x1D,0xFFFF);
  if(c!=CAID) CaidsChanged();
  CAID=c;
  memcpy(&cardID,&buff[8],4);
  memcpy(&groupID,&buff[8],4); groupID[3]=0;
  SetCard(new cCardNDS(cardID));
  AddProv(new cProviderNDS(groupID));
  char str[20], str2[20];
  infoStr.Printf("Cardtype: %c%c.%d\n"
                 "BoxID %s Caid %04x CardID %s\n",
                 atr->hist[10],atr->hist[11],atr->hist[12],HexStr(str,boxID,4),CAID,HexStr(str2,cardID,4));
  PRINTF(L_SC_INIT,"cardtype: %c%c.%d boxID %s caid %04x cardID %s",atr->hist[10],atr->hist[11],atr->hist[12],HexStr(str,boxID,4),CAID,HexStr(str2,cardID,4));

  cSmartCardDataVideoGuard2 cd(dtSeed);
  cSmartCardDataVideoGuard2 *entry=(cSmartCardDataVideoGuard2 *)smartcards.FindCardData(&cd);
  if(!entry) {
    PRINTF(L_SC_ERROR,"no NDS seed available");
    return false;
    }
  state.SetSeed(entry->seed0,entry->seed1);
  unsigned char tbuff[64];
  state.GetCamKey(tbuff);

  static const unsigned char insB4[5] = { 0xD0,0xB4,0x00,0x00,0x00 };
  if(DoCmd(insB4,tbuff)<0 || !Status()) {
    PRINTF(L_SC_ERROR,"cmd D0B4 failed");
    return false;
    }
  
  static const unsigned char insBC[5] = { 0xD0,0xBC,0x00,0x00,0x00 };
  if(DoCmd(insBC)<0 || !Status()) {
    PRINTF(L_SC_ERROR,"cmd D0BC failed");
    return false;
    }
  static const unsigned char insBE[5] = { 0xD3,0xBE,0x00,0x00,0x00 };
  if(DoCmd(insBE)<0 || !Status()) {
    PRINTF(L_SC_ERROR,"cmd D3BE failed");
    return false;
    }

  static const unsigned char ins58a[5] = { 0xD1,0x58,0x00,0x00,0x00 }; 
  if(DoCmd(ins58a)<0 || !Status()) {
    PRINTF(L_SC_ERROR,"cmd D158 failed");
    return false;
    }
  static const unsigned char ins4Ca[5] = { 0xD1,0x4C,0x00,0x00,0x00 }; 
  if(DoCmd(ins4Ca,payload4C)<0 || !Status()) {
    PRINTF(L_SC_ERROR,"cmd D14C failed");
    return false;
    }
  ReadTiers();
  return true;
}
Ejemplo n.º 21
0
int main(int argc,char *argv[]) {

char *cp;
char host[49];
char tmpb[CMD_BUF_SIZE];
int  c;

#if NEWS
   printf("xmemtest: See <news> command\n");
   printf("xmemtest: Type h for help\n");
#endif

   pname = argv[0];
   printf("%s: Compiled %s %s\n",pname,__DATE__,__TIME__);

   for (;;) {
	   c = getopt(argc, argv, "c:h");
	   if (c < 0)
		   break;
	   switch (c) {
	   case 'c':
		   if (set_conf_path(optarg))
			   printf("\nWarning: path invalid or too long\n");
		   break;
	   case 'h':
		   usage_complete();
		   exit(0);
	   }
   }

   xmem = XmemOpen();
   if (xmem == 0) {
      printf("\nWARNING: Could not open driver");
      printf("\n\n");
   } else {
      printf("Driver opened OK: Using XMEM module: 1\n\n");
   }
   ReadSegTable(0);
   ReadNodeTableFile(0);
   printf("\n");

   bzero((void *) host,49);
   gethostname(host,48);

   while (True) {

      if (xmem) sprintf(prompt,"%s:Xmem[%02d]",host,cmdindx+1);
      else     sprintf(prompt,"%s:NoDriver:Xmem[%02d]",host,cmdindx+1);

      cmdbuf = &(history[cmdindx][0]);
      if (strlen(cmdbuf)) printf("{%s} ",cmdbuf);
      printf("%s",prompt);

      bzero((void *) tmpb,CMD_BUF_SIZE);
      if (gets(tmpb)==NULL) exit(1);

      cp = &(tmpb[0]);
      if (*cp == '!') {
	 cmdindx = strtoul(++cp,&cp,0) -1;
	 if (cmdindx >= HISTORIES) cmdindx = 0;
	 cmdbuf = &(history[cmdindx][0]);
	 continue;
      } else if (*cp == '.') {
	 printf("Execute:%s\n",cmdbuf); fflush(stdout);
      } else if ((*cp == '\n') || (*cp == '\0')) {
	 cmdindx++;
	 if (cmdindx >= HISTORIES) { printf("\n"); cmdindx = 0; }
	 cmdbuf = &(history[cmdindx][0]);
	 continue;
      } else if (*cp == '?') {
	 printf("History:\n");
	 printf("\t!<1..24> Goto command\n");
	 printf("\tCR       Goto next command\n");
	 printf("\t.        Execute current command\n");
	 printf("\this      Show command history\n");
	 continue;
      } else {
	 cmdindx++; if (cmdindx >= HISTORIES) { printf("\n"); cmdindx = 0; }
	 strcpy(cmdbuf,tmpb);
      }
      bzero((void *) val_bufs,sizeof(val_bufs));
      GetAtoms(cmdbuf);
      DoCmd(0);
   }
}
Ejemplo n.º 22
0
void FIMGSE2D::StretchBlt_Bilinear(PRECTL prclSrc, PRECTL prclDst, ROT_TYPE m_iRotate)
{
    POINT ptCompensatedOffset;
    WORD usSrcWidth = 0;
    WORD usSrcHeight = 0;
    WORD usDstWidth = 0;
    WORD usDstHeight = 0;
    
    DWORD uXIncr = 0;
    DWORD uYIncr = 0;
    DWORD uCmdRegVal=0;

    RECTL    rectDst;
    RECTL    rectDstRT;            //< If rotation case this value must be corrected.
    RECTL    rectDstLT;
    RECTL    rectDstRB;
    RECTL    rectDstLB;

    RETAILMSG(DISP_ZONE_ENTER,(TEXT("\n[2DHW] StretchBlt Entry")));    

    /// Always LeftTop Coordinate is less than RightBottom for Source and Destination Region
    assert( (prclSrc->left < prclSrc->right) && (prclSrc->top < prclSrc->bottom) );
    assert( (prclDst->left < prclDst->right) && (prclDst->top < prclDst->bottom) );    

    /// Set Stretch parameter
    /// most right and bottom line does not be drawn.
    usSrcWidth=(WORD) ABS( prclSrc->right  - prclSrc->left);
    usDstWidth=(WORD) ABS( prclDst->right  - prclDst->left);
    usSrcHeight=(WORD) ABS( prclSrc->bottom  - prclSrc->top);
    usDstHeight=(WORD) ABS( prclDst->bottom  - prclDst->top);

    if((m_iRotate == ROT_90) ||(m_iRotate == ROT_270) )
    {
        SWAP(usDstHeight, usDstWidth, WORD);
    }

    /// Stretch ratio calculation, width and height is include last line
    /// ex) 10x10 to 30x30
    /// Given Coordinate parameter
    /// SrcCoord. (0,0)~(10,10) :  srcwidth = 10-0 = 10, srcheight = 10-0 = 10
    /// DstCoord. (30,30)~(60,60) : dstwidth = 60-30 = 30, dstheight = 60-30 = 30
    /// Actual using coordinate
    /// src (0,0)~(9,9)
    /// Dst (30,30)~(59,59)
    /// Increment calculation : srcwidth/dstwidth = 10/30 = 0.33333...
    
    if(usSrcWidth == usDstWidth && usSrcHeight == usDstHeight)
    {
        RETAILMSG(DISP_ZONE_2D, (TEXT("\nThis is not stretch or shrink BLT, redirect to BitBlt, R:%d"), m_iRotate));
        BitBlt(prclSrc, prclDst, m_iRotate);
        return;
    }
    
    /// calculate horizontal length        
    uXIncr = CalculateXYIncrFormat(usSrcWidth , usDstWidth );    
    SetXIncr(uXIncr);
    RETAILMSG(DISP_ZONE_2D,(TEXT("\nXIncr : %d.%d"), (uXIncr&0x003ff800)>>11, (uXIncr & 0x000007ff)));        
    
    /// calculate vertical length
    uYIncr = CalculateXYIncrFormat(usSrcHeight  , usDstHeight );
    SetYIncr(uYIncr);
    RETAILMSG(DISP_ZONE_2D,(TEXT("\nYIncr : %d.%d"), (uYIncr&0x003ff800)>>11, (uYIncr & 0x000007ff)));            

    /// Set Source Region Coordinate
    SetCoordinateSrcBlock(prclSrc->left, prclSrc->top, prclSrc->right - 1, prclSrc->bottom - 1);    

    /// Now We divide destination region by 4 logically.
    /// 1. LeftTop Vertical Bar, 2. RightTop Block, 3. LeftBottom Small Block, 4.RightBottom Horizontal Bar
    
    /// 1. LeftTop Vertical Bar
    /// This region has destination's height - RightBottom Horizontal bar's height
    /// and has width value can be gotten by this fomula : 
    ///     Refered source surface's pixel coordinate = 0.5 + Increment ratio(Src/Dst) * destination's coordinate
    /// In stretchBlt, Destination's coordinate always starts from (0,0)
    /// Here, Bar's width is (max desitnation's coordinate+1) until refered source surface's pixel coordinate is not over 1.0.
    /// ex) 10x10 to 30x30
    ///    Increment ratio = 10/30 = 0.33333
    ///    Refered source surface's pixel coordinate = 0.5+0.333*0, 0.5+0.333*1, 0.5+0.333*2
    ///    0.5, 0.833  meets this condition. so max destination's coordnate is 1. width is 2
    /// then each block of destination's has this region
    /// LT = (0,0)~(1,27), LB(0,28)~(1,29), RT(2,0)~(29,27), RB(2,28)~(29,29)
    ///  real stretch ratio is 30/10 = 3. so 2 is less than 3. we need add offset 1
    /// ex) 10x10 to 50x50
    ///    Increment ratio = 10/50 = 0.2
    ///    Refered source surface's pixel coordinate = 0.5+0.2*0, 0.5+0.2*1, 0.5+0.2*2, 0.5+0.2*3
    ///   0.5, 0.7, 0.9 meets this condition. so max destination's coordinate is 2. width is 3
    /// then each block of desitnation's has this region
    /// LT = (0,0)~(2,46), LB(0,47)~(2,49), RT(3,0)~(49,47), RB(3,47)~(49,49)
    ///  real stretch ratio is 50/10 = 5. so 3 is less than 5, we need add offset 2
    ptCompensatedOffset.x = GetCompensatedOffset(usSrcWidth, usDstWidth);
    ptCompensatedOffset.y = GetCompensatedOffset(usSrcHeight, usDstHeight);

    ///    

    /// Calculate Destination Region Coordinate for each rotation degree
    if(m_iRotate == ROT_180)        //< origin set to (x2,y2)
    {
        rectDst.left = prclDst->right - 1;                        //< x2
        rectDst.top = prclDst->bottom - 1;                        //< y2
        rectDst.right = 2 * (prclDst->right - 1) - prclDst->left ;        //< x2 + (x2 - x1)
        rectDst.bottom = 2 * (prclDst->bottom -1) - prclDst->top;    //< y2 + (y2 - y1)
    }
    else     if(m_iRotate == ROT_90)        //<In this time, Height and Width are swapped.    
    {
        rectDst.left = prclDst->right - 1;                        //< x2
        rectDst.right = prclDst->right - 1 + prclDst->bottom - 1 - prclDst->top;    //< x2 + (y2 - y1)
        rectDst.top = prclDst->top;                                        //< y1
        rectDst.bottom = prclDst->top + prclDst->right - 1 - prclDst->left;        //< y1 + (x2 - x1)
    }
    else     if(m_iRotate == ROT_270)        //<In this time, Height and Width are swapped.    
    {
        rectDst.left = prclDst->left;                            //< x1
        rectDst.right = prclDst->left + prclDst->bottom - 1- prclDst->top;        //< x1 + (y2 - y1)
        rectDst.top = prclDst->bottom - 1;                                    //< y2
        rectDst.bottom = prclDst->bottom - 1 + prclDst->right - 1- prclDst->left;    //< y2 + (x2 - x1)
    }
    else        //< ROT_0
    {
        rectDst.left = prclDst->left;
        rectDst.top = prclDst->top;        
        rectDst.right = prclDst->right - 1;
        rectDst.bottom = prclDst->bottom - 1;
    }

    RETAILMSG(DISP_ZONE_2D,(TEXT("\nROT:%d, Src:(%d,%d)~(%d,%d), Dst:(%d,%d)~(%d,%d), OC:(%d,%d)"), 
        m_iRotate, prclSrc->left, prclSrc->top, prclSrc->right, prclSrc->bottom, 
        rectDst.left, rectDst.top, rectDst.right, rectDst.bottom, rectDst.left, rectDst.top));

    /// Set Destination's Rotation mode
    SetRotationMode(m_iRotate);        
    SetRotationOrg((WORD)rectDst.left, (WORD)rectDst.top);    
    uCmdRegVal = G2D_STRETCH_BITBLT_BIT;
    
    if(ptCompensatedOffset.x != 0 || ptCompensatedOffset.y != 0)
    {
        rectDstRB.left = rectDst.left + ptCompensatedOffset.x;
        rectDstRB.right = rectDst.right;
        rectDstRB.top = rectDst.top + ptCompensatedOffset.y;
        rectDstRB.bottom = rectDst.bottom;
        SetClipWindow(&rectDstRB);    //< Reconfigure clip region as Each Block's region    
        SetCoordinateDstBlock(rectDstRB.left, rectDstRB.top, rectDstRB.right + ptCompensatedOffset.x, rectDstRB.bottom + ptCompensatedOffset.y);

        /// First Issuing for Right Bottom Big Region.
        RequestEmptyFifo(1);
        
        RETAILMSG(DISP_ZONE_2D,(TEXT("\nRight Bottom Block : Dst:(%d,%d)~(%d,%d)"), 
            rectDstRB.left, rectDstRB.top, rectDstRB.right, rectDstRB.bottom));    
        
        m_pG2DReg->CMDR1 = uCmdRegVal;

        rectDstRT.left = rectDstRB.left;
        rectDstRT.right = rectDst.right;
        rectDstRT.top = rectDst.top;
        rectDstRT.bottom = rectDstRB.top - 1;
        SetClipWindow(&rectDstRT);
        SetCoordinateDstBlock(rectDstRT.left, rectDst.top, rectDst.right + ptCompensatedOffset.x, rectDst.bottom);

        /// Second Issuing for Right Top Horizontal Bar Region.(in 0, 180 degree)
        RequestEmptyFifo(1);
        RETAILMSG(DISP_ZONE_2D,(TEXT("\nRight Top Block : Dst:(%d,%d)~(%d,%d)"), 
            rectDstRT.left, rectDstRT.top, rectDstRT.right, rectDstRT.bottom));    
        
        m_pG2DReg->CMDR1 = uCmdRegVal;

        
        rectDstLB.left = rectDst.left;
        rectDstLB.right = rectDstRB.left - 1;
        rectDstLB.top = rectDstRB.top;
        rectDstLB.bottom = rectDst.bottom;
        SetClipWindow(&rectDstLB);
        SetCoordinateDstBlock(rectDst.left, rectDstLB.top, rectDst.right, rectDstLB.bottom + ptCompensatedOffset.y);    
        /// Third Issuing for Left Bottom Vertical Bar(in 0,180 degree)
        RequestEmptyFifo(1);
        RETAILMSG(DISP_ZONE_2D,(TEXT("\nLeft Bottom Block : Dst:(%d,%d)~(%d,%d)"), 
            rectDstLB.left, rectDstLB.top, rectDstLB.right, rectDstLB.bottom));    
        
        m_pG2DReg->CMDR1 = uCmdRegVal;

        
        rectDstLT.left = rectDst.left;
        rectDstLT.right = rectDstLB.right;
        rectDstLT.top = rectDst.top;
        rectDstLT.bottom = rectDstRT.bottom;
        SetClipWindow(&rectDstLT);
    RETAILMSG(DISP_ZONE_2D,(TEXT("\nLeft Top Block : Dst:(%d,%d)~(%d,%d)"), 
        rectDstLT.left, rectDstLT.top, rectDstLT.right, rectDstLT.bottom));    
        
    }
    
    SetCoordinateDstBlock(rectDst.left, rectDst.top, rectDst.right, rectDst.bottom);    
    /// Last Issuing for Left Top Small Region(in 0,180 degree)

    DoCmd(&(m_pG2DReg->CMDR1), uCmdRegVal, G2D_DEFAULT_RETURN_TYPE);    

    RETAILMSG(DISP_ZONE_ENTER,(TEXT("\n[2DHW] StretchBlt Exit")));
    /// TODO: Resource Register clearing can be needed.

}