ES-2024 reverter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
752B

  1. #ifndef _CONTEXT_H_
  2. #define _CONTEXT_H_
  3. #include "filedata.h"
  4. #include "linebuffer.h"
  5. #include "list.h"
  6. #define FLAG_CONFIG 0x01
  7. #define FLAG_FIRMWARE 0x02
  8. #define FLAG_SPEEDUP 0x04
  9. struct context {
  10. struct list_head list;
  11. /* device local stuff */
  12. int fd;
  13. int (* dev_close)(struct context *context);
  14. int (* dev_setbaudrate)(struct context *context, int baudrate);
  15. char *devname;
  16. void *dev_privdata;
  17. /* event stuff */
  18. struct event_fd *event;
  19. /* statemachine */
  20. int state;
  21. int flags;
  22. /* line buffer */
  23. struct linebuffer *lbuf;
  24. /* xmodem */
  25. int lastpkt;
  26. struct filedata *file;
  27. };
  28. struct context * create_context(const char *filename);
  29. int destroy_context(struct context *ctx);
  30. int context_close(void);
  31. #endif /* _CONTEXT_H_ */