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

📄 pg_io.h

📁 一个移植到凌阳单片机spce061a上面的实时操作系统
💻 H
字号:
///////////////////////////////////////////////////////////////
//
//
//   PGOS : A Portable,Configable Embedded System Kernel
//
//             Intel X86 Specific Code
//
//   This is an open source project under GPL lincence  
//
//        Version 0.9.0 ---- Development Snopshot
//
//   File name : PG_BASICIO.H : Basic IO Operations  
//   History :
//
//          2005-08-12  First build by X.K. @ PGOS Team  
//          
/////////////////////////////////////////////////////////////////

#ifndef PG_BASIO_H
#define PG_BASIO_H

/////////////////////////////////////////////////////////////////
// Output Device
//
/////////////////////////////////////////////////////////////////
#define PG_STDOUT       0x01
#define PG_STDERR       0x02
#define PG_OUT_SERIAL   0x04
#define PG_NETWORK      0x08
#define PG_DEFDEV       0xFF
#define PG_OUTDEV   PG_STDOUT

/////////////////////////////////////////////////////////////////
// Input Device
//
/////////////////////////////////////////////////////////////////
#define PG_STDIN     0x01
#define PG_INSERIAL  0x02
#define PG_INDEV   PG_STDIN

/////////////////////////////////////////////////////////////////
// IO operation status
//
/////////////////////////////////////////////////////////////////
#define PG_WRT_BIT        1
#define PG_RED_BIT        2
#define PG_IO_ALLOWED  0x01
#define PG_IO_FORBID   0x00

/////////////////////////////////////////////////////////////////
// IO Mode
//
/////////////////////////////////////////////////////////////////
#define PG_READ     0x00
#define PG_WRITE    0xFF

/////////////////////////////////////////////////////////////////
// IO Message
//
/////////////////////////////////////////////////////////////////
#define  MSG_IO_OPERATION  PGOS_USER_MSG + 1 

/////////////////////////////////////////////////////////////////
// PGOS Basic IO Operations
// 
// High level
// All high level IO operations will cause a block
/////////////////////////////////////////////////////////////////

// Read a byte from the PG_INDEV devices
PGOS_STATUS  pgos_io_readbyte( BYTE* ch ) ;
// Read a string from the PG_INDEV devices
PGOS_STATUS  pgos_io_readstring( BYTE* buffer, WORD len ) ;
// Flush internal ring buffer
PGOS_STATUS  pgos_io_flush( VOID ) ;
// Write a byte to the PG_OUTDEV devices
PGOS_STATUS  pgos_io_wrtbyte( BYTE ch ) ;
// Write a string to the PG_INDEV devices
PGOS_STATUS  pgos_io_wrtstring( const BYTE* buffer, WORD len ) ;


/////////////////////////////////////////////////////////////////
// PGOS IO Operations
// 
// Low level 
/////////////////////////////////////////////////////////////////

// Write a byte to the given device ring buffer
PGOS_STATUS  pgos_lowio_wb( BYTE ch, BYTE device ) ;
// Write string to the given device ring buffer
PGOS_STATUS  pgos_lowio_wbstr( const BYTE* buffer, WORD len ) ;
// Read a byte from the given device ring buffer
PGOS_STATUS  pgos_lowio_rb( BYTE* ch, BYTE device ) ;
// Set the IO operation device
VOID pgos_lowio_setdefdev( BYTE device ) ;
// Initialize the IO operations
PGOS_STATUS pgos_lowio_init( WORD rl ) ;
// Return the empty space in ring buffer
WORD pgos_lowio_emptysize( VOID ) ;
// Wait for IO operations allowed
VOID pgos_lowio_wait( BYTE io_mode ) ; 

////////////////////////////////////////////////////////////////
// PGOS IO Driver
// 
// Provides IO in/out services
////////////////////////////////////////////////////////////////
VOID pgos_io_driver( VOID ) ;

////////////////////////////////////////////////////////////////
// IO Driver Callback Function
// 
// if IO operations allowed wakeup operation task
////////////////////////////////////////////////////////////////
VOID pgos_io_drv_callback( VOID* info ) ;

#endif

⌨️ 快捷键说明

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