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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; _% t6 b: [7 q  G- ^% C
  1. [code]EDMA sample test application
    8 Q+ x2 x0 W2 z1 O* F  x2 l
  2. /*. O+ L' F2 N6 M3 e( n! i
  3. * edma_test.c$ d$ V- e/ U. |9 X/ M% r# K  N
  4. *
    9 Q' A8 a; A5 u# \8 \( ?0 w* O
  5. * brief  EDMA3 Test Application
    9 B% v4 W* q0 G- g
  6. *0 L2 k  i3 B' a  v% \. U: i+ d1 i
  7. *   This file contains EDMA3 Test code.
    . \! t! G/ M# T- h# x
  8. *0 D$ r5 [1 o0 ?0 ?$ X% E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ b) Z3 c8 g( F$ u- @$ s7 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . y- v; C2 R8 m
  11. *         TO CHANGE.
    ( w; s% |3 E/ c5 A
  12. *# ?/ |9 ^9 K/ b3 R- k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. }3 k! @) K6 ^7 K( F
  14. *
    % A$ ]: [/ s* e' W
  15. * This program is free software; you can redistribute it and/or
    8 i4 m7 [" L: K5 ^6 U9 n
  16. * modify it under the terms of the GNU General Public License as; S' S# O& X3 R: \5 B7 J
  17. * published by the Free Software Foundation version 2.
    : o7 _, t8 w8 b- E9 k, p" s* Y
  18. *
    : T1 |5 F7 H' b& R' |  g8 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; o2 d: l* e6 j! c; C' n4 g
  20. * kind, whether express or implied; without even the implied warranty6 _' H& C( h( z$ x; C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' V, N5 R! P& K
  22. * GNU General Public License for more details.1 q1 q, f* u3 p0 g8 A  ?: |
  23. */
    $ W* s0 b1 p. o" B/ a
  24. $ k/ j- Z) N5 K' a
  25. #include <linux/module.h>( k& e* p' V: b
  26. #include <linux/init.h>
    , d4 f/ E, }2 D5 [
  27. #include <linux/errno.h>) W) m+ Q! b# a, d" {* ~, Z
  28. #include <linux/types.h>( S) j+ [8 I5 L  l3 V
  29. #include <linux/interrupt.h>$ z, Q" V! L6 `9 G+ z1 L& y
  30. #include <asm/io.h>+ X  A2 ]5 k( P. J
  31. #include <linux/moduleparam.h>
    $ ^$ ~' v& e% \; D* c: Z. K' k
  32. #include <linux/sysctl.h>+ U5 h9 _2 [9 r" B; f
  33. #include <linux/mm.h>( k0 O* ~+ T/ y6 W
  34. #include <linux/dma-mapping.h>
    4 f* o1 Q$ G" C* `6 e* ]

  35. 2 x$ i4 d- {+ x
  36. #include <mach/memory.h>
    ( L5 k# A6 t3 W! ~& |
  37. #include <mach/hardware.h># e3 u/ Q! t  p0 N
  38. #include <mach/irqs.h>
    6 P. E# }. S) }
  39. #include <asm/hardware/edma.h># i% H/ C- c% Z" a* c2 N: d

  40. & b: b' e# R& n+ j& ~  M& V
  41. #undef EDMA3_DEBUG
    3 i( y0 ]2 b: u6 }4 W. X
  42. /*#define EDMA3_DEBUG*/
    7 s8 @* N8 O. w2 e, p6 B
  43. " N6 E3 p% T2 i& N4 ]4 P2 D5 w+ i( A
  44. #ifdef EDMA3_DEBUG( \0 V; x/ S& L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % N/ `7 ~# p  C( ]" J! G& t0 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! S  _) z4 H4 T: D3 a- A' ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), w. v6 r8 J% u; V" K
  48. #else
    1 N/ `6 r8 V$ K. n+ b0 X6 g( Y' F5 [/ V
  49. #define DMA_PRINTK( x... )
    " w& ?1 o+ a) M4 t- X) o
  50. #define DMA_FN_IN
    " W( v8 K# ~  x, J  @( E7 u
  51. #define DMA_FN_OUT
    + b9 e6 j. |$ l6 O: D$ W+ w0 }
  52. #endif
    5 l7 U+ i' P' G; M' k1 b7 f
  53. ! C! _0 r0 \5 t  Z: ~0 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 Z& w' U* Q/ ^, b+ R7 V) y4 L, A
  55. #define STATIC_SHIFT                33 j7 s3 W! k+ i2 q
  56. #define TCINTEN_SHIFT               20# f# D! q: u8 k$ v# w' ~7 w
  57. #define ITCINTEN_SHIFT              21& [6 O, s3 @+ H4 D% R
  58. #define TCCHEN_SHIFT                22' D5 O: P4 ]/ z: ~+ H2 g8 I3 N
  59. #define ITCCHEN_SHIFT               23+ h# n7 B0 J' m+ K6 Z. g

  60. * t- ~2 M" o- s: t: X
  61. static volatile int irqraised1 = 0;
    ' `( J, h! }6 \7 }4 A: Y! l2 q/ w+ X
  62. static volatile int irqraised2 = 0;, d6 y- R( t8 G9 s
  63. 4 d. X. n7 |1 u. t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C, y2 y" ^4 v* ^: U! t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- J: J+ g* U* D# [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      }" ?- g* z, l( V0 D" h
  67. 5 \/ q4 Q5 X! N# f
  68. dma_addr_t dmaphyssrc1 = 0;
    4 M  k! H7 x( x, S& S+ q
  69. dma_addr_t dmaphyssrc2 = 0;
    4 A7 Q% u7 M2 m: Q- f2 S- t. L
  70. dma_addr_t dmaphysdest1 = 0;
    & d/ Y1 y4 k3 F7 x
  71. dma_addr_t dmaphysdest2 = 0;
    % d% q! M: y) \
  72. 5 P+ q7 Y. c* ^
  73. char *dmabufsrc1 = NULL;3 j+ @: o& D0 S2 \; Z- |- [
  74. char *dmabufsrc2 = NULL;
    # E; y4 l# D9 L# ?4 b+ e, x& a. e1 l
  75. char *dmabufdest1 = NULL;
    2 @) d) D& K* D/ W' B
  76. char *dmabufdest2 = NULL;, o' T- u3 Q, Y1 S7 q4 ?
  77. - ^' d% ^3 S. G! ~8 U1 Z2 N# y) K
  78. static int acnt = 512;
    - a5 b; K; ]3 ]0 T  `
  79. static int bcnt = 8;
    , b% f) |3 E/ s
  80. static int ccnt = 8;1 t) O% L: c  h9 i/ ?9 v0 a  ?
  81. 6 g4 H/ K, E' c* T
  82. module_param(acnt, int, S_IRUGO);& x/ a& k1 ?$ V4 G+ v# f4 C& l
  83. module_param(bcnt, int, S_IRUGO);
    - e4 R) f0 V2 H. Q5 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* U( Z: `3 [: o4 g2 s7 X  a# W: i

' n/ w! V5 y9 X$ S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& R& f- ~5 L( y$ a  marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 s8 S2 _- m$ }4 l  e. I, ?* I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 Y# q- Y) [, [. e) e) H" e/ {3 z
  b5 F% s1 n0 S+ B* a

0 i) B, m* I) w- C0 B! c7 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 22:53 , Processed in 0.039057 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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