dsp_monitor.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #include <linux/module.h>
  2. #include <linux/sched.h>
  3. #include <linux/kernel.h>
  4. #include <linux/cache.h>
  5. #include <asm/cacheflush.h>
  6. //#include <asm/arch/am_regs.h>
  7. #include <mach/am_regs.h>
  8. //#include <asm/bsp.h>
  9. #include "dsp_microcode.h"
  10. #include "audiodsp_module.h"
  11. #include "dsp_control.h"
  12. //#include <asm/dsp/dsp_register.h>
  13. static void audiodsp_monitor(unsigned long arg)
  14. {
  15. struct audiodsp_priv *priv=(struct audiodsp_priv *)arg;
  16. static unsigned long old_dsp_jiffies=0;
  17. static unsigned long jiffies_error=0;
  18. unsigned long dsp_jiffies;
  19. unsigned long dsp_status;
  20. dsp_jiffies=DSP_RD(DSP_JIFFIES);
  21. dsp_status=DSP_RD(DSP_STATUS);
  22. if(old_dsp_jiffies==dsp_jiffies)
  23. jiffies_error++;
  24. else
  25. {
  26. jiffies_error=0;
  27. old_dsp_jiffies=dsp_jiffies;
  28. }
  29. if(jiffies_error>5)
  30. {
  31. DSP_PRNT("Found audio dsp have some problem not running \n");
  32. DSP_PRNT("audio jiffies=%ld\n",old_dsp_jiffies);
  33. DSP_PRNT("audio status=%lx\n",dsp_status);
  34. }
  35. priv->dsp_mointer.expires=jiffies+HZ;
  36. add_timer(&priv->dsp_mointer);
  37. }
  38. void start_audiodsp_monitor(struct audiodsp_priv *priv)
  39. {
  40. priv->dsp_mointer.expires=jiffies;
  41. add_timer(&priv->dsp_mointer);
  42. }
  43. void stop_audiodsp_monitor(struct audiodsp_priv *priv)
  44. {
  45. del_timer_sync(&priv->dsp_mointer);
  46. }
  47. void init_audiodsp_monitor(struct audiodsp_priv *priv)
  48. {
  49. setup_timer(&priv->dsp_mointer,audiodsp_monitor,(unsigned long)priv);
  50. }
  51. void release_audiodsp_monitor(struct audiodsp_priv *priv)
  52. {
  53. stop_audiodsp_monitor(priv);
  54. }