op_blackfin.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * File: arch/blackfin/oprofile/op_blackfin.h
  3. * Based on:
  4. * Author: Anton Blanchard <anton@au.ibm.com>
  5. *
  6. * Created:
  7. * Description:
  8. *
  9. * Modified:
  10. * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
  11. * Copyright 2004-2006 Analog Devices Inc.
  12. *
  13. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License as published by
  17. * the Free Software Foundation; either version 2 of the License, or
  18. * (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, see the file COPYING, or write
  27. * to the Free Software Foundation, Inc.,
  28. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  29. */
  30. #ifndef OP_BLACKFIN_H
  31. #define OP_BLACKFIN_H 1
  32. #define OP_MAX_COUNTER 2
  33. #include <asm/blackfin.h>
  34. /* Per-counter configuration as set via oprofilefs. */
  35. struct op_counter_config {
  36. unsigned long valid;
  37. unsigned long enabled;
  38. unsigned long event;
  39. unsigned long count;
  40. unsigned long kernel;
  41. unsigned long user;
  42. unsigned long unit_mask;
  43. };
  44. /* System-wide configuration as set via oprofilefs. */
  45. struct op_system_config {
  46. unsigned long enable_kernel;
  47. unsigned long enable_user;
  48. };
  49. /* Per-arch configuration */
  50. struct op_bfin533_model {
  51. int (*reg_setup) (struct op_counter_config *);
  52. int (*start) (struct op_counter_config *);
  53. void (*stop) (void);
  54. int num_counters;
  55. char *name;
  56. };
  57. extern struct op_bfin533_model op_model_bfin533;
  58. static inline unsigned int ctr_read(void)
  59. {
  60. unsigned int tmp;
  61. tmp = bfin_read_PFCTL();
  62. __builtin_bfin_csync();
  63. return tmp;
  64. }
  65. static inline void ctr_write(unsigned int val)
  66. {
  67. bfin_write_PFCTL(val);
  68. __builtin_bfin_csync();
  69. }
  70. static inline void count_read(unsigned int *count)
  71. {
  72. count[0] = bfin_read_PFCNTR0();
  73. count[1] = bfin_read_PFCNTR1();
  74. __builtin_bfin_csync();
  75. }
  76. static inline void count_write(unsigned int *count)
  77. {
  78. bfin_write_PFCNTR0(count[0]);
  79. bfin_write_PFCNTR1(count[1]);
  80. __builtin_bfin_csync();
  81. }
  82. extern int pm_overflow_handler(int irq, struct pt_regs *regs);
  83. #endif