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

📄 bo_entry.c

📁 ARM入门的好帮手.包含了从简单到相对较复杂的程序.
💻 C
字号:
//*-----------------------------------------------------------------------------
//*      ATMEL Microcontroller Software Support  -  ROUSSET  -
//*-----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*-----------------------------------------------------------------------------
//* File Name           : bo_entry.c
//* Object              : Main loop of AT91EB40 test
//*
//* 1.0 04/09/98 JLV    : Creation
//* 2.0 21/10/98 JCZ    : Clean up.
//*-----------------------------------------------------------------------------

#include "periph\stdc\std_c.h"
#include "periph\usart\usart.h"
#include "periph\pio\pio.h"
#include "parts\r40807\r40807.h"

#include "at91eb40.h"       /* AT91EB40 description */

#define ADDR_ANGEL      0x01002000

extern int BootLoad ( void ) ;
extern void BootFts (void ) ;
extern int BootFlash ( void ) ;

//*----------------------------------------------------------------------------
//* Function Name           : BootEntry
//* Object                  : Entry point of boot
//* Input Parameters        : None
//* Output Parameters       : None
//* Functions called        :
//*----------------------------------------------------------------------------
int main (void )
//* Begin
{
    //* -- Set up PIO
    PIO_BASE->PIO_PDR  = PERIPHERAL;
    PIO_BASE->PIO_OER  = PIO_OUT;
    PIO_BASE->PIO_CODR = PIO_OUT;           /* Turn LEDs off */
    PIO_BASE->PIO_IDR  = 0xFFFFFFFF;        /* Disable PIO interrupts */

    //* Repeat for ever
    for (;;)
    {
        //* If SW4 button pressed, Load in SRAM
        if (PIO_BASE->PIO_PDSR & SW4)
        {
            //* Expect SW3 un-pressed
            PIO_BASE->PIO_SODR = LED1;
            return BootLoad();
        }//* EndIf

        //* If SW3 button pressed, Functional Test Software
        if (PIO_BASE->PIO_PDSR & SW3)
        {
            //* Expect SW4 un-pressed
            PIO_BASE->PIO_SODR = LED1_2_3;
            while (PIO_BASE->PIO_PDSR & SW3);
            PIO_BASE->PIO_CODR = LED1_2_3;
            BootFts();
        }//* EndIf
		
		//* If SW5 button pressed, Flash Test
		if (PIO_BASE->PIO_PDSR & SW5)
		{
		    //* Expect SW5 un-pressed
		    PIO_BASE->PIO_SODR = LED1_3;
		    while (PIO_BASE->PIO_PDSR & SW5);
		    PIO_BASE->PIO_CODR = LED1_3;
		    BootFlash();
		}//* EndIf

        //* If no button pressed, Angel
        PIO_BASE->PIO_SODR = LED2;
        return (ADDR_ANGEL);

    }//* EndRepeat

//* End
}

⌨️ 快捷键说明

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