pwm-s3c2443.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* linux/include/asm-arm/arch-bast/dma.h
  2. *
  3. * Copyright (C) 2003,2004 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * Samsung S3C PWM support
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * Changelog:
  13. * ??-May-2003 BJD Created file
  14. * ??-Jun-2003 BJD Added more dma functionality to go with arch
  15. * 10-Nov-2004 BJD Added sys_device support
  16. */
  17. #ifndef __ASM_ARCH_DMA_H
  18. #define __ASM_ARCH_DMA_H __FILE__
  19. #include <linux/sysdev.h>
  20. #include <asm/arch/regs-timer.h>
  21. #define pwmch_t int
  22. /* we have 4 pwm channels */
  23. #define S3C_PWM_CHANNELS 4
  24. struct s3c_pwm_client {
  25. char *name;
  26. };
  27. typedef struct s3c_pwm_client s3c_pwm_client_t;
  28. typedef struct s3c_pwm_chan_s s3c2443_pwm_chan_t;
  29. /* s3c_pwm_cbfn_t
  30. *
  31. * buffer callback routine type
  32. */
  33. typedef void (*s3c_pwm_cbfn_t)(void *buf);
  34. /* struct s3c_pwm_chan_s
  35. *
  36. * full state information for each DMA channel
  37. */
  38. struct s3c_pwm_chan_s {
  39. /* channel state flags and information */
  40. unsigned char number; /* number of this dma channel */
  41. unsigned char in_use; /* channel allocated */
  42. unsigned char irq_claimed; /* irq claimed for channel */
  43. unsigned char irq_enabled; /* irq enabled for channel */
  44. /* channel state */
  45. s3c_pwm_client_t *client;
  46. void *dev;
  47. /* channel configuration */
  48. unsigned int flags; /* channel flags */
  49. /* channel's hardware position and configuration */
  50. unsigned int irq; /* channel irq */
  51. /* driver handles */
  52. s3c_pwm_cbfn_t callback_fn; /* buffer done callback */
  53. /* system device */
  54. struct sys_device sysdev;
  55. };
  56. /* the currently allocated channel information */
  57. extern s3c2443_pwm_chan_t s3c_chans[];
  58. /* functions --------------------------------------------------------------- */
  59. /* s3c6400_pwm_request
  60. *
  61. * request a pwm channel exclusivley
  62. */
  63. extern int s3c2443_pwm_request(pwmch_t channel, s3c_pwm_client_t *, void *dev);
  64. /* s3c_dma_ctrl
  65. *
  66. * change the state of the dma channel
  67. */
  68. //extern int s3c_dma_ctrl(dmach_t channel, s3c_chan_op_t op);
  69. /* s3c_dma_setflags
  70. *
  71. * set the channel's flags to a given state
  72. */
  73. /* s3c6400_pwm_free
  74. *
  75. * free the dma channel (will also abort any outstanding operations)
  76. */
  77. extern int s3c2443_pwm_free(pwmch_t channel, s3c_pwm_client_t *);
  78. /* s3c_dma_config
  79. *
  80. * configure the dma channel
  81. */
  82. extern int s3c2443_pwm_set_buffdone_fn(pwmch_t, s3c_pwm_cbfn_t rtn);
  83. extern int s3c2443_timer_setup (int channel, int usec, unsigned long g_tcnt, unsigned long g_tcmp);
  84. #endif /* __ASM_ARCH_DMA_H */