Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.4 KiB

4 years ago
  1. //----------------------------------------------------------------------
  2. // File: PORT.C
  3. //
  4. // Contains generic port access routines.
  5. //
  6. // Revisions:
  7. // 01-08-93 KJB First.
  8. // 03-25-93 JAP Fixed up typedef and prototype inconsistencies
  9. //
  10. //----------------------------------------------------------------------
  11. #include CARDTXXX_H
  12. //
  13. // CardPortSet
  14. //
  15. // This routine sets a mask on a certain port. It or's the mask with
  16. // the value currently at the port. Works only for ports where all bits
  17. // are readable and writable.
  18. //
  19. VOID CardPortSet (PUCHAR baseIoAddress, UCHAR mask)
  20. {
  21. UCHAR tmp;
  22. CardPortGet (baseIoAddress,&tmp);
  23. tmp = tmp | mask;
  24. CardPortPut (baseIoAddress,tmp);
  25. }
  26. //
  27. // CardPortClear
  28. //
  29. // This routine clears a mask on a certain port. It and's the inverse with
  30. // the value currently at the port. Works only for ports where all bits
  31. // are readable and writable.
  32. //
  33. VOID CardPortClear (PUCHAR baseIoAddress, UCHAR mask)
  34. {
  35. UCHAR tmp;
  36. CardPortGet(baseIoAddress,&tmp);
  37. tmp = tmp & (0xff ^ mask);
  38. CardPortPut(baseIoAddress,tmp);
  39. }
  40. //
  41. // CardPortTest
  42. //
  43. // This routine clears a mask on a certain port. It and's the mask with
  44. // the value currently at the port. This result is returned.
  45. //
  46. BOOLEAN CardPortTest(PUCHAR baseIoAddress, UCHAR mask)
  47. {
  48. UCHAR tmp;
  49. CardPortGet(baseIoAddress,&tmp);
  50. return (tmp & mask);
  51. }