SCSI_ATN.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*******************************************************************************
  2. * File Name: SCSI_ATN.c
  3. * Version 1.90
  4. *
  5. * Description:
  6. * This file contains API to enable firmware control of a Pins component.
  7. *
  8. * Note:
  9. *
  10. ********************************************************************************
  11. * Copyright 2008-2012, Cypress Semiconductor Corporation. All rights reserved.
  12. * You may use this file only in accordance with the license, terms, conditions,
  13. * disclaimers, and limitations in the end user license agreement accompanying
  14. * the software package with which this file was provided.
  15. *******************************************************************************/
  16. #include "cytypes.h"
  17. #include "SCSI_ATN.h"
  18. /* APIs are not generated for P15[7:6] on PSoC 5 */
  19. #if !(CY_PSOC5A &&\
  20. SCSI_ATN__PORT == 15 && ((SCSI_ATN__MASK & 0xC0) != 0))
  21. /*******************************************************************************
  22. * Function Name: SCSI_ATN_Write
  23. ********************************************************************************
  24. *
  25. * Summary:
  26. * Assign a new value to the digital port's data output register.
  27. *
  28. * Parameters:
  29. * prtValue: The value to be assigned to the Digital Port.
  30. *
  31. * Return:
  32. * None
  33. *
  34. *******************************************************************************/
  35. void SCSI_ATN_Write(uint8 value)
  36. {
  37. uint8 staticBits = (SCSI_ATN_DR & (uint8)(~SCSI_ATN_MASK));
  38. SCSI_ATN_DR = staticBits | ((uint8)(value << SCSI_ATN_SHIFT) & SCSI_ATN_MASK);
  39. }
  40. /*******************************************************************************
  41. * Function Name: SCSI_ATN_SetDriveMode
  42. ********************************************************************************
  43. *
  44. * Summary:
  45. * Change the drive mode on the pins of the port.
  46. *
  47. * Parameters:
  48. * mode: Change the pins to this drive mode.
  49. *
  50. * Return:
  51. * None
  52. *
  53. *******************************************************************************/
  54. void SCSI_ATN_SetDriveMode(uint8 mode)
  55. {
  56. CyPins_SetPinDriveMode(SCSI_ATN_0, mode);
  57. }
  58. /*******************************************************************************
  59. * Function Name: SCSI_ATN_Read
  60. ********************************************************************************
  61. *
  62. * Summary:
  63. * Read the current value on the pins of the Digital Port in right justified
  64. * form.
  65. *
  66. * Parameters:
  67. * None
  68. *
  69. * Return:
  70. * Returns the current value of the Digital Port as a right justified number
  71. *
  72. * Note:
  73. * Macro SCSI_ATN_ReadPS calls this function.
  74. *
  75. *******************************************************************************/
  76. uint8 SCSI_ATN_Read(void)
  77. {
  78. return (SCSI_ATN_PS & SCSI_ATN_MASK) >> SCSI_ATN_SHIFT;
  79. }
  80. /*******************************************************************************
  81. * Function Name: SCSI_ATN_ReadDataReg
  82. ********************************************************************************
  83. *
  84. * Summary:
  85. * Read the current value assigned to a Digital Port's data output register
  86. *
  87. * Parameters:
  88. * None
  89. *
  90. * Return:
  91. * Returns the current value assigned to the Digital Port's data output register
  92. *
  93. *******************************************************************************/
  94. uint8 SCSI_ATN_ReadDataReg(void)
  95. {
  96. return (SCSI_ATN_DR & SCSI_ATN_MASK) >> SCSI_ATN_SHIFT;
  97. }
  98. /* If Interrupts Are Enabled for this Pins component */
  99. #if defined(SCSI_ATN_INTSTAT)
  100. /*******************************************************************************
  101. * Function Name: SCSI_ATN_ClearInterrupt
  102. ********************************************************************************
  103. * Summary:
  104. * Clears any active interrupts attached to port and returns the value of the
  105. * interrupt status register.
  106. *
  107. * Parameters:
  108. * None
  109. *
  110. * Return:
  111. * Returns the value of the interrupt status register
  112. *
  113. *******************************************************************************/
  114. uint8 SCSI_ATN_ClearInterrupt(void)
  115. {
  116. return (SCSI_ATN_INTSTAT & SCSI_ATN_MASK) >> SCSI_ATN_SHIFT;
  117. }
  118. #endif /* If Interrupts Are Enabled for this Pins component */
  119. #endif /* CY_PSOC5A... */
  120. /* [] END OF FILE */