Definition in file mass_storage_example.c.
#include "nlao_cpu.h"
#include "compiler.h"
#include "preprocessor.h"
#include "mass_storage_example.h"
#include "board.h"
#include "print_funcs.h"
#include "intc.h"
#include "power_clocks_lib.h"
#include "gpio.h"
#include "ctrl_access.h"
#include "conf_usb.h"
#include "usb_task.h"
#include "device_mass_storage_task.h"
#include "host_mass_storage_task.h"
#include "ushell_task.h"
Go to the source code of this file.
Functions | |
Hmatrix bus configuration | |
int | _init_startup (void) |
Low-level initialization routine called during startup, before the main function. | |
void | init_hmatrix (void) |
Low-level initialization routine called during startup, before the main function. | |
int | main (void) |
Main function. Execution starts here. | |
Variables | |
System Clock Frequencies | |
static pcl_freq_param_t | pcl_freq_param |
int _init_startup | ( | void | ) |
Low-level initialization routine called during startup, before the main function.
This version comes in replacement to the default one provided by the Newlib add-ons library. Newlib add-ons' _init_startup only calls init_exceptions, but Newlib add-ons' exception and interrupt vectors are defined in the same section and Newlib add-ons' interrupt vectors are not compatible with the interrupt management of the INTC module. More low-level initializations are besides added here.
Definition at line 303 of file mass_storage_example.c.
References pcl_freq_param.
00304 { 00305 // Import the Exception Vector Base Address. 00306 extern void _evba; 00307 00308 // Load the Exception Vector Base Address in the corresponding system register. 00309 Set_system_register(AVR32_EVBA, (int)&_evba); 00310 00311 // Enable exceptions. 00312 Enable_global_exception(); 00313 00314 // Initialize interrupt handling. 00315 INTC_init_interrupts(); 00316 00317 // Give the used CPU clock frequency to Newlib, so it can work properly. 00318 set_cpu_hz(pcl_freq_param.pba_f); 00319 00320 // Don't-care value for GCC. 00321 return 1; 00322 }
void init_hmatrix | ( | void | ) |
Low-level initialization routine called during startup, before the main function.
This version comes in replacement to the default one provided by the Newlib add-ons library. Newlib add-ons' _init_startup only calls init_exceptions, but Newlib add-ons' exception and interrupt vectors are defined in the same section and Newlib add-ons' interrupt vectors are not compatible with the interrupt management of the INTC module. More low-level initializations are besides added here.
Definition at line 273 of file mass_storage_example.c.
Referenced by main().
00274 { 00275 union 00276 { 00277 unsigned long scfg; 00278 avr32_hmatrix_scfg_t SCFG; 00279 } u_avr32_hmatrix_scfg; 00280 00281 // For the internal-flash HMATRIX slave, use last master as default. 00282 u_avr32_hmatrix_scfg.scfg = AVR32_HMATRIX.scfg[AVR32_HMATRIX_SLAVE_FLASH]; 00283 u_avr32_hmatrix_scfg.SCFG.defmstr_type = AVR32_HMATRIX_DEFMSTR_TYPE_LAST_DEFAULT; 00284 AVR32_HMATRIX.scfg[AVR32_HMATRIX_SLAVE_FLASH] = u_avr32_hmatrix_scfg.scfg; 00285 }
int main | ( | void | ) |
Main function. Execution starts here.
42 | Fatal error. |
Definition at line 506 of file mass_storage_example.c.
References device_mass_storage_task(), device_mass_storage_task_init(), host_mass_storage_task(), host_mass_storage_task_init(), init_hmatrix(), pcl_freq_param, ushell_task(), and ushell_task_init().
00507 { 00508 // Configure system clocks. 00509 if (pcl_configure_clocks(&pcl_freq_param) != PASS) 00510 return 42; 00511 00512 // Initialize USART link. 00513 init_dbg_rs232(pcl_freq_param.pba_f); 00514 00515 #if (defined AT45DBX_MEM) && (AT45DBX_MEM == ENABLE) 00516 at45dbx_resources_init(); 00517 #endif 00518 #if SD_MMC_SPI_MEM == ENABLE 00519 sd_mmc_spi_resources_init(); 00520 #endif 00521 #if ((defined SD_MMC_MCI_0_MEM) && (SD_MMC_MCI_0_MEM == ENABLE)) || ((defined SD_MMC_MCI_1_MEM) && (SD_MMC_MCI_1_MEM == ENABLE)) 00522 sd_mmc_mci_resources_init(); 00523 #endif 00524 #ifdef FREERTOS_USED 00525 if (!ctrl_access_init()) 00526 { 00527 portDBG_TRACE("The module CTRL_ACCESS could not be initialized."); 00528 return 42; 00529 } 00530 #endif // FREERTOS_USED 00531 00532 // Init Hmatrix bus 00533 init_hmatrix(); 00534 00535 // Initialize USB clock. 00536 pcl_configure_usb_clock(); 00537 00538 // Initialize USB tasks. 00539 usb_task_init(); 00540 #if USB_DEVICE_FEATURE == ENABLED 00541 device_mass_storage_task_init(); 00542 #endif 00543 #if USB_HOST_FEATURE == ENABLED 00544 host_mass_storage_task_init(); 00545 #endif 00546 ushell_task_init(pcl_freq_param.pba_f); 00547 00548 #ifdef FREERTOS_USED 00549 vTaskStartScheduler(); 00550 portDBG_TRACE("FreeRTOS returned."); 00551 return 42; 00552 #else 00553 while (TRUE) 00554 { 00555 usb_task(); 00556 #if USB_DEVICE_FEATURE == ENABLED 00557 device_mass_storage_task(); 00558 #endif 00559 #if USB_HOST_FEATURE == ENABLED 00560 host_mass_storage_task(); 00561 #endif 00562 ushell_task(); 00563 } 00564 #endif // FREERTOS_USED 00565 }
pcl_freq_param_t pcl_freq_param [static] |
Initial value:
Definition at line 262 of file mass_storage_example.c.
Referenced by _init_startup(), and main().