Changeset 614

Show
Ignore:
Timestamp:
02/12/10 02:08:13 (6 months ago)
Author:
anthony_rowe
Message:

row frame grab attempt

Location:
trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/hal/lpc2103-retkodfuncam/fast-interrupt.c

    r613 r614  
    2828#include "cc3_hal.h" 
    2929 
     30#define VIC_MSK_EINT0_DCLK      0x04000 
    3031 
     32volatile uint32_t row_done;  
    3133volatile uint32_t dclk_cnt;  
    32 volatile uint8_t row_buf[1280]; 
     34volatile uint8_t row_buf[ROW_BUF_LEN]; 
    3335 
    3436__attribute__((section(".boot.fiq"))) 
    3537void fast_interrupt (void) 
    3638{ 
    37       // XXX: cleanup the static 1280 crap below 
    38    // if (REG (VICRawIntr) & VIC_MSK_EINT0_DCLK) { 
    39       REG (SYSCON_EXTINT) = 0x1;  // clear EINT0 
    40         if(dclk_cnt<1280) row_buf[dclk_cnt]=(REG(GPIO_IOPIN)>>24);  
    41       dclk_cnt++; 
    42       if(dclk_cnt%2==0) 
    43       REG (GPIO_IOSET) = _CC3_LED_0; 
    44       else 
    45       REG (GPIO_IOCLR) = _CC3_LED_0; 
    46       //dclk_callback(); 
    47       //  if(dclk_callback!=NULL) dclk_callback(); 
    48    // } 
    49 //    REG(VICVectAddr) = 0x0; 
     39  if(dclk_cnt<ROW_BUF_LEN ) { 
     40          row_buf[dclk_cnt]=(REG(GPIO_IOPIN)>>24);  
     41          dclk_cnt++; 
     42  } else { 
     43  row_done=1;    
     44  REG (VICIntEnClr) = VIC_MSK_EINT0_DCLK; 
     45  } 
     46 REG (SYSCON_EXTINT) = 0x1;  // clear EINT0 
    5047} 
  • trunk/hal/lpc2103-retkodfuncam/interrupt.c

    r613 r614  
    207207    } 
    208208 
    209    else if (REG (VICRawIntr) & VIC_MSK_TIMER1_HBLK) { 
     209   if (REG (VICRawIntr) & VIC_MSK_TIMER1_HBLK) { 
    210210        REG(TIMER1_IR) = 0xff;  // clear TIMER1 interrupt register flags 
    211211        if(hblk_callback!=NULL) hblk_callback(); 
  • trunk/hal/lpc2103-retkodfuncam/interrupt.h

    r613 r614  
    2020#define INTERRUPT_H 
    2121 
     22#define ROW_BUF_LEN             500 
     23 
    2224#include <stdbool.h> 
    2325 
     
    2527// XXX: this doesn't belong here 
    2628extern volatile uint32_t dclk_cnt;  
    27 extern volatile uint8_t row_buf[1280]; 
     29extern volatile uint32_t row_done;  
     30extern volatile uint8_t row_buf[ROW_BUF_LEN]; 
    2831 
    2932void enable_ext_interrupt (void); 
  • trunk/projects/cmucam1/cmucam1.c

    r613 r614  
    103103volatile uint32_t hblk_cnt; 
    104104//volatile uint32_t dclk_cnt;  
    105 volatile uint32_t frame_done, row_done; 
     105volatile uint32_t frame_done; 
    106106 
    107107volatile uint32_t row_width; 
     108volatile uint32_t dclk_lines[288]; 
    108109 
    109110 
     
    119120        row_done=0; 
    120121        row_width=width; 
    121         do{ } while(!row_done); 
     122        do{  
     123        } while(!row_done); 
    122124        return hblk_cnt; 
    123125} 
     
    125127void my_vblk() 
    126128{ 
    127   hblk_cnt=0;  
    128 } 
    129 /* 
    130  // XXX: This moved to fast-interrupt.c 
    131 void my_dclk() 
    132 { 
    133         if(dclk_cnt<1280) row_buf[dclk_cnt]=(REG(GPIO_IOPIN)>>24);  
    134         dclk_cnt++; 
    135 } 
    136 */ 
    137 void my_hblk() 
    138 { 
    139 hblk_cnt++; 
    140         if( hblk_cnt%2==0 )  
    141         { 
    142                 // Use this row to print dclk_cnt from last row 
    143                 disable_dclk_interrupt(); 
    144                 print_num(hblk_cnt); 
    145                 cc3_uart0_write(" "); 
    146                 print_num(dclk_cnt); 
    147                 cc3_uart0_write("\r\n"); 
    148         } 
    149         else { 
    150                 // Lets count dclk 
    151                 dclk_cnt=0; 
    152                 enable_dclk_interrupt(); 
    153         } 
    154 } 
    155  
    156  
    157  
    158  
    159 /* 
    160 // Here is some craptacular code to try and grab a row of data 
    161  
    162 void my_vblk() 
    163 { 
     129     
    164130  // start of frame 
    165131  frame_done=0; 
     
    168134} 
    169135 
    170 void my_dclk() 
    171 { 
    172  // Read a row into memory 
    173  if(dclk_cnt< row_width) { 
    174          row_buf[dclk_cnt]=(REG(GPIO_IOPIN)>>24);  
    175          dclk_cnt++; 
    176  } 
    177  else 
    178  { 
    179   // signal when you have enough 
    180   row_done=1;    
    181   disable_dclk_interrupt(); 
    182  } 
    183 } 
    184136 
    185137void my_hblk() 
    186138{ 
    187  
    188139        if(hblk_cnt<1023)  
    189140        { 
     
    191142                // Reset the dclk_cnt which is the index into 
    192143                // the row buffer that gets filled by the dclk int       
    193                 dclk_cnt=0; 
    194144                hblk_cnt++; 
    195                 if( row_done==0 ) enable_dclk_interrupt(); 
     145                if( row_done==0 ) { 
     146                        dclk_cnt=0; 
     147                        enable_dclk_interrupt(); 
     148                } 
    196149        } 
    197150        else 
     
    205158                row_done=1; 
    206159        } 
    207 } 
    208  
    209 */ 
     160 
     161} 
     162 
     163 
     164 
    210165 
    211166int main (void) 
    212167{ 
    213168        int32_t val, n,led_state; 
    214         uint8_t red,green,blue,pix_data[4]; 
     169        uint8_t red,green,blue,pix_data[4],y1,u,v,y2; 
    215170        int32_t raw_pix_data[4],raw_pix_data_tmp; 
    216171        int32_t row,col,row_max,col_max,i,j; 
    217172 
     173 
     174  disable_dclk_interrupt(); 
     175  disable_hblk_interrupt(); 
     176  disable_vblk_interrupt(); 
    218177 
    219178        cc3_uart_init (0, 
     
    305264  init_camera_interrupts(); 
    306265 
    307   // Simple dclk counting test 
    308   enable_vblk_interrupt();  
    309   enable_hblk_interrupt();  
    310   while(1); 
    311   // End dclk counting test 
    312  
    313   while(1){ 
    314  
     266 
     267//  while(1){ 
     268 
     269 
     270        cc3_uart0_putchar (1); 
    315271        // Start next frame capture (vblk stops at end of frame) 
    316272        enable_vblk_interrupt();  
     
    318274        do { 
    319275                // ask for a row of size n, return which row was captured 
    320                 row=capture_next_row(100); // 1280 is max 
    321                 print_num(row); 
    322                 cc3_uart0_write("\r\n"); 
     276                row=capture_next_row(ROW_BUF_LEN); // 1280 is max 
     277                cc3_uart0_putchar (2); 
     278                for(i=0; i<ROW_BUF_LEN; i++ )  
     279                { 
     280                        /* 
     281                        red=row_buf[i+1] & 0xf8;  
     282                        blue=row_buf[i] & 0x1f<<3;  
     283                        green=(row_buf[i] & 0xe0>>5) | (row_buf[i+1]<<5);  
     284                        i++; 
     285                        if(red<4) red=4; 
     286                        if(green<4) green=4; 
     287                        if(blue<4) blue=4; 
     288                        cc3_uart0_putchar (red); 
     289                        cc3_uart0_putchar (green); 
     290                        cc3_uart0_putchar (blue); 
     291 
     292                        */ 
     293 
     294                        y1=row_buf[i]; 
     295                        u=row_buf[i+1]; 
     296                        y2=row_buf[i+2]; 
     297                        v=row_buf[i+3]; 
     298                        i+=3; 
     299 
     300                        cc3_uart0_putchar (y1); 
     301                        cc3_uart0_putchar (u); 
     302                        cc3_uart0_putchar (v); 
     303 
     304                        cc3_uart0_putchar (y2); 
     305                        cc3_uart0_putchar (u); 
     306                        cc3_uart0_putchar (v); 
     307                } 
     308                //print_num(row); 
     309                //cc3_uart0_write("\r\n"); 
    323310        } while(!frame_done); 
    324          
    325   } 
     311                cc3_uart0_putchar (3); 
     312        while(1);        
     313//  } 
    326314 
    327315 
  • trunk/projects/cmucam1/ppm-fd/ppm-fd.c

    r585 r614  
    44 
    55#define X_MAX           1024 
    6 #define Y_MAX           768 
     6#define Y_MAX           1024     
    77#define CHAN_MAX        3 
    88