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

📄 system.h

📁 在ucos-ii下用LPC2290的spi端口驱动M65的液晶屏
💻 H
📖 第 1 页 / 共 2 页
字号:
/****************************************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 0x10060830

__swi(0xaa) unsigned int SwiHandle(int, ...);

/*********************************************************************************************************
** 函数名称: FIQDisable
** 功能描述: 全局禁止FIQ中断
** 输 入: 无
** 输 出: 无
********************************************************************************************************/
__inline void FIQDisable(void)
{
    SwiHandle(0x100);
}

/*********************************************************************************************************
** 函数名称: FIQEnable
** 功能描述: 全局允许FIQ中断
** 输 入: 无
** 输 出: 无
********************************************************************************************************/
__inline void FIQEnable(void)
{
    SwiHandle(0x101);
}

/*********************************************************************************************************
** 函数名称: FIQSave
** 功能描述: 全局禁止FIQ中断的同时返回FIQ的状态
**           FIQRestore()配对使用
** 输 入: 无
** 输 出: 无
********************************************************************************************************/
__inline unsigned int FIQSave(void)
{
    return SwiHandle(0x102);
}

/*********************************************************************************************************
** 函数名称: FIQRestore
** 功能描述: 与IRQFIQSaveSave()配对使用,恢复全局FIQ状态
** 输 入: psr:FIQSave()返回的值
** 输 出: 无
********************************************************************************************************/
__inline void FIQRestore(unsigned int psr)
{
    SwiHandle(0x103, psr);
}

/*********************************************************************************************************
** 函数名称: SetDefIRQAddr
** 功能描述: 设置非向量中断服务程序
** 输 入:   Function:中断服务程序(普通C语言函数) 
** 输 出:无
********************************************************************************************************/
__inline void SetDefIRQAddr(void *Function)
{
    SwiHandle(0x104, Function);
}

/*********************************************************************************************************
** 函数名称: SetISRFuction
** 功能描述: 设置向量中断服务程序
** 输 入: Channel: 中断通道号
**         PRI:     中断优先级
**         Function:中断服务程序(普通C语言函数) 
** 输 出:无
********************************************************************************************************/
extern void SetISRFuction(unsigned int Channel, unsigned int PRI, void *Function);

/*********************************************************************************************************
** 函数名称: SysInit
** 功能描述: 系统初始化从I2c从器件读数据
** 输 入: 无
** 输 出: 无
********************************************************************************************************/
extern void SysInit(void);

/*********************************************************************************************************
** 函数名称: I2cInit
** 功能描述: 初始化I2c为(主模式)
** 输 入: I2cDiv:I2c总线分频值
**
** 输 出:TRUE  :成功
**        FALSE:失败
********************************************************************************************************/
extern uint8 I2cInit(uint32 I2cDiv);

/*********************************************************************************************************
** 函数名称: I2cWrite
** 功能描述: 向I2C从器件写数据 
** 输 入: Addr:从机地址
**        Data:指向将要写的数据的指针
**        NByte:写的数据数目
** 输 出:发送的数据字节数
**
********************************************************************************************************/
extern uint16 I2cWrite(uint8 Addr, uint8 *Data, int16 NByte);

/*********************************************************************************************************
** 函数名称: I2cRead
** 功能描述: 从I2c从器件读数据
** 输 入: Addr:从机地址
**        Ret:指向返回数据存储位置的指针
**        Eaddr:扩展地址存储位置
**        EaddrNByte:扩展地址字节数,0为无
**        ReadNbyte:将要读取的字节数目
** 输 出:已读取的字节数
********************************************************************************************************/
extern int16 I2cRead(uint8 Addr, uint8 *Ret, uint8 *Eaddr, int16 EaddrNByte, int16 ReadNbyte);

/*********************************************************************************************************
** 函数名称: I2cGetFlag
** 功能描述: 获取I2C总线状态
** 输 入: 无
**
** 输 出:  0:               忙
**          I2C_WRITE_END:   写完成
**          I2C_READ_END:    读完成
**          I2C_NOT_GET_BUS: 丢失仲裁
**          I2C_ACK_ERR:     接收ACK错误
**          0xff:            空闲
********************************************************************************************************/
extern uint8 I2cGetFlag(void);

/*********************************************************************************************************
** 函数名称: I2cGetWriteBytes
** 功能描述: 获得未写完的数据个数 
** 输 入: 无
** 输 出: 未写完的数据个数
**
********************************************************************************************************/
extern uint16 I2cGetWriteBytes(void);

/*********************************************************************************************************
** 函数名称: I2cGetReadBytes
** 功能描述: 从I2c从器件读数据
** 输 入: 无
** 输 出:未读完的数据个数
********************************************************************************************************/
extern int16 I2cGetReadBytes(void);

/*********************************************************************************************************
** Function name:			GetIpSet
** Descriptions:			获得本机IP设置
**                          注意:这是保存在非易失存储器中的设置,而不是运行中的设置
** input parameters:		ip:保存获得的IP
** Returned value:			TRUE or FLASH
********************************************************************************************************/
extern uint8 GetIpSet(uint8 *ip);

/*********************************************************************************************************
** Function name:			GetMarkSet
** Descriptions:			获得本机子网掩码设置
**                          注意:这是保存在非易失存储器中的设置,而不是运行中的设置
** input parameters:		mark:保存获得的子网掩码
** Returned value:			TRUE or FLASH
********************************************************************************************************/
extern uint8 GetMarkSet(uint8 *mark);

/*********************************************************************************************************
** Function name:			GetGateWaySet
** Descriptions:			获得本机网关设置
**                          注意:这是保存在非易失存储器中的设置,而不是运行中的设置
** input parameters:		GateWaySet:保存获得的网关
** Returned value:			TRUE or FLASH
********************************************************************************************************/
extern uint8 GetGateWaySet(uint8 *GateWaySet);

/*********************************************************************************************************
** Function name:			GetPortSet
** Descriptions:			获得本机端口设置
**                          注意:这是保存在非易失存储器中的设置,而不是运行中的设置
** input parameters:		none
** Returned value:			获得的端口
********************************************************************************************************/
extern uint16 GetPortSet(void);

/*********************************************************************************************************
** Function name:			GetServerIpSet
** Descriptions:			获得服务器IP设置
**                          注意:这是保存在非易失存储器中的设置,而不是运行中的设置
** input parameters:		ip:保存获得的IP
** Returned value:			TRUE or FLASH
********************************************************************************************************/
extern uint8 GetServerIpSet(uint8 *ip);

/*********************************************************************************************************
** Function name:			GetServerPortSet
** Descriptions:			获得服务器端口设置
**                          注意:这是保存在非易失存储器中的设置,而不是运行中的设置
** input parameters:		none
** Returned value:			获得的端口
********************************************************************************************************/
extern uint16 GetServerPortSet(void);

/*********************************************************************************************************
** Function name:			SaveIpSet
** Descriptions:			保存本机IP设置
** 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:			保存本机子网掩码设置
** input parameters:		mark0~mark3:子网掩码
** Returned value:			TRUE or FLASH
********************************************************************************************************/
extern uint8 SaveMarkSet(uint8 mark0, uint8 mark1, uint8 makrk2, uint8 mark3);

/*********************************************************************************************************
** Function name:			SaveGateWaySet
** Descriptions:			保存本机网关设置
** input parameters:		GateWaySet0~GateWaySet3:网关IP
** Returned value:			TRUE or FLASH
********************************************************************************************************/
extern uint8 SaveGateWaySet(uint8 GateWaySet0, uint8 GateWaySet1, uint8 GateWaySet2, uint8 GateWaySet3);

⌨️ 快捷键说明

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