home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / oslib / h / cache < prev    next >
Encoding:
Text File  |  1994-09-07  |  4.7 KB  |  164 lines

  1. #ifndef cache_H
  2. #define cache_H
  3.  
  4. /* C header file for Cache
  5.  * written by DefMod (Sep  7 1994) on Wed Sep  7 21:25:39 1994
  6.  * Copyright © Acorn Computers Ltd, 1994
  7.  */
  8.  
  9. /*************************************************************************
  10.  * This source file was written by Acorn Computers Limited. It is part   *
  11.  * of the OSLib library for writing applications for RISC OS. It may be  *
  12.  * used freely in the creation of programs for RISC OS.                  *
  13.  *************************************************************************/
  14.  
  15. #ifndef types_H
  16.    #include "types.h"
  17. #endif
  18.  
  19. #ifndef os_H
  20.    #include "os.h"
  21. #endif
  22.  
  23. /**********************************
  24.  * SWI names and SWI reason codes *
  25.  **********************************/
  26. #undef  Cache_Control
  27. #define Cache_Control                           0x280
  28. #undef  XCache_Control
  29. #define XCache_Control                          0x20280
  30. #undef  Cache_Cacheable
  31. #define Cache_Cacheable                         0x281
  32. #undef  XCache_Cacheable
  33. #define XCache_Cacheable                        0x20281
  34. #undef  Cache_Updateable
  35. #define Cache_Updateable                        0x282
  36. #undef  XCache_Updateable
  37. #define XCache_Updateable                       0x20282
  38. #undef  Cache_Disruptive
  39. #define Cache_Disruptive                        0x283
  40. #undef  XCache_Disruptive
  41. #define XCache_Disruptive                       0x20283
  42. #undef  Cache_Flush
  43. #define Cache_Flush                             0x284
  44. #undef  XCache_Flush
  45. #define XCache_Flush                            0x20284
  46.  
  47. /*************************
  48.  * Function declarations *
  49.  *************************/
  50.  
  51. #ifdef __cplusplus
  52.    extern "C" {
  53. #endif
  54.  
  55. /*************************************************************
  56.  * NOTE: The following functions provide direct access to    *
  57.  *       the SWI's noted in the function description.        *
  58.  *       Please read the relevant PRM section for more       *
  59.  *       information on their input/output parameters.       *
  60.  *************************************************************/
  61.  
  62. /* ------------------------------------------------------------------------
  63.  * Function:      cache_control()
  64.  *
  65.  * Description:   Turns the cache on or off
  66.  *
  67.  * Input:         eor_mask - value of R0 on entry
  68.  *                and_mask - value of R1 on entry
  69.  *
  70.  * Output:        old_state - value of R0 on exit (X version only)
  71.  *
  72.  * Returns:       R0 (non-X version only)
  73.  *
  74.  * Other notes:   Calls SWI 0x280.
  75.  */
  76.  
  77. extern os_error *xcache_control (bits eor_mask,
  78.       bits and_mask,
  79.       bits *old_state);
  80. extern bits cache_control (bits eor_mask,
  81.       bits and_mask);
  82.  
  83. /* ------------------------------------------------------------------------
  84.  * Function:      cache_cacheable()
  85.  *
  86.  * Description:   Controls which area of memory may be cached
  87.  *
  88.  * Input:         eor_mask - value of R0 on entry
  89.  *                and_mask - value of R1 on entry
  90.  *
  91.  * Output:        old_state - value of R0 on exit (X version only)
  92.  *
  93.  * Returns:       R0 (non-X version only)
  94.  *
  95.  * Other notes:   Calls SWI 0x281.
  96.  */
  97.  
  98. extern os_error *xcache_cacheable (bits eor_mask,
  99.       bits and_mask,
  100.       bits *old_state);
  101. extern bits cache_cacheable (bits eor_mask,
  102.       bits and_mask);
  103.  
  104. /* ------------------------------------------------------------------------
  105.  * Function:      cache_updateable()
  106.  *
  107.  * Description:   Controls which area of memory will be automatically
  108.  *                updated in the cache
  109.  *
  110.  * Input:         eor_mask - value of R0 on entry
  111.  *                and_mask - value of R1 on entry
  112.  *
  113.  * Output:        old_state - value of R0 on exit (X version only)
  114.  *
  115.  * Returns:       R0 (non-X version only)
  116.  *
  117.  * Other notes:   Calls SWI 0x282.
  118.  */
  119.  
  120. extern os_error *xcache_updateable (bits eor_mask,
  121.       bits and_mask,
  122.       bits *old_state);
  123. extern bits cache_updateable (bits eor_mask,
  124.       bits and_mask);
  125.  
  126. /* ------------------------------------------------------------------------
  127.  * Function:      cache_disruptive()
  128.  *
  129.  * Description:   Controls which areas of memory cause automatic flushing
  130.  *                of the cache on a write
  131.  *
  132.  * Input:         eor_mask - value of R0 on entry
  133.  *                and_mask - value of R1 on entry
  134.  *
  135.  * Output:        old_state - value of R0 on exit (X version only)
  136.  *
  137.  * Returns:       R0 (non-X version only)
  138.  *
  139.  * Other notes:   Calls SWI 0x283.
  140.  */
  141.  
  142. extern os_error *xcache_disruptive (bits eor_mask,
  143.       bits and_mask,
  144.       bits *old_state);
  145. extern bits cache_disruptive (bits eor_mask,
  146.       bits and_mask);
  147.  
  148. /* ------------------------------------------------------------------------
  149.  * Function:      cache_flush()
  150.  *
  151.  * Description:   Flushes the cache
  152.  *
  153.  * Other notes:   Calls SWI 0x284.
  154.  */
  155.  
  156. extern os_error *xcache_flush (void);
  157. extern void cache_flush (void);
  158.  
  159. #ifdef __cplusplus
  160.    }
  161. #endif
  162.  
  163. #endif
  164.