OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 F% \3 ]! [* y# P6 U2 M
  1. [code]EDMA sample test application
    / z( w( w$ S  d1 J( Y3 o
  2. /*
    8 d9 _8 |5 |/ K' [% S
  3. * edma_test.c
    ' }3 Y3 O% D" P
  4. *
    - G; u9 Y, r; l/ [! d6 a! O& m
  5. * brief  EDMA3 Test Application9 a% U+ a6 T: U! x2 ?: s1 z3 i
  6. *
    9 p( }0 k, p8 Z0 @4 p
  7. *   This file contains EDMA3 Test code.) d9 o" b5 D! I$ B
  8. *
    9 k. H- g( y% t1 y5 y0 \' u8 Z% z- I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. V5 e/ d3 X9 w4 g/ {2 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 U6 x  l1 J! K( K+ ~3 B. f2 g
  11. *         TO CHANGE.$ t2 P- _8 l3 l5 e/ }, b
  12. *- v% D  Z0 w2 ?. |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ Q8 ?7 Q: r2 n/ i4 w- a+ P
  14. ** `3 q* e& R& j- g6 E6 n# w3 ~
  15. * This program is free software; you can redistribute it and/or
    1 y( F- |3 a+ q3 g8 w; w
  16. * modify it under the terms of the GNU General Public License as$ X2 w! H. X9 i* `4 v
  17. * published by the Free Software Foundation version 2.
    + \2 k1 m# r4 ^2 z! O' S* y! ~; g: @
  18. *
    4 G& P7 U$ a- g& d8 c" m) Q6 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + z& D1 `7 V$ G( Q% t
  20. * kind, whether express or implied; without even the implied warranty7 Y: `" ]$ j, }4 ~/ k; ]& V! S3 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 F( {2 Z( f6 |/ m0 W+ J
  22. * GNU General Public License for more details.
    # j% X3 P& ]6 [# {
  23. */  }# b0 V1 w" P9 g0 p

  24. 3 X9 W. E/ g* Z& Z, ^% s& U
  25. #include <linux/module.h>
    8 z$ ]# p( X) e' [7 r
  26. #include <linux/init.h>
    3 r4 d, `5 k9 @+ v& ?' ?
  27. #include <linux/errno.h>
    5 I* B+ u. y0 g
  28. #include <linux/types.h>
    * }0 E3 x4 r/ {, Z" @
  29. #include <linux/interrupt.h>6 f4 P+ h4 b# F5 t6 g/ _9 J+ \
  30. #include <asm/io.h>
    , b: C7 s! J# l
  31. #include <linux/moduleparam.h>- D& l, q7 w% ~4 U5 x  O- e
  32. #include <linux/sysctl.h>1 S/ q' a& t  K5 q6 ~
  33. #include <linux/mm.h>
      W7 P# G* |: {, p. o  ^' s& o+ ~
  34. #include <linux/dma-mapping.h>3 ~) v  r7 Q3 s, m$ s  c
  35. # q5 D# p1 T# D8 T5 c4 e: I, z7 l
  36. #include <mach/memory.h>
    " f9 o1 q0 B) r' ]9 a
  37. #include <mach/hardware.h>1 x+ d, @# u% U2 L  k
  38. #include <mach/irqs.h>
    4 S1 M( P7 R. d8 F; d
  39. #include <asm/hardware/edma.h>7 n. g3 ?- @% `; ]
  40. ! V; H1 j3 T7 _8 h% @
  41. #undef EDMA3_DEBUG
    . W. J1 E9 S* @! _2 E: A% c
  42. /*#define EDMA3_DEBUG*/; k9 i; U9 e; Z8 a3 G

  43. 3 F. ]1 M+ r+ K3 K* H1 E8 j7 p- l
  44. #ifdef EDMA3_DEBUG/ f  i6 S$ q) F  E2 b5 U  P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 Z4 ]* T9 V' P2 e1 Y7 N) ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- J0 {! G: q8 n9 y$ Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  I* b) y/ M3 @; W3 u$ T
  48. #else0 K% a- H; y, D& B
  49. #define DMA_PRINTK( x... )' D& [" V( S9 @9 e' \  S; L
  50. #define DMA_FN_IN
    & I: p# Z9 ~& A3 p
  51. #define DMA_FN_OUT
    ' D# \% r9 [8 m6 l0 q
  52. #endif
    3 E2 s: w7 v  E4 V

  53. , |/ N7 s! a+ o' S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 R  Y8 a" j4 S8 y- W& |6 q
  55. #define STATIC_SHIFT                3
    . U% ^4 g! d9 K8 `) ?- x
  56. #define TCINTEN_SHIFT               20. v9 `9 B2 n9 i8 t' E- ^! ?- J% \
  57. #define ITCINTEN_SHIFT              21
    4 ~8 @! E% |& U% o5 o: f
  58. #define TCCHEN_SHIFT                22
    9 M8 V' }! B5 Q- ^$ }( c4 ^
  59. #define ITCCHEN_SHIFT               23
      k0 ~0 s1 F5 i5 y

  60.   s$ x1 `4 Y) \+ P9 o3 {
  61. static volatile int irqraised1 = 0;
    % [" S$ N5 N7 R! a! t% ~. H" I0 I9 G
  62. static volatile int irqraised2 = 0;
    # \: }: @, ^- {$ k' F" T3 G

  63. * w, o. I7 O4 T' S; m& f1 |1 v# S+ s2 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ^/ I6 {8 d$ t9 ]' @6 V* V1 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ }8 ^; v: ^' ]  X9 K/ r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + S8 V$ J4 c/ r9 y

  67. : O  W7 b+ g' D* x! l$ \
  68. dma_addr_t dmaphyssrc1 = 0;7 e8 Q# i: S* j" D$ S! v
  69. dma_addr_t dmaphyssrc2 = 0;
    5 ]$ S4 A/ N( p- W1 S8 E% W
  70. dma_addr_t dmaphysdest1 = 0;
    ! o  C- E- H, m8 m
  71. dma_addr_t dmaphysdest2 = 0;
    # K. m, Q* M& k. o
  72. ' c! o- N0 }7 B+ ~2 q/ I' \
  73. char *dmabufsrc1 = NULL;8 a7 |$ S+ A* O5 r" N$ j
  74. char *dmabufsrc2 = NULL;  G5 Y0 d' Y; g4 l+ b7 @8 H' E
  75. char *dmabufdest1 = NULL;! Y2 z( y& p3 r
  76. char *dmabufdest2 = NULL;; A. x) O3 r2 a7 i
  77. : C, |: z4 C7 ~! |
  78. static int acnt = 512;# G% L9 I( t5 C% F
  79. static int bcnt = 8;9 V. N! h4 N1 s
  80. static int ccnt = 8;* ^0 e& Y1 T; m! M) ~9 t# a
  81. 7 p% c- X( }6 M
  82. module_param(acnt, int, S_IRUGO);
    1 b/ H" O) t! {" J  D8 h' E+ n
  83. module_param(bcnt, int, S_IRUGO);+ I' j6 u; R1 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ k1 v2 I1 W- g" T% v. M' t) W% G* r0 z/ n  N  g, g- B: _! a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 @- }9 N" `5 A, `( J1 k8 R& ?arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" U# p3 `! [, x% A7 @6 ^3 E% v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 k+ X% V4 [* O6 Z* R. f+ ^
* J  w3 n5 I) C; C9 e2 @
8 c1 @2 M3 j2 ~& V! g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-2-2 09:27 , Processed in 0.040086 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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