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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 j) x+ R& ?9 W3 g+ Z
  1. [code]EDMA sample test application
    ) V' _3 z/ J% h$ Y4 H& O, {6 S
  2. /*; U+ @4 X7 C2 w$ v! z' C
  3. * edma_test.c6 k3 {2 P% ]3 X$ A) O# q% f# x
  4. *
    6 I0 Y# r# q5 P' E& }4 s! h
  5. * brief  EDMA3 Test Application: Q, P! w, W. |# ^5 U
  6. *
    # P8 n5 M3 F' ?2 A4 [
  7. *   This file contains EDMA3 Test code.5 \  K; S5 G- I4 F" I
  8. ** p% u5 `  x3 t+ K( L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 u1 i$ A- ^' ?+ n! U# F: b% D- L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 `7 G' j, f; U. J( X; d2 f5 G
  11. *         TO CHANGE.3 t* U$ s( p" X+ V/ o$ f
  12. *  o" T2 f  x$ M9 v% k( Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 m! d# T0 A/ w; t; ]0 p
  14. *
    % ]  T+ V% [3 U- o6 j1 Y( v
  15. * This program is free software; you can redistribute it and/or
    5 Q. K2 ]. Z( f6 G' x
  16. * modify it under the terms of the GNU General Public License as
    1 W& w) K$ l1 P! I, K6 t7 W" L
  17. * published by the Free Software Foundation version 2.4 R% |& U  d; ?) U  D* h
  18. *
    0 f2 f1 g( N8 k- p6 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 y0 }& t6 R  `  A9 s1 D3 U, G" r
  20. * kind, whether express or implied; without even the implied warranty  m' O3 w$ d9 Y8 v( v5 [% Y1 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; l( ?. Y9 |- U: i
  22. * GNU General Public License for more details.
    ( p9 G" Q$ t* c+ I
  23. */
    % S' r) D9 j* H0 v2 U6 s& q

  24. 1 E9 o, t# M2 ~  Q# G) s& z
  25. #include <linux/module.h>! F. \% Z+ g% f- S
  26. #include <linux/init.h>
    8 H+ }0 G4 |8 I% D% w9 H8 Q5 R
  27. #include <linux/errno.h>
    3 M* M" q  v1 _( z
  28. #include <linux/types.h>: e$ @) C) s2 |
  29. #include <linux/interrupt.h>+ \$ Q" J3 b( y$ o5 P% @
  30. #include <asm/io.h>' j1 _$ o' C; y& I# o5 v
  31. #include <linux/moduleparam.h>' s5 ^2 ]7 U' v- z4 i7 T% O
  32. #include <linux/sysctl.h># w) o$ a# u2 z  E: U5 X
  33. #include <linux/mm.h>
    % ~0 ?, W( p; D6 [2 }# ^
  34. #include <linux/dma-mapping.h>
    6 R: F, t# B6 z) K

  35. % A0 X. ], G5 y; |0 O% B* E
  36. #include <mach/memory.h>
    ) v& A  U* d; L5 C: W& k
  37. #include <mach/hardware.h>- @7 w  x; Q" d( H7 I+ P! ?4 Z3 N
  38. #include <mach/irqs.h>1 G& j) n6 V" G$ R
  39. #include <asm/hardware/edma.h>' t+ v" k0 L+ m) k. {  A

  40.   X  _9 q& ]5 K* t
  41. #undef EDMA3_DEBUG; P( ~( D  }4 W6 O; E3 }
  42. /*#define EDMA3_DEBUG*/
    $ q1 o" ~% E$ f3 t" t
  43. " E; C/ J, `6 X& }
  44. #ifdef EDMA3_DEBUG
    1 Z% F# ~8 f& h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 R% h5 ]: }" c- Q: n4 n0 Z2 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 t7 z! o, I8 g& I: y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ~" U2 W* X6 \7 A) }: E2 f5 d* j9 B) e
  48. #else: `+ E6 f4 p; |5 w8 v9 Q
  49. #define DMA_PRINTK( x... )
    2 d+ z, C: w1 b2 ?" v0 S# Z
  50. #define DMA_FN_IN, H9 ~1 E3 i* G# c- e: c! a, c9 f
  51. #define DMA_FN_OUT
    & {) d4 q8 i+ E% z# H2 A; z9 c+ f
  52. #endif
    1 H4 Y% X& C% N5 ]

  53. ) e' H5 `) c6 D  r* ~1 y8 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); ^5 s9 v2 w, V, @/ C
  55. #define STATIC_SHIFT                3" H2 `' X: b) \; b
  56. #define TCINTEN_SHIFT               20/ L; ~9 B8 B" |6 }; z4 `2 C# D
  57. #define ITCINTEN_SHIFT              21: g" J% N  i* M3 s3 t4 g
  58. #define TCCHEN_SHIFT                22  R7 @# \- O+ c) }
  59. #define ITCCHEN_SHIFT               23' @. M' C( i* y

  60. " d5 ?( M$ `$ M% L. R% x) Y9 ~
  61. static volatile int irqraised1 = 0;8 ~* S% O' j* ?+ P
  62. static volatile int irqraised2 = 0;
    ' [/ Z8 Y8 I( X3 r0 d

  63. : H5 i9 k6 q  T! Y' e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + T) ~9 b3 C1 A& L3 E! `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , H, J9 q9 @: A4 ]1 [9 n: ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% d1 J- j3 e2 W
  67. # @9 d+ M! w& [- \. l
  68. dma_addr_t dmaphyssrc1 = 0;
    + h$ J. ^7 j9 e% t3 _- @$ e/ u
  69. dma_addr_t dmaphyssrc2 = 0;
    6 o' Y9 u) f% z
  70. dma_addr_t dmaphysdest1 = 0;2 {- `( |* [( t) t: k  M+ A
  71. dma_addr_t dmaphysdest2 = 0;
    1 U: l2 X; M+ ]+ v4 h& M  X

  72. 1 j. s: P  O7 I/ c
  73. char *dmabufsrc1 = NULL;5 j9 ^: l" a2 g# f6 n4 p. Z- k: S8 L
  74. char *dmabufsrc2 = NULL;
    % a* p1 j- r! q4 C
  75. char *dmabufdest1 = NULL;
    ; j! R+ I* @0 q* L2 F4 ?5 K5 h* c
  76. char *dmabufdest2 = NULL;
    5 k+ ]% h( Q: p* p& U

  77. % u7 V5 H  K6 ?/ R, b
  78. static int acnt = 512;
    ( @& u! Q" L& O  F( ^9 c8 M
  79. static int bcnt = 8;
    0 ~( X8 V' \1 P2 L4 `: v8 t6 ]
  80. static int ccnt = 8;
    6 p( w) A  G8 H
  81. 8 S# M& }  s7 ?2 `  U3 c
  82. module_param(acnt, int, S_IRUGO);& H+ r. T+ l+ w5 e. F0 G& x
  83. module_param(bcnt, int, S_IRUGO);! i4 e( d4 ]1 q5 P. z8 b$ `: e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# ~' W. ~+ [! x" X+ P$ e
/ i8 ^. M6 C. S; w* ]( n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% K; _9 s% g  b; Y1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" I) ^7 S7 ~7 W4 Z5 I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( \- |; n8 D& \' f/ p2 ]0 ]$ Z# N+ h9 n
/ B2 |7 b9 I2 H
  d; L/ e! L. n$ `% o/ y8 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-27 00:27 , Processed in 0.046061 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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