Definition in file hid_example.c.
#include "nlao_cpu.h"
#include "nlao_usart.h"
#include "compiler.h"
#include "board.h"
#include "print_funcs.h"
#include "intc.h"
#include "power_clocks_lib.h"
#include "conf_usb.h"
#include "usb_task.h"
#include "device_mouse_hid_task.h"
#include "host_mouse_hid_task.h"
#include "hid_example.h"
Go to the source code of this file.
Functions | |
int | _init_startup (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 190 of file hid_example.c.
References pcl_freq_param.
00191 { 00192 // Import the Exception Vector Base Address. 00193 extern void _evba; 00194 00195 // Load the Exception Vector Base Address in the corresponding system register. 00196 Set_system_register(AVR32_EVBA, (int)&_evba); 00197 00198 // Enable exceptions. 00199 Enable_global_exception(); 00200 00201 // Initialize interrupt handling. 00202 INTC_init_interrupts(); 00203 00204 // Give the used CPU clock frequency to Newlib, so it can work properly. 00205 set_cpu_hz(pcl_freq_param.pba_f); 00206 00207 // Initialize the USART used for the debug trace with the configured parameters. 00208 set_usart_base( ( void * ) DBG_USART ); 00209 00210 // Don't-care value for GCC. 00211 return 1; 00212 }
int main | ( | void | ) |
Main function. Execution starts here.
42 | Fatal error. |
Definition at line 244 of file hid_example.c.
References device_mouse_hid_task(), device_mouse_hid_task_init(), host_mouse_hid_task(), host_mouse_hid_task_init(), and pcl_freq_param.
00245 { 00246 // Configure system clocks. 00247 if (pcl_configure_clocks(&pcl_freq_param) != PASS) 00248 return 42; 00249 00250 // Initialize USB clock (on PLL1) 00251 pcl_configure_usb_clock(); 00252 00253 // Initialize usart comm 00254 init_dbg_rs232(pcl_freq_param.pba_f); 00255 00256 // Initialize USB task 00257 usb_task_init(); 00258 00259 #if USB_DEVICE_FEATURE == ENABLED 00260 // Initialize device mouse USB task 00261 device_mouse_hid_task_init(); 00262 #endif 00263 #if USB_HOST_FEATURE == ENABLED 00264 //host_keyboard_hid_task_init(); 00265 00266 // Initialize host mouse USB task 00267 host_mouse_hid_task_init(); 00268 #endif 00269 00270 #ifdef FREERTOS_USED 00271 // Start OS scheduler 00272 vTaskStartScheduler(); 00273 portDBG_TRACE("FreeRTOS returned."); 00274 return 42; 00275 #else 00276 // No OS here. Need to call each task in round-robin mode. 00277 while (TRUE) 00278 { 00279 usb_task(); 00280 #if USB_DEVICE_FEATURE == ENABLED 00281 device_mouse_hid_task(); 00282 #endif 00283 #if USB_HOST_FEATURE == ENABLED 00284 //host_keyboard_hid_task(); 00285 host_mouse_hid_task(); 00286 #endif 00287 } 00288 #endif // FREERTOS_USED 00289 }
pcl_freq_param_t pcl_freq_param [static] |
Initial value:
Definition at line 165 of file hid_example.c.
Referenced by _init_startup(), and main().