OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 8946|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   t0 C; z6 ~1 }. W" D6 e1 K
  1. [code]EDMA sample test application% H' b/ I+ j6 E8 F2 U+ |& K
  2. /*
    3 E, N! i3 v7 J$ H( a  N
  3. * edma_test.c, Q" [7 T1 e. V
  4. *
    $ y( `" m4 a5 J6 Y$ n6 o
  5. * brief  EDMA3 Test Application  H5 c% b* g6 w9 k5 L; L
  6. *
    + S. W6 a1 b% V6 n( x
  7. *   This file contains EDMA3 Test code.8 T+ t. j1 u" A0 U+ P' }
  8. *9 k. |9 J$ ~5 Q( h! H  g4 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 d( R  s- e6 i; r% U- `4 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 i* a* ~7 z2 N& H1 _" K
  11. *         TO CHANGE.3 ?2 [& O; d) J' v) |
  12. *+ r! A  u8 z% y4 O( h& e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - E5 j/ U6 @& O6 l; @$ j$ ^. g# `
  14. *
    4 x% z) X, W! Q; J! S
  15. * This program is free software; you can redistribute it and/or
    0 V! t8 Q& l+ X
  16. * modify it under the terms of the GNU General Public License as2 J. j% g9 L/ O" M# R% {4 }9 t
  17. * published by the Free Software Foundation version 2.
    / b3 f3 s9 B  H
  18. *  U, d4 Z1 e3 a3 `( u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 T4 x+ o' a0 d( d4 f
  20. * kind, whether express or implied; without even the implied warranty
    , k- S! i* E9 s1 {) o) t# ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * n/ ]1 I0 u# ^- M* ?) Y
  22. * GNU General Public License for more details.
    - ^6 L: ~; k) n( U0 J5 r
  23. */; O% a3 h- Q$ D- n* p5 k* I9 F

  24. 9 p1 O2 Y' w; t- M1 x' Z6 k' R
  25. #include <linux/module.h>* D# l& f; W1 l7 u& z9 O
  26. #include <linux/init.h>
    , v2 }- c. ~$ J6 D
  27. #include <linux/errno.h>
    6 t0 A! |' L3 t9 m$ ^5 X4 O" n
  28. #include <linux/types.h>" Q& _  ]' b3 s  m1 [9 B* O$ e
  29. #include <linux/interrupt.h>
    0 V5 L' z' X5 S7 C3 C
  30. #include <asm/io.h># T# z& l, T5 h2 k& P
  31. #include <linux/moduleparam.h>
    & G# L# x4 y* }4 v1 [6 C
  32. #include <linux/sysctl.h>
    . u. m" j/ D- B- Y
  33. #include <linux/mm.h>, S- p) ?2 ]9 S4 _" T  B
  34. #include <linux/dma-mapping.h>
    # W7 l- l4 ~5 S: V
  35. + ?( ]2 L; n1 X
  36. #include <mach/memory.h>
    7 p3 }4 y! f) b: N3 d& ?
  37. #include <mach/hardware.h>( M& D3 f2 L/ @5 L. ~
  38. #include <mach/irqs.h>: e8 o0 `* V6 O, v
  39. #include <asm/hardware/edma.h>
    ; e% ~( Z/ i6 L, ]$ }/ ]; Q/ S) z
  40. 3 N+ O& O% a$ c" h( d) E& |4 o8 S
  41. #undef EDMA3_DEBUG* \1 g3 F8 f$ Q9 h5 v
  42. /*#define EDMA3_DEBUG*/
    ! |3 O  ]$ F  s" l; {$ x% ]

  43. 9 \5 j. v/ U4 A- b8 n# N! y' E4 e8 {
  44. #ifdef EDMA3_DEBUG" ^# R1 c* ~; M8 r$ R" q! I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 e& }. [6 \4 O) T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! m$ I% e* K2 g4 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 N' F' e" z8 ~
  48. #else
    6 k+ f! p- x! M0 q/ Z* w: ~9 a6 X
  49. #define DMA_PRINTK( x... )! q. B- I" S' f4 |, P3 [: b' D
  50. #define DMA_FN_IN
    5 j3 M  u  ]  V) X8 \/ X' j
  51. #define DMA_FN_OUT
    ; J) k7 e( e8 J
  52. #endif$ ]7 ~# |: L* D& S  \' i- o

  53. 1 z  f, Z0 C; e" Y0 P) x, E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 e# j2 _7 A. B( X! v" g! C
  55. #define STATIC_SHIFT                3
    " p3 _& Q0 r$ B, V, P
  56. #define TCINTEN_SHIFT               20
    6 u' ?# B0 y2 r( V
  57. #define ITCINTEN_SHIFT              21
    ; _6 I! a7 S, K. o$ `
  58. #define TCCHEN_SHIFT                22
    & B* i6 G- i: |8 v, J
  59. #define ITCCHEN_SHIFT               23/ T, M9 }2 Y* e4 U; J

  60. : \: }0 G# O) d9 c
  61. static volatile int irqraised1 = 0;
    / A1 `, n, o; o* T4 X- d. W0 a
  62. static volatile int irqraised2 = 0;9 U+ Y  m- W* H# I
  63. , f! `) C! `5 Z; t7 }* p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i2 M9 l& x/ u7 h4 [% B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) _6 L3 D  F) |0 D. z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & K$ I/ U/ C, D" R& i' T( V4 c/ c
  67.   q1 l) r3 K! b0 p
  68. dma_addr_t dmaphyssrc1 = 0;
    ) W( Q! Z5 r3 f' [; {6 I
  69. dma_addr_t dmaphyssrc2 = 0;
    7 _2 z- d8 `( S# I
  70. dma_addr_t dmaphysdest1 = 0;
    * U) c: M' c: ~: h4 H
  71. dma_addr_t dmaphysdest2 = 0;
    + [* f7 T; n( U' C9 F1 U( t

  72. : j% k) f$ x  c- F2 a( A
  73. char *dmabufsrc1 = NULL;
    0 h8 u  j7 i# Z
  74. char *dmabufsrc2 = NULL;2 b3 A! ~; L1 O+ I
  75. char *dmabufdest1 = NULL;
    6 {5 G, }0 u5 Z- c/ B
  76. char *dmabufdest2 = NULL;
    6 H5 n  ~0 W9 m* b- H: Q
  77. 6 {1 q* t, Q8 g- p0 C! C
  78. static int acnt = 512;
    " N. j+ _) X8 j( m1 a9 P+ @0 K% c
  79. static int bcnt = 8;3 @: Y: i2 ]1 o  z
  80. static int ccnt = 8;
    1 X% A. q$ s. V7 r, x
  81. ( I' ~4 ]; f, g8 T1 ^7 U. ]+ s9 B. j' a
  82. module_param(acnt, int, S_IRUGO);
    * |2 |; t4 [" F0 I
  83. module_param(bcnt, int, S_IRUGO);5 R9 j- D2 W1 E# ^% w% ^& V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ K* f+ ]4 D# S* j1 C7 @- q' q2 k) e1 U* e2 [, c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 n6 g* W4 b8 C! q! O: h$ Harm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* p7 d9 Q" I9 c; y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- c, I2 `  ]! h* N! b; c
  Y1 m5 c5 @+ ]1 \  M" S+ \6 ]1 D( m
* W# U' L9 ~! x6 ?& J% V! n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2025-12-5 12:49 , Processed in 0.051034 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表