00001
00077 #include "string.h"
00078 #include "board.h"
00079 #include "sdramc.h"
00080 #include "intc.h"
00081 #include "gpio.h"
00082 #include "print_funcs.h"
00083 #include "usart.h"
00084 #include "et024006dhu.h"
00085 #include "power_clocks_lib.h"
00086 #include "delay.h"
00087 #include "jpeg_decoder.h"
00088 #include "jpegfile.h"
00089
00090
00093
00094 #if BOARD==EVK1104
00095 # define EXAMPLE_TC_CHANNEL_PIN AVR32_TC0_A0_0_0_PIN
00096 # define EXAMPLE_TC_CHANNEL_FUNCTION AVR32_TC0_A0_0_0_FUNCTION
00097 #elif BOARD==EVK1105
00098 #endif
00100
00101 const U8 * stream_jpeg_src_ptr;
00102 U16 stream_src_size;
00103
00104 pcl_freq_param_t pcl_freq_param=
00105 {
00106 .cpu_f = 60000000
00107 , .pba_f = 60000000
00108 , .osc0_f = FOSC0
00109 , .osc0_startup = OSC0_STARTUP
00110 };
00111
00112 #if BOARD == EVK1105
00113 #include "pwm.h"
00114 avr32_pwm_channel_t pwm_channel6 = {
00115
00116
00117
00118
00119
00120
00121
00122 .cdty = 0,
00123 .cprd = 100
00124 };
00125
00126 static void tft_bl_init(void)
00127 {
00128
00129 pwm_opt_t opt = {
00130 .diva = 0,
00131 .divb = 0,
00132 .prea = 0,
00133 .preb = 0
00134 };
00135
00136
00137
00138
00139
00140
00141
00142 pwm_init(&opt);
00143 pwm_channel6.CMR.calg = PWM_MODE_LEFT_ALIGNED;
00144 pwm_channel6.CMR.cpol = PWM_POLARITY_HIGH;
00145 pwm_channel6.CMR.cpd = PWM_UPDATE_DUTY;
00146 pwm_channel6.CMR.cpre = AVR32_PWM_CMR_CPRE_MCK_DIV_2;
00147
00148 pwm_channel_init(6, &pwm_channel6);
00149 pwm_start_channels(AVR32_PWM_ENA_CHID6_MASK);
00150
00151 }
00152 #endif // #if BOARD == EVK1105
00153
00154
00155
00156
00157 int main(void)
00158 {
00159 et024006_color_t const *picture_ptr;
00160
00161
00162 pcl_configure_clocks(&pcl_freq_param);
00163
00164
00165 delay_init(pcl_freq_param.cpu_f);
00166
00167
00168 init_dbg_rs232(pcl_freq_param.pba_f);
00169
00170
00171 et024006_Init( pcl_freq_param.cpu_f, pcl_freq_param.cpu_f );
00172
00173 sdramc_init(pcl_freq_param.cpu_f);
00174
00175
00176 #if BOARD == EVK1105
00177
00178
00179
00180 tft_bl_init();
00181
00182 while(pwm_channel6.cdty < pwm_channel6.cprd)
00183 {
00184 pwm_channel6.cdty++;
00185 pwm_channel6.cupd = pwm_channel6.cdty;
00186
00187 pwm_async_update_channel(AVR32_PWM_ENA_CHID6, &pwm_channel6);
00188 delay_ms(10);
00189 }
00190 #elif BOARD == EVK1104 || BOARD == UC3C_EK
00191 gpio_set_gpio_pin(ET024006DHU_BL_PIN);
00192 #endif
00193
00194
00195 et024006_DrawFilledRect(0,0,ET024006_WIDTH,ET024006_HEIGHT,0x2458 );
00196
00197 print_dbg("\x1B[2J\x1B[HDecoding JPEG image...\n");
00198
00199 if (!jpeg_lib_init())
00200 {
00201 print_dbg("\n\r Decoder Initialization failed");
00202 while (1);
00203 }
00204
00205 stream_jpeg_src_ptr = jpegdata;
00206 stream_src_size = sizeof jpegdata/sizeof jpegdata[0];
00207
00208
00209 U16 width;
00210 U16 height;
00211
00212 while(1)
00213 {
00214 width= 320;
00215 height= 240;
00216 picture_ptr = (et024006_color_t const *)jpeg_lib_decode_ex(0, &width, &height);
00217 et024006_PutPixmap( picture_ptr, 320, 0, 0, 0, 0, 320, 240 );
00218 delay_ms(2000);
00219 width= 160;
00220 height= 120;
00221 picture_ptr = (et024006_color_t const *)jpeg_lib_decode_ex(0, &width, &height);
00222 et024006_PutPixmap( picture_ptr, 160, 0, 0, 0, 0, 160,120 );
00223 et024006_PutPixmap( picture_ptr, 160, 0, 0, 160, 0, 160, 120 );
00224 et024006_PutPixmap( picture_ptr, 160, 0, 0, 0, 120, 160, 120 );
00225 et024006_PutPixmap( picture_ptr, 160, 0, 0, 160, 120, 160, 120 );
00226 delay_ms(500);
00227 et024006_PutPixmap( picture_ptr, 160, 0, 0, 80, 60, 160, 120 );
00228 delay_ms(2000);
00229 }
00230 jpeg_lib_exit();
00231 }