database.h 990 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef __DATABASE_H
  2. #define __DATABASE_H
  3. #include "fuses.h"
  4. typedef struct device {
  5. const char *name;
  6. unsigned int protocol_id;
  7. unsigned int variant;
  8. unsigned int addressing_mode;
  9. unsigned int read_buffer_size;
  10. unsigned int write_buffer_size;
  11. enum { BYTE, WORD, BIT } word_size;
  12. unsigned int code_memory_size; // Presenting for every device
  13. unsigned int data_memory_size;
  14. unsigned int data_memory2_size;
  15. unsigned int chip_id; // A vendor-specific chip ID (i.e. 0x1E9502 for ATMEGA48)
  16. unsigned int chip_id_bytes_count : 3;
  17. unsigned int opts1;
  18. unsigned int opts2;
  19. unsigned int opts3;
  20. unsigned int opts4;
  21. unsigned int package_details; // pins count or image ID for some devices
  22. unsigned int write_unlock;
  23. fuse_decl_t *fuses; // Configuration bytes that's presenting in some architectures
  24. } device_t;
  25. #define WORD_SIZE(device) (((device)->opts4 & 0xFF000000) == 0x01000000 ? 2 : 1)
  26. extern device_t devices[];
  27. device_t *get_device_by_name(const char *name);
  28. #endif