ibRsv.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /***************************************************************************
  2. lib/ibRsv.c
  3. -------------------
  4. copyright : (C) 2001,2002,2003 by Frank Mori Hess
  5. email : fmhess@users.sourceforge.net
  6. ***************************************************************************/
  7. /***************************************************************************
  8. * *
  9. * This program is free software; you can redistribute it and/or modify *
  10. * it under the terms of the GNU General Public License as published by *
  11. * the Free Software Foundation; either version 2 of the License, or *
  12. * (at your option) any later version. *
  13. * *
  14. ***************************************************************************/
  15. #include "ib_internal.h"
  16. int internal_ibrsv( ibConf_t *conf, int v )
  17. {
  18. ibBoard_t *board;
  19. uint8_t status_byte = v;
  20. int retval;
  21. if( conf->is_interface == 0 )
  22. {
  23. setIberr( EARG );
  24. return -1;
  25. }
  26. board = interfaceBoard( conf );
  27. retval = ioctl( board->fileno, IBRSV, &status_byte );
  28. if( retval < 0 )
  29. {
  30. return retval;
  31. }
  32. return 0;
  33. }
  34. // should return old status byte in iberr on success
  35. int ibrsv( int ud, int v )
  36. {
  37. ibConf_t *conf;
  38. int retval;
  39. conf = enter_library( ud );
  40. if( conf == NULL )
  41. return exit_library( ud, 1 );
  42. retval = internal_ibrsv( conf, v );
  43. if( retval < 0 )
  44. {
  45. return exit_library( ud, 1 );
  46. }
  47. return exit_library( ud, 0 );
  48. }