Changeset 614
- Timestamp:
- 02/12/10 02:08:13 (6 months ago)
- Location:
- trunk
- Files:
-
- 5 modified
-
hal/lpc2103-retkodfuncam/fast-interrupt.c (modified) (1 diff)
-
hal/lpc2103-retkodfuncam/interrupt.c (modified) (1 diff)
-
hal/lpc2103-retkodfuncam/interrupt.h (modified) (2 diffs)
-
projects/cmucam1/cmucam1.c (modified) (8 diffs)
-
projects/cmucam1/ppm-fd/ppm-fd.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/lpc2103-retkodfuncam/fast-interrupt.c
r613 r614 28 28 #include "cc3_hal.h" 29 29 30 #define VIC_MSK_EINT0_DCLK 0x04000 30 31 32 volatile uint32_t row_done; 31 33 volatile uint32_t dclk_cnt; 32 volatile uint8_t row_buf[ 1280];34 volatile uint8_t row_buf[ROW_BUF_LEN]; 33 35 34 36 __attribute__((section(".boot.fiq"))) 35 37 void fast_interrupt (void) 36 38 { 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 50 47 } -
trunk/hal/lpc2103-retkodfuncam/interrupt.c
r613 r614 207 207 } 208 208 209 elseif (REG (VICRawIntr) & VIC_MSK_TIMER1_HBLK) {209 if (REG (VICRawIntr) & VIC_MSK_TIMER1_HBLK) { 210 210 REG(TIMER1_IR) = 0xff; // clear TIMER1 interrupt register flags 211 211 if(hblk_callback!=NULL) hblk_callback(); -
trunk/hal/lpc2103-retkodfuncam/interrupt.h
r613 r614 20 20 #define INTERRUPT_H 21 21 22 #define ROW_BUF_LEN 500 23 22 24 #include <stdbool.h> 23 25 … … 25 27 // XXX: this doesn't belong here 26 28 extern volatile uint32_t dclk_cnt; 27 extern volatile uint8_t row_buf[1280]; 29 extern volatile uint32_t row_done; 30 extern volatile uint8_t row_buf[ROW_BUF_LEN]; 28 31 29 32 void enable_ext_interrupt (void); -
trunk/projects/cmucam1/cmucam1.c
r613 r614 103 103 volatile uint32_t hblk_cnt; 104 104 //volatile uint32_t dclk_cnt; 105 volatile uint32_t frame_done , row_done;105 volatile uint32_t frame_done; 106 106 107 107 volatile uint32_t row_width; 108 volatile uint32_t dclk_lines[288]; 108 109 109 110 … … 119 120 row_done=0; 120 121 row_width=width; 121 do{ } while(!row_done); 122 do{ 123 } while(!row_done); 122 124 return hblk_cnt; 123 125 } … … 125 127 void my_vblk() 126 128 { 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 164 130 // start of frame 165 131 frame_done=0; … … 168 134 } 169 135 170 void my_dclk()171 {172 // Read a row into memory173 if(dclk_cnt< row_width) {174 row_buf[dclk_cnt]=(REG(GPIO_IOPIN)>>24);175 dclk_cnt++;176 }177 else178 {179 // signal when you have enough180 row_done=1;181 disable_dclk_interrupt();182 }183 }184 136 185 137 void my_hblk() 186 138 { 187 188 139 if(hblk_cnt<1023) 189 140 { … … 191 142 // Reset the dclk_cnt which is the index into 192 143 // the row buffer that gets filled by the dclk int 193 dclk_cnt=0;194 144 hblk_cnt++; 195 if( row_done==0 ) enable_dclk_interrupt(); 145 if( row_done==0 ) { 146 dclk_cnt=0; 147 enable_dclk_interrupt(); 148 } 196 149 } 197 150 else … … 205 158 row_done=1; 206 159 } 207 } 208 209 */ 160 161 } 162 163 164 210 165 211 166 int main (void) 212 167 { 213 168 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; 215 170 int32_t raw_pix_data[4],raw_pix_data_tmp; 216 171 int32_t row,col,row_max,col_max,i,j; 217 172 173 174 disable_dclk_interrupt(); 175 disable_hblk_interrupt(); 176 disable_vblk_interrupt(); 218 177 219 178 cc3_uart_init (0, … … 305 264 init_camera_interrupts(); 306 265 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); 315 271 // Start next frame capture (vblk stops at end of frame) 316 272 enable_vblk_interrupt(); … … 318 274 do { 319 275 // 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"); 323 310 } while(!frame_done); 324 325 } 311 cc3_uart0_putchar (3); 312 while(1); 313 // } 326 314 327 315 -
trunk/projects/cmucam1/ppm-fd/ppm-fd.c
r585 r614 4 4 5 5 #define X_MAX 1024 6 #define Y_MAX 7686 #define Y_MAX 1024 7 7 #define CHAN_MAX 3 8 8
