Definition in file main.c.
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include "pm.h"
#include "flashc.h"
#include "sdramc.h"
#include "FreeRTOS.h"
#include "task.h"
#include "partest.h"
#include "serial.h"
#include "ethernet.h"
#include "netif/etharp.h"
#include "flash.h"
#include "gpio.h"
#include "print_funcs.h"
Go to the source code of this file.
Defines | |
| #define | mainCOM_BAUD_RATE ( ( unsigned portLONG ) 57600 ) |
| #define | mainCOM_BUFFER_LEN ( ( unsigned portLONG ) 70 ) |
| #define | mainETH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) |
| #define | mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) |
| #define | mainRESET_COUNT_ADDRESS ( ( void * ) 0xC0000000 ) |
Functions | |
| void | local_start_pll (void) |
| int | main (void) |
| local_start_pll Initialize the microcontroller to it opertational frequency | |
| void | print_lwip_dbg (const char *format,...) |
| #define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) |
| void local_start_pll | ( | void | ) |
Definition at line 106 of file main.c.
Referenced by __low_level_init(), and _init_startup().
00106 { 00107 00108 volatile avr32_pm_t *pm = &AVR32_PM; 00109 00110 // Switch the main clock to OSC0 00111 pm_switch_to_osc0(pm, FOSC0, OSC0_STARTUP); 00112 // Setup PLL0 on OSC0, mul=15 ,no divisor, lockcount=16, ie. 12Mhz x 11 = 132MHz output 00113 pm_pll_setup(pm, // volatile avr32_pm_t *pm 00114 0, // unsigned int pll 00115 10, // unsigned int mul 00116 1, // unsigned int div, Sel Osc0/PLL0 or Osc1/Pll1 00117 0, // unsigned int osc 00118 16);// unsigned int lockcount 00119 00120 00121 // set PLL options to run @ 96 Mhz 00122 pm_pll_set_option(pm, // volatile avr32_pm_t *pm 00123 0, // unsigned int pll 00124 1, // unsigned int pll_freq 00125 1, // unsigned int pll_div2 00126 0); // unsigned int pll_wbwdisable 00127 // Enable PLL0 00128 pm_pll_enable(pm, 0); 00129 // Wait for PLL0 locked 00130 pm_wait_for_pll0_locked(pm) ; 00131 // Setup generic clock number 0 on PLL, with OSC0/PLL0, no divisor 00132 pm_gc_setup(pm, 0, 1, // Use Osc (=0) or PLL (=1) 00133 0, // Sel Osc0/PLL0 or Osc1/Pll1 00134 0, 0); 00135 00136 // Enable Generic clock 0*/ 00137 pm_gc_enable(pm, 0); 00138 00139 // set divider to 8 for PBA bus and 2 for PBB 0 for CPU 00140 pm_cksel(pm, 1, 1, 1, 0, 0, 0); 00141 00142 // one wait state at 66 Mhz 00143 flashc_set_wait_state(1); 00144 /* Output the clock to a gpio(PA7) */ 00145 gpio_enable_module_pin(AVR32_PM_GCLK_0_0_PIN, AVR32_PM_GCLK_0_0_FUNCTION); 00146 00147 // switch to clock 00148 pm_switch_to_clock(pm, AVR32_PM_MCCTRL_MCSEL_PLL0); 00149 00150 /* Initialize the SDRAM Controller and the external SDRAM chip. */ 00151 sdramc_init(66000000); 00152 00153 }
| main | ( | void | ) |
local_start_pll Initialize the microcontroller to it opertational frequency
start the software here 1) Initialize the microcontroller and the shared hardware resources of the board.
Definition at line 165 of file main.c.
References configMAX_PRIORITIES, mainLED_TASK_PRIORITY, vParTestInitialise(), and vStartEthernetTaskLauncher().
00165 { 00166 00167 /* Init rs232 with pba = FOSC0 */ 00168 init_dbg_rs232(66000000/4); 00169 print_dbg("Init Done\n"); 00170 00171 00172 /* Setup the LED's for output. */ 00173 vParTestInitialise(); 00174 00175 /* Start the flash tasks just to provide visual feedback that the demo is 00176 executing. */ 00177 vStartLEDFlashTasks( mainLED_TASK_PRIORITY); 00178 print_dbg("vStartLEDFlashTasks :Started\n"); 00179 00180 /* 2) Start the ethernet tasks launcher. */ 00181 vStartEthernetTaskLauncher(configMAX_PRIORITIES); 00182 print_dbg("vStartEthernetTaskLauncher :Started\n"); 00183 00184 /* 3) Start FreeRTOS. */ 00185 vTaskStartScheduler(); 00186 00187 /* Will only reach here if there was insufficient memory to create the idle task. */ 00188 00189 return 0; 00190 }
| void print_lwip_dbg | ( | const char * | format, | |
| ... | ||||
| ) |
1.5.5