clsim_lib.c

Go to the documentation of this file.
00001 
00006 #include "edtinc.h"
00007 #include "clsim_lib.h"
00008 
00030 void pdv_cls_set_size(PdvDev *pdv_p,
00031                 int taps,
00032                 int depth ,
00033                 int width,
00034                 int height,
00035                 int hblank,
00036                 int totalwidth,
00037                 int vblank,
00038                 int totalheight)
00039 
00040 {
00041     PdvDependent *dd_p = pdv_p->dd_p;
00042     int clocks;
00043 
00044     if (taps == 0)
00045         taps = 1;
00046 
00047     clocks = width / taps;
00048 
00049     if (hblank)
00050         totalwidth = clocks + hblank;
00051 
00052     if (vblank)
00053         totalheight = height + vblank;
00054 
00055     /* hold off sim start */
00056 
00057     edt_reg_write(pdv_p, PDV_CLSIM_HCNTMAX, totalwidth-1);
00058     edt_reg_write(pdv_p, PDV_CLSIM_VACTV, height-1);
00059     edt_reg_write(pdv_p, PDV_CLSIM_VCNTMAX, totalheight-1);
00060 
00061     edt_reg_write(pdv_p, PDV_CL_DATA_PATH, dd_p->cl_data_path);
00062 
00063     edt_reg_write(pdv_p, PDV_CFG, 0);
00064 }
00065 
00083 void
00084 pdv_cls_set_line_timing(PdvDev *pdv_p,
00085                 int width,
00086                 int taps,
00087                 int Hfvstart,
00088                 int Hfvend,
00089                 int Hlvstart,
00090                 int Hlvend,
00091                 int Hrvstart,
00092                 int Hrvend)
00093 
00094 {
00095     int clocks;
00096     
00097     if (taps == 0)
00098         taps = 1;
00099     
00100     clocks = width / taps;
00101 
00102     edt_reg_write(pdv_p, PDV_CLSIM_HFVSTART, Hfvstart);
00103     edt_reg_write(pdv_p, PDV_CLSIM_HFVEND, (Hfvend)?Hfvend:Hfvstart+clocks);
00104 
00105     edt_reg_write(pdv_p, PDV_CLSIM_HLVSTART, Hlvstart);
00106     edt_reg_write(pdv_p, PDV_CLSIM_HLVEND, (Hlvend)?Hlvend:Hlvstart+clocks);
00107 
00108     edt_reg_write(pdv_p, PDV_CLSIM_HRVSTART, Hrvstart);
00109     edt_reg_write(pdv_p, PDV_CLSIM_HRVEND, (Hrvend)?Hrvend:Hrvstart+clocks);
00110 
00111 }
00112 
00113 
00120 int
00121 pdv_cls_get_hgap(PdvDev *pdv_p)
00122 
00123 {
00124     int totalcnt;
00125     int clocks;
00126     int taps;
00127     int rgb;
00128 
00129     rgb = pdv_p->dd_p->cl_cfg & 1;
00130 
00131     totalcnt = edt_reg_read(pdv_p, PDV_CLSIM_HCNTMAX) + 1;
00132 
00133     if (rgb)
00134         taps = 1;
00135     else if (pdv_get_depth(pdv_p) > 8)
00136         taps = 1;
00137     else
00138         taps = (edt_reg_read(pdv_p, PDV_CL_DATA_PATH) >> 4) + 1;
00139 
00140     clocks = pdv_get_width(pdv_p) / taps;
00141 
00142     return totalcnt - clocks;
00143 
00144 }
00145 
00152 int
00153 pdv_cls_get_vgap(PdvDev *pdv_p)
00154 
00155 {
00156     int totalcnt;
00157     int vactv;
00158 
00159     totalcnt = edt_reg_read(pdv_p, PDV_CLSIM_VCNTMAX) + 1;
00160 
00161     vactv = edt_reg_read(pdv_p, PDV_CLSIM_VACTV) + 1;
00162 
00163     return totalcnt - vactv;
00164 
00165 }
00166 
00167 /*******************************************
00168  * Set up serial communication *
00169  *******************************************/
00170 
00171 
00172 void
00173 pdv_cls_init_serial(PdvDev *pdv_p)
00174 
00175 {
00176     pdv_reset_serial(pdv_p);
00177 
00178     edt_reg_write(pdv_p, PDV_CMD, 1);
00179     
00180     edt_reg_write(pdv_p, PDV_SERIAL_DATA_CNTL, 3);
00181     edt_reg_write(pdv_p, PDV_BYTESWAP, 0);
00182 
00183     pdv_serial_read_enable(pdv_p);
00184 }
00185 
00186 /*****************************************
00187  * general bit setting routine
00188  *
00189  *****************************************/
00190 
00191 void pdv_cls_set_cfg_bit(PdvDev *pdv_p,
00192                           int reg,
00193                          int mask,
00194                          int state)
00195 
00196 {
00197     int cfg = edt_reg_read(pdv_p, reg);
00198     
00199     cfg = (cfg & ~mask) | ((state)? mask : 0);
00200 
00201     edt_reg_write(pdv_p, reg, cfg);
00202 
00203 }
00204 
00215 void
00216 pdv_cls_set_linescan(PdvDev *pdv_p, int state)
00217 
00218 {
00219     pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 0x80, state);
00220 }
00221 
00234 void
00235 pdv_cls_set_lvcont(PdvDev *pdv_p, int state)
00236 
00237 {
00238    pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 0x40, state);
00239 }
00240 
00257 void
00258 pdv_cls_set_rven(PdvDev *pdv_p, int state)
00259 
00260 {
00261    pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 0x20, state);
00262 }
00263 
00275 void
00276 pdv_cls_set_uartloop(PdvDev *pdv_p, int state)
00277 
00278 {
00279    pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 0x10, state);
00280 }
00281 
00294 void
00295 pdv_cls_set_smallok(PdvDev *pdv_p, int state)
00296 
00297 {
00298    pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 8, state);
00299 }
00300 
00321 void
00322 pdv_cls_set_intlven(PdvDev *pdv_p, int state)
00323 
00324 {
00325    pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 4, state);
00326 }
00327 
00341 void
00342 pdv_cls_set_firstfc(PdvDev *pdv_p, int state)
00343 
00344 {
00345    pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 2, state);
00346 }
00347 
00367 void 
00368 pdv_cls_set_datacnt(PdvDev *pdv_p, int state)
00369 
00370 {
00371     pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGA, 1, state);
00372 }
00373 
00379 void
00380 pdv_cls_set_led(PdvDev *pdv_p, int state)
00381 
00382 {
00383     pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGC, 0x80,state);
00384 }
00385 
00395 void
00396 pdv_cls_set_trigsrc(PdvDev *pdv_p, int state)
00397 
00398 {
00399     pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGC, 0x08,state);
00400 }
00401 
00412 void
00413 pdv_cls_set_trigpol(PdvDev *pdv_p, int polarity)
00414 
00415 {
00416     pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGC, 0x04, polarity);
00417 }
00418 
00428 void
00429 pdv_cls_set_trigframe(PdvDev *pdv_p, int state)
00430 
00431 {
00432     pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGC, 0x02, state);
00433 }
00443 void
00444 pdv_cls_set_trigline(PdvDev *pdv_p, int state)
00445 
00446 {
00447     pdv_cls_set_cfg_bit(pdv_p, PDV_CLSIM_CFGC, 1,state);
00448 }
00467 void
00468 pdv_cls_sim_start(PdvDev *pdv_p)
00469 
00470 {
00471     edt_reg_write(pdv_p, PDV_CFG, 0);
00472 }
00473 
00483 void
00484 pdv_cls_sim_stop(PdvDev *pdv_p)
00485 
00486 {
00487 
00488     edt_reg_write(pdv_p, PDV_CFG, 8);
00489 }
00490 
00491 void
00492 pdv_cls_set_height(PdvDev *pdv_p, int rasterlines, int vblank)
00493 
00494 {
00495     edt_reg_write(pdv_p, PDV_CLSIM_VACTV, rasterlines-1);
00496 
00497     if (vblank > 0)
00498         edt_reg_write(pdv_p, PDV_CLSIM_VCNTMAX, rasterlines-1+vblank);
00499 
00500 }
00501 
00502 void
00503 pdv_cls_set_width(PdvDev *pdv_p, int width, int hblank)
00504 
00505 {
00506     int totalwidth;
00507     int taps = edt_reg_read(pdv_p, PDV_CL_DATA_PATH);
00508 
00509     taps =  (taps >> 4) + 1;
00510 
00511     if (taps == 0)
00512         taps = 1;
00513 
00514     totalwidth = width / taps;
00515 
00516     if (hblank)
00517         totalwidth += hblank;
00518 
00519      /* hold off sim start */
00520 
00521     edt_reg_write(pdv_p, PDV_CLSIM_HCNTMAX, totalwidth-1);  
00522 
00523     pdv_cls_set_line_timing(pdv_p,
00524                 width,
00525                 taps,0,0,0,0,0,0);
00526         
00527 }
00528 
00529 
00533 void pdv_cls_set_clock(PdvDev *pdv_p, double freq) 
00534 
00535 {       /* Pixel clock frequency in MHz */
00536     int hex, 
00537         bit, 
00538         dbit, 
00539         m, 
00540         n, 
00541         n2, 
00542         b, 
00543         m_best, 
00544         n_best;
00545     double ref=14.0;  /* 40.0/3.0; */
00546     double targ35, 
00547         best35, 
00548         current35;    /* PixClock*3.5 in MHz */
00549     double err_current35, 
00550         err_best35, 
00551         err1x;
00552 
00553     int mmin = (int) (0.99 + 800*4/ref);    /* highest acceptable m value */
00554     int mmax = (int) (1800*4/ref);      /* lowest acceptable m value */
00555 
00556     /* 0 means use internal clock (40 MHz) */
00557 
00558     if (freq == 0.0)
00559     {
00560         edt_reg_write(pdv_p, EDT_SS_PLL_CTL, 0);
00561         return;
00562     }
00563 
00564     if (freq<19.9 || freq>85.1) {
00565         printf("Error, %3.4f is not in range of 20 to 85 MHz\n", freq);
00566     return; 
00567     }
00568     if (mmax > 511)   
00569         mmax=511;
00570 
00571     targ35 = freq*3.5;
00572     best35 = 0.0;  
00573     m_best=0; 
00574     n_best=0;  
00575     err_best35=100.0;
00576 
00577     for (m=mmin; m<=mmax; m++) 
00578     {
00579         for (n=1; n<=8; n*=2) 
00580         {       /* for n values of 1,2,4,8 */
00581                 current35 = ref/8 * m / n;
00582                 err_current35 = targ35 - current35;       /* abs() not for doubles */
00583                 if (err_current35 < 0)    
00584                 err_current35 = -err_current35;
00585                 if (err_current35 < err_best35) 
00586             {
00587                     best35=current35; 
00588                 m_best=m; 
00589                 n_best=n;  
00590                 err_best35=err_current35;
00591                 }
00592             }
00593     }
00594     if (n_best==1) 
00595         n2=3;
00596     else if (n_best==2) 
00597         n2=0;
00598     else if (n_best==4) 
00599         n2=1;
00600     else if (n_best==8) 
00601         n2=2;
00602     hex = n2<<9 | m_best;
00603 
00604     err1x = (best35-targ35)/3.5;
00605     if (err1x < 0.0)   
00606         err1x = - err1x;
00607     if (err1x > 0.00090) 
00608     {
00609         printf("req:%3.4f got:%3.4f err:%3.4f ecl:%3.4f vco:%3.4f m:%d n:%d h:%04x\n",
00610                 freq,
00611                 best35/3.5,
00612                 (best35-targ35)/3.5,
00613                 best35,best35*2*n_best,
00614                 m_best,n_best,hex);
00615        }
00616 
00617     edt_reg_write(pdv_p, EDT_SS_PLL_CTL, 0);
00618     for (bit=13; bit>=0; bit--) 
00619     {   /* send 14 data bits to ECL PLL */
00620        b = hex & (1<<bit);       /* rising edge of *CLK shifts data in*/
00621             if (b)   
00622             dbit=EDT_SS_PLL_DATA; 
00623         else 
00624             dbit=0; 
00625             edt_reg_write(pdv_p, EDT_SS_PLL_CTL, dbit) ;    
00626             edt_reg_write(pdv_p, EDT_SS_PLL_CTL, dbit | EDT_SS_PLL_CLK);
00627     }        /* latches to m,n transparent while *STROBE0 is high */
00628     edt_reg_write(pdv_p, EDT_SS_PLL_CTL, EDT_SS_PLL_STROBE0);
00629     edt_reg_write(pdv_p, EDT_SS_PLL_CTL, 0);
00630 }
00631 
00632 
00641 void pdv_cls_set_dvalid(PdvDev *pdv_p, u_char skip, u_char mode)
00642 {
00643     edt_reg_write(pdv_p, PDV_CLSIM_CFGB, (skip << 4) | (mode & 3));  
00644 }
00645 
00654 void pdv_cls_set_fill(PdvDev *pdv_p, u_char left, u_char right)
00655 {
00656     /* left= FILLA, right=FILLB. */
00657     edt_reg_write(pdv_p, PDV_CLSIM_FILLA, left);
00658     edt_reg_write(pdv_p, PDV_CLSIM_FILLB, right); 
00659 }
00660 
00668 void pdv_cls_set_readvalid(PdvDev *pdv_p, 
00669                 u_short HrvStart, u_short HrvEnd)
00670 {
00671     edt_reg_write(pdv_p, PDV_CLSIM_HRVSTART, HrvStart);
00672     edt_reg_write(pdv_p, PDV_CLSIM_HRVEND, HrvEnd);
00673 }
00674 
00675 
00692 void pdv_cls_setup_interleave(PdvDev *pdv_p,
00693                 short tap0start, short tap0delta, 
00694                 short tap1start, short tap1delta,
00695                 short tap2start, short tap2delta,
00696                 short tap3start, short tap3delta) 
00697 
00698 {
00699     edt_reg_write(pdv_p, PDV_CLSIM_TAP0START, tap0start);
00700     edt_reg_write(pdv_p, PDV_CLSIM_TAP0DELTA, tap0delta);
00701 
00702     edt_reg_write(pdv_p, PDV_CLSIM_TAP1START, tap1start);
00703     edt_reg_write(pdv_p, PDV_CLSIM_TAP1DELTA, tap1delta);
00704 
00705     edt_reg_write(pdv_p, PDV_CLSIM_TAP2START, tap2start);
00706     edt_reg_write(pdv_p, PDV_CLSIM_TAP2DELTA, tap2delta);
00707 
00708     edt_reg_write(pdv_p, PDV_CLSIM_TAP3START, tap3start);
00709     edt_reg_write(pdv_p, PDV_CLSIM_TAP3DELTA, tap3delta);
00710 
00711 }
00712 
00713 
00714 #include "edt_si570.h"
00715 
00716 /*
00717  * Set si570 clock speed in microseconds.
00718  * @param pdv_p pointer to pdv device structure returned by #pdv_open
00719  * @param target clock speed in microseconds (ALERT CHECK THIS)
00720  * @return void
00721  */
00722 void
00723 pe8dvcls_set_clock(PdvDev *pdv_p, double target)
00724 
00725 {
00726     u_int base_desc = 0x70; 
00727     u_int device  = 0;
00728     EdtSI570 clock_parms;
00729     int do_reset = 0;
00730 
00731      /* Set up the input channel */
00732     double nominal = 100000000.0;
00733 
00734     if (target < 100)
00735         target *= 1000000.0;
00736 
00737     edt_si570_set_clock(pdv_p, base_desc, device, nominal, target, &clock_parms);
00738 
00739 }
00740 
00741 
00748 int
00749 pdv_cls_set_dep(PdvDev *pdv_p)
00750 
00751 {
00752     PdvDependent *dd_p = (PdvDependent *) pdv_p->dd_p;
00753     ClSimControl *cls = &dd_p->cls;
00754 
00755     edt_startdma_action(pdv_p, EDT_ACT_NEVER);
00756 
00757     pdv_cls_sim_stop(pdv_p);
00758     
00759     /* set clock  0 means use onboard clock*/
00760     if (cls->pixel_clock == 0)
00761         cls->pixel_clock = 20.0;
00762     
00763     
00764     /* set size params */
00765     
00766     pdv_set_width(pdv_p, dd_p->width);
00767     pdv_set_height(pdv_p, dd_p->height);
00768     pdv_set_depth(pdv_p, dd_p->depth);
00769 
00770 
00771     pdv_set_cam_width(pdv_p, dd_p->width);
00772     pdv_set_cam_height(pdv_p, dd_p->height);
00773 
00774     if (dd_p->cl_cfg & 1)
00775     {
00776         cls->taps = 1;
00777         dd_p->cl_data_path = 0x37;
00778     }
00779     else if (pdv_p->devid == PDVCLS_ID && dd_p->depth > 8)
00780     {
00781         cls->taps = 1;
00782         dd_p->cl_data_path = 0x17;
00783     }
00784     else if (cls->taps == 0)
00785         cls->taps = (dd_p->cl_data_path >> 4) + 1;
00786     else if (dd_p->cl_data_path == 0)
00787         dd_p->cl_data_path = ((cls->taps - 1) << 4) + 7;
00788 
00789     if (cls->hblank == 0 && cls->Hcntmax == 0)
00790         cls->hblank = PDV_CLS_DEFAULT_HGAP;
00791 
00792     if (cls->vblank == 0 && cls->Vcntmax == 0)
00793         cls->vblank = PDV_CLS_DEFAULT_VGAP;
00794 
00795     pdv_cls_set_size(pdv_p,
00796                 cls->taps,
00797                 dd_p->depth,
00798                 dd_p->width,
00799                 dd_p->height,
00800                 cls->hblank, cls->Hcntmax,
00801                 cls->vblank, cls->Vcntmax);
00802 
00803     pdv_cls_set_line_timing(pdv_p,
00804                 dd_p->width,
00805                 cls->taps,
00806                 cls->Hfvstart,
00807                 cls->Hfvend,
00808                 cls->Hlvstart,
00809                 cls->Hlvend,
00810                 cls->Hrvstart,
00811                 cls->Hrvend);
00812 
00813     /* special case with rvstart/end superseding width */
00814 
00815     if (cls->Hrvend)
00816     {
00817         pdv_set_width(pdv_p,cls->Hrvend-cls->Hrvstart);
00818     }
00819         
00820     /* set cfg values */
00821 
00822     pdv_cls_set_linescan(pdv_p, cls->flags.Cfg.linescan);
00823     pdv_cls_set_lvcont(pdv_p, cls->flags.Cfg.lvcont);
00824     pdv_cls_set_rven(pdv_p, cls->flags.Cfg.rven);
00825     pdv_cls_set_uartloop(pdv_p, cls->flags.Cfg.uartloop);
00826     pdv_cls_set_smallok(pdv_p, cls->flags.Cfg.smallok);
00827     pdv_cls_set_intlven(pdv_p, cls->flags.Cfg.intlven);
00828     pdv_cls_set_firstfc(pdv_p, cls->flags.Cfg.firstfc);
00829     pdv_cls_set_datacnt(pdv_p, cls->flags.Cfg.datacnt);
00830    
00831     pdv_cls_set_dvalid(pdv_p, cls->flags.Cfg.dvskip, cls->flags.Cfg.dvmode);
00832 
00833     pdv_cls_set_led(pdv_p, cls->flags.Cfg.led);
00834     pdv_cls_set_trigsrc(pdv_p, cls->flags.Cfg.trigsrc);
00835     pdv_cls_set_trigpol(pdv_p, cls->flags.Cfg.trigpol);
00836     pdv_cls_set_trigframe(pdv_p, cls->flags.Cfg.trigframe);
00837     pdv_cls_set_trigline(pdv_p, cls->flags.Cfg.trigline);
00838 
00839     pdv_cls_set_fill(pdv_p,cls->FillA, cls->FillB);
00840 
00841     edt_reg_write(pdv_p, PDV_CLSIM_EXSYNCDLY, cls->Exsyncdly);
00842 
00843     if (dd_p->n_intlv_taps == 4)
00844     {
00845         pdv_cls_setup_interleave(pdv_p,
00846             dd_p->intlv_taps[0].startx,
00847             dd_p->intlv_taps[0].dx,
00848             dd_p->intlv_taps[1].startx,
00849             dd_p->intlv_taps[1].dx,
00850             dd_p->intlv_taps[2].startx,
00851             dd_p->intlv_taps[2].dx,
00852             dd_p->intlv_taps[3].startx,
00853             dd_p->intlv_taps[3].dx);
00854     } 
00855     else
00856     {
00857         pdv_cls_set_intlven(pdv_p, 0);
00858     }
00859 
00860     pdv_cls_sim_start(pdv_p);
00861 
00862     if (pdv_p->devid == PE8DVCLS_ID)
00863     {
00864         if (pdv_p->channel_no == 0)
00865             pe8dvcls_set_clock(pdv_p, cls->pixel_clock);
00866     }
00867     else
00868         pdv_cls_set_clock(pdv_p, cls->pixel_clock);
00869 
00870 
00871     return 0;
00872 
00873 }
00874 
00886 int
00887 pdv_cls_dep_sanity_check(PdvDev *pdv_p)
00888 
00889 {
00890     return 0;
00891 }
00892 
00899 double
00900 pdv_cls_frame_time(PdvDev *pdv_p)
00901 
00902 {
00903     double clock = pdv_p->dd_p->cls.pixel_clock;
00904 
00905     if (clock != 0.0)
00906     {
00907         double msecs; /* msecs per clock */
00908         double frameclocks, lineclocks;
00909 
00910         msecs = 1.0 / (clock * 1000.0);
00911 
00912         lineclocks = edt_reg_read(pdv_p, PDV_CLSIM_HCNTMAX) * msecs;
00913 
00914         frameclocks = edt_reg_read(pdv_p, PDV_CLSIM_VCNTMAX) * lineclocks;
00915 
00916         return frameclocks;
00917     }
00918 
00919     return 0.0;
00920 }
00921 
00926 void
00927 pdv_cls_dump_state(PdvDev *pdv_p)
00928 
00929 {
00930     int val;
00931     double clock;
00932     val = edt_reg_read(pdv_p, PDV_CL_DATA_PATH);
00933 
00934     printf("Taps:   %d\n", (val >> 4) + 1);
00935 
00936     val = edt_reg_read(pdv_p, PDV_CLSIM_CFGA);
00937     printf("CfgA:\n");
00938     printf("    linescan:   %s\n", (val & 0x80)? "enabled":"off");
00939     printf("    lvcont  :   %s\n", (val & 0x40)? "enabled":"off");
00940     printf("    rven    :   %s\n", (val & 0x20)? "enabled":"off");
00941     printf("    uartloop:   %s\n", (val & 0x10)? "enabled":"off");
00942     printf("    smallok :   %s\n", (val & 8)? "enabled":"off");
00943     printf("    intlven :   %s\n", (val & 4)? "enabled":"off");
00944     printf("    firstfc :   %s\n", (val & 2)? "enabled":"off");
00945     printf("    datacnt :   %s\n", (val & 1)? "enabled":"off");
00946     val = edt_reg_read(pdv_p, PDV_CLSIM_CFGB);
00947     printf("CfgB:\n");
00948     printf("    dvskip  :   %d\n", (val >> 4));
00949     printf("    dvmode  :   %d\n", (val & 3));
00950     val = edt_reg_read(pdv_p, PDV_CLSIM_CFGC);
00951     printf("CfgC:\n");
00952     printf("    led     :   %s\n", (val & 0x80)? "enabled":"off");
00953     printf("    trigsrc :   %s\n", (val & 8)? "enabled":"off");
00954     printf("    trigpol :   %s\n", (val & 4)? "enabled":"off");
00955     printf("    trigfram:   %s\n", (val & 2)? "enabled":"off");
00956     printf("    trigline:   %s\n", (val & 1)? "enabled":"off");
00957  
00958     printf("\nFillA   :  0x%x\n", edt_reg_read(pdv_p, PDV_CLSIM_FILLA));
00959     printf("FillB   :  0x%x\n\n", edt_reg_read(pdv_p, PDV_CLSIM_FILLB));
00960 
00961 
00962     val = edt_reg_read(pdv_p, PDV_CLSIM_HCNTMAX);
00963     printf("Hcntmax :  %d clocks\n", val+1);
00964 
00965     val = edt_reg_read(pdv_p, PDV_CLSIM_VACTV);
00966     printf("Vactv   :  %d lines\n", val+1);
00967 
00968     val = edt_reg_read(pdv_p, PDV_CLSIM_VCNTMAX);
00969     printf("Vcntmax :  %d lines\n", val+1);
00970 
00971     printf("Hfvstart:  %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HFVSTART));
00972     printf("Hfvend  :  %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HFVEND));
00973     printf("Hlvstart:  %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HLVSTART));
00974     printf("Hlvend  :  %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HLVEND));
00975     printf("Hrvstart:  %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HRVSTART));
00976     printf("Hrvend  :  %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HRVEND));
00977 
00978     printf("hblank    :  %d\n", pdv_cls_get_hgap(pdv_p));
00979     printf("vblank    :  %d\n", pdv_cls_get_vgap(pdv_p));
00980 
00981     if (edt_reg_read(pdv_p, PDV_CLSIM_CFGA) & 4)
00982     {
00983         printf("\nInterleave\n");
00984 
00985         printf("Tap 0 : Start %4d Delta %4d\n", edt_reg_read(pdv_p, PDV_CLSIM_TAP0START),
00986                     edt_reg_read(pdv_p, PDV_CLSIM_TAP0DELTA));
00987         printf("Tap 1 : Start %4d Delta %4d\n", edt_reg_read(pdv_p, PDV_CLSIM_TAP1START),
00988                     edt_reg_read(pdv_p, PDV_CLSIM_TAP1DELTA));
00989         printf("Tap 2 : Start %4d Delta %4d\n", edt_reg_read(pdv_p, PDV_CLSIM_TAP2START),
00990                     edt_reg_read(pdv_p, PDV_CLSIM_TAP2DELTA));
00991         printf("Tap 3 : Start %4d Delta %4d\n", edt_reg_read(pdv_p, PDV_CLSIM_TAP3START),
00992                     edt_reg_read(pdv_p, PDV_CLSIM_TAP3DELTA));
00993     }
00994 
00995     clock = pdv_p->dd_p->cls.pixel_clock;
00996 
00997     if (clock != 0.0)
00998     {
00999         double msecs; /* msecs per clock */
01000         double frameclocks, lineclocks;
01001 
01002         printf("\npixel_clock        : %10.4f MHz\n", pdv_p->dd_p->cls.pixel_clock);
01003 
01004         msecs = 1.0 / (clock * 1000.0);
01005 
01006         lineclocks = edt_reg_read(pdv_p, PDV_CLSIM_HCNTMAX) * msecs;
01007         printf("Line time          : %10.4f msecs\n", lineclocks);
01008 
01009         frameclocks = edt_reg_read(pdv_p, PDV_CLSIM_VACTV) * lineclocks;
01010         printf("Active Frame time  : %10.4f msecs\n", frameclocks);
01011 
01012         frameclocks = edt_reg_read(pdv_p, PDV_CLSIM_VCNTMAX) * lineclocks;
01013         printf("Frame time         : %10.4f msecs\n", frameclocks);
01014 
01015         if (frameclocks)
01016             printf("Frame Rate         : %10.4f fps\n",1000.0 / frameclocks);
01017 
01018     }
01019 }
01020 
01021   
01028 void
01029 pdv_cls_dump_geometry(PdvDev *pdv_p)
01030 {
01031     int val;
01032     val = edt_reg_read(pdv_p, PDV_CL_DATA_PATH);
01033 
01034     printf("\nFillA   :  0x%x\n", edt_reg_read(pdv_p, PDV_CLSIM_FILLA));
01035     printf("FillB   :  0x%x\n\n", edt_reg_read(pdv_p, PDV_CLSIM_FILLB));
01036 
01037 
01038     val = edt_reg_read(pdv_p, PDV_CLSIM_HCNTMAX);
01039     printf("Hcntmax :  %d clocks\n", val+1);
01040 
01041     val = edt_reg_read(pdv_p, PDV_CLSIM_VACTV);
01042     printf("Vactv   :  %d lines\n", val+1);
01043 
01044     val = edt_reg_read(pdv_p, PDV_CLSIM_VCNTMAX);
01045     printf("Vcntmax :  %d lines\n", val+1);
01046 
01047     printf("Hfvstart:  %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HFVSTART));
01048     printf("Hfvend  :  %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HFVEND));
01049     printf("Hlvstart:  %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HLVSTART));
01050     printf("Hlvend  :  %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HLVEND));
01051     printf("Hrvstart:  %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HRVSTART));
01052     printf("Hrvend  :  %d\n", edt_reg_read(pdv_p, PDV_CLSIM_HRVEND));
01053 
01054     printf("hblank    :  %d\n", pdv_cls_get_hgap(pdv_p));
01055     printf("vblank    :  %d\n", pdv_cls_get_vgap(pdv_p));
01056 
01057 }
01058 

Generated on Mon Mar 21 14:14:37 2011 by  doxygen 1.4.7