📄 embedded_services.h
字号:
void (*ReadCallback) (AT91S_PipeStatus, void *);
void *pPrivateReadData;
void *pPrivateWriteData;
// Pipe methods
AT91S_PipeStatus (*Write) (
struct _AT91S_Pipe *pPipe,
char const * pData,
unsigned int size,
void (*callback) (AT91S_PipeStatus, void *),
void *privateData);
AT91S_PipeStatus (*Read) (
struct _AT91S_Pipe *pPipe,
char *pData,
unsigned int size,
void (*callback) (AT91S_PipeStatus, void *),
void *privateData);
AT91S_PipeStatus (*AbortWrite) (
struct _AT91S_Pipe *pPipe);
AT91S_PipeStatus (*AbortRead) (
struct _AT91S_Pipe *pPipe);
AT91S_PipeStatus (*Reset) (
struct _AT91S_Pipe *pPipe);
char (*IsWritten) (
struct _AT91S_Pipe *pPipe,
char const *pVoid);
char (*IsReceived) (
struct _AT91S_Pipe *pPipe,
char const *pVoid);
} AT91S_Pipe, *AT91PS_Pipe;
// types used in AT91S_Pipe
typedef AT91PS_Pipe (*AT91PF_OpenPipe) (AT91PS_Pipe, AT91PS_SvcComm, AT91PS_Buffer);
typedef void (*AT91PF_PipeWriteCallBack) (AT91S_PipeStatus, void *);
typedef void (*AT91PF_PipeReadCallBack) (AT91S_PipeStatus, void *);
typedef AT91S_PipeStatus (*AT91PF_PipeWrite) (AT91PS_Pipe, char const *, unsigned int, void (*) (AT91S_PipeStatus, void *), void *);
typedef AT91S_PipeStatus (*AT91PF_PipeRead) (AT91PS_Pipe, char const *, unsigned int, void (*) (AT91S_PipeStatus, void *), void *);
typedef AT91S_PipeStatus (*AT91PF_PipeAbortWrite) (AT91PS_Pipe);
typedef AT91S_PipeStatus (*AT91PF_PipeAbortRead) (AT91PS_Pipe);
typedef AT91S_PipeStatus (*AT91PF_PipeReset) (AT91PS_Pipe);
typedef char (*AT91PF_PipeIsWritten) (AT91PS_Pipe, char const *);
typedef char (*AT91PF_PipeIsReceived) (AT91PS_Pipe, char const *);
// This function is called by the application
extern AT91PS_Pipe AT91F_OpenPipe(
AT91PS_Pipe pPipe,
AT91PS_SvcComm pSvcComm,
AT91PS_Buffer pBuffer);
// Following functions are called through AT91S_Pipe pointers
extern AT91S_PipeStatus AT91F_PipeWrite(
AT91PS_Pipe pPipe,
char const *pVoid,
unsigned int size,
AT91PF_PipeWriteCallBack callback,
void *privateData);
extern AT91S_PipeStatus AT91F_PipeRead(
AT91PS_Pipe pPipe,
char *pVoid,
unsigned int Size,
AT91PF_PipeReadCallBack callback,
void *privateData);
extern AT91S_PipeStatus AT91F_PipeAbortWrite(AT91PS_Pipe pPipe);
extern AT91S_PipeStatus AT91F_PipeAbortRead(AT91PS_Pipe pPipe);
extern AT91S_PipeStatus AT91F_PipeReset(AT91PS_Pipe pPipe);
extern char AT91F_PipeMsgWritten(AT91PS_Pipe pPipe, char const *pVoid);
extern char AT91F_PipeMsgReceived(AT91PS_Pipe pPipe, char const *pVoid);
#ifdef DBG_DRV_PIPE
// This function parse the error number and return a string
// describing the error message
extern char const *AT91F_PipeGetError(AT91S_PipeStatus msgId);
#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// End of Pipe structure
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CRC service
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
extern const unsigned char bit_rev[256];
extern void CalculateCrc32(const unsigned char *,unsigned int, unsigned int *);
extern void CalculateCrc16(const unsigned char *, unsigned int , unsigned short *);
extern void CalculateCrcHdlc(const unsigned char *, unsigned int, unsigned short *);
extern void CalculateCrc16ccitt(const unsigned char *, unsigned int , unsigned short *);
/************************************************************************************************************************/
typedef const unsigned char* AT91PS_SVC_CRC_BIT_REV ;
typedef void (*AT91PF_SVC_CRC32) (const unsigned char *, unsigned int, unsigned int *);
typedef void (*AT91PF_SVC_CRC16) (const unsigned char *, unsigned int, unsigned short *);
typedef void (*AT91PF_SVC_CRCHDLC) (const unsigned char *, unsigned int, unsigned short *);
typedef void (*AT91PF_SVC_CRCCCITT)(const unsigned char *, unsigned int , unsigned short *);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// End of CRC service
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Sinus service
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef short (*AT91PF_Sinus) (int angle);
typedef const short * AT91PS_SINE_TAB;
/************************************************************************************************************************/
extern short AT91F_Sinus(int angle);
extern const short AT91C_SINUS180_TAB[256];
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// End of Sinus service
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ROM Entry service
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef void (TypeAICHandler) (void) ;
/************************************************************************************************************************/
// ROM BOOT Structure Element Definition (liv v2)
typedef struct _AT91S_MEMCDesc
{
AT91PS_MC memc_base ; /* Peripheral base */
unsigned char periph_id ; /* MC Peripheral Identifier */
} AT91S_MEMCDesc, *AT91PS_MEMCDesc ;
typedef struct _AT91S_Pio2Desc
{
AT91PS_PIO pio_base ; /* Base Address */
unsigned char periph_id ; /* Peripheral Identifier */
unsigned char pio_number ; /* Total Pin Number */
} AT91S_Pio2Desc, *AT91PS_Pio2Desc ;
typedef struct _AT91S_SPIDesc
{
AT91PS_SPI spi_base ;
const AT91PS_PIO pio_base ;
unsigned char periph_id ;
unsigned char pin_spck ;
unsigned char pin_miso ;
unsigned char pin_mosi ;
unsigned char pin_npcs[4] ;
} AT91S_SPIDesc, *AT91PS_SPIDesc ;
typedef struct _AT91S_USART2Desc
{
AT91PS_USART usart_base ; /* Peripheral base */
const AT91PS_PIO pio_base ; /* IO controller descriptor */
unsigned int pin_rxd ; /* RXD pin number in the PIO */
unsigned int pin_txd ; /* TXD pin number in the PIO */
unsigned int pin_sck ; /* SCK pin number in the PIO */
unsigned int pin_rts ; /* RTS pin number in the PIO */
unsigned int pin_cts ; /* CTS pin number in the PIO */
unsigned int pin_dtr ; /* DTR pin number in the PIO */
unsigned int pin_ri ; /* RI pin number in the PIO */
unsigned int pin_dsr ; /* DSR pin number in the PIO */
unsigned int pin_dcd ; /* DCD pin number in the PIO */
unsigned int periph_id ; /* USART Peripheral Identifier */
} AT91S_USART2Desc, *AT91PS_USART2Desc ;
typedef struct _AT91S_TWIDesc
{
AT91PS_TWI TWI_base ;
const AT91PS_PIO pio_base ;
unsigned int pin_sck ;
unsigned int pin_sda ;
unsigned int periph_id;
}AT91S_TWIDesc, *AT91PS_TWIDesc;
typedef struct _AT91S_STDesc
{
AT91PS_ST st_base ; /* Peripheral base address */
TypeAICHandler *AsmSTHandler ; /* Assembly interrupt handler */
unsigned char PeriphId ; /* Peripheral Identifier */
} AT91S_STDesc, *AT91PS_STDesc;
/************************************************************************************************************************/
typedef struct _AT91S_RomBoot {
const unsigned int version;
// Peripheral descriptors
const AT91S_MEMCDesc MEMC_DESC;
const AT91S_STDesc SYSTIMER_DESC;
const AT91S_Pio2Desc PIOA_DESC;
const AT91S_Pio2Desc PIOB_DESC;
const AT91S_USART2Desc DBGU_DESC;
const AT91S_USART2Desc USART0_DESC;
const AT91S_USART2Desc USART1_DESC;
const AT91S_USART2Desc USART2_DESC;
const AT91S_USART2Desc USART3_DESC;
const AT91S_TWIDesc TWI_DESC;
const AT91S_SPIDesc SPI_DESC;
// Objects entry
const AT91PF_OpenPipe OpenPipe;
const AT91PF_OpenSBuffer OpenSBuffer;
const unsigned int reserved1;
const AT91PF_OpenSvcXmodem OpenSvcXmodem;
const AT91PF_OpenCtlTempo OpenCtlTempo;
const unsigned int reserved2;
const unsigned int reserved3;
const unsigned int reserved4;
const AT91PF_SVC_CRC16 CRC16;
const AT91PF_SVC_CRCCCITT CRCCCITT;
const AT91PF_SVC_CRCHDLC CRCHDLC;
const AT91PF_SVC_CRC32 CRC32;
const AT91PS_SVC_CRC_BIT_REV Bit_Reverse_Array;
const AT91PS_SINE_TAB SineTab;
const AT91PF_Sinus Sine;
} AT91S_RomBoot, *AT91PS_RomBoot;
#define AT91C_ROM_BOOT_ADDRESS ((const AT91S_RomBoot *) ( *((unsigned int *) (AT91C_BASE_ROM + 0x20))) )
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// End of ROM Entry Service
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
extern AT91S_DATAFLASH_INFO dataflash_info[CFG_MAX_DATAFLASH_BANKS];
extern void AT91F_SpiInit (void);
extern int AT91F_DataflashProbe (int i, AT91PS_DataflashDesc pDesc);
extern int AT91F_DataFlashRead (struct _AT91PS_SvcDataFlash *, unsigned long , unsigned long, unsigned char *);
extern AT91S_DataFlashStatus AT91F_DataFlashWrite(struct _AT91PS_SvcDataFlash *,unsigned char *, int, int);
extern AT91PS_DataFlash AT91F_DataflashInit (void);
extern void AT91F_DataflashPrintInfo(void);
extern int addr_dataflash (unsigned long addr);
extern int read_dataflash (unsigned long addr, unsigned long size, unsigned char *result);
extern int write_dataflash (unsigned long addr_dest, unsigned int addr_src, unsigned int size);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -