mweeprom.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef _MWEEPROM_H_
  2. #define _MWEEPROM_H_
  3. /*
  4. * Copyright (C) 2004 by Jan Dubiec. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the copyright holders nor the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY JAN DUBIEC AND CONTRIBUTORS
  20. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JAN DUBIEC
  23. * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. */
  31. /*
  32. * $Log: mweeprom.h,v $
  33. * Revision 1.2 2004/03/19 07:46:35 jdubiec
  34. * Make this file independent on sys/types.h due to compilation problems.
  35. *
  36. * Revision 1.1 2004/03/16 16:48:28 haraldkipp
  37. * Added Jan Dubiec's H8/300 port.
  38. *
  39. */
  40. /*
  41. * Microwire EEPROM routines compatible with avr-gcc API which Nut/OS uses.
  42. * Based on Yousuke FURUSAWA's code:
  43. * http://www.open.esys.tsukuba.ac.jp/~yousuke/software/h8/microwire/index.jp.html
  44. *
  45. * Jan Dubiec <jdx@slackware.pl>
  46. *
  47. */
  48. #include <stddef.h>
  49. #ifdef __cplusplus
  50. extern "C" {
  51. #endif
  52. extern unsigned char eeprom_read_byte(const unsigned char *addr);
  53. extern unsigned short eeprom_read_word(const unsigned short *addr);
  54. extern void eeprom_read_block(void *buf, const void *addr, size_t n);
  55. extern void eeprom_write_byte(unsigned char *addr, unsigned char val);
  56. extern void eeprom_write_word(unsigned short *addr, unsigned short val);
  57. extern void eeprom_write_block(const void *buf, void *addr, size_t n);
  58. extern void eeprom_fill_all(const unsigned char c);
  59. extern void eeprom_erase(unsigned char *addr);
  60. extern void eeprom_erase_all(void);
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64. #endif /* #ifndef _MWEEPROM_H_ */