?? system.h
字號:
/****************************************Copyright (c)**************************************************
** Guangzou ZLG-MCU Development Co.,LTD.
** graduate school
** http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name: target.h
** Last modified Date: 2005-11-14
** Last Version: 1.0
** Descriptions: header file of the specific codes for LPC2200 target boards
** Every project should include a copy of this file, user may modify it as needed
**------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
**
********************************************************************************************************/
#ifndef __SYSTEM_H
#define __SYSTEM_H
#ifdef __cplusplus
extern "C" {
#endif
#define I2C_WRITE_END 1 /* 寫完成 */
#define I2C_READ_END 2 /* 讀完成 */
#define I2C_NOT_GET_BUS 4 /* 丟失仲裁 */
#define I2C_ACK_ERR 8 /* 接收ACK錯誤 */
#define I2C_FINISH 16 /* 操作完成 */
#define CODE_VER 0x11070518
#define PRODUCTION_NAME "M2020-FNU20"
__swi(0xaa) unsigned int SwiHandle(int, ...);
/*********************************************************************************************************
** 函數(shù)名稱: FIQDisable
** 功能描述: 全局禁止FIQ中斷
** 輸 入: 無
** 輸 出: 無
********************************************************************************************************/
__inline void FIQDisable(void)
{
SwiHandle(0x100);
}
/*********************************************************************************************************
** 函數(shù)名稱: FIQEnable
** 功能描述: 全局允許FIQ中斷
** 輸 入: 無
** 輸 出: 無
********************************************************************************************************/
__inline void FIQEnable(void)
{
SwiHandle(0x101);
}
/*********************************************************************************************************
** 函數(shù)名稱: FIQSave
** 功能描述: 全局禁止FIQ中斷的同時返回FIQ的狀態(tài)
** FIQRestore()配對使用
** 輸 入: 無
** 輸 出: 無
********************************************************************************************************/
__inline unsigned int FIQSave(void)
{
return SwiHandle(0x102);
}
/*********************************************************************************************************
** 函數(shù)名稱: FIQRestore
** 功能描述: 與IRQFIQSaveSave()配對使用,恢復(fù)全局FIQ狀態(tài)
** 輸 入: psr:FIQSave()返回的值
** 輸 出: 無
********************************************************************************************************/
__inline void FIQRestore(unsigned int psr)
{
SwiHandle(0x103, psr);
}
/*********************************************************************************************************
** 函數(shù)名稱: SetDefIRQAddr
** 功能描述: 設(shè)置非向量中斷服務(wù)程序
** 輸 入: Function:中斷服務(wù)程序(普通C語言函數(shù))
** 輸 出:無
********************************************************************************************************/
__inline void SetDefIRQAddr(void *Function)
{
SwiHandle(0x104, Function);
}
/*********************************************************************************************************
** 函數(shù)名稱: SetISRFuction
** 功能描述: 設(shè)置向量中斷服務(wù)程序
** 輸 入: Channel: 中斷通道號
** PRI: 中斷優(yōu)先級
** Function:中斷服務(wù)程序(普通C語言函數(shù))
** 輸 出:無
********************************************************************************************************/
extern void SetISRFuction(unsigned int Channel, unsigned int PRI, void *Function);
/*********************************************************************************************************
** 函數(shù)名稱: SysInit
** 功能描述: 系統(tǒng)初始化從I2c從器件讀數(shù)據(jù)
** 輸 入: 無
** 輸 出: 無
********************************************************************************************************/
extern void SysInit(void);
/*********************************************************************************************************
** 函數(shù)名稱: I2cInit
** 功能描述: 初始化I2c為(主模式)
** 輸 入: I2cDiv:I2c總線分頻值
**
** 輸 出:TRUE :成功
** FALSE:失敗
********************************************************************************************************/
extern uint8 I2cInit(uint32 I2cDiv);
/*********************************************************************************************************
** 函數(shù)名稱: I2cWrite
** 功能描述: 向I2C從器件寫數(shù)據(jù)
** 輸 入: Addr:從機(jī)地址
** Data:指向?qū)⒁獙懙臄?shù)據(jù)的指針
** NByte:寫的數(shù)據(jù)數(shù)目
** 輸 出:發(fā)送的數(shù)據(jù)字節(jié)數(shù)
**
********************************************************************************************************/
extern uint16 I2cWrite(uint8 Addr, uint8 *Data, int16 NByte);
/*********************************************************************************************************
** 函數(shù)名稱: I2cRead
** 功能描述: 從I2c從器件讀數(shù)據(jù)
** 輸 入: Addr:從機(jī)地址
** Ret:指向返回數(shù)據(jù)存儲位置的指針
** Eaddr:擴(kuò)展地址存儲位置
** EaddrNByte:擴(kuò)展地址字節(jié)數(shù),0為無
** ReadNbyte:將要讀取的字節(jié)數(shù)目
** 輸 出:已讀取的字節(jié)數(shù)
********************************************************************************************************/
extern int16 I2cRead(uint8 Addr, uint8 *Ret, uint8 *Eaddr, int16 EaddrNByte, int16 ReadNbyte);
/*********************************************************************************************************
** 函數(shù)名稱: I2cGetFlag
** 功能描述: 獲取I2C總線狀態(tài)
** 輸 入: 無
**
** 輸 出: 0: 忙
** I2C_WRITE_END: 寫完成
** I2C_READ_END: 讀完成
** I2C_NOT_GET_BUS: 丟失仲裁
** I2C_ACK_ERR: 接收ACK錯誤
** 0xff: 空閑
********************************************************************************************************/
extern uint8 I2cGetFlag(void);
/*********************************************************************************************************
** 函數(shù)名稱: I2cGetWriteBytes
** 功能描述: 獲得未寫完的數(shù)據(jù)個數(shù)
** 輸 入: 無
** 輸 出: 未寫完的數(shù)據(jù)個數(shù)
**
********************************************************************************************************/
extern uint16 I2cGetWriteBytes(void);
/*********************************************************************************************************
** 函數(shù)名稱: I2cGetReadBytes
** 功能描述: 從I2c從器件讀數(shù)據(jù)
** 輸 入: 無
** 輸 出:未讀完的數(shù)據(jù)個數(shù)
********************************************************************************************************/
extern int16 I2cGetReadBytes(void);
/*********************************************************************************************************
** Function name: GetIpSet
** Descriptions: 獲得本機(jī)IP設(shè)置
** 注意:這是保存在非易失存儲器中的設(shè)置,而不是運(yùn)行中的設(shè)置
** input parameters: ip:保存獲得的IP
** Returned value: TRUE or FLASH
********************************************************************************************************/
extern uint8 GetIpSet(uint8 *ip);
/*********************************************************************************************************
** Function name: GetMarkSet
** Descriptions: 獲得本機(jī)子網(wǎng)掩碼設(shè)置
** 注意:這是保存在非易失存儲器中的設(shè)置,而不是運(yùn)行中的設(shè)置
** input parameters: mark:保存獲得的子網(wǎng)掩碼
** Returned value: TRUE or FLASH
********************************************************************************************************/
extern uint8 GetMarkSet(uint8 *mark);
/*********************************************************************************************************
** Function name: GetGateWaySet
** Descriptions: 獲得本機(jī)網(wǎng)關(guān)設(shè)置
** 注意:這是保存在非易失存儲器中的設(shè)置,而不是運(yùn)行中的設(shè)置
** input parameters: GateWaySet:保存獲得的網(wǎng)關(guān)
** Returned value: TRUE or FLASH
********************************************************************************************************/
extern uint8 GetGateWaySet(uint8 *GateWaySet);
/*********************************************************************************************************
** Function name: GetPortSet
** Descriptions: 獲得本機(jī)端口設(shè)置
** 注意:這是保存在非易失存儲器中的設(shè)置,而不是運(yùn)行中的設(shè)置
** input parameters: none
** Returned value: 獲得的端口
********************************************************************************************************/
extern uint16 GetPortSet(void);
/*********************************************************************************************************
** Function name: GetServerIpSet
** Descriptions: 獲得服務(wù)器IP設(shè)置
** 注意:這是保存在非易失存儲器中的設(shè)置,而不是運(yùn)行中的設(shè)置
** input parameters: ip:保存獲得的IP
** Returned value: TRUE or FLASH
********************************************************************************************************/
extern uint8 GetServerIpSet(uint8 *ip);
/*********************************************************************************************************
** Function name: GetServerPortSet
** Descriptions: 獲得服務(wù)器端口設(shè)置
** 注意:這是保存在非易失存儲器中的設(shè)置,而不是運(yùn)行中的設(shè)置
** input parameters: none
** Returned value: 獲得的端口
********************************************************************************************************/
extern uint16 GetServerPortSet(void);
/*********************************************************************************************************
** Function name: SaveIpSet
** Descriptions: 保存本機(jī)IP設(shè)置
** input parameters: ip0~ip3:ip值
** Returned value: TRUE or FLASH
********************************************************************************************************/
extern uint8 SaveIpSet(uint8 ip0, uint8 ip1, uint8 ip2, uint8 ip3);
/*********************************************************************************************************
** Function name: SaveMarkSet
** Descriptions: 保存本機(jī)子網(wǎng)掩碼設(shè)置
** input parameters: mark0~mark3:子網(wǎng)掩碼
** Returned value: TRUE or FLASH
********************************************************************************************************/
extern uint8 SaveMarkSet(uint8 mark0, uint8 mark1, uint8 makrk2, uint8 mark3);
/*********************************************************************************************************
** Function name: SaveGateWaySet
** Descriptions: 保存本機(jī)網(wǎng)關(guān)設(shè)置
** input parameters: GateWaySet0~GateWaySet3:網(wǎng)關(guān)IP
** Returned value: TRUE or FLASH
********************************************************************************************************/
extern uint8 SaveGateWaySet(uint8 GateWaySet0, uint8 GateWaySet1, uint8 GateWaySet2, uint8 GateWaySet3);
/*********************************************************************************************************
** Function name: SavePortSet
** Descriptions: 保存本機(jī)端口設(shè)置
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -