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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' Z+ G; N' t9 B1 f! |0 m4 J
  1. [code]EDMA sample test application# D! S' }$ l( \  y: j) y
  2. /*6 a1 W. T- H" H# J7 e& N
  3. * edma_test.c7 J: G2 ^% M8 A* L" v
  4. *  W/ ^& q1 u/ S/ h6 g! h. P
  5. * brief  EDMA3 Test Application' a' y* y0 [) L: o! B3 ?  t
  6. *) @$ ?9 b' w. y3 p- u
  7. *   This file contains EDMA3 Test code.. O8 y" L, q  X
  8. *: a& H" p9 g* k/ J/ Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 {/ H2 [% Y: f* ^' d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 U, X9 i7 W" A8 N' Z. ]' U
  11. *         TO CHANGE.+ e' z1 \* O& l; B2 H- ]: i& z4 ^' Y
  12. */ N. Y  Y# w" l7 M9 W2 ?# |& j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " \4 f% Z7 \# T, r
  14. *, y% g2 u4 I9 r2 x  J9 }
  15. * This program is free software; you can redistribute it and/or
    4 }. _4 p7 }1 N8 s( i* e
  16. * modify it under the terms of the GNU General Public License as
    + i8 |% y& y( x7 D' C* k5 Q) R+ N) K
  17. * published by the Free Software Foundation version 2.) f) ~5 `4 o$ k" g$ z' ?7 ?5 P
  18. *" P. T$ [3 K- W4 r0 X# L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 Q% Y* Y5 _9 ]2 u, P7 t( n
  20. * kind, whether express or implied; without even the implied warranty
    - q. {% A5 `) v( \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' w1 c! C( b1 K
  22. * GNU General Public License for more details.. a% g: Q/ Z: \$ s# F/ f
  23. */
    ) j2 s" A8 [" B( s3 T: d' ?3 p4 b
  24. 8 L8 D" E+ H. L& X5 C
  25. #include <linux/module.h>9 }6 V! V: ?0 m) C( v, @: O  f% e
  26. #include <linux/init.h>
    - Q1 K2 W+ @- N. M2 b' Y- |
  27. #include <linux/errno.h>( U2 K' s9 t+ z' {
  28. #include <linux/types.h>0 l8 |) e9 t1 ^0 j' l, l  \5 q% I7 L
  29. #include <linux/interrupt.h>
    " D' p. q3 u9 w0 T. G; J
  30. #include <asm/io.h># D6 n! B0 `! ^0 |
  31. #include <linux/moduleparam.h>
    ) G3 F' H5 l, q+ r, c) c* M
  32. #include <linux/sysctl.h>
    ! h- C7 _$ @4 d( l3 T$ L9 m
  33. #include <linux/mm.h>
    ! U2 \! _0 U) ~. H; u1 l2 J
  34. #include <linux/dma-mapping.h>
    ' G$ w$ X6 S& q9 ?& X& J

  35. # f' A* Z5 P3 w/ u& D1 @
  36. #include <mach/memory.h>
    % \5 X. A# y6 ?. B" ^
  37. #include <mach/hardware.h>+ Q# v0 y) ~, a6 G
  38. #include <mach/irqs.h>
    - _" b- r" C' N2 o
  39. #include <asm/hardware/edma.h>
    # _/ D' {+ c# h/ g1 J/ [9 {
  40. 2 v4 n$ W  c* S
  41. #undef EDMA3_DEBUG
    $ {5 P! i2 @: x. D: s% \  w
  42. /*#define EDMA3_DEBUG*/
    $ x$ B. n9 q9 E! S

  43. 2 H) l3 D3 b9 o0 ]& e
  44. #ifdef EDMA3_DEBUG
    ' w5 }* \% Z. B  h7 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 v& }& X% N% x' z. v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 G5 _. v8 I' ]9 D4 l( j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ B0 G+ |# l, k0 E2 n2 d& q- m+ |
  48. #else% ^! V& P. i' ^2 }9 y4 L: `
  49. #define DMA_PRINTK( x... )" s# N8 V3 r( @7 X4 \+ f2 u
  50. #define DMA_FN_IN
    % v: m2 ?4 r( T' ?
  51. #define DMA_FN_OUT4 s( k$ X' i8 a* c8 I9 w  @* F
  52. #endif
    & f, J2 \1 |7 q' t+ T8 P3 S7 `6 g
  53. ; U3 Z( t" {; l4 R& @! `* |; ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 ]+ C1 `% E! O5 D1 k) \% w# C
  55. #define STATIC_SHIFT                3
    2 ~$ y' v- k+ b4 M
  56. #define TCINTEN_SHIFT               200 i7 [3 h) o% j* f! t
  57. #define ITCINTEN_SHIFT              21
    $ a! r  J. Q$ v% w0 J& Q# @
  58. #define TCCHEN_SHIFT                22
    # ^  v* L: `% q7 d
  59. #define ITCCHEN_SHIFT               236 g+ E* z2 \7 Q( f
  60. - l3 W* c  A5 z6 ?
  61. static volatile int irqraised1 = 0;1 p+ s! T2 y8 H9 p4 o
  62. static volatile int irqraised2 = 0;
    # |% ^0 G" [3 [( R! a9 I# c& x

  63. & S+ S- W; o: A* \; X) }& l: R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 }9 ]- q4 ?( i& {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 j  e8 b; d* l* Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ R- R/ [) x: D2 I$ i, O
  67. / B7 h* M; S% B& S, D+ u) i
  68. dma_addr_t dmaphyssrc1 = 0;) X. r4 e+ n  h( e. ]
  69. dma_addr_t dmaphyssrc2 = 0;4 A% Z5 L+ o6 {
  70. dma_addr_t dmaphysdest1 = 0;9 A. e  V$ T8 ~- C
  71. dma_addr_t dmaphysdest2 = 0;- A6 M# `5 Y+ f
  72. ! N4 z1 p/ I% @$ i1 y# j3 Q
  73. char *dmabufsrc1 = NULL;
    $ ^% P% R! T: ^6 g/ e9 L; v
  74. char *dmabufsrc2 = NULL;$ e  g+ k! ?" O, G2 M& t$ W& P
  75. char *dmabufdest1 = NULL;* s4 _$ D, d3 A
  76. char *dmabufdest2 = NULL;
    4 e2 \1 w" h5 M. l5 W1 Q. z
  77. . Y9 E. a( |" m" }3 S
  78. static int acnt = 512;
    9 h" p5 X+ g; t  ]; F
  79. static int bcnt = 8;. F* a& e  E4 `1 q: d5 W; S
  80. static int ccnt = 8;% f( S& G$ `( V, C$ |* j8 V2 F
  81. ! G% M& B5 r  s! a9 i- R& j
  82. module_param(acnt, int, S_IRUGO);- I) X5 O' O2 c0 F/ E
  83. module_param(bcnt, int, S_IRUGO);4 [' |: e. D  J* m# p/ L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ S, q' Z8 L  P0 l
; L4 \5 o! }' T% `) _- n% X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 j, L2 O9 B0 F3 q- `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 w8 ?8 D. X9 |* A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 C6 B4 U/ t' n, i, ~  G5 e
& n+ N0 l2 r, g3 b
. ?+ N- ^/ g/ V4 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 07:16 , Processed in 0.041027 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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