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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 R/ h) O$ J' f' ~: q/ x
  1. [code]EDMA sample test application1 H# E# C* p4 W
  2. /*
    2 {5 G  c3 D& ~1 @
  3. * edma_test.c9 q5 W+ K7 |$ A2 I4 Z/ u9 d
  4. *: ?  K( W" s( d; H0 E
  5. * brief  EDMA3 Test Application
    $ e/ i1 L2 I# o, D* q! X( t$ f' J
  6. *
    ; @  u8 H* q0 ]8 {3 Y1 ]8 Z. b' F) z, [
  7. *   This file contains EDMA3 Test code.
    ( I, j6 r) ~9 w; ^
  8. *
    & G5 Y7 j$ w6 b/ X" G- C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 x& N1 H, s( Y5 @' {$ ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, f) G3 ^. [6 r, W1 H8 w$ V
  11. *         TO CHANGE.' P: _0 ^  x: b* j
  12. *
    3 _5 {) f$ \! x3 L( ~" N- |) K  M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 q) M, c1 T6 ~, N& [( m- b
  14. *
    " e8 m: n2 v7 y
  15. * This program is free software; you can redistribute it and/or9 v+ _( Q! e2 F" R+ y: L7 i
  16. * modify it under the terms of the GNU General Public License as" K  \; }. y) M* G  _9 h8 c
  17. * published by the Free Software Foundation version 2.
    0 v# Y9 s3 E/ ?% h2 Z, l, a0 k/ A
  18. *
    1 U, k4 Q" j4 p. s9 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , \1 c9 t. L' Q0 d. X) g& j3 h4 f
  20. * kind, whether express or implied; without even the implied warranty" q9 i6 Y, v9 c/ q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* _2 i; y4 v$ }& H* d( h% B
  22. * GNU General Public License for more details., s% \. C! Q1 z
  23. */# P; W" E  i! M& L( V( X3 s: E4 I
  24. ) A+ G/ d( [; ]7 n7 j. Z' J
  25. #include <linux/module.h>
    ) ^: I) Z5 M! P. }* m
  26. #include <linux/init.h>5 e" v! j! x2 x+ }  f* t+ M
  27. #include <linux/errno.h>+ r2 O. K6 r% Z6 W/ l2 l! _/ M
  28. #include <linux/types.h>6 c/ @, H; W" v- u+ Q
  29. #include <linux/interrupt.h>* r) |( Z' f) O( ?8 O
  30. #include <asm/io.h>
    3 U% f6 Z$ O3 M) }
  31. #include <linux/moduleparam.h>4 M/ S4 G. W% A8 d! b
  32. #include <linux/sysctl.h>
    3 Z! x- q. m) t0 l" M' a' ?$ p
  33. #include <linux/mm.h>* V5 o5 W3 L( c" h/ Z+ t
  34. #include <linux/dma-mapping.h>
    ' Z( `, E% K0 v* ^

  35. 0 l1 }- t+ D+ }& K9 l
  36. #include <mach/memory.h>
    6 G1 e* s# i7 M3 Y
  37. #include <mach/hardware.h>, E" z0 U6 H3 h0 M1 Z! n, ]
  38. #include <mach/irqs.h>
    + O$ Q3 R" L) j5 W: R
  39. #include <asm/hardware/edma.h>; h" }8 x. C! d3 S$ d
  40. ! K% M& D6 z0 V8 A# ~  _' @
  41. #undef EDMA3_DEBUG4 w* K4 X6 F& K- k
  42. /*#define EDMA3_DEBUG*/9 m1 g% D& J7 p, f. d9 y
  43. 7 h, X" x8 E. w+ E0 _/ r& w
  44. #ifdef EDMA3_DEBUG
    # W( n/ F8 K. G6 H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 T" L. V2 m/ m9 U9 D( m9 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 @6 }5 l6 E# o  f5 l( R6 b' `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 f' e4 `5 A3 \4 l0 j$ D% h6 Z6 k' D
  48. #else
    ! `# u; }( \" a& Q% S5 X6 L4 s$ k% z  S
  49. #define DMA_PRINTK( x... )
    ( O1 T8 t( N" o
  50. #define DMA_FN_IN4 V  {: L' ?8 w/ v4 `, c
  51. #define DMA_FN_OUT' Q* y; T+ e/ [
  52. #endif7 ~. \8 n, ]% Y* O2 c
  53. . R& ]) x4 O9 ]5 u2 i, v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! v/ \) A; k7 f* I
  55. #define STATIC_SHIFT                3: s7 B2 L: P) _; t
  56. #define TCINTEN_SHIFT               20
    ) q" Z2 U! {0 z& c% Q6 `; w
  57. #define ITCINTEN_SHIFT              21
    6 C3 x$ M! }; N' {  o; z
  58. #define TCCHEN_SHIFT                22+ L4 @* ?+ S( C" \( V7 E& S
  59. #define ITCCHEN_SHIFT               23
    ! B+ Q" |$ g& A2 s/ F
  60. 0 k: N  c4 Z0 c) _& s1 R# K! }! \
  61. static volatile int irqraised1 = 0;
    2 @: e6 }" h$ Y( V0 |6 `8 ]
  62. static volatile int irqraised2 = 0;  W, e$ p8 Q' x1 q4 R: g. \$ c; e

  63. 0 [/ C' p% O/ Q: f/ U5 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      [- G! G1 w. A1 x3 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' `: _2 u8 p- i/ W6 T" ]" x- ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; O" d9 S: I- [& `% {
  67. 7 U/ @9 V7 H' C, |# t8 t# o/ |
  68. dma_addr_t dmaphyssrc1 = 0;8 y1 p3 x! U( q& |1 f, w
  69. dma_addr_t dmaphyssrc2 = 0;
      R0 p8 ~5 D; ?' I$ p0 F
  70. dma_addr_t dmaphysdest1 = 0;
    ) T! ^5 c& _& e2 t
  71. dma_addr_t dmaphysdest2 = 0;
    ) d8 v4 V9 ]- _2 p! w0 X0 c) D" y

  72. & Z1 G3 j' \) k6 @
  73. char *dmabufsrc1 = NULL;
    ' S$ y* N8 e% H& ?- Q# k0 {' S7 L
  74. char *dmabufsrc2 = NULL;
    ) V% b9 q1 o' c
  75. char *dmabufdest1 = NULL;
    % r, z+ N- W* `  ~
  76. char *dmabufdest2 = NULL;
    3 V6 f0 ^, ^8 B+ {. Z

  77. & y& U9 X3 c2 E5 q5 {0 B. D
  78. static int acnt = 512;) c1 b# B9 F+ v3 r, U/ P
  79. static int bcnt = 8;/ b1 h5 _; W9 r! I0 v
  80. static int ccnt = 8;
    3 K/ P& ?% S: ?2 }3 e+ N$ P( c

  81. # t# x" o. d0 e$ c# ~6 `& b
  82. module_param(acnt, int, S_IRUGO);
    & p; c, N! i( [& H2 y$ i& y6 Y
  83. module_param(bcnt, int, S_IRUGO);& {  x# e) D1 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( M: h% ]1 o2 [5 X+ h5 [# t, n% U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 t% C& }' P/ J2 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 q3 w5 p/ H- _# C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ N! K; e6 s" z* ]1 X& [8 c
# U' v( a$ ~5 _$ Z" c

! s  K( D% F1 o5 J8 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 20:14 , Processed in 0.039329 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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