📄 isa.h
字号:
/*============================================================================
____________________________________________________________________________
______________________________________________
SSSS M M CCCC Standard Microsystems Corporation
S MM MM SSSS C Austin Design Center
SSS M M M S C 11000 N. Mopac Expressway
S M M SSS C Stonelake Bldg. 6, Suite 500
SSSS M M S CCCC Austin, Texas 78759
SSSS ______________________________________________
____________________________________________________________________________
Copyright(C) 1999, Standard Microsystems Corporation
All Rights Reserved.
This program code listing is proprietary to SMSC and may not be copied,
distributed, or used without a license to do so. Such license may have
Limited or Restricted Rights. Please refer to the license for further
clarification.
____________________________________________________________________________
Notice: The program contained in this listing is a proprietary trade
secret of SMSC, Hauppauge, New York, and is copyrighted
under the United States Copyright Act of 1976 as an unpublished work,
pursuant to Section 104 and Section 408 of Title XVII of the United
States code. Unauthorized copying, adaption, distribution, use, or
display is prohibited by this law.
____________________________________________________________________________
Use, duplication, or disclosure by the Government is subject to
restrictions as set forth in subparagraph(c)(1)(ii) of the Rights
in Technical Data and Computer Software clause at DFARS 52.227-7013.
Contractor/Manufacturer is Standard Microsystems Corporation,
80 Arkay Drive, Hauppauge, New York, 1178-8847.
____________________________________________________________________________
____________________________________________________________________________
<module name> - <module description>
____________________________________________________________________________
comments tbd
____________________________________________________________________________
Revision History
Date Who Comment
________ ___ _____________________________________________________________
07/16/99 tbh -initial version
01/28/03 ds Removed function prototypes that are not relevant for 242 and 211 to reclaim code space.
These functions are protected by the #if !defined(k_mcu_97242) && !defined(k_mcu_97211)
02/28/03 ds Further expanded the code reduction to the whole 20x family.
============================================================================*/
#ifdef OBSOLETE
//------------------------------------------------------------------------------
// isa io registers
#define at_isa(__addr) = __addr
// the current implementation limits isa memory access to a total of 64k bytes
// isa io access is physically limited to 64k
typedef uint16 t_isa_address;
typedef code uint16 t_isa_register;
#else
//------------------------------------------------------------------------------
// isa io registers
// the current implementation limits isa memory access to a total of 64k bytes
// isa io access is physically limited to 64k
#ifndef __isa_dot_c__
#define t_isa_register extern unsigned short volatile code
#define at_isa(__addr)
#else
#define t_isa_register unsigned short volatile code
#define at_isa(__addr) = __addr
#endif
typedef uint16 t_isa_address;
#endif
//+-----------------------------------------------------------------------------
// Name:
// _isa_register_rd
//
// Declaration:
// t_datum _isa_register_rd(t_isa_register reg);
//
// Purpose:
// Read a datum from a "register" in isaio space.
//
// Arguments:
// reg - the t_isa_register to be read.
//
// Return:
// The t_datum stored at the register location.
//
// Notes:
// 10x only. The 20x family does not have an isa bus.
// This macro does no more than expand into the isa_io_rd() function.
// Its intention is to act as part of a complete suite of macros that
// operate on isaio space locations as "registers". A register in this
// sense is nothing more than an address in isaio space. The terminology
// is encouraged, however, because it conveys additional meaning about the
// intended purpose of the operation at hand, and thus improves the readability
// of the source code.
//
// Since:
// MinimOS 2.1
//------------------------------------------------------------------------------
#define _isa_register_rd(__reg) isa_io_rd((__reg))
//+-----------------------------------------------------------------------------
// Name:
// _isa_register_wr
//
// Declaration:
// void _isa_register_wr(t_isa_register reg, t_datum datum);
//
// Purpose:
// Write a datum to a "register" in isaio space.
//
// Arguments:
// reg - the t_isa_register to be written.
// datum - the t_datum to write to it.
//
// Return:
// None.
//
// Notes:
// 10x only. The 20x family does not have an isa bus.
// This macro does no more than expand into the isa_io_wr() function.
// Its intention is to act as part of a complete suite of macros that
// operate on isaio space locations as "registers". A register in this
// sense is nothing more than an address in isaio space. The terminology
// is encouraged, however, because it conveys additional meaning about the
// intended purpose of the operation at hand, and thus improves the readability
// of the source code.
//
// Since:
// MinimOS 2.1
//------------------------------------------------------------------------------
#define _isa_register_wr(__reg, __val) isa_io_wr((__reg), (__val))
//+-----------------------------------------------------------------------------
// Name:
// _isa_register_setbit
//
// Declaration:
// void _isa_register_setbit(t_isa_register reg, t_bit_ix bitix);
//
// Purpose:
// Set a specific bit in an isaio register a logic one level.
//
// Arguments:
// reg - the t_isa_register to be written.
// bitix - a t_bit_ix representing the index of the bit to set.
//
// Return:
// None.
//
// Notes:
// 10x only. The 20x family does not have an isa bus.
// This is a read/modify/write operation.
// It should not be used on "registers" that are read only, write only,
// or access different hardware entities on read and write. E.g, writing
// sets control, reading provides status.
// Its intention is to act as part of a complete suite of macros that
// operate on isaio space locations as "registers". A register in this sense
// is nothing more than an address in isaio space. The terminology is encouraged,
// however, because it conveys additional meaning about the intended purpose of
// the operation at hand, and thus improves the readability of the source code.
//
// Since:
// MinimOS 2.1
//------------------------------------------------------------------------------
#define _isa_register_setbit(__ref, __bitix) _isa_register_wr((__ref), _isa_register_rd((__ref)) |(1 << __bitix))
//+-----------------------------------------------------------------------------
// Name:
// _isa_register_clrbit
//
// Declaration:
// void _isa_register_clrbit(t_isa_register reg, t_bit_ix bitix);
//
// Purpose:
// Clear a specific bit in an isaio register a logic zero level.
//
// Arguments:
// reg - the t_isa_register to be written.
// bitix - a t_bit_ix representing the index of the bit to clear.
//
// Return:
// None.
//
// Notes:
// 10x only. The 20x family does not have an isa bus.
// This is a read/modify/write operation.
// It should not be used on "registers" that are read only, write only,
// or access different hardware entities on read and write. E.g, writing
// sets control, reading provides status.
// Its intention is to act as part of a complete suite of macros that
// operate on isaio space locations as "registers". A register in this sense
// is nothing more than an address in isaio space. The terminology is encouraged,
// however, because it conveys additional meaning about the intended purpose of
// the operation at hand, and thus improves the readability of the source code.
//
// Since:
// MinimOS 2.1
//------------------------------------------------------------------------------
#define _isa_register_clrbit(__ref, __bitix) _isa_register_wr((__ref), _isa_register_rd((__ref)) & ~(1 << __bitix))
//+-----------------------------------------------------------------------------
// Name:
// _isa_register_set_bits
//
// Declaration:
// void _isa_register_set_bits(t_isa_register reg, t_bit_mask bitmsk);
//
// Purpose:
// Set a group of bits in an ISA "register" to a logic one level.
//
// Arguments:
// reg - the t_isa_register to be written.
// bitmsk - a t_bit_mask containing 1's in the bit positions of the bits to be set.
//
// Return:
// None.
//
// Notes:
// 10x only. The 20x family does not have an isa bus.
// This is a read/modify/write operation.
// It should not be used on "registers" that are read only, write only,
// or access different hardware entities on read and write. E.g, writing
// sets control, reading provides status.
// Its intention is to act as part of a complete suite of macros that
// operate on isaio space locations as "registers". A register in this sense
// is nothing more than an address in isaio space. The terminology is encouraged,
// however, because it conveys additional meaning about the intended purpose of
// the operation at hand, and thus improves the readability of the source code.
//
// Since:
// MinimOS 2.1
//------------------------------------------------------------------------------
#define _isa_register_set_bits(__ref, __bitmsk) _isa_register_wr((__ref), _isa_register_rd((__ref)) |(__bitmsk))
//+-----------------------------------------------------------------------------
// Name:
// _isa_register_clr_bits
//
// Declaration:
// void _isa_register_clr_bits(t_isa_register reg, t_bit_mask bitmsk);
//
// Purpose:
// Clear a group of bits in an ISA "register" to a logic zero level.
//
// Arguments:
// reg - the t_isa_register to be written.
// bitmsk - a t_bit_mask containing 1's in the bit positions of the bits to be cleared.
//
// Return:
// None.
//
// Notes:
// 10x only. The 20x family does not have an isa bus.
// This is a read/modify/write operation.
// It should not be used on "registers" that are read only, write only,
// or access different hardware entities on read and write. E.g, writing
// sets control, reading provides status.
// Its intention is to act as part of a complete suite of macros that
// operate on isaio space locations as "registers". A register in this sense
// is nothing more than an address in isaio space. The terminology is encouraged,
// however, because it conveys additional meaning about the intended purpose of
// the operation at hand, and thus improves the readability of the source code.
//
// Since:
// MinimOS 2.1
//------------------------------------------------------------------------------
#define _isa_register_clr_bits(__ref, __bitmsk) _isa_register_wr((__ref), _isa_register_rd((__ref)) & ~(__bitmsk))
//------------------------------------------------------------------------------
// IMPORTANT NOTE:
// The macro versions of the functions are faster, but trickier to use properly.
// they exist only to improve the performance of the kernel. If you personally
// choose to use the macro versions (to squeeze out evert ounce of performance)
// then you should make sure you understand any differences between the macros
// and the functions, and how that can affect your implementation.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Name:
// _isa_acquire
//
// Declaration:
// void _isa_acquire(void);
//
// Purpose:
// Faster version for the kernel to use.
// 10x:
// Obtains the ISA bus from the DMAC for use by the MCU.
// The macro cannot complete until the DMAC actually relinquishes the bus.
// The amount of time required depends on the type and length of DMA transfer
// in progress.
// 20x:
// Not supported. Use the function version instead.
//
// Arguments:
// None.
//
// Return:
// None.
//
// Notes:
// For the 10x family.
//
// Notes:
// This is the macro version of isa_acquire().
// It is faster than the function. Use where performance is critical.
//
// It can block if the dmac breaks badly... hanging the firmware...
//
// Since:
// MinimOS-1.0
//------------------------------------------------------------------------------
#define _isa_acquire() { _mcu_register_clr_bits(x_bus_req, kbm_bus_req_hlda); \
while (_mcu_register_rd(x_bus_req) & kbm_bus_req_aen); }
//------------------------------------------------------------------------------
// Name:
// _isa_release
//
// Declaration:
// void _isa_release(void);
//
// Purpose:
// Faster version for the kernel to use.
// 10x:
// Relinquishes MCU control of the ISA bus to the DMAC.
// 20x:
// Not supported. Use the function version instead.
//
// Arguments:
// None.
//
// Return:
// None.
//
// Notes:
// For the 10x family.
//
// This is the macro version of isa_release().
// It is faster than the function. Use where performance is critical.
//
// Since:
// MinimOS-1.0
//------------------------------------------------------------------------------
#define _isa_release() { _mcu_register_set_bits(x_bus_req, kbm_bus_req_hlda); }
//------------------------------------------------------------------------------
// prototypes
#ifndef k_20x_family
void isa_acquire(void) reentrant;
void isa_release(void) reentrant;
#ifdef OBSOLETE
t_datum isa_io_rd(t_isa_register ireg) reentrant;
void isa_io_wr(t_isa_register ireg, t_datum datum) reentrant;
#else
t_datum isa_io_rd(t_isa_address ireg) reentrant;
void isa_io_wr(t_isa_address ireg, t_datum datum) reentrant;
#endif
t_datum isa_mem_rd(t_isa_address addr) reentrant;
void isa_mem_wr(t_isa_address addr, t_datum datum) reentrant;
#endif
//---eof------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -