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

📄 lib_spi.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_spi.h
//* Object              : Serial Peripheral Interface Library Header.
//*
//* 1.0 21/01/02 HI    : Creation
//*---------------------------------------------------------------------------

#ifndef lib_spi_h
#define lib_spi_h

#include    "periph/spi/spi.h"

typedef struct _AT91S_SPIDesc
{
    AT91PS_SPI         		spi_base ;
    const AT91PS_PIO        pio_base ;
    u_char             		periph_id ;
    u_char                  pin_spck ;
    u_char                  pin_miso ;
    u_char                  pin_mosi ;
    u_char                  pin_npcs[4] ;
} AT91S_SPIDesc, *AT91PS_SPIDesc ;


__inline void AT91F_SpiSetCr(AT91PS_SPI  pSPI, int cr)
{
	pSPI->SP_CR = cr;
}

__inline void AT91F_SpiSetMr (AT91PS_SPI pSPI, int mode )
{
	pSPI->SP_MR = mode  ;
}

__inline int AT91F_SpiGetMr (const AT91PS_SPI pSPI)
{
	return(pSPI->SP_MR);
}

__inline int AT91F_SpiGetChar (const AT91PS_SPI pSPI)
{
    return((pSPI->SP_RDR) & 0xFFFF);
}

__inline void AT91F_SpiSendChar (AT91PS_SPI pSPI, int character )
{
    pSPI->SP_TDR = (character & 0xFFFF);
}


__inline int AT91F_SpiGetStatus (const AT91PS_SPI pSPI)
{
    return(pSPI->SP_SR);
}


__inline int AT91F_SpiSetIer(const AT91PS_SPI pSPI, int its)
{
    pSPI->SP_IER = its;
}


extern void AT91F_SpiOpen  ( const AT91PS_APMC , const AT91PS_SPIDesc , u_int  );
extern void AT91F_SpiClose ( const AT91PS_APMC , const AT91PS_SPIDesc );


#endif /* lib_spi_h */


⌨️ 快捷键说明

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