📄 fs8806.h
字号:
/*
**********************************************************************************************
* Project: Fs8806
* File: FS8806.h
* Contents:
* The FS8806 lib interface for caller
*
* $Date:
*
* Copyright (c) 2006 Fameg, Inc. All rights reserved
***********************************************************************************************
*/
#ifndef FS8806_H
#define FS8806_H
#include "kernel/system.h"
#include "hw/SoftI2C.h"
/*
***********************************************************************************************
must set USER_CONFIG to 1 only one time before include in c file
as below
#define USER_CONFIG 1
#include "FS8806.h"
***********************************************************************************************
*/
#ifndef USER_CONFIG
#define USER_CONFIG 0
#endif
/**********************************************/
#if 0
#define MCS51 0
#define M68K 1
#define X86 2
#define ARM 3
#define OTHER 4
#define CPU MCS51
#define true 1
#define false 0
#define TRUE 1
#define FALSE 0
#ifndef NULL
#define NULL (void *)0
#endif
#if (CPU==MCS51)
#define BYTE unsigned char //data type define (depend on MCU)
#define WORD unsigned short
#define BOOL BYTE
#define DWORD unsigned long
#define code code
#define data data
#elif (CPU==M68K)
#define BYTE unsigned char //data type define (depend on MCU)
#define WORD unsigned short
#define BOOL BYTE
#define DWORD unsigned long
#define code
#define data
#elif (CPU==X86||CPU==ARM)
#define BYTE unsigned char //data type define (depend on CPU)
#define WORD unsigned short
#define BOOL BYTE
#define DWORD unsigned int
#define code
#define data
#elif (CPU==OTHER)
#define BYTE unsigned char
#define WORD unsigned short
#define BOOL BYTE
#define DWORD unsigned int
#define code
#define data
#endif
#endif
/*
*****************************************************************************************************
* User must config Message storage address , It is correspond to
* Message Address parameter of "Code Generator"
*
*****************************************************************************************************
*/
// #define MessageAddress 0x5000
#define MessageAddress 0xFFC0 //last 64 bytes
/*************************************************************/
#if USER_CONFIG // the following is the user config , not for lib config
/*
*****************************************************************************************************
debug parameter,user can debug his own system by config
the following parameter
CHK_INTERVAL:check FS8806 receive state between frame NO's interval
MMAP: if OS has memory map, user must set this macro to 1
and use char ReadCode(void *s1, void *s2, int n); interface
to access ROM data.otherelse set to 0 and use memcpy to
access ROM data
*****************************************************************************************************
*/
const BYTE CHK_INTERVAL = 1 ;
const BYTE MMAP=0;
/*************************************************************/
//must arrange prog_len in ROM address 0x10000
BYTE code *pAuthAddress=( BYTE code *)MessageAddress;
#endif //USER_CONFIG
/**************************************************************
* The return value of GetLastError errcode
**************************************************************/
#define NOERROR 0x00
#define PRAMWRONG 0x01 //input param wrong
#define WriteCmdErr 0x21 //I2c communication has no ack
#define RequestStatusCmdErr 0x22
#define ReceiveStatusErr 0x23
#define ChipOffI2cBus 0xFF //extra info
#define CRCERR 0x03 //receive packack CRC wrong
#define CMDERR 0x04 //invalid reponse
#define RDYERR 0x05 //cmd =0xa1, but SN not match
#define SNERR 0x06 //SN right ,but cmd wrong
#define NotRdy 0x07
/************************************************************************
*
* FS8806 lib funcion interface
*
************************************************************************/
void InitFS8806Lib(BOOL ComMod, BYTE I2cSlvAdr, BOOL I2cIsHigh, BYTE SpiCLkMod, WORD SpiRate, BYTE *key ,BYTE Rand);
BOOL Authentication(BYTE *in,BYTE *out,BYTE * isComplete);
BOOL WriteNVMOpr(BYTE Nvmoffset,BYTE len,BYTE * buffer);
BOOL ReadNVMOpr(BYTE Nvmoffset,BYTE len,BYTE * buffer);
BOOL GetChipIdOpr(BYTE *pID);
BOOL ResetChipOpr(); //soft reset
BOOL PowerDownChipOpr();
BOOL WakeFromPowerDownOpr();
BYTE GetLastError();
#endif //FS8806_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -