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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 j" j. w5 y3 z* A; ~. z, a
  1. [code]EDMA sample test application
    ; @7 O4 c% d9 q
  2. /*/ I" C# M: m& Q
  3. * edma_test.c
    $ s0 }3 J" G' ~# o. Q5 P
  4. *
    5 [. R" a' O, q- y& ?
  5. * brief  EDMA3 Test Application
    1 k& |8 K$ u, S: J2 \9 k
  6. *4 |' _6 y" B* m4 \* p& D
  7. *   This file contains EDMA3 Test code.& g, r* ~( s4 L
  8. *
    " A* y$ c- T6 n. H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - C! V' _! y8 L  s/ K$ P5 q  v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 ~$ W8 B/ [5 W5 b" \
  11. *         TO CHANGE.9 j9 X8 k3 G7 r; r3 a  j5 G
  12. *  ?* V7 y- k8 v1 [, _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 y0 {0 N+ `9 w* A  w- n: N
  14. *
    & w- S, n0 Z0 U" x
  15. * This program is free software; you can redistribute it and/or- I- n1 N- d/ x; w/ Q& `% u
  16. * modify it under the terms of the GNU General Public License as
    1 c- o" r- W6 d
  17. * published by the Free Software Foundation version 2.
    8 D9 r1 s% N2 S
  18. *
    4 f  M' R" O6 }6 M  e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & F  ~) |/ f6 C, Z
  20. * kind, whether express or implied; without even the implied warranty
    2 V& p" |7 w4 O- C$ ^6 ?  l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 ?0 s- Q4 }6 k; w3 L+ V
  22. * GNU General Public License for more details.
    . p: X) g8 u; ~! o- I$ T. f2 H
  23. */
    0 j+ ~8 z3 u7 }
  24. 9 N& y/ W' J. Z5 c8 Z. `
  25. #include <linux/module.h>) Y+ V/ |. s0 h" S5 e+ s/ A
  26. #include <linux/init.h>- ~- ^9 q3 K. h1 a  x1 ]
  27. #include <linux/errno.h>7 F5 {( M3 e% c4 F$ E
  28. #include <linux/types.h>( I/ O3 _6 o, u: ?
  29. #include <linux/interrupt.h>: l, h+ a3 Y1 O- K: h! V$ ]& N
  30. #include <asm/io.h>
    1 F; ]' j+ X2 Q7 B
  31. #include <linux/moduleparam.h>5 U: V' p( w: w( G% r- {: f
  32. #include <linux/sysctl.h>
    2 c% z) h$ k. c( C8 _+ ?- _. g! p, z
  33. #include <linux/mm.h>; g+ M6 G; O; w1 V2 _
  34. #include <linux/dma-mapping.h>0 I3 J" M" Z* B
  35. ! ]5 I. `! q5 {  F& g5 P. C9 Y& I
  36. #include <mach/memory.h>
    , \6 f1 A$ y8 \5 E4 j
  37. #include <mach/hardware.h>6 `) i. ~* {0 t+ _3 F! F
  38. #include <mach/irqs.h>* x9 Y2 {' [8 {5 N2 {* O! p# y0 W
  39. #include <asm/hardware/edma.h>$ F4 \2 o" M' d6 d0 l+ L: _
  40. 2 v% I* m/ W/ C  o3 r
  41. #undef EDMA3_DEBUG
    ! |+ e3 X4 {" n- B5 r( S8 U
  42. /*#define EDMA3_DEBUG*/8 T1 z6 F; C: K& E: L8 f

  43. ; j. I! L7 h+ A+ ?5 p! z5 W# K
  44. #ifdef EDMA3_DEBUG" w5 Q1 N+ b9 u, j" j5 ]! O1 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 \8 Y. x7 {2 ?" }& G. }  P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% {; Z* a3 A) K1 H/ O* \, G0 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 K. p( R1 s  F
  48. #else( k4 _% S( T+ q7 q: c) t+ q4 b
  49. #define DMA_PRINTK( x... )
    ( }6 ]- x' [, {
  50. #define DMA_FN_IN" K: ?/ ?# S* Q: m" l% Z; g
  51. #define DMA_FN_OUT
    , W8 c: Y6 S3 J
  52. #endif! E4 m5 q( H- {: U2 i$ u
  53. ! k& u) j: \( c& m6 C' u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , w2 |( M. ], q5 i: B$ [  ~
  55. #define STATIC_SHIFT                3
    , H# u8 o8 S* A4 Y( N1 c  f/ l
  56. #define TCINTEN_SHIFT               20
      y9 h1 [3 W$ T3 L
  57. #define ITCINTEN_SHIFT              214 l1 u, T- H, p( X! U- Y4 t6 e
  58. #define TCCHEN_SHIFT                22
    - M0 l6 c$ D" h2 Y& W
  59. #define ITCCHEN_SHIFT               23
    - Y7 m) S3 O" }3 _# O% F6 Z
  60. 8 u1 }+ O+ l: L
  61. static volatile int irqraised1 = 0;
    5 r, ?) H% y* l5 J
  62. static volatile int irqraised2 = 0;
    : l; M- F" C' A. a$ w
  63. * }2 L3 E4 a, I6 d: k. P* m6 }4 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& q3 \& M$ R0 O) i8 v$ A* b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 J$ a* _! H% U+ P& v* h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 e# x4 Y9 b) c0 F
  67. 6 b/ c: Q8 Q6 v1 T  r
  68. dma_addr_t dmaphyssrc1 = 0;
    / C& w0 f+ z3 i1 ^. @
  69. dma_addr_t dmaphyssrc2 = 0;
    ' V* `" y4 D7 Y% Y
  70. dma_addr_t dmaphysdest1 = 0;6 o, P# N  l+ V0 t1 z( O/ z
  71. dma_addr_t dmaphysdest2 = 0;
    0 m! v+ Y7 A" r9 a, m7 S% |) y
  72. 4 q7 N! q% m# O( a
  73. char *dmabufsrc1 = NULL;
    $ m" Z( W% i9 C# R1 M# H
  74. char *dmabufsrc2 = NULL;7 v/ z0 e7 U# u; B/ x) G
  75. char *dmabufdest1 = NULL;) t3 ]  S5 C& a# S: {
  76. char *dmabufdest2 = NULL;; W8 l' f, x6 P
  77.   [8 o! |7 ^: R! H  U
  78. static int acnt = 512;
    7 ?9 y% U5 h: m$ N. V  d# k. ?2 Z7 G
  79. static int bcnt = 8;
    1 c5 J  @1 s( [" D7 ~( w
  80. static int ccnt = 8;
    " [, ^" ~( F, l2 s2 X' M( u

  81. ; S: Y& q; n7 W4 O" }) `* u5 ]
  82. module_param(acnt, int, S_IRUGO);6 r) K* [, v% v3 z- ?, U/ O
  83. module_param(bcnt, int, S_IRUGO);! _9 g, ~3 [$ y( H% T3 L6 y  J' O0 y( L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* v9 Z; d' D6 F; e+ Y: v, O
6 Y/ F0 ]9 f  r0 u, a2 ~& J. i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 E! `9 b4 [3 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 R1 `+ S3 z# V$ R& W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) U2 s7 R' R- A+ P% P# w# D; E9 ^7 f; G( G
3 n) u" h9 T! `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 08:51 , Processed in 0.039437 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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