⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 44b_main.c

📁 RockOS是在ARM上开发的
💻 C
字号:
/******************************************************************************
   Copyright (c) 2006 by RockOS.
   All rights reserved.

   This software is supported by Rock Software Workroom.

   Any bugs please contact the author with e-mail or QQ:
     E-mail : baobaoba520@yahoo.com.cn
         QQ : 59681888
*******************************************************************************
File name   : main.c
Description : This is the C entry for ARM board.
            : 
Auther      : sunxinqiu
History     :
  2006-3-15   first release.
******************************************************************************/

#include "bsp.h"

/******************************************************************************
Function    : void Main()
Params      : N/A
            : 
            : 
            : 
Return      : never return.
Description : this is the main entry of the C code, all hardware devices should
            : should be initialized before starting the OS.
******************************************************************************/
void Main ()
{
    /* Init GPIO. */
    init_gpio();

    /* interrupt controller. */
    init_irq();

    /* RTC and Tick. */
    init_rtc();

    /* PWM Timer. */
    init_pwm();

    /* start pwm timer5. */
    pwm_start(PWM_TIMER5, 10000/TICK_INT_FREQ, 1);

    /* UART. */
    init_uart();

    /* display the copyright informations. */
    UART_sendString(UART_CH0, "\n");
    UART_sendString(UART_CH0, "*******************************************************************************\n");
    UART_sendString(UART_CH0, "*  Copyright (c) 2006 by RockOS.                                              *\n");
    UART_sendString(UART_CH0, "*  All rights reserved.                                                       *\n");
    UART_sendString(UART_CH0, "*                                                                             *\n");
    UART_sendString(UART_CH0, "*  This software is issued by Rock Software Workroom.                         *\n");
    UART_sendString(UART_CH0, "*                                                                             *\n");
    UART_sendString(UART_CH0, "*  Any bugs please contact the author with e-mail or QQ:                      *\n");
    UART_sendString(UART_CH0, "*    E-mail : baobaoba520@yahoo.com.cn                                        *\n");
    UART_sendString(UART_CH0, "*        QQ : 59681888                                                        *\n");
    UART_sendString(UART_CH0, "*       BBS : http://www.itsn.cn/bbs                                          *\n");    
    UART_sendString(UART_CH0, "*******************************************************************************\n");

    g_exception = NONE_EXCEPTION;

    pISR_UNDEF = (unsigned)OnUndefException;
    pISR_SWI = (unsigned)OnSwi;
    pISR_PABORT = (unsigned)OnPabortException;
    pISR_DABORT = (unsigned)OnDabortException;

    /* install main ISRs. */
//    pISR_TICK = (unsigned)OnTickInterrupt;
    pISR_TIMER5 = (unsigned)OnTimer5Interrupt;
    pISR_URXD0 = (unsigned)OnRxD0Interrupt;
    pISR_UERR01 = (unsigned)OnUerr01Interrupt;

//    add_irq(IRQ_TICK);
    add_irq(IRQ_TIMER5);
    add_irq(IRQ_URXD0);
    add_irq(IRQ_UERR01);

    /* then start the os. */
    root();

    enable_watchdog();
    while(1);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -