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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 z: ]9 z/ V) s$ e+ f2 D* z
  1. [code]EDMA sample test application
    * ]" _7 C* ^5 U* v$ N
  2. /*3 E! w' P* l. N- K9 m6 C9 I* w
  3. * edma_test.c5 o, V1 x1 R  d# a/ ]& o2 h
  4. *; M+ @( Z& D2 W
  5. * brief  EDMA3 Test Application
    1 q) f5 R9 T: s' M# s" }2 T9 d
  6. *
    6 y' H* V4 O7 C. r+ z4 s
  7. *   This file contains EDMA3 Test code.
    , I5 R6 e+ u" S; n$ R
  8. *& X7 F0 v# M1 b# b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; |( S; h4 V3 X$ Y, H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 E& W$ n' o4 Q& R# Z' S) Q4 {
  11. *         TO CHANGE.4 r" f: O) N6 I
  12. *! r2 N) p0 q& X3 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) h, k1 ]( S* |; o
  14. *) x7 ^- a* B- \$ a$ v
  15. * This program is free software; you can redistribute it and/or: L' @7 D. R1 J  k1 f
  16. * modify it under the terms of the GNU General Public License as0 f$ k8 |, Y/ L9 e
  17. * published by the Free Software Foundation version 2.
    6 t/ C3 M9 c* w0 R
  18. *, g$ [, }! t6 V+ ^" \: `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 E+ s! s( u+ M; v
  20. * kind, whether express or implied; without even the implied warranty
    + X: B) ^( b) h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 j$ T; B* x9 j, b2 I8 _& z
  22. * GNU General Public License for more details.
    5 N6 H7 q: Y9 c$ ?' @! t$ I" C
  23. */( Y' }4 c2 X" t: ^3 O) {
  24. & Y. q9 B0 G  N! T" V0 r1 d
  25. #include <linux/module.h>
    ( ~" q- e6 H* A6 s3 @; u
  26. #include <linux/init.h>% i$ E9 M9 r! ]5 q2 a
  27. #include <linux/errno.h>* r0 `3 j( O8 [8 v! w9 ?
  28. #include <linux/types.h>
    6 A. i+ ?4 T9 o
  29. #include <linux/interrupt.h>  k8 m* V( ^. ]- `7 w+ T
  30. #include <asm/io.h>6 I( r% r+ a7 o6 K: e
  31. #include <linux/moduleparam.h>
    $ u# z+ }  I, ^  x, t
  32. #include <linux/sysctl.h>
    7 F# V! P- S5 z' i$ A9 B% s
  33. #include <linux/mm.h>
    8 h% V0 l1 y/ [* W' L5 n: Q
  34. #include <linux/dma-mapping.h>
    " t2 J9 Z2 U" Q* U/ x

  35. ( p( Y3 c" N9 k2 h8 z' y! Z
  36. #include <mach/memory.h>
    + M, n4 |) M0 V5 s
  37. #include <mach/hardware.h>
    $ t8 u  E. @$ ~
  38. #include <mach/irqs.h>
    , Q/ l: T1 M# a1 b0 s
  39. #include <asm/hardware/edma.h>
    ( ^# g/ L. M- }; |; Y  c
  40. 8 V; T# D( h# _  {, J
  41. #undef EDMA3_DEBUG
    # z# B2 \$ R  s+ ]2 U2 I
  42. /*#define EDMA3_DEBUG*/' b* {0 I' f" [5 y- Q. B
  43. 1 u" q( \1 u5 R+ Y
  44. #ifdef EDMA3_DEBUG$ w5 |9 G1 l, j  \& V" e6 I. M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( Q4 c* b8 |: O: f/ R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) W* j! X4 e$ Z9 _: T9 o: L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' m1 n5 ]1 R3 J3 m1 c8 m/ L7 P
  48. #else. C) V3 j# o2 x6 f  M( i. r! H& o
  49. #define DMA_PRINTK( x... )
    4 I% x& ]1 r+ n$ p
  50. #define DMA_FN_IN
    ' x. X/ ]$ T1 }6 c$ V2 L
  51. #define DMA_FN_OUT
    ( L3 v. P$ N2 j
  52. #endif
    ! t) R. I. c6 s+ t9 {
  53. 7 r& |' ?) t" z7 ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & E1 b8 f7 E/ x2 s
  55. #define STATIC_SHIFT                3
    9 d# R% }) x  W- k9 |  z( y/ e
  56. #define TCINTEN_SHIFT               20
    ( [5 I: F" G8 |) z
  57. #define ITCINTEN_SHIFT              21
    , X" v5 v- T2 @' q8 n! H/ n
  58. #define TCCHEN_SHIFT                22  A4 h8 X4 I" C9 z
  59. #define ITCCHEN_SHIFT               23+ ]$ ?9 m/ U+ r* o% T& {
  60. ! N4 _$ I# P* N5 W
  61. static volatile int irqraised1 = 0;
      L$ ]# I# B+ Q1 O0 u7 W
  62. static volatile int irqraised2 = 0;
    / |8 p2 U# {) M/ v! z8 P* l

  63. ) d& |6 I% O* Q0 E7 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 d! t2 Z: N- ^# R+ _- Q* t, p; {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' N. y$ J5 z4 o0 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# p- \3 \1 n- g! m9 Y# V; d

  67. / p/ Y; m$ [* ]$ H
  68. dma_addr_t dmaphyssrc1 = 0;" J' m- ^9 H8 [* W
  69. dma_addr_t dmaphyssrc2 = 0;- Z+ l/ k4 O8 ?. j3 |
  70. dma_addr_t dmaphysdest1 = 0;
    9 R) ~+ O* h$ i( T' o
  71. dma_addr_t dmaphysdest2 = 0;
    ! m) u& e, R# J  A

  72. - _( w- s( H, p* R0 b
  73. char *dmabufsrc1 = NULL;
    + j, i! x/ ^! w( p; i
  74. char *dmabufsrc2 = NULL;
    / S8 j4 c7 E& M5 N2 g2 d% @
  75. char *dmabufdest1 = NULL;1 s/ f7 J* r+ x6 T5 o* r+ r$ S
  76. char *dmabufdest2 = NULL;5 G5 U4 i$ {$ H- X; _
  77. ' o. \: U2 [& i8 a5 X& j! M$ _
  78. static int acnt = 512;! \3 ~/ h+ f2 r. f" l5 I! K' p- L5 R4 Q, F
  79. static int bcnt = 8;
    " b" O8 N! l+ k* T0 O
  80. static int ccnt = 8;8 Z8 s/ m! p7 ?. q% l' p

  81. 2 ^! q- ^; g, \0 ]% ?
  82. module_param(acnt, int, S_IRUGO);
    2 M# H1 }$ `* i) G2 @% v. Y
  83. module_param(bcnt, int, S_IRUGO);7 {' r- o* f* G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 L7 Z, B/ g7 ]& J* p& `* O

* T  g3 x5 c8 I, d' O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  }. V* P* |8 W% u# {3 w
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: f/ d" E! r% B7 V" F! j8 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 W2 q+ o$ j  X  N' j; B- ^4 |9 }3 [0 Y- y3 ?" M" l

3 u6 J0 c( J* O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-9 05:31 , Processed in 0.035500 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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