Definition in file ijg_example.c.
#include "string.h"
#include "board.h"
#include "sdramc.h"
#include "intc.h"
#include "gpio.h"
#include "print_funcs.h"
#include "usart.h"
#include "et024006dhu.h"
#include "power_clocks_lib.h"
#include "delay.h"
#include "jpeg_decoder.h"
#include "jpegfile.h"
Go to the source code of this file.
Functions | |
int | _init_startup (void) |
int | main (void) |
Variables | |
pcl_freq_param_t | pcl_freq_param |
const U8 * | stream_jpeg_src_ptr |
U16 | stream_src_size |
int _init_startup | ( | void | ) |
Definition at line 115 of file ijg_example.c.
00119 { 00120 // Enable exceptions. 00121 Enable_global_exception(); 00122 00123 // Initialize interrupt handling. 00124 INTC_init_interrupts(); 00125 00126 // Switch to external Oscillator 0 to speed-up start-up 00127 #ifndef AVR32_PM_VERSION_RESETVALUE // UC3A, UC3A3, UC3B parts. 00128 pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP); 00129 #else // Implementation for UC3C, UC3L parts. 00130 // Configure OSC0 in crystal mode, external crystal with a fcrystal Hz frequency. 00131 scif_configure_osc_crystalmode(SCIF_OSC0, FOSC0); 00132 scif_enable_osc(SCIF_OSC0, OSC0_STARTUP, true); 00133 pm_set_mclk_source(PM_CLK_SRC_OSC0); 00134 #endif 00135 00136 // Initialize the SDRAM Controller and the external SDRAM chip. 00137 sdramc_init(66000000); 00138 // From that point on, the external SDRAM can be accessed as a memory being 00139 // part of the AVR32 UC3 memory map. 00140 00141 00142 // EWAVR32: Request initialization of data segments. 00143 // GCC: Don't-care value. 00144 return 1; 00145 }
int main | ( | void | ) |
Definition at line 192 of file ijg_example.c.
References jpeg_lib_decode_ex(), jpeg_lib_exit(), jpeg_lib_init(), jpegdata, pcl_freq_param, stream_jpeg_src_ptr, and stream_src_size.
00193 { 00194 et024006_color_t const *picture_ptr; 00195 00196 // Set CPU and PBA clock 00197 //pcl_configure_clocks(&pcl_freq_param); 00198 pcl_switch_to_osc(PCL_OSC0, FOSC0, OSC0_STARTUP); 00199 00200 00201 // Initialize delay module 00202 delay_init(pcl_freq_param.cpu_f); 00203 // Initialize usart communication 00204 init_dbg_rs232(pcl_freq_param.pba_f); 00205 // Initialize TFT display 00206 et024006_Init( FOSC0, FOSC0 ); 00207 //et024006_Init( pcl_freq_param.cpu_f, pcl_freq_param.cpu_f /*HSB*/); 00208 00209 // Enable back-light 00210 #if BOARD == EVK1105 00211 /* PWM is fed by PBA bus clock which is by default the same 00212 * as the CPU speed. We set a 0 duty cycle and thus keep the 00213 * display black*/ 00214 tft_bl_init(); 00215 /* Lets do a nice fade in by increasing the duty cycle */ 00216 while(pwm_channel6.cdty < pwm_channel6.cprd) 00217 { 00218 pwm_channel6.cdty++; 00219 pwm_channel6.cupd = pwm_channel6.cdty; 00220 //pwm_channel6.cdty--; 00221 pwm_async_update_channel(AVR32_PWM_ENA_CHID6, &pwm_channel6); 00222 delay_ms(10); 00223 } 00224 #elif BOARD == EVK1104 || BOARD == UC3C_EK 00225 gpio_set_gpio_pin(ET024006DHU_BL_PIN); 00226 #endif 00227 00228 // Clear the display: make it blue 00229 et024006_DrawFilledRect(0,0,ET024006_WIDTH,ET024006_HEIGHT,0x2458 ); 00230 00231 print_dbg("\x1B[2J\x1B[HDecoding JPEG image...\n"); 00232 00233 if (!jpeg_lib_init()) // JPEG IJG lib initialization 00234 { 00235 print_dbg("\n\r Decoder Initialization failed"); 00236 while (1); 00237 } 00238 // JPEG stream definition 00239 stream_jpeg_src_ptr = jpegdata; 00240 stream_src_size = sizeof jpegdata/sizeof jpegdata[0]; 00241 00242 // main decoder 00243 U16 width; 00244 U16 height; 00245 00246 while(1) 00247 { 00248 width= 320; 00249 height= 240; 00250 picture_ptr = (et024006_color_t const *)jpeg_lib_decode_ex(0, &width, &height); 00251 et024006_PutPixmap( picture_ptr, 320, 0, 0, 0, 0, 320, 240 ); 00252 delay_ms(2000); 00253 width= 160; 00254 height= 120; 00255 picture_ptr = (et024006_color_t const *)jpeg_lib_decode_ex(0, &width, &height); 00256 et024006_PutPixmap( picture_ptr, 160, 0, 0, 0, 0, 160,120 ); 00257 et024006_PutPixmap( picture_ptr, 160, 0, 0, 160, 0, 160, 120 ); 00258 et024006_PutPixmap( picture_ptr, 160, 0, 0, 0, 120, 160, 120 ); 00259 et024006_PutPixmap( picture_ptr, 160, 0, 0, 160, 120, 160, 120 ); 00260 delay_ms(500); 00261 et024006_PutPixmap( picture_ptr, 160, 0, 0, 80, 60, 160, 120 ); 00262 delay_ms(2000); 00263 } 00264 jpeg_lib_exit(); // JPEG IJG lib out 00265 }
pcl_freq_param_t pcl_freq_param |
Initial value:
{ .cpu_f = 60000000 , .pba_f = 60000000 , .osc0_f = FOSC0 , .osc0_startup = OSC0_STARTUP }
Definition at line 106 of file ijg_example.c.
Referenced by main().
const U8* stream_jpeg_src_ptr |
U16 stream_src_size |