www.pudn.com > rc500.rar > RDIO.H


/////////////////////////////////////////////////////////////////////////////// 
//    Copyright (c), Philips Semiconductors Gratkorn 
// 
//                  (C)PHILIPS Electronics N.V.2000 
//       All rights are reserved. Reproduction in whole or in part is  
//      prohibited without the written consent of the copyright owner. 
//  Philips reserves the right to make changes without notice at any time. 
// Philips makes no warranty, expressed, implied or statutory, including but 
// not limited to any implied warranty of merchantibility or fitness for any 
//particular purpose, or that the use will not infringe any third party patent, 
// copyright or trademark. Philips must not be liable for any loss or damage 
//                          arising from its use. 
/////////////////////////////////////////////////////////////////////////////// 
// 
// Projekt         : M500 
// Files           : RdIO.h RdIO.c 
// Created         : 01.03.00 
// COMMENT         : Reader IO routines 
//================== M O D I F I C A T I O N S ================================ 
// Date   : 01.03.00           User   : HB 
// Comment:	File created 
/////////////////////////////////////////////////////////////////////////////// 
#ifndef RDIO_H 
#define RDIO_H 
 
// _____________________________________________________________________________ 
// 
//  FUNCTION: OpenIO 
//        IN: - 
//       OUT: - 
//    RETURN: 0     no error occured 
//            != 0  error opening IO 
//   COMMENT: open and initialise communication channel to the reader module 
// 
char OpenIO(void); 
 
// _____________________________________________________________________________ 
// 
//  FUNCTION: WriteIO 
//        IN: address   register address in the reader module address space 
//            value     value, which should be written 
//       OUT: - 
//    RETURN: - 
//   COMMENT: This function determines the necessary page address of the  
//            reader module and writes the page number to the page  
//            register and the value to the specified address. 
// 
void WriteIO(unsigned char Address, unsigned char value); 
 
// _____________________________________________________________________________ 
// 
//  FUNCTION: ReadIO 
//        IN: address  register address in the reader module address space 
//       OUT: - 
//    RETURN: value    value, which should be read 
//   COMMENT: This function determines the necessary page address of the  
//            reader module and writes the page number to the page  
//            register and the value to the specified address. 
// 
unsigned char ReadIO(unsigned char Address); 
 
#ifndef SEC_NO_MICORE 
//_____________________________________________________________________________ 
// 
//  FUNCTION: WriteIOBlock 
//        IN: addr_data   byte stream alternating address and data 
//            len         number of address/data pairs 
//       OUT: - 
//    RETURN:  
//   COMMENT: This function expects a byte stream with alternating one  
//            address byte and the corresponding value byte. 
//            The parameter "len" indicates the number of  
//            address/value pairs in the "addr_data" array. 
//            e. g.  
//            addr_data = addr1,val1,addr2,val2,addr3,val3,....,addrN,valN 
//            len = N 
// 
void WriteIOBlock(unsigned char *Addr_Data, unsigned short len); 
 
// _____________________________________________________________________________ 
// 
//  FUNCTION: ReadIOBlock 
//        IN: addr_data   byte stream alternating address and data 
//            len         number of address/data pairs 
//       OUT: addr_data   byte stream alternating address and data 
//    RETURN:  
//   COMMENT: This function expects a byte stream with alternating one  
//            address byte followed and the corresponding value byte. 
//            The parameter "len" indicates the number of  
//            address/value pairs in the "addr_data" array. 
//            The value bytes are filled in by this function. 
//            e. g.  
//            addr_data = addr1,val1,addr2,val2,addr3,val3,....,addrN,valN 
//            len = N 
// 
void ReadIOBlock(unsigned char *Addr_Data, unsigned short len); 
#endif 
 
// _____________________________________________________________________________ 
// 
//  FUNCTION: CloseIO 
//        IN: - 
//       OUT: - 
//    RETURN: - 
//   COMMENT: Closing the communication channel to the reader module 
// 
void CloseIO(void); 
 
// _____________________________________________________________________________ 
// 
//  FUNCTION: WriteRawIO 
//        IN: addr        address within the reader address space (0x00 to 0xFF), 
//                        where the value should be written. 
//            value       value, which should be written 
//       OUT: - 
//    RETURN: - 
//   COMMENT: Inline code for reading one char from the reader module 
//            The reader module is connected to a 8 bit multiplexed data address 
//            bus, therefore the lower address byte is directly mapped to the 
//	      reader module is mapped as follows: 
//                     uC             Reader 
//                     AD0              A0 
//                     AD1              A1 
//			.		. 
//                     AD7              A7 
// 
#define WriteRawIO(addr,value)  *(GpBase + addr) = value; 
 
// _____________________________________________________________________________ 
// 
//  FUNCTION: ReadRawIO 
//        IN: addr        address within the reader address space (0x00 to 0xFF), 
//                        which shoud be read. 
//       OUT: - 
//    RETURN: value of the reader module 
//   COMMENT: Inline code for reading one char from the reader module 
//            The reader module is connected to a 8 bit multiplexed data address 
//            bus, therefore the lower address byte is directly mapped to the 
//	      reader module is mapped as follows: 
//                     uC             Reader 
//                     AD0              A0 
//                     AD1              A1 
//			.		. 
//                     AD7              A7 
// 
#define ReadRawIO(addr) (*(GpBase + addr)) 
 
extern unsigned char xdata *GpBase;    // variable only for internal use 
#endif