Subversion Repositories HomeAutomation

Rev

Rev 198 | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. /* vim: sw=8 ts=8 si et: */
  2. /****************************************************************************
  3. * Title   :   compatibility module for forward compatibility with
  4.               newer ARV C compiler which does not have older
  5.               macros
  6. * Authors:    Guido Socher
  7. * Copyright: GPL
  8. *
  9. *        
  10. *****************************************************************************/
  11. #ifndef AVR_COMPAT_H
  12. #define AVR_COMPAT_H
  13.  
  14. // uncomment the following line if you have avr-1.2.x or less:
  15. //#define ALIBC_OLD 1
  16.  
  17. #ifndef cbi
  18. #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
  19. #endif
  20.  
  21. #ifndef sbi
  22. #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
  23. #endif
  24.  
  25. #ifndef inb
  26. #define inb(sfr) _SFR_BYTE(sfr)
  27. #endif
  28.  
  29. #ifndef outb
  30. #define outb(sfr, val) (_SFR_BYTE(sfr) = (val))
  31. #endif
  32.  
  33. #ifndef inw
  34. #define inw(sfr) _SFR_WORD(sfr)
  35. #endif
  36.  
  37. #ifndef outw
  38. #define outw(sfr, val) ( _SFR_WORD(sfr) = (val))
  39. #endif
  40.  
  41. #ifndef outp
  42. #define outp(val, sfr) outb(sfr, val)
  43. #endif
  44.  
  45. #ifndef inp
  46. #define inp(sfr) inb(sfr)
  47. #endif
  48.  
  49. #ifndef BV
  50. #define BV(bit) _BV(bit)
  51. #endif
  52.  
  53. /* compatibility macro for libc 1.0 to 1.2 */
  54. #ifndef PRG_RDB
  55. #define PRG_RDB(addr)       pgm_read_byte(addr)
  56. #endif
  57.  
  58. #endif //AVR_COMPAT_H
  59.  
  60.