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

  1. #ifndef iic_H
  2. #define iic_H
  3.  
  4. /* C header file for IIC
  5.  * written by DefMod (Sep  7 1994) on Wed Sep  7 21:23:26 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  IIC_Control
  27. #define IIC_Control                             0x240
  28. #undef  XIIC_Control
  29. #define XIIC_Control                            0x20240
  30. #undef  IICControl_Read
  31. #define IICControl_Read                         0x1
  32. #undef  IICControl_Write
  33. #define IICControl_Write                        0x0
  34.  
  35. /************************
  36.  * Constant definitions *
  37.  ************************/
  38. #define error_IIC_NO_ACKNOWLEDGE                0x20300u
  39.  
  40. /*************************
  41.  * Function declarations *
  42.  *************************/
  43.  
  44. #ifdef __cplusplus
  45.    extern "C" {
  46. #endif
  47.  
  48. /*************************************************************
  49.  * NOTE: The following functions provide direct access to    *
  50.  *       the SWI's noted in the function description.        *
  51.  *       Please read the relevant PRM section for more       *
  52.  *       information on their input/output parameters.       *
  53.  *************************************************************/
  54.  
  55. /* ------------------------------------------------------------------------
  56.  * Function:      iiccontrol_read()
  57.  *
  58.  * Description:   Reads from an IIC device
  59.  *
  60.  * Input:         device - value of R0 on entry
  61.  *                buffer - value of R1 on entry
  62.  *                size - value of R2 on entry
  63.  *
  64.  * Other notes:   Calls SWI 0x240 with R0 |= 0x1.
  65.  */
  66.  
  67. extern os_error *xiiccontrol_read (int *device,
  68.       byte *buffer,
  69.       int size);
  70. extern void iiccontrol_read (int *device,
  71.       byte *buffer,
  72.       int size);
  73.  
  74. /* ------------------------------------------------------------------------
  75.  * Function:      iiccontrol_write()
  76.  *
  77.  * Description:   Writes to an IIC device
  78.  *
  79.  * Input:         device - value of R0 on entry
  80.  *                data - value of R1 on entry
  81.  *                size - value of R2 on entry
  82.  *
  83.  * Other notes:   Calls SWI 0x240 with R0 |= 0x0.
  84.  */
  85.  
  86. extern os_error *xiiccontrol_write (int *device,
  87.       byte *data,
  88.       int size);
  89. extern void iiccontrol_write (int *device,
  90.       byte *data,
  91.       int size);
  92.  
  93. #ifdef __cplusplus
  94.    }
  95. #endif
  96.  
  97. #endif
  98.