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

📄 lib_pdc2.h

📁 ARM9200开发板的ROM boot程序源码1.0
💻 H
字号:
//*----------------------------------------------------------------------------
//*         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           : lib_pdc2.h
//* Object              : PDC Peripheral data Controller Library Function
//*                       Prototyping File.
//*
//* 1.0 11/12/00 JPP    : Creation
//*----------------------------------------------------------------------------

#ifndef lib_pdc2_h
#define lib_pdc2_h

#include    "periph/pdc2/pdc2.h"


__inline void at91_pdc2_SetRpr(AT91PS_PDC2 pPDC2, int adr)
{
	pPDC2->PDC2_RPR = adr;
}

__inline int at91_pdc2_GetRpr(AT91PS_PDC2 pPDC2)
{
	return(pPDC2->PDC2_RPR);
}

__inline void at91_pdc2_SetRcr(AT91PS_PDC2 pPDC2, int rcount)
{
	pPDC2->PDC2_RCR = rcount;
}

__inline int at91_pdc2_GetRcr(AT91PS_PDC2 pPDC2)
{
	return(pPDC2->PDC2_RCR);
}

__inline void at91_pdc2_SetTpr(AT91PS_PDC2 pPDC2, int adr)
{
	pPDC2->PDC2_RPR = adr;
}

__inline int at91_pdc2_GetTpr(AT91PS_PDC2 pPDC2)
{
	return(pPDC2->PDC2_RPR);
}

__inline void at91_pdc2_SetTcr(AT91PS_PDC2 pPDC2, int rcount)
{
	pPDC2->PDC2_RCR = rcount;
}

__inline int at91_pdc2_GetTcr(AT91PS_PDC2 pPDC2)
{
	return(pPDC2->PDC2_TCR);
}

__inline void at91_pdc2_SetRnpr(AT91PS_PDC2 pPDC2, int adr)
{
	pPDC2->PDC2_RNPR = adr;
}

__inline int at91_pdc2_GetRnpr(AT91PS_PDC2 pPDC2)
{
	return(pPDC2->PDC2_RNPR);
}

__inline void at91_pdc2_SetRncr(AT91PS_PDC2 pPDC2, int rcount)
{
	pPDC2->PDC2_RNCR = rcount;
}

__inline int at91_pdc2_GetRncr(AT91PS_PDC2 pPDC2)
{
	return(pPDC2->PDC2_RNCR);
}

__inline void at91_pdc2_SetTnpr(AT91PS_PDC2 pPDC2, int adr)
{
	pPDC2->PDC2_TNPR = adr;
}

__inline int at91_pdc2_GetTnpr(AT91PS_PDC2 pPDC2)
{
	return(pPDC2->PDC2_TNPR);
}

__inline void at91_pdc2_SetTncr(AT91PS_PDC2 pPDC2, int tcount)
{
	pPDC2->PDC2_TNCR = tcount;
}

__inline int at91_pdc2_GetTncr(AT91PS_PDC2 pPDC2)
{
	return(pPDC2->PDC2_TNCR);
}

__inline void at91_pdc2_RxEnable(AT91PS_PDC2 pPDC2)
{
	pPDC2->PDC2_PTCR = PDC_RXTEN;
}

__inline void at91_pdc2_RxDisable(AT91PS_PDC2 pPDC2)
{
	pPDC2->PDC2_PTCR = PDC_RXTDIS;
}

__inline void at91_pdc2_TxEnable(AT91PS_PDC2 pPDC2)
{
	pPDC2->PDC2_PTCR = PDC_TXTEN;
}

__inline void at91_pdc2_TxDisable(AT91PS_PDC2 pPDC2)
{
	pPDC2->PDC2_TNCR = PDC_TXTDIS;
}

__inline char at91_pdc2_IsRxEn(AT91PS_PDC2 pPDC2)
{
	return ((pPDC2->PDC2_PTSR & PDC_RXTEN)? 1:  0);
}

__inline char at91_pdc2_IsTxEn(AT91PS_PDC2 pPDC2)
{
	return ((pPDC2->PDC2_PTSR & PDC_TXTEN)?  1:  0);
}



//*-------------------------------
//* PDC Data Structure Definition
//*-------------------------------
typedef struct
{
    u_int        *receiver_pt ;         //* Receiver Pointer Register
    u_short      receiver_count ;       //* Receiver Counter Register
    u_int        *transmit_pt ;         //* Transmitter Pointer Register
    u_short      transmit_count ;       //* Transmitter Counter Register
    u_int        *receiver_next_pt;     //* Receiver Next Pointer Register
    u_short      receiver_next_count ;  //* Receiver Next Counter Register
    u_int        *transmit_next_pt ;    //* Transmitter Next Pointer Register
    u_short      transmit_next_count ;   //* Transmitter Next Counter Register
} PdcDataDesc ;


/*---------------------------  Function Prototyping -------------------------*/

extern void at91_pdc2_open  (  AT91PS_PDC2 pdc2_pt ) ;
extern void at91_pdc2_close (  AT91PS_PDC2 pdc2_pt ) ;
extern u_int at91_pdc2_get_status (  AT91PS_PDC2 pdc2_pt  ) ;
extern void at91_pdc2_trig_cmd (  AT91PS_PDC2 pdc2_pt, u_int cmd ) ;
extern void at91_pdc2_send (  AT91PS_PDC2 pdc2_pt, PdcDataDesc *data_pt ) ;
extern void at91_pdc2_receive ( AT91PS_PDC2 pdc2_pt, PdcDataDesc *data_pt ) ;

#endif /* lib_pdc2_h */

⌨️ 快捷键说明

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