KISS Data Aquisition and Control System
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.

105 lines
2.5 KiB

  1. /*
  2. *
  3. * PRU Debug Program header file
  4. * (c) Copyright 2011, 2013 by Arctica Technologies
  5. * Written by Steven Anderson
  6. *
  7. */
  8. #ifndef PRUDBG_H
  9. #define PRUDBG_H
  10. // default processor to use if none is specified on the command line when prudebug is started
  11. #define DEFAULT_PROCESSOR_INDEX AM335x
  12. // list of processors to use in the define above (DEFAULT_PROCESSOR_INDEX)
  13. // value for define must match the array index in the processor structure
  14. // in the prudbg.c file.
  15. #define AM1707 0
  16. #define AM335x 1
  17. // general settings
  18. #define MAX_CMD_LEN 25
  19. #define MAX_CMDARGS_LEN 200
  20. #define MAX_COMMAND_LINE (MAX_CMD_LEN + MAX_CMDARGS_LEN + 1)
  21. #define MAX_ARGS 10
  22. #define MAX_PRU_MEM 0xFFFF
  23. #define NUM_OF_PRU 2
  24. #define MAX_NUM_OF_PRUS 16 // maximum number of PRUs to expect in any processor
  25. #define MAX_BREAKPOINTS 5
  26. #define MAX_WATCH 5
  27. #define MAX_PROC_NAME 20
  28. // register offsets
  29. #define PRU_CTRL_REG 0x0000
  30. #define PRU_STATUS_REG 0x0001
  31. #define PRU_INTGPR_REG 0x0100
  32. // PRU control register bit flags
  33. #define PRU_REG_PCRESET_MASK 0x0000FFFF
  34. #define PRU_REG_RUNSTATE 0x00008000
  35. #define PRU_REG_SINGLE_STEP 0x00000100
  36. #define PRU_REG_COUNT_EN 0x00000008
  37. #define PRU_REG_SLEEPING 0x00000004
  38. #define PRU_REG_PROC_EN 0x00000002
  39. #define PRU_REG_SOFT_RESET 0x00000001
  40. // defines for PRU memory mapping method requeste by user
  41. #define ACCESS_GUESS 0
  42. #define ACCESS_UIO 1
  43. #define ACCESS_MEM 2
  44. // defines for command repeats
  45. #define LAST_CMD_NONE 0
  46. #define LAST_CMD_D 1
  47. #define LAST_CMD_DD 2
  48. #define LAST_CMD_DI 3
  49. #define LAST_CMD_DIS 4
  50. #define LAST_CMD_SS 5
  51. // defines for structures below
  52. #define BP_UNUSED 0
  53. #define BP_ACTIVE 1
  54. #define WA_UNUSED 0
  55. #define WA_PRINT_ON_ANY 1
  56. #define WA_HALT_ON_VALUE 2
  57. #define TRUE 1
  58. #define FALSE 0
  59. // global structures
  60. struct breakpoints {
  61. unsigned char state;
  62. unsigned int address;
  63. };
  64. struct watchvariable {
  65. unsigned char state;
  66. unsigned int address;
  67. unsigned int value;
  68. unsigned int old_value;
  69. };
  70. // global variables
  71. extern unsigned int *pru;
  72. extern unsigned int pru_inst_base[], pru_ctrl_base[], pru_data_base[];
  73. extern unsigned int pru_num;
  74. extern struct breakpoints bp[MAX_NUM_OF_PRUS][MAX_BREAKPOINTS];
  75. extern struct watchvariable wa[MAX_NUM_OF_PRUS][MAX_WATCH];
  76. // function prototypes
  77. int cmd_input(char *prompt, char *cmd, char *cmdargs, unsigned int *argptrs, unsigned int *numargs);
  78. void printhelp();
  79. int cmd_d (int offset, int addr, int len);
  80. int cmd_loadprog(unsigned int addr, char *fn);
  81. void cmd_run();
  82. void cmd_soft_reset();
  83. void disassemble(char *str, unsigned int inst);
  84. #endif // PRUDBG_H