<commit_before>/**
* \file
*
* \brief Empty user application template
*
*/

/**
* \mainpage User Application template doxygen documentation
*
* \par Empty user application template
*
* Bare minimum empty user application template
*
* \par Content
*
* -# Include the ASF header files (through asf.h)
* -# "Insert system clock initialization code here" comment
* -# Minimal main function that starts with a call to board_init()
* -# "Insert application code here" comment
*
*/

/*
* Include header files for all drivers that have been imported from
* Atmel Software Framework (ASF).
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#include <asf.h>
#include "compiler.h"
#include "board.h"
#include "power_clocks_lib.h"
#include "gpio.h"
#include "pm_uc3c.h"
#include "scif_uc3c.h"
#include "intc.h"
#include "can.h"
#include "canif.h"
#include "usart.h"
#include "print_funcs.h"
#include "conf_debug.h"
#include "conf_can.h"
#include "conf_messages.h"
//#include "conf_can_example.h"

uint32_t clk_main, clk_cpu, clk_periph, clk_busa, clk_busb;

// CAN MOB allocation into HSB RAM
#if defined (__GNUC__) && defined (__AVR32__)
volatile can_msg_t CAN_MOB_NORTH[NB_MOB_CHANNEL] __attribute__ ((section (".hsb_ram_loc")));
volatile can_msg_t CAN_MOB_SOUTH[NB_MOB_CHANNEL] __attribute__ ((section (".hsb_ram_loc")));
#elif defined (__ICCAVR32__)
volatile __no_init can_msg_t CAN_MOB_NORTH[NB_MOB_CHANNEL] @0xA0000000;
volatile __no_init can_msg_t CAN_MOB_SOUTH[NB_MOB_CHANNEL] @0xA0000000;
#endif

/* Call backs */
void can_out_callback_north(U8 handle, U8 event){
    //TODO
    //stub
}
void can_out_callback_south(U8 handle, U8 event){
    //TODO
    //stub
}
int main (void)
{
    /* Insert system clock initialization code here (sysclk_init()). */
    sysclk_init();
    
    board_init();
    
    //init debug printing for usart
    init_dbg_rs232(sysclk_get_pba_hz());
    
    #if DBG_CLKS
    /* test return of clocks */
    //clk_main = sysclk_get_main_hz();
    //clk_cpu = sysclk_get_cpu_hz();

    switch (sysclk_get_cpu_hz())
    {
        case 60000000:
        print_dbg("\n\rCPU Clock: 60MHZ\n\r");
        print_dbg("");
        break;
        default:
        print_dbg("\n\rcpu mhz outside expectations\n\r");
    }<commit_msg>better print debug, uses actual return values instead of cases<commit_after>/**
* \file
*
* \brief Empty user application template
*
*/

/**
* \mainpage User Application template doxygen documentation
*
* \par Empty user application template
*
* Bare minimum empty user application template
*
* \par Content
*
* -# Include the ASF header files (through asf.h)
* -# "Insert system clock initialization code here" comment
* -# Minimal main function that starts with a call to board_init()
* -# "Insert application code here" comment
*
*/

/*
* Include header files for all drivers that have been imported from
* Atmel Software Framework (ASF).
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#include <asf.h>
#include "compiler.h"
#include "board.h"
#include "power_clocks_lib.h"
#include "gpio.h"
#include "pm_uc3c.h"
#include "scif_uc3c.h"
#include "intc.h"
#include "can.h"
#include "canif.h"
#include "usart.h"
#include "print_funcs.h"
#include "conf_debug.h"
#include "conf_can.h"
#include "conf_messages.h"
//#include "conf_can_example.h"

uint32_t clk_main, clk_cpu, clk_periph, clk_busa, clk_busb;

// CAN MOB allocation into HSB RAM
#if defined (__GNUC__) && defined (__AVR32__)
volatile can_msg_t CAN_MOB_NORTH[NB_MOB_CHANNEL] __attribute__ ((section (".hsb_ram_loc")));
volatile can_msg_t CAN_MOB_SOUTH[NB_MOB_CHANNEL] __attribute__ ((section (".hsb_ram_loc")));
#elif defined (__ICCAVR32__)
volatile __no_init can_msg_t CAN_MOB_NORTH[NB_MOB_CHANNEL] @0xA0000000;
volatile __no_init can_msg_t CAN_MOB_SOUTH[NB_MOB_CHANNEL] @0xA0000000;
#endif

/* Call backs */
void can_out_callback_north(U8 handle, U8 event){
    //TODO
    //stub
}
void can_out_callback_south(U8 handle, U8 event){
    //TODO
    //stub
}
int main (void)
{
    /* Insert system clock initialization code here (sysclk_init()). */
    sysclk_init();
    
    board_init();
    
    //init debug printing for usart
    init_dbg_rs232(sysclk_get_pba_hz());
    
    print_dbg("\r======INITIALIZED======\n\r");
    
    #if DBG_CLKS
    /* test return of clocks */
    //clk_main = sysclk_get_main_hz();
    //clk_cpu = sysclk_get_cpu_hz();
    print_dbg("\n\rMain Clock Freq\n\r");
    print_dbg_ulong(sysclk_get_main_hz());
    print_dbg("\n\rCPU Freq\n\r");
    print_dbg_ulong(sysclk_get_cpu_hz());
{'fraction_non_alphanumeric': 0.1316017316017316, 'fraction_numerical': 0.015584415584415584, 'mean_word_length': 4.128745837957824, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 5, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1530158', 'n_tokens_mistral': 1770, 'n_tokens_neox': 1685, 'n_words': 423}