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

📄 pio.c

📁 详细介绍了arm7-at91r40008,的开发全过程
💻 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           : pio.c
//* Object              : pio Init Interrupt Management
//*
//* 1.0 03/Jan/03 JPP   : Creation

//*----------------------------------------------------------------------------

// Include Standard LIB  files 

#include "../ucos_ii/includes.h"
#define 	PIO_INTERRUPT_LEVEL	2
extern void pio_asm_irq_handler(void);
static const char Pio_header[]=
{
"\n\r  *** ATMEL Pio IRQ ***\n\r"
"Copyright (a) 2004 DONGFANG Corporations Version: 1.0\n\r"
};

//*------------------------- Internal Function --------------------------------

//*----------------------------------------------------------------------------
//* Function Name       : Usart0_init
//* Object              : USART0 initialization 
//* Input Parameters    : SYNC  异步模式    同步模式
//*			: PAR   偶校验  奇校验  强制为0  强制为1 无奇偶校验 多机模式
//*			: NBSTOP  1位  1.5位  2位  保留
//*			: BAUD 波特率
//*			: 以上参数参照usart.h中定义
//*----------------------------------------------------------------------------
void Pio_init (void)
//* Begin
{
    //* define switch at PIO input
    	at91_pio_open ( &PIO_DESC, SW_MASK, PIO_INPUT );
    	at91_pio_set_mode( &PIO_DESC, SW_MASK, PIO_FILTER_BIT );

/*	at91_irq_open ( PIO_ID, PIO_INTERRUPT_LEVEL, AIC_SRCTYPE_EXT_NEGATIVE_EDGE, pio_asm_irq_handler ) ;

	PIO_IER = SW1_Test;
	PIO_IER = SW2_Mntn;
*/
/*
    // open external IRQ interrupt
    	AT91F_PIO_CfgPeriph(AT91C_BASE_PIO,SW2_MASK,0);
    // open external IRQ0 interrupt
	AT91F_AIC_ConfigureIt ( pAic, AT91C_ID_IRQ0, IRQ0_INTERRUPT_LEVEL,AT91C_AIC_SRCTYPE_INT_EDGE_TRIGGERED, irq0_asm_irq_handler); 
	AT91F_AIC_EnableIt (pAic, AT91C_ID_IRQ0);
*/
}

//*----------------------------------------------------------------------------
//* Function Name       : pio_c_irq_handler
//* Object              : pio interrupt function
//* Input Parameters    : none
//* Output Parameters   : none
//* Functions called    : at91_pio_write
//*----------------------------------------------------------------------------
void pio_c_irq_handler(void)
{	
	int dummy;
	//* enable the next PIO IRQ
    	dummy =PIO_ISR;
    	//* suppress the compilation warning
    	dummy =dummy;
    	at91_usart_send_frame(&USART1_DESC, (char *)Pio_header, sizeof(Pio_header)) ;
}

⌨️ 快捷键说明

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