pwm-s3c2450.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 s3c2450_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 s3c2450_pwm_chan_t s3c_chans[];
  58. /* functions --------------------------------------------------------------- */
  59. /* s3c2450_pwm_request
  60. *
  61. * request a pwm channel exclusivley
  62. */
  63. extern int s3c2450_pwm_request(pwmch_t channel, s3c_pwm_client_t *, void *dev);
  64. /* s3c2450_pwm_free
  65. *
  66. * free the dma channel (will also abort any outstanding operations)
  67. */
  68. extern int s3c2450_pwm_free(pwmch_t channel, s3c_pwm_client_t *);
  69. extern int s3c2450_pwm_set_buffdone_fn(pwmch_t, s3c_pwm_cbfn_t rtn);
  70. extern int s3c2450_timer_setup (int channel, int usec, unsigned long g_tcnt, unsigned long g_tcmp);
  71. #endif /* __ASM_ARCH_DMA_H */