home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / 3_1DOCS.DMS / in.adf / autodocs.lha / doc / cardres.doc < prev    next >
Encoding:
Text File  |  1993-10-15  |  40.1 KB  |  1,239 lines

  1. TABLE OF CONTENTS
  2.  
  3. card.resource/BeginCardAccess
  4. card.resource/CardAccessSpeed
  5. card.resource/CardChangeCount
  6. card.resource/CardForceChange
  7. card.resource/CardInterface
  8. card.resource/CardMiscControl
  9. card.resource/CardProgramVoltage
  10. card.resource/CardResetCard
  11. card.resource/CardResetRemove
  12. card.resource/CopyTuple
  13. card.resource/DeviceTuple
  14. card.resource/EndCardAccess
  15. card.resource/GetCardMap
  16. card.resource/IfAmigaXIP
  17. card.resource/OwnCard
  18. card.resource/ReadCardStatus
  19. card.resource/ReleaseCard
  20. card.resource/BeginCardAccess                   card.resource/BeginCardAccess
  21.  
  22.    NAME
  23.     BeginCardAccess -- Called before you begin credit-card memory access
  24.    
  25.    SYNOPSIS
  26.     result=BeginCardAccess( handle )
  27.     d0            a1
  28.  
  29.     BOOL BeginCardAccess( struct CardHandle * );
  30.  
  31.    FUNCTION
  32.     This function should be called before you begin access
  33.     to credit-card memory.
  34.  
  35.     Its effect will depend on the type of Amiga machine your
  36.     code happens to be running on.  On some machines it
  37.     will cause an access light to be turned ON.
  38.  
  39.    INPUTS
  40.     handle - Same handle as that used when OwnCard() was called.
  41.  
  42.    RETURNS
  43.     TRUE if you are still the owner of the credit-card, and
  44.     memory access is permitted.  FALSE if you are no longer
  45.     the owner of the credit-card (usually indicating that
  46.     the card was removed).
  47.  
  48.    NOTES
  49.     This function may be called from within a task, or from a level 1
  50.     or level 2 interrupt.
  51.  
  52.     It is highly recommended that you call this function
  53.     before accessing credit-card memory, as well as checking
  54.     the return value.  If it is a return value of FALSE, you
  55.     should stop accessing credit-card memory.
  56.  
  57.    SEE ALSO
  58.     OwnCard(), EndCardAccess()
  59.  
  60. card.resource/CardAccessSpeed                   card.resource/CardAccessSpeed
  61.  
  62.    NAME
  63.     CardAccessSpeed -- Select best possible memory access speed.
  64.    
  65.    SYNOPSIS
  66.     result=CardAccessSpeed( handle, nanoseconds );
  67.     d0             a1      d0
  68.  
  69.     ULONG CardAccessSpeed( struct CardHandle *, ULONG );
  70.  
  71.    FUNCTION
  72.     This function is used to set memory access speed for all CPU
  73.     accesses to card memory.
  74.  
  75.     Typically this information would be determined by first examining
  76.     the Card Information Structure.
  77.  
  78.     Then you would use this function to let the card.resource
  79.     select the best possible access speed for you, however note
  80.     that the range of possible access speeds may vary on some
  81.     machines (depending on the type of credit-card interface
  82.     hardware being provided).
  83.  
  84.    INPUTS
  85.     handle - Same handle as that used when OwnCard() was called.
  86.  
  87.     nanoseconds - Preferred access speed in nanoseconds.
  88.  
  89.    RETURNS
  90.     Speed - Access speed selected by resource (in nanoseconds). 
  91.  
  92.     0  - Not successful.  Either because the credit-card was
  93.     removed, or the access speed you requested is slower than
  94.     that supported by the credit-card interface hardware.
  95.  
  96.    NOTES
  97.     This function may be called from within a task, or from a level 1
  98.     or level 2 interrupt.
  99.  
  100.    SEE ALSO
  101.     OwnCard()
  102.  
  103. card.resource/CardChangeCount                   card.resource/CardChangeCount
  104.  
  105.    NAME
  106.     CardChangeCount -- Obtain card change count.
  107.    
  108.    SYNOPSIS
  109.     count = CardChangeCount( VOID )
  110.     d0
  111.  
  112.     ULONG CardChangeChange( VOID );
  113.  
  114.    FUNCTION
  115.     This function returns the card change count.  The
  116.     counter is incremented by one for every removal, and
  117.     for every successful insertion (a card which is inserted
  118.     long enough to be debounced before it is removed again).
  119.  
  120.    RESULT
  121.     The change count number.
  122.  
  123.    NOTES
  124.     This function may be called from a task, or any level interrupt.
  125.  
  126.    SEE ALSO
  127.  
  128. card.resource/CardForceChange                   card.resource/CardForceChange
  129.  
  130.    NAME
  131.     CardForceChange -- Force a card change.
  132.    
  133.    SYNOPSIS
  134.     success = CardForceChange( VOID )
  135.     d0
  136.  
  137.     BOOL CardForceChange( VOID );
  138.  
  139.    FUNCTION
  140.     This function is not intended for general use.  Its
  141.     purpose is to force a credit-card change as if
  142.     the user had removed, or inserted a card.
  143.     
  144.     This function is intended to be used by a utility program
  145.     which needs to force the current card owner to release
  146.     ownership of the card, thereby allowing the utility an
  147.     opportunity to own the credit-card.
  148.  
  149.    RESULT
  150.     TRUE if the function succeeded, FALSE if card change is
  151.     not allowed.  This function will generally succeed, unless
  152.     someone is using the card in reset remove mode at the time
  153.     this function is called.
  154.  
  155.    NOTES
  156.     This function should only be called from a task.
  157.  
  158.    SEE ALSO
  159.  
  160. card.resource/CardInterface                       card.resource/CardInterface
  161.  
  162.    NAME
  163.     CardInterface -- Determine the type of card interface.
  164.    
  165.    SYNOPSIS
  166.     return = CardInterface()
  167.     d0
  168.  
  169.     ULONG CardInterface( void );
  170.  
  171.    FUNCTION
  172.     This function is used to determine the type of credit-card
  173.     (hardware) interface available.  For the most part the
  174.     card.resource hides the hardware details from devices within its
  175.     function calls.  However should we need to provide a work-around
  176.     because of differences, or limitations imposed by future interface
  177.     hardware, this function must be used to identify which interface
  178.     is available.
  179.  
  180.    RETURN
  181.     A ULONG value as defined in card.h/i.
  182.  
  183.    NOTES
  184.     In general only I/O devices (e.g., a device which interfaces
  185.     with a modem card) would need to provide work-arounds,
  186.     or alternative code.  An example would be a change in the way
  187.     interrupt requests from the card are handled.  Specific details
  188.     will be provided as need in the future.  I/O devices) should abort
  189.     properly if this function returns a value which is unknown.
  190.  
  191.     Current implementations (see card.h/i) -
  192.  
  193.     CARD_INTERFACE_AMIGA_0
  194.     -------------------------------------------------------------
  195.  
  196.     The card slot can be configured for use as an I/O interface
  197.     by using the CardMiscControl() function.
  198.  
  199.     The card slot inhibits writes to cards which do not negate
  200.     the WP status bit.  This can be overridden by using the
  201.     CardMiscControl() function.
  202.  
  203.     Changes in the interrupt request line are latched by a gate-array,
  204.     and have to be obtained via the status change mechanism provided
  205.     when you call the OwnCard() function.  The interrupt is cleared
  206.     when you return from the status change interrupt.  A level 2
  207.     interrupt is generated.  Usually you will want to clear the
  208.     interrupt on the card at this time, and Signal() a task.  The IRQ
  209.     line is the same as the RDY/BSY line.
  210.  
  211.     Changes in BVD1, WP, and RDY/BSY are also latched by the gate-array,
  212.     and are obtainable via the status change mechanism provided by
  213.     the OwnCard() function.  A level 2 interrupt is generated.
  214.  
  215.     Changes in BVD2 (also used for digital audio) have to be
  216.     monitored via polling.  Generally this will cause no problem.
  217.     Monitoring changes in BVD1 & BVD2 to monitor for low battery
  218.     condition can be handled by a low priority tool which periodically
  219.     checks the condition of both lines using the ReadCardStatus()
  220.     function.
  221.  
  222.     As of card.resource V39 (check VERSION in resource base), the
  223.     CardMiscControl() function can be used to enable/disable
  224.     status change interrupts for changes in BVD1, BVD2, and the
  225.     RDY/BSY status line.  Status change interrupts for WR
  226.     (Write-protect enable/disable) are always enabled.  The default
  227.     state of enabled/disabled status change interrupts noted above
  228.     are unchanged, and automatically reset to the defaults when
  229.     a card is removed, or when even a task releases ownership
  230.     of the card.
  231.  
  232.     Some PC oriented eight (8) bit cards may require you read
  233.     odd-byte I/O address registers at the corresponding even-byte
  234.     address plus 64K.  There is sufficient I/O address space
  235.     provided that exceeding I/O address space should not be a problem.
  236.  
  237.     Your code should wait at least 1 millisecond for Vpp to stabilize
  238.     after voltage change (see CardProgramVoltage()).
  239.  
  240.     SEE ALSO
  241.     CardMiscControl(), resources/card.i, resources/card.h
  242.  
  243. card.resource/CardMiscControl                   card.resource/CardMiscControl
  244.  
  245.    NAME
  246.     CardMiscControl -- Set/Clear miscellaneous control bits
  247.    
  248.    SYNOPSIS
  249.     control_bits=CardMiscControl( handle, control_bits );
  250.     d0                 a1          d1
  251.  
  252.     UBYTE CardMiscControl( struct CardHandle *, UBYTE );
  253.  
  254.    FUNCTION
  255.     Used to set/clear miscellaneous control bits (generally for
  256.     use with I/O cards).
  257.  
  258.    INPUTS
  259.     handle - Same handle as that used when OwnCard() was called.
  260.  
  261.     control_bits - A mask value of control bits to be turned on/off.
  262.  
  263.     The bit values which might be usable are defined in card.h/i.
  264.  
  265.     For example, to enable digital audio, and disable hardware
  266.     write-protect (if supported), you would call this function with these
  267.     values --
  268.  
  269.     CARDF_DISABLE_WP|CARDF_ENABLE_DIGAUDIO
  270.     
  271.     Then to turn off digital audio, but leave write-protect
  272.     disable, you would use a value of --
  273.  
  274.     CARDF_DISABLE_WP
  275.  
  276.     Finally too reenable write protect, call this function with
  277.     a mask value of 0.
  278.  
  279.    RETURNS
  280.     control_bits - The same mask value you called this function
  281.     with if successful.  If one, or more bits has been cleared
  282.     in the return mask, this would indicate that the control bit
  283.     is not being supported, or that the card has been removed
  284.     by the user.
  285.  
  286.     For example, if you called this function with a mask value
  287.     of --
  288.  
  289.     CARDF_DISABLE_WP|CARDF_ENABLE_DIGAUDIO
  290.  
  291.     And this function returned a value of --
  292.  
  293.     CARDF_DISABLE_WP
  294.  
  295.     This would indicate that it is not possible to enable digital
  296.     audio (most likely because this feature has not been implemented).
  297.     
  298.    NOTES
  299.     This function may be called from within a task, or from a level 1
  300.     or level 2 interrupt.
  301.  
  302.     !!!IMPORTANT!!!
  303.  
  304.     You should ALWAYS try to enable digital audio for I/O cards
  305.     as this will also configure the card socket for the I/O
  306.     interface (if supported).
  307.  
  308.     Not all cards will connect the write-enable line (e.g.,
  309.     some I/O cards).  On some machines (e.g., the A600) it will
  310.     not be possible to write to such cards unless you disable
  311.     write-protection by using this function.
  312.  
  313.     !!!NEW!!!
  314.  
  315.     For card.resource V39 (check resource base for VERSION before
  316.     using), new bits have been defined which let you enable/disable
  317.     particular status change interrupts.  See CardInterface() for
  318.     defaults.  These new bits are backwards compatable with V37
  319.     for which only the CARDB_DISABLE_WP, and CARDB_ENABLE_DIGAUDIO
  320.     bits were defined.  These new bits allow you to enable, or
  321.     disable specific status change interrupts including BVD1/SC,
  322.     BVD2/DA, and BSY/IRQ.  The defaults for these status change
  323.     interrupts are unchanged from V37, and WR (Write-protect) status
  324.     change interrupts are always enabled as they use to be.
  325.  
  326.     An example of use:
  327.  
  328.     CARD_INTF_SETCLR!CARD_INTF_BVD1
  329.  
  330.     Would enable BVD1/SC status change interrupts, and not change
  331.     the enable/disable state for BVD2/DA or BSY/IRQ status change
  332.     interrupts.  If the change was made successfully, the
  333.     CARD_INTB_BVD1 bit would be set in register D0 when this function
  334.     returns.
  335.  
  336.    SEE ALSO
  337.     CardInterface(), resources/card.h, resources/card.i
  338.  
  339. card.resource/CardProgramVoltage             card.resource/CardProgramVoltage
  340.  
  341.    NAME
  342.     CardProgramVoltage -- Set programming voltage.
  343.    
  344.    SYNOPSIS
  345.     success=CardProgramVoltage( handle, voltage );
  346.                     a1      d0
  347.  
  348.     LONG CardProgramVoltage( struct CardHandle *, ULONG );
  349.  
  350.    FUNCTION
  351.     Used to set programming voltages (e.g., for FLASH-ROM/EPROM
  352.     cards).
  353.  
  354.    INPUTS
  355.     handle - Same handle as that used when OwnCard() was called.
  356.  
  357.     voltage - See card.i/h for valid values.
  358.  
  359.    RETURNS
  360.     1  - Successful.
  361.  
  362.     0  - Not successful.  Most likely because the credit-card
  363.     card has been removed, and you are no longer the owner.
  364.  
  365.     -1 - This function is not being supported.  On some machines
  366.     with a minimal (hardware) credit-card interface, this feature
  367.     may not be possible.
  368.  
  369.    NOTES
  370.     This function may be called from within a task, or from a level 1
  371.     or level 2 interrupt.
  372.  
  373.        !!!WARNING!!!
  374.  
  375.     Flash-ROM programming requires careful coding to prevent
  376.     leaving the Erase command on too long.  Failure to observe
  377.     the maximum time between the Erase command, and the Erase-Verify
  378.     command can make a Flash-ROM card unusable.  Some Flash-ROM cards
  379.     may provide an internal watch-dog timer which protects the card.
  380.  
  381.     Because of the relatively long time (e.g., 10ms) between Erase, and
  382.     Erase-Verify which must be observed, the need for such critical
  383.     timing can be problematic on a multi-tasking machine.
  384.  
  385.     Vendors of Flash-ROM's recommend a high priority interrupt
  386.     generated by a 10ms timer be used to turn off Erase.  On the
  387.     Amiga this can be accomplished by using a CIA-B interval timer.
  388.     The timer.device also provides a mechanism for generating a low
  389.     priority interrupt.  The timer.device is easier to use than CIA
  390.     interval timers, though not as accurate or as safe.
  391.  
  392.     Even if the Flash-ROM card provides an internal watch-dog timer,
  393.     implementation of the code during Erase should assume that
  394.     the Flash-ROM does not.
  395.  
  396.    SEE ALSO
  397.     OwnCard(), resources/card.h, resources/card.i
  398.  
  399. card.resource/CardResetCard                       card.resource/CardResetCard
  400.  
  401.    NAME
  402.     CardResetCard -- Reset credit-card.
  403.    
  404.    SYNOPSIS
  405.     success=CardResetCard( handle );
  406.                 a1
  407.  
  408.     BOOL CardResetCard( struct CardHandle * );
  409.  
  410.    FUNCTION
  411.     Used to reset a credit-card.  Some cards, such as some
  412.     configurable cards can be reset.
  413.  
  414.     Asserts credit-card reset for at least 10us.
  415.  
  416.    INPUTS
  417.     handle - Same handle as that used when OwnCard() was called.
  418.  
  419.    RETURNS
  420.     TRUE  - Successful.
  421.  
  422.     FALSE  - Not successful.  Most likely because the credit-card
  423.     card has been removed, and you are no longer the owner.
  424.  
  425.    NOTES
  426.     This function may be called from within a task, or from a level 1
  427.     or level 2 interrupt.
  428.  
  429.     ***IMPORTANT***
  430.  
  431.     It is the responsibility of the card owner to reset
  432.     configurable cards, or any other type of card such as
  433.     some I/O cards before calling ReleaseCard() if the owner
  434.     has made use of that card such that it is no longer in its
  435.     reset state (unless you are releasing the card because it
  436.     has been removed).
  437.  
  438.     If the card manufacturer indicates that a certain amount
  439.     of time must elapse between end of reset, and completion
  440.     of card initialization, you should wait at least that long
  441.     before releasing the card (unless you are releasing the card
  442.     because it has been removed).
  443.  
  444.    SEE ALSO
  445.     OwnCard(), ReleaseCard()
  446.  
  447. card.resource/CardResetRemove                   card.resource/CardResetRemove
  448.  
  449.    NAME
  450.     CardResetRemove -- Set/Clear reset on card removal.
  451.    
  452.    SYNOPSIS
  453.     success=CardResetRemove( handle, flag );
  454.                  a1      d0
  455.  
  456.     BOOL CardResetRemove( struct CardHandle *, ULONG );
  457.  
  458.    FUNCTION
  459.     Used to set/clear HARDWARE RESET on card change detect.
  460.  
  461.     This function should generally not be used by devices
  462.     which support HOT-REMOVAL.  HARDWARE RESET on removal
  463.     is generally intended for execute-in-place software, or
  464.     ram cards whose memory has been added as system ram.
  465.  
  466.    INPUTS
  467.     handle - Same handle as that used when OwnCard() was called.
  468.  
  469.     flag - TRUE if you want to SET HARDWARE RESET on credit
  470.            card removal.  FALSE if you want to CLEAR HARDWARE
  471.            RESET.
  472.  
  473.    RETURNS
  474.     1  - Success.
  475.  
  476.     0  - Function failed (most likely because the card was removed
  477.          by the user, and you are no longer the owner of the card).
  478.  
  479.     -1 - This function is not being made available.
  480.  
  481.    NOTES
  482.     This function should only be called from a task.
  483.  
  484.    SEE ALSO
  485.     OwnCard()
  486.  
  487. card.resource/CopyTuple                               card.resource/CopyTuple
  488.  
  489.    NAME
  490.     CopyTuple -- Find/copy a credit card tuple.
  491.    
  492.    SYNOPSIS
  493.     success = CopyTuple( CardHandle, buffer, tuplecode, size );
  494.     d0            a1     a0     d1        d0
  495.  
  496.     BOOL CopyTuple( struct CardHandle *, UBYTE *, ULONG, ULONG );
  497.  
  498.    FUNCTION
  499.     This function scans credit-card memory for a tuple, and
  500.     if found, copies it into a supplied buffer.  The entire
  501.     tuple (including the tuple code, and link) are copied to
  502.     the supplied buffer.  The number of bytes copied to the
  503.     buffer will be 2 bytes, plus the argument "size", or the
  504.     value in the tuple LINK field (whichever is SMALLER).
  505.  
  506.     The software calling this function is responsible for
  507.     examining the copy of the tuple (e.g., recognition of
  508.     fields, recognition of stop bytes, etc. within the tuple).
  509.     
  510.     This function does the best job it can to find a tuple
  511.     in attribute, or common memory.  It follows tuple chains,
  512.     and skips odd bytes in attribute memory.
  513.  
  514.     This function monitors for credit-card removal while reading data.
  515.     If the credit-card is removed while a byte is being read, it will
  516.     stop searching, and return FALSE.
  517.  
  518.     This function does not protect against another task writing
  519.     to credit-card memory while data is being read.  The device
  520.     is responsible for single-threading reads/writes to the
  521.     credit card as needed.
  522.  
  523.     This function can be used to find multiple tuple codes; this
  524.     is a very rare case, so the mechanism provided for doing so is
  525.     unusual.  See INPUTS below for more information.
  526.  
  527.     This function does not read bytes within the body of any tuples
  528.     except for the tuple you want copied, and the basic compatibility
  529.     tuples this function understands (see list below).
  530.  
  531.     On some machines this function may slow down memory access
  532.     speed while reading the tuple chain.  This is done to prevent
  533.     potential problems on slow cards.  By examining the CISTPL_DEVICE,
  534.     and CISTPL_DEVICE_A tuples, you can determine the best possible
  535.     memory access speed for the type of card inserted.  Because memory
  536.     access speed may be slowed down, calls to this function should
  537.     be single-threaded.
  538.  
  539.     The Card Information Structure must start with a CISTPL_DEVICE
  540.     tuple stored as the first tuple in attribute memory.  If not,
  541.     this function will search for a CISTPL_LINKTARGET tuple
  542.     stored at byte 0 of common memory.  Therefore it is possible
  543.     to store a CIS on cards which do not have any writeable
  544.     attribute memory, though this may cause problems for other
  545.     software implemented on other machines.  For example, some
  546.     SRAM cards do not come with writeable attribute memory, and/or
  547.     some may have OPTIONAL EEPROM memory which may not have been
  548.     initialized by the card manufacturer.  While it could be
  549.     argued that such cards do not conform to the PCMCIA PC Card
  550.     Standard, such cards are cheaper, and therefore likely to be
  551.     used.
  552.  
  553.    INPUTS
  554.     CardHandle - Same handle as that used when OwnCard() was
  555.     called.
  556.  
  557.     buffer - Pointer to a buffer where the tuple will be copied.
  558.  
  559.     The buffer should be at least as large as "size" + 8 (see
  560.     use of "size" argument below).  Therefore the minimum buffer
  561.     size is 8 bytes.  See NOTES below.
  562.  
  563.     tuplecode - The tuple code you want to search for.  This is
  564.     a ULONG value.  The upper 16 bits should be 0, or a number between
  565.     1-32K where a value of 0 means you want to find the first tuple
  566.     match, a value of 1 the second, etc.  For example -
  567.  
  568.     0x41 means find the FIRST tuple equal to $41.
  569.  
  570.     ((1<<16)|(0x41)) means find the SECOND tuple equal to $41.
  571.  
  572.     ((2<<16)|(0x41)) means find the THIRD tuple equal to $41.
  573.  
  574.     size - The maximum number of bytes you want copied (not
  575.            including the tuple code, and link).  The actual number
  576.            of bytes copied may be less than "size" if the tuple
  577.            link field is less than "size".
  578.  
  579.            A size of 0 will result in only the tuple code, and
  580.            link being copied to your buffer if the tuple is found.
  581.  
  582.            If you do not care how many bytes are copied, any unsigned
  583.            value of 255 or greater will do.  In this case a maximum
  584.            of 257 bytes might be copied to your buffer (if the
  585.            tuple link field is the maximum of 255).
  586.  
  587.            Other sizes are useful if you know the size of the tuple
  588.            you want copied, or you know there are active registers
  589.            stored within the tuple, and only want to copy a portion
  590.            of a tuple.
  591.  
  592.    RETURNS
  593.  
  594.     TRUE if the tuple was found, and copied, else FALSE.
  595.     This function may also return false if the CIS is believed
  596.     to be corrupt, or if the card is removed while reading the
  597.     tuples.
  598.  
  599.    NOTES
  600.  
  601.     This function can be called multiple times (adjusting the "size"
  602.     argument) to read a tuple of variable length, or unknown size.
  603.  
  604.     Your supplied buffered is used by this function for working
  605.     storage - the contents of it will be modified even if this
  606.     function fails to find the tuple you want a copy of.
  607.  
  608.     This function should NOT be used to find/copy tuples of type :
  609.  
  610.     - CISTPL_LONGLINK_A
  611.     - CISTPL_LONGLINK_C
  612.     - CISTPL_NO_LINK
  613.     - CISTPL_LINKTARGET
  614.     - CISTPL_NULL
  615.     - CISTPL_END
  616.     
  617.     These tuples are automatically handled for you by this function.
  618.  
  619.    SEE ALSO
  620.     OwnCard()
  621.  
  622. card.resource/DeviceTuple                           card.resource/DeviceTuple
  623.  
  624.    NAME
  625.     DeviceTuple -- Decode a device tuple
  626.    
  627.    SYNOPSIS
  628.     return=DeviceTuple( tuple_data, storage)
  629.                    a0        a1    
  630.  
  631.     ULONG DeviceTuple( UBYTE *, struct DeviceTData *);
  632.  
  633.    FUNCTION
  634.     Extracts SIZE, TYPE, and SPEED from a device tuple (generally
  635.     obtained with CopyTuple()).
  636.  
  637.    INPUTS
  638.     tuple_data - Pointer to a CISTPL_DEVICE tuple (generally obtained
  639.     with CopyTuple()).
  640.  
  641.     storage - Pointer to a DeviceTData structure in which results
  642.     are to be stored.
  643.  
  644.     struct    DeviceTData {
  645.         ULONG    dtd_DTsize;        /* Size of card (bytes)    */
  646.         ULONG    dtd_DTspeed;        /* Speed in nanoseconds    */
  647.         UBYTE    dtd_DTtype;        /* Type of card        */
  648.         UBYTE    dtd_DTflags;        /* Other flags        */
  649.     };
  650.  
  651.  
  652.    RETURN
  653.     SIZE (same as dtd_DTsize) if the Device Tuple could be decoded.
  654.     FALSE (0) if the tuple is believed to be invalid.  The tuple is
  655.     considered to be invalid if:
  656.  
  657.         The tuple link value is 0.
  658.  
  659.         The device type/speed byte is $00, or $FF.
  660.  
  661.         The device type is DTYPE_EXTEND, which is undefined
  662.         as of this writing.
  663.  
  664.         The extended speed byte is a value which is
  665.         undefined as of this writing.
  666.  
  667.         The extended speed byte is extended again which is
  668.         undefined as of this writing.
  669.  
  670.         The device Size byte is $FF.
  671.  
  672.    NOTES
  673.     Some cards may not have a size specified in the device
  674.     tuple.  An example would be an I/O card.  The size would be
  675.     returned as one (1) in this case.
  676.  
  677.     You should not call this function with a partial CISTPL_DEVICE
  678.     tuple, or the return values may be junk.
  679.  
  680.    SEE ALSO
  681.     CopyTuple(), resources/card.h, resources/card.i
  682.  
  683. card.resource/EndCardAccess                       card.resource/EndCardAccess
  684.  
  685.    NAME
  686.     EndCardAccess -- Called at the end of credit-card memory access
  687.    
  688.    SYNOPSIS
  689.     result=EndCardAccess( handle )
  690.     d0            a1
  691.  
  692.     ULONG EndCardAccess( struct CardHandle * );
  693.  
  694.    FUNCTION
  695.     This function should be called when you are done accessing
  696.     credit-card memory.
  697.  
  698.     Its effect will depend on the type of Amiga machine your
  699.     code happens to be running on.  On some machines it
  700.     will cause an access light to be turned OFF in approximately
  701.     1/2 second.
  702.  
  703.     On machines which support an access light, the light will
  704.     automatically be turned off when you call ReleaseCard().
  705.  
  706.    INPUTS
  707.     handle - Same handle as that used when OwnCard() was called.
  708.  
  709.    RETURNS
  710.     TRUE if you are still the owner of the credit-card.  FALSE
  711.     if you are no longer the owner of the credit-card (usually
  712.     indicating the card was removed).
  713.  
  714.    NOTES
  715.     This function may be called from within a task, or from a level 1
  716.     or level 2 interrupt.
  717.  
  718.     It is highly recommended that you call this function
  719.     after accessing credit-card memory, as well as checking
  720.     the return value.  If it is a return value of FALSE, you
  721.     should stop accessing credit-card memory, and conclude
  722.     that the card was removed before this function was called.
  723.  
  724.     On some machines it is possible that the credit-card will be
  725.     removed before you receive the removed interrupt.
  726.  
  727.    SEE ALSO
  728.     OwnCard(), ReleaseCard(), BeginCardAccess()
  729.  
  730. card.resource/GetCardMap                             card.resource/GetCardMap
  731.  
  732.    NAME
  733.     GetCardMap -- Obtain pointer to CardMemoryMap structure
  734.    
  735.    SYNOPSIS
  736.     pointer=GetCardMap()
  737.     d0
  738.  
  739.     struct CardMemoryMap *GetCardMap( void );
  740.  
  741.    FUNCTION
  742.     Obtain pointer to a CardMemoryMap structure.  The structure
  743.     is READ only.
  744.  
  745.     Devices should never assume credit-card memory appears
  746.     at any particular place in memory.  By using this function
  747.     to obtain pointers to the base memory locations of the various
  748.     credit-card memory types, your device will continue to work
  749.     properly should credit cards appear in different memory
  750.     locations in future hardware.
  751.  
  752.    RETURNS
  753.     Pointer to CardMemoryMap structure -
  754.  
  755.         struct CardMemoryMap {
  756.         UBYTE    *cmm_CommonMemory;
  757.         UBYTE    *cmm_AttributeMemory;
  758.         UBYTE    *cmm_IOMemory;
  759.         };
  760.  
  761.     As of card.resource V39, this structure has been extended to
  762.     include the size of these memory regions.  See card.h/card.i
  763.     for the new fields.  If card.resource V39, use the constants
  764.     in the CardMemoryMap structure rather than hard coded constants
  765.     for memory region size.
  766.  
  767.    NOTES
  768.     If any pointer in the structure is NULL, it means this type
  769.     of credit-card memory is not being made available.
  770.  
  771.    SEE ALSO
  772.     resources/card.h, resources/card.i
  773.  
  774. card.resource/IfAmigaXIP                             card.resource/IfAmigaXIP
  775.  
  776.    NAME
  777.     IfAmigaXIP -- Check if a card is an Amiga execute-in-place card.
  778.    
  779.    SYNOPSIS
  780.     result=IfAmigaXIP( handle )
  781.     d0               a2
  782.  
  783.     struct Resident *IfAmigaXIP( struct CardHandle * );
  784.  
  785.    FUNCTION
  786.     Check to see if a card in the slot is an Amiga execute-in-place
  787.     card.  The Card Information Structure must have a valid
  788.     CISTPL_AMIGAXIP tuple.
  789.     
  790.     Tuples can be treated like structures.  The format of a
  791.     CISTPL_AMIGAXIP tuple is -
  792.     
  793.  
  794.      struct TP_AmigaXIP {
  795.         UBYTE    TPL_CODE;
  796.         UBYTE    TPL_LINK;
  797.         UBYTE    TP_XIPLOC[4];
  798.         UBYTE    TP_XIPFLAGS;
  799.         UBYTE    TP_XIPRESRV;
  800.     };
  801.  
  802.  
  803.     The TPL_CODE field must be equal to CISTPL_AMIGAXIP (0x91).
  804.  
  805.     The TPL_LINK field must be equal to the length of the body
  806.     of a CISTPL_AMIGAXIP tuple (0x06).
  807.  
  808.     The TP_XIPLOC array is the memory location of your ROM-TAG
  809.     stored in little-endian order.  This value is stored as an
  810.     "offset" into common memory as is the standard for storing 32 bit
  811.     bit pointers in tuples.
  812.  
  813.     For example, a pointer to a ROM-TAG stored at an offset of
  814.     0x00000200 would be stored as four bytes like so:
  815.  
  816.         0x00, 0x02, 0x00, 0x00
  817.  
  818.     Currently credit-card common memory is mapped starting at
  819.     memory location 0x600000.  Because a ROM-TAG is used,
  820.     it is implied that execute-in-place code can be compiled/linked
  821.     to use absolute references.  It is believed that most developers
  822.     will not want to have to write pc-relative code only.
  823.  
  824.     The TP_XIPFLAGS field is treated as a set of flag bits.
  825.     See card.i/h for defined bits.  All undefined bits MUST be
  826.     0.
  827.  
  828.     The TP_XIPRESRV field must be 0 for now.
  829.     
  830.  
  831.     The system polls for cards which have a CISTPL_AMIGAXIP tuple
  832.     at the same time that it searches for devices to boot off.
  833.     When a card with a valid CISTPL_AMIGAXIP tuple is found, the
  834.     system will call your ROM-TAG via Exec's InitResident() function.
  835.  
  836.     The system examines the return code from InitResident().  A
  837.     NULL return in D0 means you are done with the card, and it can
  838.     be removed by the user.  A successful return indicates you are
  839.     still using the card.  Some programs (e.g., some games) may
  840.     never return.  The only requirement is that if you do return,
  841.     you must leave the system in a "good" state (including returning
  842.     most of, or all the memory you allocated).  The standard
  843.     convention for preserving registers apply.
  844.  
  845.     Note that your execute-in-place code will not be called
  846.     a second time, unless you have returned a non-successful
  847.     result.  In this case your execute-in-place code MUST
  848.     assume the user can remove, and insert your card again.
  849.     There are a variety of ways to check for re-insertion
  850.     (e.g., search for a message port, device, library, task,
  851.     etc., that you created).
  852.  
  853.     Note that your execute-in-place code runs in an environment
  854.     similar to boot block games; before DOS has been initialized!
  855.  
  856.     Your execute-in-place code should NOT try to initialize DOS
  857.     because DOS requires a suitable disk-like device be at
  858.     the head of the expansion base mountlist to boot off.
  859.  
  860.     If you need DOS, it is possible to boot off a credit-card using
  861.     carddisk.device.  Such cards will require a valid
  862.     CISTPL_DEVICE tuple, and CISTPL_FORMAT tuple.  A portion
  863.     of the card can be used for a minimal number of data blocks
  864.     like the method described above.
  865.  
  866.     However this method is not recommended, though it is anticipated
  867.     that some developers will have thought of, and used this
  868.     method anyway.  If you must do this, at least use the
  869.     CardHandle returned by OwnCard() to set hardware reset
  870.     on removal else the machine will likely crash anyway if
  871.     the card is removed while your execute-in-place code is running.
  872.  
  873.    RETURNS
  874.     Pointer to a ROM-TAG on the card, or NULL indicating that:
  875.  
  876.     o The card does not meet the above requirements, or
  877.     o The card has been removed, or
  878.     o You are not the owner of the credit-card.
  879.  
  880.    NOTES
  881.     This function is being made public so developers can test
  882.     test that their execute-in-place credit-cards meet the
  883.     requirements for an Amiga execute-in-place card.  In general
  884.     there is no reason for devices, or applications to use this
  885.     function.
  886.  
  887.     Amiga execute-in-place software is identified via a tuple code
  888.     reserved for manufacturer specific use, therefore the manufacturer
  889.     of the card may freely use the CISTPL_VERS_1, or CISTPL_VERS_2
  890.     tuples to place identification information on the credit-card.
  891.  
  892.     No attempt has been made to make use of the MS-DOS execute-in-place
  893.     method; it is believed that most manufacturers of Amiga
  894.     execute-in-place software will prefer a simple, and small
  895.     scheme for running their execute-in-place code.
  896.  
  897.    SEE ALSO
  898.     OwnCard(), resources/card.h, resources/card.i
  899.  
  900. card.resource/OwnCard                                   card.resource/OwnCard
  901.  
  902.    NAME
  903.     OwnCard -- Own credit card registers, and memory
  904.    
  905.    SYNOPSIS
  906.     return = OwnCard( handle )
  907.     d0        a1
  908.  
  909.     struct CardHandle *OwnCard( struct CardHandle * );
  910.  
  911.    FUNCTION
  912.     This function is used to obtain immediate, or deferred
  913.     ownership of a credit-card in the credit-card slot.
  914.  
  915.     Typically an EXEC STYLE DEVICE will be written to interface
  916.     between an application, and a credit card in the slot.  While
  917.     applications, and libraries can attempt to own a credit-card
  918.     in the card slot, the rest of this documentation assumes a
  919.     device interface will be used.
  920.  
  921.     Because credit-cards can be inserted, or removed by the user at
  922.     any time (otherwise known as HOT-INSERTION, and HOT-REMOVAL),
  923.     the card.resource provides devices with a protocol which
  924.     lets many devices bid for ownership of a newly inserted card.
  925.  
  926.     In general, devices should support HOT-REMOVAL, however there
  927.     are legitimate cases where HOT-REMOVAL is not practical.  For
  928.     these cases this function allows you to own the resource using
  929.     the CARDB_RESETREMOVE flag.  If the card is removed before your
  930.     device calls ReleaseCard(), the machine will RESET.
  931.  
  932.    INPUTS
  933.     handle - pointer to a CardHandle structure.
  934.  
  935.         struct CardHandle {
  936.         struct Node          cah_CardNode;
  937.         struct Interrupt    *cah_CardRemoved;
  938.         struct Interrupt    *cah_CardInserted;
  939.         struct Interrupt    *cah_CardStatus;
  940.         UBYTE             cah_CardFlags;
  941.         };
  942.  
  943.     The following fields in the structure must be filled
  944.     in by the application before calling OwnCard() -
  945.  
  946.     cah_CardNode.ln_Pri -
  947.  
  948.         See table below.  The Node field is used by the resource to
  949.         add your handle to a sorted list of CardHandle structures. 
  950.         This list is used by the resource to notify devices when the
  951.         device owns the credit-card.
  952.  
  953.         Your device will only be notified (at most) one time
  954.         per card insertion, and perhaps less often if some
  955.         higher priority device on the notification list retains
  956.         ownership of a card in the slot.
  957.  
  958.     Priority    Comments
  959.     --------------------------------------------------
  960.         >= 21    Reserved for future use
  961.  
  962.         10-20    To be used by third party devices (e.g.,
  963.             I/O CARD manufacturers) which look for
  964.             specific card tuples to identify credit-cards.
  965.  
  966.         01-19    Reserved for future use
  967.  
  968.         00    To be used by general purpose devices which
  969.             have loose card specification requirements.
  970.  
  971.         <= -1    Reserved for future use
  972.  
  973.           
  974.     cah_CardNode.ln_Type -
  975.  
  976.         Must be set to 0 for now.  This field may be used in the
  977.         future to identify an extended CardHandle structure.
  978.  
  979.     cah_CardNode.ln_Name -
  980.  
  981.         Must be initialized to NULL, or name of device which owns
  982.         this structure.
  983.  
  984.     cah_CardRemoved -
  985.  
  986.         Pointer to an initialized interrupt structure.  Only the
  987.         is_Data, and is_Code fields need to be initialized.  This
  988.         is the interrupt code which will be called when a credit-card
  989.         which your device owns is removed.  Once you receive this
  990.         interrupt, all credit-card interface control registers are
  991.         reset (e.g., programming voltage, access speed, etc.), and 
  992.         you should stop accessing the card as soon as possible.
  993.  
  994.         Because your code is called on interrupt time, you
  995.         should do the least amount possible, and use little
  996.         stack space.
  997.  
  998.         This pointer can be NULL if you have asked for reset
  999.         on card-removal, and you never turn reset off.
  1000.  
  1001.     cah_ CardInserted -
  1002.  
  1003.         Pointer to an initialized interrupt structure.  Only the
  1004.         is_Data, and is_Code fields need to be initialized.  This
  1005.         is the code which will be called when your CardHandle owns
  1006.         the credit-card in the slot.
  1007.  
  1008.         Note that your code may be called on the context of
  1009.         an interrupt, or a task in FORBID, therefore you should
  1010.         do the least amount possible, and use little stack space.
  1011.  
  1012.         Note that it is possible to receive a card removed
  1013.         interrupt immediately before you receive this interrupt if
  1014.         the card is removed while your CardInserted interrupt
  1015.         is being called.
  1016.         
  1017.         Your device owns the credit-card until the card is manually
  1018.         removed by the user, or you release the card by calling
  1019.         ReleaseCard().
  1020.  
  1021.         Your device should examine the card in the slot (e.g., look
  1022.         for specific tuples), and decide if the card is of a type your
  1023.         device understands.
  1024.  
  1025.         If not, release ownership of the card by calling
  1026.         ReleaseCard() so that other devices will be given a chance to
  1027.         examine the current card in the credit-card slot.
  1028.  
  1029.     cah_CardStatus -
  1030.  
  1031.         Pointer to an initialized interrupt structure.  Only the
  1032.         is_Data, and is_Code fields need to be initialized.
  1033.  
  1034.         Note that your code will be called on the context of
  1035.         an interrupt, therefore you should do the least
  1036.         amount possible, and use little stack space.
  1037.  
  1038.         Note that it is possible to receive a card removed
  1039.         interrupt immediately before you receive this interrupt
  1040.         if the card is removed during this interrupt.
  1041.         
  1042.         If this pointer is NULL, you will not receive card status
  1043.         change interrupts.
  1044.  
  1045.         Your interrupt code will be called with a mask value in
  1046.         register D0, and a pointer to your data in A1.
  1047.  
  1048.         The mask value in D0 can be interpreted using the same bit
  1049.         definitions returned by ReadCardStatus().  Note that more
  1050.         than one bit may be set, and the mask only tells you what has
  1051.         changed, not the current state.
  1052.  
  1053.         Use ReadCardStatus() if you need to determine the current
  1054.         state of the status bits.
  1055.  
  1056.         Not all status change interrupts will necessarily be
  1057.         enabled on all systems.  For example, on some systems
  1058.         BVD2/DA status change interrupts will not be enabled so
  1059.         that digital audio can occur without generating many
  1060.         interrupts.  Status change interrupts are typically meant
  1061.         to be used for monitoring BSY/IRQ, WR, and BVD1/SC.  Battery
  1062.         voltage low detection would best be done by a separate
  1063.         utility which periodically polls BVD1 & BVD2 by using the
  1064.         ReadCardStatus() function.
  1065.  
  1066.         Typically the mask value in D0 MUST be returned unchanged
  1067.         on exit from your code.  The return value in D0 is then used
  1068.         to clear the source(s) of the interrupt.
  1069.  
  1070.         In the rare case that you need to keep a status change
  1071.         interrupt active, clear the appropriate bit(s) in D0 before
  1072.         returning via RTS.  Clear no bits other than those defined
  1073.         as valid bits for ReadCardStatus()!
  1074.  
  1075.         !!!NEW FOR V39!!!
  1076.  
  1077.         See definition of CARDB_POSTSTATUS below.
  1078.  
  1079.     cah_CardFlags -
  1080.  
  1081.         Optional flags (all other bits must be 0).
  1082.  
  1083.         - CARDB_RESETREMOVE means you want the machine to
  1084.           reset if the credit-card in the slot is removed
  1085.           while you own the credit-card.
  1086.  
  1087.         - CARDB_IFAVAILABLE means you only want ownership of
  1088.           the credit-card in the slot if it is immediately
  1089.           available.
  1090.  
  1091.         If it is available, your CardHandle structure will be added
  1092.         to a list so that you can be notified via an interrupt when
  1093.         the credit-card is removed by the user.
  1094.  
  1095.         If the credit-card is not immediately available (either
  1096.         because there is no credit-card in the slot, or because some
  1097.         other device owns the credit-card), your CardHandle structure
  1098.         will NOT be added to the notification list.
  1099.  
  1100.         - CARDB_DELAYOWNERSHIP means you never want a successful
  1101.           return from OwnCard() even if the credit-card is
  1102.           available.  Rather you will be notified of ownership
  1103.           via your cah_CardInserted interrupt.  If you use this flag,
  1104.           OwnCard() will always return -1.  This flag cannot be used
  1105.           with the CARDB_IFAVAILABLE flag.
  1106.  
  1107.         - CARDB_POSTSTATUS is new for V39 card.resource (check
  1108.           resource base VERSION before using).  It is meant to be
  1109.           used by drivers which want to service the card hardware
  1110.           AFTER the status change interrupt has been cleared on the
  1111.           gate array.  Previously a PORTS interrupt server had 
  1112.           to be added to do this; this is somewhat more efficient, and
  1113.           easier to use.  Your status change interrupt is first called
  1114.           with status change bits in register D0.  You would examine
  1115.           these bits, and set a flag(s) for the POST callback.  When
  1116.           you return from the status change interrupt, the interrupt
  1117.           on the gate array is cleared (based on what you return in
  1118.           register D0), and your status change interrupt is immediately 
  1119.           called again, but this time with 0 in D0.  The value you
  1120.           return in D0 for the POST callback case is ignored.
  1121.           
  1122.  
  1123.     ALL other fields are used by the resource, and no fields in the
  1124.     structure may be modified while the structure is in use by the
  1125.     resource.  If you need to make changes, you must remove your
  1126.     CardHandle (see ReleaseCard()), make the changes, and then call
  1127.     OwnCard() again.
  1128.  
  1129.    RESULTS
  1130.      0  - indicates success, your device owns the credit card.
  1131.  
  1132.     -1  - indicates that the card cannot be owned (most likely 
  1133.           because there is no card in the credit card slot).
  1134.  
  1135.     ptr - indicates failure.  Returns pointer to the CardHandle
  1136.           structure which owns the credit card.
  1137.  
  1138.    NOTES
  1139.     This function should only be called from a task.
  1140.  
  1141.       CardHandle interrupts are called with a pointer to your data
  1142.     in A1, and a pointer to your code in A5.  With the exception
  1143.     of status change interrupts, D0-D1, A0-A1, and A5-A6 may be
  1144.     treated as scratch registers.  Status change interrupts are
  1145.     also called with meaningful data in D0, and expect D0 be
  1146.     preserved upon RTS from your code.  No other registers are
  1147.     guaranteed to contain initialized data.  All other registers
  1148.     must be preserved.
  1149.  
  1150.     SEE ALSO
  1151.     ReleaseCard(), ReadCardStatus(), resources/card.i, resources/card.h
  1152.  
  1153. card.resource/ReadCardStatus                     card.resource/ReadCardStatus
  1154.  
  1155.    NAME
  1156.     ReadCardStatus -- Read credit card status register
  1157.    
  1158.    SYNOPSIS
  1159.     status=ReadCardStatus()
  1160.     d0
  1161.  
  1162.     UBYTE ReadCardStatus( void );
  1163.  
  1164.    FUNCTION
  1165.     Returns current state of the credit card status register.
  1166.  
  1167.     See card.h/i for bit definitions.
  1168.  
  1169.     Note that the meaning of the returned status bits may vary
  1170.     depending on the type of card inserted in the slot, and
  1171.     mode of operation.  Interpretation of the bits is left
  1172.     up to the application.
  1173.  
  1174.    RETURNS
  1175.     A UBYTE value to be interpreted as status bits.
  1176.  
  1177.    NOTES
  1178.     This function may be called from within a task, or from any level
  1179.     interrupt.
  1180.  
  1181.    SEE ALSO
  1182.     resources/card.h, resources/card.i
  1183.  
  1184. card.resource/ReleaseCard                           card.resource/ReleaseCard
  1185.  
  1186.    NAME
  1187.     ReleaseCard -- Release ownership of credit card
  1188.    
  1189.    SYNOPSIS
  1190.     ReleaseCard( handle, flags )
  1191.              a1         d0
  1192.  
  1193.     void ReleaseCard( struct CardHandle *, ULONG );
  1194.  
  1195.    FUNCTION
  1196.     This function releases ownership of the credit card in the
  1197.     slot.
  1198.  
  1199.     The access light (if any) is automatically turned off
  1200.     (if it was turned on) when you release ownership of
  1201.     a card you owned, and all credit-card control registers
  1202.     are reset to their default state.
  1203.  
  1204.     You must call this function if -
  1205.  
  1206.     You own the credit-card, and want to release it so that
  1207.     other devices on the notification list will have a chance
  1208.     to examine the credit-card in the card slot.
  1209.  
  1210.     You took a Card Removed interrupt while you owned the
  1211.     credit-card.  If so, you MUST call this function, else
  1212.     no other task will be notified of newly inserted cards.  On
  1213.     some machines the credit-card interface hardware may also
  1214.     be left disabled until you respond to the card removed interrupt
  1215.     by calling this function.
  1216.  
  1217.     You want to remove yourself from the notification list (see
  1218.     optional flags below).
  1219.  
  1220.    INPUTS
  1221.     handle - Same handle as that used when OwnCard() was called.
  1222.  
  1223.     flags - Optional flags.
  1224.  
  1225.         - CARDB_REMOVEHANDLE means you want remove your
  1226.         CardHandle structure from the notification list
  1227.         whether or not you currently own the credit-card
  1228.         in the card slot.  The node structure in your
  1229.         CardHandle will be removed from the notification
  1230.         list, and ownership will be released if you were
  1231.         the owner of the card.
  1232.  
  1233.    NOTES
  1234.     This function should only be called from a task.
  1235.  
  1236.     SEE ALSO
  1237.     OwnCard(), resources/card.i, resources/card.h
  1238.  
  1239.