/*! * Start the USB modules. * * \return true upon success, else false. */ bool b_usbsys_start( void ) { // Create the usb_tsk_semphr and launch the usb_task() task. usb_task_init(); #if USB_DEVICE_FEATURE == true // Init the device Mass Storage module and // create the device_mass_storage_task() task device_mass_storage_task_init(); #endif #if USB_HOST_FEATURE == true // Init the host Mass Storage module and // create the host_mass_storage_task() task host_mass_storage_task_init(); #endif return( true ); }
int main (void) { pcl_freq_param_t local_pcl_freq_param; /* USART_Int_Test (); return (0); */ // Configure system clocks. local_pcl_freq_param = pcl_freq_param; if (pcl_configure_clocks (&local_pcl_freq_param) != PASS) { return 42; } /* Load the Exception Vector Base Address in the corresponding system register. */ Set_system_register (AVR32_EVBA, (int) &_evba); /* Enable exceptions. */ ENABLE_ALL_EXCEPTIONS (); /* Initialize interrupt handling. */ INTC_init_interrupts (); #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)) sd_mmc_mci_resources_init (); #endif #ifdef FREERTOS_USED if (!ctrl_access_init ()) { return 42; } #endif // FREERTOS_USED // Init Hmatrix bus init_hmatrix (); // Initialize USB clock. pcl_configure_usb_clock (); /* SmartCard_test (); return 42; Test_ALL_Pins (); Test_MCI_Pins (); Test_LEDs_Pins (); TestUart0 (); while (1); return (0); */ #ifdef TIME_MEASURING_ENABLE TIME_MEASURING_Init (); #endif // For debugging BUFFERED_SIO_Init (); #ifdef INTERPRETER_ENABLE IDF_task_init (); #endif // Internal work task - FAT Access IW_task_init (); // Initialize USB tasks. usb_task_init (); #if USB_DEVICE_FEATURE == ENABLED #ifdef USB_MSD device_mass_storage_task_init (); #endif // USB_MSD #endif // CCID_Test_task_init (); #ifdef USB_CCID USB_CCID_task_init (); #endif DFU_DisableFirmwareUpdate (); // Stick always starts in application mode /**/ // Protect bootloader #ifdef STICK_20_A_MUSTER_PROD // flashc_set_bootloader_protected_size (0x2000); // flashc_activate_security_bit (); // Debugging disabled, only chip erase works (bootloader is save) , AES storage keys and setup // are erased flashc_lock_external_privileged_fetch (TRUE); // Disable external instruction fetch #endif // DFU_FirmwareResetUserpage (); // Set BOD33 detection reset to 3.06 Volt pm_bod33_ResetDisable (); pm_bod33_set_level (AVR32_PM_BOD33_LEVEL_306_VOLT); pm_bod33_ResetEnable (); // ushell_task_init(pcl_freq_param.pba_f); // Create the semaphore vSemaphoreCreateBinary (AES_semphr); // Wait for the semaphore while (!xSemaphoreTake (AES_semphr, portMAX_DELAY)); // Release the semaphore in order to start a new device/host task portBASE_TYPE task_woken = pdFALSE; /* taskENTER_CRITICAL (); xSemaphoreGiveFromISR (AES_semphr, &task_woken); taskEXIT_CRITICAL (); */ taskENTER_CRITICAL (); xSemaphoreGive (AES_semphr); taskEXIT_CRITICAL (); // Start stick vTaskStartScheduler (); // It never gets to this point return 42; }