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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& x; i  z' L) U. r& E
  1. [code]EDMA sample test application6 x6 M1 \, {, p9 n9 b6 |
  2. /*1 _/ s# X4 r& ]3 v0 P0 T
  3. * edma_test.c& Q' t5 I5 I4 V: o5 h+ y; p
  4. *
    ) {. k1 c7 m% n. `
  5. * brief  EDMA3 Test Application
    8 ]! ~+ q; Q2 K
  6. *
    : k% H# H+ d- Y  S8 ~
  7. *   This file contains EDMA3 Test code.
    3 _9 H  U* }$ z
  8. *
    ; |# c/ q. T1 @% _$ v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) a& o( @1 q* t4 h# Z* `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! |, D% U, h6 j' J4 ^
  11. *         TO CHANGE.
      L* O4 l9 `% M+ a) J) c# C6 Y
  12. *4 X  y2 c+ _! ^' V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 S+ x& K2 Y7 w7 q$ b$ H
  14. *4 Z8 P' r( o6 |2 u! r- R3 W
  15. * This program is free software; you can redistribute it and/or
    % y. k- l4 I5 h8 A1 P
  16. * modify it under the terms of the GNU General Public License as; Q8 Y# J3 ?" I6 U
  17. * published by the Free Software Foundation version 2.
    4 P& v* \$ |% k! }* n+ x! E
  18. *
    % s; Y3 Y5 D3 Y: H& A* i( w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 p1 M5 h- i+ V. H* d0 }
  20. * kind, whether express or implied; without even the implied warranty
    * ~) L( x/ ?/ c+ O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 H2 Y' E7 }9 o  G$ F2 O( z$ g5 w
  22. * GNU General Public License for more details.0 l2 P1 X3 C# i
  23. */
    . K# h) r  Q, ]" g# I
  24. , ?# K- z; |3 z) }+ k
  25. #include <linux/module.h>* Q2 z% ]$ |7 }
  26. #include <linux/init.h>
    5 v5 T( W) \2 q; h
  27. #include <linux/errno.h>
    ) U0 \" E2 ?6 H! h2 Z
  28. #include <linux/types.h>
    3 U; R% d% L& ^, e1 K& C
  29. #include <linux/interrupt.h>
    - ?& g; \. u3 a$ p
  30. #include <asm/io.h>
    4 V1 Y: v' T; w% R; |9 [
  31. #include <linux/moduleparam.h>, z( J- v# w. P+ j
  32. #include <linux/sysctl.h>) l3 V& a$ A6 ]2 ^1 `% D( q9 m
  33. #include <linux/mm.h>
    " c4 s9 A3 Q9 u6 z( s6 M( X
  34. #include <linux/dma-mapping.h>3 x( j% M% s3 u4 \9 S

  35. ! i/ I& U" |0 z1 z# P2 \& @* p
  36. #include <mach/memory.h>/ B4 f0 ?4 `6 v$ }+ `9 ?
  37. #include <mach/hardware.h>! j- A  ^' b; ]! ]9 N
  38. #include <mach/irqs.h>" x( h; b4 I, p5 F4 Z
  39. #include <asm/hardware/edma.h>
    ' G' {' v. J& K

  40. 7 l8 Q1 o; X# |& T  q/ I. S2 e
  41. #undef EDMA3_DEBUG  U: z3 \* S  H5 w$ O
  42. /*#define EDMA3_DEBUG*/
    ' Z8 [! J/ d" Q: q' F' x+ Q* p

  43. % T! I$ s+ k  c' }, l- u% [1 [0 e
  44. #ifdef EDMA3_DEBUG+ y4 E/ ^3 R1 ]% t3 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ i2 _4 h" c3 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 \; p8 C9 f1 `- K- b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 C( i. n7 d* ?5 Q* S
  48. #else
    ! z# f, f& @- D2 M, [
  49. #define DMA_PRINTK( x... )
    ) A: i7 g  ?! G
  50. #define DMA_FN_IN( R. d4 |9 `4 f1 `* V
  51. #define DMA_FN_OUT
    : H7 D( j6 W' O3 ^2 S7 O
  52. #endif
    : a0 x& c# s! X3 R* m- A. u8 z

  53. % P/ N, j+ b; q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 i# y, C2 ?& H" [3 K! g; V4 t
  55. #define STATIC_SHIFT                3
    " @% Y- Z; K9 V1 o: H
  56. #define TCINTEN_SHIFT               202 H1 B: T, X* o7 N. O4 ?
  57. #define ITCINTEN_SHIFT              21  s% a7 ^; p- s3 f' u+ E" ^
  58. #define TCCHEN_SHIFT                22
    , H; c: S. X  @: x( b  L: u
  59. #define ITCCHEN_SHIFT               23
    % B3 B  J! x# ^. g4 P# R6 a! B, A

  60. 0 d9 U; o4 k7 f1 O
  61. static volatile int irqraised1 = 0;
    ( j) ?- e1 d( [+ m. Q9 c6 Y# G
  62. static volatile int irqraised2 = 0;
    . Q! b" Z7 l$ l5 ^3 i" ^4 C( U/ f
  63. 1 m( b) ]" q0 R6 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ?3 ?  R8 k: F' {$ G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* i8 b3 L( `' k5 x0 Z: g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) r# k7 Q! ?" c1 r
  67. 0 {' g  r$ t8 d% B
  68. dma_addr_t dmaphyssrc1 = 0;
    9 o4 {# G8 X  ~8 t/ b- c- a' F( t
  69. dma_addr_t dmaphyssrc2 = 0;% o9 ~2 f/ X* Q, E  q, b
  70. dma_addr_t dmaphysdest1 = 0;; |! a, l; Z& O$ {9 m, v* d
  71. dma_addr_t dmaphysdest2 = 0;# D$ A& q. I1 H2 r  b

  72. 0 A  {" p; Z: Q( B
  73. char *dmabufsrc1 = NULL;
      s" i; K  l4 `" _3 ], f
  74. char *dmabufsrc2 = NULL;- P0 S  _' O6 t
  75. char *dmabufdest1 = NULL;
    * O1 P$ H5 ?  I) ^
  76. char *dmabufdest2 = NULL;$ e9 j8 M; r$ z. G

  77. + q+ k& a  F! a' M. c! ?
  78. static int acnt = 512;# H3 R, s9 Z; @5 {  U! Q, F* Q
  79. static int bcnt = 8;" I/ w* ~2 g( R3 n
  80. static int ccnt = 8;( J! a9 U6 A8 [2 U* O' g% R
  81. 3 J  |% L" s/ @& p6 G( X
  82. module_param(acnt, int, S_IRUGO);
    3 k! _) k' R- m- \9 Z
  83. module_param(bcnt, int, S_IRUGO);! R8 ~7 D/ m! a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 A' O8 V' i" T' i% D3 S
: V" I/ ~4 B! R4 h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- t3 v( M) |/ e% A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" P; r1 L2 e% m( U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* n3 ?+ t+ B% u/ {/ O! j
9 W9 N2 O) c3 F5 _0 g. p2 K4 M8 J7 Z. _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-30 07:44 , Processed in 0.040804 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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