rjlhex.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. ** This file is part of fsusb_picdem
  3. **
  4. ** fsusb_picdem is free software; you can redistribute it and/or
  5. ** modify it under the terms of the GNU General Public License as
  6. ** published by the Free Software Foundation; either version 2 of the
  7. ** License, or (at your option) any later version.
  8. **
  9. ** fsusb_picdem is distributed in the hope that it will be useful, but
  10. ** WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. ** General Public License for more details.
  13. **
  14. ** You should have received a copy of the GNU General Public License
  15. ** along with fsusb_picdem; if not, write to the Free Software
  16. ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. ** 02110-1301, USA
  18. */
  19. #ifndef __RJLHEX_H__
  20. #define __RJLHEX_H__
  21. #include <stdio.h>
  22. typedef struct _hex_record {
  23. unsigned char datlen;
  24. unsigned int addr;
  25. unsigned char type;
  26. unsigned char checksum;
  27. unsigned char data[0];
  28. } hex_record;
  29. typedef struct _hex_file {
  30. FILE *f;
  31. unsigned long addr;
  32. } hex_file;
  33. // Create a hex_file from an already-open FILE *
  34. hex_file *hex_open(FILE *f);
  35. // Read the next hex_record from f
  36. hex_record *hex_read(hex_file *f);
  37. #endif /* __RJLHEX_H__ */