Definition in file mmi_task.h.
Go to the source code of this file.
Functions | |
void | mmi_task (void) |
Entry point of the MMI task management. | |
void | mmi_task_init (U32 fcpu, U32 fpba) |
This function initializes the hardware/software resources required for the MMI task. |
void mmi_task | ( | void | ) |
Entry point of the MMI task management.
Definition at line 157 of file mmi_task.c.
References avr32_logo, display_box(), display_perf(), MMI_MASS_STORAGE, MMI_MASS_STORAGE_START, mmi_ms_display(), mmi_state, MMI_TOP_MENU, MMI_TOP_MENU_START, ms_activity_timer, ms_clear_timer, ms_cnt_read, ms_cnt_screen, ms_cnt_write, ms_key_logo, MS_N_PROGRESS_BAR, ms_old_cnt_read, ms_old_cnt_write, ms_progress_bar_level, ms_progress_bar_type, perf_read, perf_write, pm_freq_param, TIMER_MS_PROGRESS_BAR_CLEAR, and TIMER_MS_PROGRESS_BAR_UPDATE.
Referenced by main().
00158 { 00159 U32 i; 00160 switch( mmi_state ) 00161 { 00162 case MMI_TOP_MENU_START: 00163 // Draw the background AVR32 logo. 00164 et024006_PutPixmap(avr32_logo, 320, 0, 0, 0, 0, 320, 240); 00165 00166 // Display welcome string. 00167 et024006_PrintString("EVK1104 Demo", (const unsigned char *)&FONT8x8, 110, 220, BLACK, -1); 00168 00169 mmi_state = MMI_TOP_MENU; 00170 break; 00171 00172 case MMI_TOP_MENU: 00173 if( Is_usb_vbus_high() ) 00174 { 00175 mmi_state = MMI_MASS_STORAGE_START; 00176 } 00177 break; 00178 00179 case MMI_MASS_STORAGE_START: 00180 // Draw the background AVR32 logo. 00181 et024006_PutPixmap(avr32_logo, 320, 0, 0, 0, 0, 320, 240); 00182 00183 // Display USB key logo. 00184 et024006_DrawFilledRect(220-1, 20-1, 80+2, 42+2, BLACK ); 00185 et024006_PutPixmap(ms_key_logo, 80, 0, 0, 220, 20, 80, 42); 00186 00187 // Display title. 00188 et024006_PrintString("U-Disk", (const unsigned char *)&FONT6x8, 240, 65, BLACK, -1); 00189 00190 // Display Activity window. 00191 display_box(80, 180, 156, 16, WHITE, BLACK); 00192 00193 // Display performances box. 00194 display_perf(120, 201, TRUE, 0, 0); 00195 00196 ms_old_cnt_read = ms_cnt_read =0; 00197 ms_old_cnt_write = ms_cnt_write =0; 00198 mmi_state = MMI_MASS_STORAGE; 00199 ms_cnt_screen = 0; 00200 for( i=0 ; i<MS_N_PROGRESS_BAR ; i++ ) 00201 { 00202 ms_progress_bar_level[i] = 1; 00203 ms_progress_bar_type[i] = BLACK; 00204 } 00205 mmi_ms_display(); 00206 00207 cpu_set_timeout( cpu_ms_2_cy(TIMER_MS_PROGRESS_BAR_UPDATE, pm_freq_param.cpu_f), &ms_activity_timer); 00208 cpu_set_timeout( cpu_ms_2_cy(TIMER_MS_PROGRESS_BAR_CLEAR, pm_freq_param.cpu_f), &ms_clear_timer); 00209 break; 00210 00211 case MMI_MASS_STORAGE: 00212 // Manage progress-bar shading. 00213 // 00214 if( cpu_is_timeout(&ms_clear_timer) ) 00215 { 00216 cpu_set_timeout( cpu_ms_2_cy(TIMER_MS_PROGRESS_BAR_CLEAR, pm_freq_param.cpu_f), &ms_clear_timer); 00217 mmi_ms_display(); 00218 } 00219 00220 // Manage progress-bar box moving. 00221 // 00222 if( cpu_is_timeout(&ms_activity_timer) ) 00223 { 00224 cpu_set_timeout( cpu_ms_2_cy(TIMER_MS_PROGRESS_BAR_UPDATE, pm_freq_param.cpu_f), &ms_activity_timer); 00225 if( ms_old_cnt_write != ms_cnt_write ) 00226 { 00227 ms_cnt_screen = (unsigned char)(ms_cnt_screen-1)%MS_N_PROGRESS_BAR; 00228 ms_progress_bar_type[ms_cnt_screen] = RED; 00229 00230 // Compute performances 00231 // 00232 perf_write = (U64)(ms_cnt_write - ms_old_cnt_write)*SD_MMC_SECTOR_SIZE/TIMER_MS_PROGRESS_BAR_UPDATE; 00233 display_perf(120, 201, FALSE, perf_write, RED); 00234 ms_old_cnt_write = ms_cnt_write; 00235 ms_progress_bar_level[ms_cnt_screen] = (perf_write>10000) ? 31 : 00236 (perf_write> 7500) ? 29 : 00237 (perf_write> 5000) ? 27 : 25 ; 00238 } 00239 else if( ms_old_cnt_read != ms_cnt_read ) 00240 { 00241 ms_cnt_screen = (unsigned char)(ms_cnt_screen+1)%MS_N_PROGRESS_BAR; 00242 ms_progress_bar_type[ms_cnt_screen] = BLUE; 00243 00244 // Compute performances 00245 // 00246 perf_read = (U64)(ms_cnt_read - ms_old_cnt_read)*SD_MMC_SECTOR_SIZE/TIMER_MS_PROGRESS_BAR_UPDATE; 00247 display_perf(120, 201, FALSE, perf_read, BLUE); 00248 ms_old_cnt_read = ms_cnt_read; 00249 ms_progress_bar_level[ms_cnt_screen] = (perf_read>10000) ? 31 : 00250 (perf_read> 7500) ? 29 : 00251 (perf_read> 5000) ? 27 : 25 ; 00252 } 00253 else 00254 { 00255 display_perf(120, 201, TRUE, 0, 0); 00256 } 00257 } 00258 00259 // Detect USB unplug. 00260 // 00261 if( Is_usb_vbus_low() ) 00262 { 00263 mmi_state = MMI_TOP_MENU_START; 00264 } 00265 break; 00266 00267 default: 00268 break; 00269 } 00270 00271 }
void mmi_task_init | ( | U32 | fcpu, | |
U32 | fpba | |||
) |
This function initializes the hardware/software resources required for the MMI task.
Definition at line 83 of file mmi_task.c.
References mmi_state, and MMI_TOP_MENU_START.
Referenced by main().
00084 { 00085 // Initialize the LCD. 00086 et024006_Init( cpu_f, cpu_f /*HSB*/); 00087 00088 // Clear the display i.e. make it black 00089 et024006_DrawFilledRect(0, 0, ET024006_WIDTH, ET024006_HEIGHT, BLACK ); 00090 00091 // Set the backlight. 00092 gpio_set_gpio_pin(ET024006DHU_BL_PIN); 00093 00094 mmi_state = MMI_TOP_MENU_START; 00095 }