shared_memory.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * =====================================================================================
  3. *
  4. * ________ .__ __ ________ ____ ________
  5. * \_____ \ __ __|__| ____ | | __\______ \ _______ _/_ |/ _____/
  6. * / / \ \| | \ |/ ___\| |/ / | | \_/ __ \ \/ /| / __ \
  7. * / \_/. \ | / \ \___| < | ` \ ___/\ / | \ |__\ \
  8. * \_____\ \_/____/|__|\___ >__|_ \/_______ /\___ >\_/ |___|\_____ /
  9. * \__> \/ \/ \/ \/ \/
  10. *
  11. * www.optixx.org
  12. *
  13. *
  14. * Version: 1.0
  15. * Created: 07/21/2009 03:32:16 PM
  16. * Author: david@optixx.org
  17. *
  18. * =====================================================================================
  19. */
  20. #ifndef __SHARED_MEMORY_H__
  21. #define __SHARED_MEMORY_H__
  22. #define SHARED_MEM_SWITCH_IRQ 0
  23. #define SHARED_MEM_SWITCH_DELAY 20
  24. #define SHARED_MEM_TX_SNES_ACK 0xa5
  25. #define SHARED_MEM_TX_SNES_RTS 0x5a
  26. #define SHARED_MEM_TX_CMD_BANK_COUNT 0x00
  27. #define SHARED_MEM_TX_CMD_BANK_CURRENT 0x01
  28. #define SHARED_MEM_TX_CMD_UPLOAD_START 0x03
  29. #define SHARED_MEM_TX_CMD_UPLOAD_END 0x04
  30. #define SHARED_MEM_TX_CMD_UPLOAD_PROGESS 0x05
  31. #define SHARED_MEM_TX_CMD_TERMINATE 0x06
  32. #define SHARED_MEM_TX_LOC_STATE 0x000000
  33. #define SHARED_MEM_TX_LOC_SIZE 0x000040
  34. #define SHARED_MEM_TX_LOC_CMD 0x000001
  35. #define SHARED_MEM_TX_LOC_PAYLOAD 0x000002
  36. #define SHARED_MEM_RX_AVR_ACK 0xa5
  37. #define SHARED_MEM_RX_AVR_RTS 0x5a
  38. #define SHARED_MEM_RX_CMD_PRINFT 0x00
  39. #define SHARED_MEM_RX_CMD_FILESEL 0x01
  40. #define SHARED_MEM_RX_LOC_STATE 0x001000
  41. #define SHARED_MEM_RX_LOC_SIZE 0x000040
  42. #define SHARED_MEM_RX_LOC_CMD 0x001001
  43. #define SHARED_MEM_RX_LOC_LEN 0x001002
  44. #define SHARED_MEM_RX_LOC_PAYLOAD 0x001003
  45. #define SHARED_IRQ_LOC_LO 0x00fffe
  46. #define SHARED_IRQ_LOC_HI 0x00ffff
  47. /*
  48. * Use COP IRQ LOC for hooked IRQ handler
  49. */
  50. #define SHARED_IRQ_HANDLER_LO 0x0ffe4
  51. #define SHARED_IRQ_HANDLER_HI 0x0ffe5
  52. #define SHARED_SCRATCHPAD_DUMP 0
  53. #define SHARED_SCRATCHPAD_CRC 0
  54. void shared_memory_init(void);
  55. uint8_t shared_memory_scratchpad_region_save_helper(uint32_t addr);
  56. void shared_memory_scratchpad_region_tx_save();
  57. void shared_memory_scratchpad_region_tx_restore();
  58. void shared_memory_scratchpad_region_rx_save();
  59. void shared_memory_scratchpad_region_rx_restore();
  60. void shared_memory_write(uint8_t cmd, uint8_t value);
  61. int shared_memory_read(uint8_t * cmd, uint8_t * len, uint8_t * buffer);
  62. #endif