main.c

Go to the documentation of this file.
00001 /*This file is prepared for Doxygen automatic documentation generation.*/
00105 
00106 /* Copyright (c) 2009 Atmel Corporation. All rights reserved.
00107  *
00108  * Redistribution and use in source and binary forms, with or without
00109  * modification, are permitted provided that the following conditions are met:
00110  *
00111  * 1. Redistributions of source code must retain the above copyright notice,
00112  * this list of conditions and the following disclaimer.
00113  *
00114  * 2. Redistributions in binary form must reproduce the above copyright notice,
00115  * this list of conditions and the following disclaimer in the documentation
00116  * and/or other materials provided with the distribution.
00117  *
00118  * 3. The name of Atmel may not be used to endorse or promote products derived
00119  * from this software without specific prior written permission.
00120  *
00121  * 4. This software may only be redistributed and used in connection with an Atmel
00122  * AVR product.
00123  *
00124  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
00125  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00126  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND
00127  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
00128  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00129  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00130  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00131  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00132  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00133  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00134  */
00135 
00136 //_____  I N C L U D E S ___________________________________________________
00137 
00138 #include "config.h"
00139 #include "modules/scheduler/scheduler.h"
00140 #include "lib_mcu/wdt/wdt_drv.h"
00141 #include "lib_mcu/power/power_drv.h"
00142 #include "lib_mem/nf/nf_mngt.h"
00143 #include "lib_mcu/uart/uart_lib.h"
00144 #define  _TRACE_        (DISABLE)
00145 #include "lib_mcu/debug.h"
00146 
00147 //_____ M A C R O S ________________________________________________________
00148 
00149 //_____ D E F I N I T I O N S ______________________________________________
00150        
00151 int main(void)
00152 { 
00153    U8 nb_device;
00154    
00155    wdtdrv_disable();
00156    Clear_prescaler();
00157 
00158    uart_init();
00159 #ifdef __GNUC__
00160    fdevopen((int (*)(char, FILE*))(uart_putchar),(int (*)(FILE*))uart_getchar); //for printf redirection used in TRACE
00161 #endif
00162    trace("\x0C-----------Start\n\r");
00163    trace_nl();
00164    
00165    // STK525 init
00166    Leds_init();
00167    Joy_init();
00168    Hwb_button_init();
00169 
00170    // Mass Storage Extension board init
00171    Avr_ms_board_init();
00172 
00173    // NAND Flash Initialization
00174 #if (NF_AUTO_DETECT_2KB == FALSE) && (NF_AUTO_DETECT_512B == FALSE)
00175    nb_device = nfc_check_type(NF_N_DEVICES);
00176    while( NF_N_DEVICES != nb_device );
00177 #else
00178    nfc_detect();
00179 #endif
00180    nf_init();
00181 
00182    nf_test_unit_ready();
00183    scheduler();
00184    return 0;
00185 }
00186 
00190 #ifdef  __GNUC__
00191 // Locate low level init function before RAM init (init3 section)
00192 // and remove std prologue/epilogue
00193 char __low_level_init(void) __attribute__ ((section (".init3"),naked));
00194 #endif
00195 
00196 #ifdef __cplusplus
00197 extern "C" {
00198 #endif
00199 char __low_level_init()
00200 {
00201   Clear_prescaler();
00202   return 1;
00203 }
00204 #ifdef __cplusplus
00205 }
00206 #endif

Generated on Mon Sep 14 13:14:17 2009 for ATMEL by  doxygen 1.5.3