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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 B- y* z! K. l% X
  1. [code]EDMA sample test application
    4 H+ q$ f/ c) L% A! P9 q
  2. /*
    7 W. F* v' D' _
  3. * edma_test.c; ?8 S" s- w" V& R" P3 M. i
  4. *
    # C$ @/ J! T% }( y( N5 w
  5. * brief  EDMA3 Test Application! T* I: i3 w  t: t  Z, p
  6. *
    # x/ a& z% V& `  L
  7. *   This file contains EDMA3 Test code.
    8 F3 o0 p' F4 A
  8. *
    9 r  V% l1 k5 l( v. Q% k, T0 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 |. J! i, y* h: z3 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 |+ A! R1 V0 M" l% @. M6 ~, x
  11. *         TO CHANGE.$ X3 E; B& [: b: M$ e) m2 a
  12. *
    3 `  I. o# G6 B! W+ u2 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! r! y  {0 k0 z8 x# [& x; _; \
  14. *
    4 W+ w& o7 L, N, ]/ \* p
  15. * This program is free software; you can redistribute it and/or
    ; l% Z5 m- x6 p! `8 k1 Q/ B
  16. * modify it under the terms of the GNU General Public License as
      w7 b" k$ j5 q- n
  17. * published by the Free Software Foundation version 2.
      B) k$ {3 {9 u0 L# O' Q
  18. *
    6 }% _% T& X! w7 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- M; D* U, g/ n6 [7 g$ I
  20. * kind, whether express or implied; without even the implied warranty0 e. }( O9 Q5 Q, S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 y; M( Z1 Q3 |# Z$ Y" _; _
  22. * GNU General Public License for more details.
    3 ]- L8 g' C$ r8 V# F
  23. */
    % ^6 w" Y% g" l) t" Q! t
  24. - D' ]9 i. S1 m/ u
  25. #include <linux/module.h>4 v7 q( U. M$ `: n, W
  26. #include <linux/init.h>
    + u' |1 g9 f+ @9 W) V
  27. #include <linux/errno.h>
      g& Q, c  F$ {7 Q
  28. #include <linux/types.h>
      n  ]  N; r/ ]( h- w
  29. #include <linux/interrupt.h>) x9 t5 M) M8 p0 [6 @. x' D) N3 W
  30. #include <asm/io.h>6 U  D& b) j, S. v9 X$ \& m
  31. #include <linux/moduleparam.h>5 T+ f: Y" y7 R6 |: N
  32. #include <linux/sysctl.h>" e: Z: s3 \' M
  33. #include <linux/mm.h>7 ~- }, }8 q, V3 L; q1 n9 }
  34. #include <linux/dma-mapping.h>$ g0 d# t# P# z8 e, t" L( Q
  35. 3 v- h% D5 w* J8 }
  36. #include <mach/memory.h>
    0 }& A6 g, {; f# ~. k
  37. #include <mach/hardware.h>/ A  x$ j# E' \7 f; _( t) |2 d% X6 c
  38. #include <mach/irqs.h>
    " z4 N" p, X: t) M' U! f
  39. #include <asm/hardware/edma.h>
    % n9 V. q- w& m4 H5 W# s

  40. 9 O$ @4 A' @- O* G
  41. #undef EDMA3_DEBUG# Q3 L) Z9 d( |% |$ F' Z; U+ P
  42. /*#define EDMA3_DEBUG*/
    % L2 G, Z* t- {4 s" r  {, v5 E

  43. ( m: r5 t4 H2 F$ d' E
  44. #ifdef EDMA3_DEBUG4 J' _- G& W/ j* D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 j0 n7 }' Z$ p9 X) j' |8 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- ?1 p+ w- F- n; c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* B' l( ]8 [9 a) t" I3 k  P
  48. #else
    + w& L2 Q4 W) h1 n& X
  49. #define DMA_PRINTK( x... )( Y, I4 x. }1 O; T# O) W. \6 P
  50. #define DMA_FN_IN
    , s9 W9 K' I6 `& f
  51. #define DMA_FN_OUT
    + z  |  l& N. E. ]; x. H% W
  52. #endif
    ) x" F0 f, a* k  n

  53. / Q0 Z& G, N( L& i5 r4 g7 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 z4 R; k/ h) C
  55. #define STATIC_SHIFT                3$ i2 n" y8 J  `+ R9 k
  56. #define TCINTEN_SHIFT               20
    - B. S8 J& H( D2 v5 m
  57. #define ITCINTEN_SHIFT              21
    * _( f- B6 r2 v# V1 M
  58. #define TCCHEN_SHIFT                22
    1 `( ]; d: U9 q. y% |) t3 }
  59. #define ITCCHEN_SHIFT               23
    3 N  Q2 X  `$ F3 X. W( j
  60. % o5 H  \; W% L6 E4 h) M9 ^/ y: |
  61. static volatile int irqraised1 = 0;, X  O, ~6 r) o0 o4 d
  62. static volatile int irqraised2 = 0;
    2 h" M6 e2 @2 C6 X
  63. + n* k4 \( K. n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o  L% |. F& I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 y# p: o. [9 p2 X9 k" b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( |$ f0 x8 J3 ?# Y4 C6 m9 l+ |
  67. 5 r! K+ l" ~% N
  68. dma_addr_t dmaphyssrc1 = 0;+ ~* N. _6 j$ T+ }! ?
  69. dma_addr_t dmaphyssrc2 = 0;: j# p& ^. j+ ?$ a
  70. dma_addr_t dmaphysdest1 = 0;
    ) j# _0 E+ ^' {5 o+ i* [
  71. dma_addr_t dmaphysdest2 = 0;
    ) T* \5 p- [0 l* z! ^
  72. 5 ^) f1 v4 L" y
  73. char *dmabufsrc1 = NULL;8 R$ R" v5 y+ b+ y7 h
  74. char *dmabufsrc2 = NULL;
    # w7 v0 \( y3 S& K: {, X6 ]
  75. char *dmabufdest1 = NULL;, c+ |! Z# z/ j' N  @8 t
  76. char *dmabufdest2 = NULL;
      m; u- d8 i, u6 \. Q
  77. 6 n6 r: V% s; G, G% z5 P" [7 l; f
  78. static int acnt = 512;
    7 |4 m0 W5 `5 h& O( S! d
  79. static int bcnt = 8;9 L* u1 l2 F) v) @- y
  80. static int ccnt = 8;
    ) u! D2 s: a/ P; h5 V" O

  81. 3 C8 m5 D4 A8 u: a; k" B
  82. module_param(acnt, int, S_IRUGO);9 l$ k' ^' F, _2 |: W9 f) E
  83. module_param(bcnt, int, S_IRUGO);4 B5 Z& C+ m( E; W+ X( q" @* x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 A& Z# P- z5 r( ]
! `8 c6 A% \+ V' m% n) B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( L; {& g) b; E) E$ Y/ h, w% H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% z2 P8 K4 D+ l# k& Y4 z2 \' ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: n& T2 I5 |# X/ R9 _
0 b! I3 _( T& M7 f0 A' c; @! I8 G+ }9 J; q8 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 16:54 , Processed in 0.040135 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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