smi_debug.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #include <linux/uaccess.h>
  2. #include <linux/module.h>
  3. #include <linux/fs.h>
  4. #include <linux/platform_device.h>
  5. #include <linux/cdev.h>
  6. #include <linux/interrupt.h>
  7. #include <asm/io.h>
  8. #include <linux/sched.h>
  9. #include <linux/wait.h>
  10. #include <linux/spinlock.h>
  11. #include <linux/delay.h>
  12. #include <linux/mm.h>
  13. #include <linux/vmalloc.h>
  14. #include <linux/dma-mapping.h>
  15. #include <linux/slab.h>
  16. #include <aee.h>
  17. #include <linux/timer.h>
  18. /* #include <asm/system.h> */
  19. #include <asm-generic/irq_regs.h>
  20. /* #include <asm/mach/map.h> */
  21. #include <sync_write.h>
  22. /*#include <mach/irqs.h>*/
  23. #include <asm/cacheflush.h>
  24. #include <linux/string.h>
  25. #include <linux/time.h>
  26. #include <linux/fb.h>
  27. #include <linux/debugfs.h>
  28. #include <m4u.h>
  29. #include <mt_smi.h>
  30. #include "smi_common.h"
  31. #include "smi_reg.h"
  32. #define SMI_LOG_TAG "smi"
  33. static char debug_buffer[4096];
  34. /* --------------------------------------------------------------------------- */
  35. /* Debug FileSystem Routines */
  36. /* --------------------------------------------------------------------------- */
  37. struct dentry *smi_dbgfs = NULL;
  38. static int debug_open(struct inode *inode, struct file *file)
  39. {
  40. file->private_data = inode->i_private;
  41. return 0;
  42. }
  43. static ssize_t debug_read(struct file *file, char __user *ubuf, size_t count, loff_t *ppos)
  44. {
  45. int n = 0;
  46. return simple_read_from_buffer(ubuf, count, ppos, debug_buffer, n);
  47. }
  48. static const struct file_operations debug_fops = {
  49. .read = debug_read,
  50. .open = debug_open,
  51. };
  52. void SMI_DBG_Init(void)
  53. {
  54. smi_dbgfs = debugfs_create_file("smi", S_IFREG | S_IRUGO, NULL, (void *)0, &debug_fops);
  55. }
  56. void SMI_DBG_Deinit(void)
  57. {
  58. debugfs_remove(smi_dbgfs);
  59. }