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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' j5 ^- j: z# a0 e; r% ?
  1. [code]EDMA sample test application6 `. s# Q  }7 j9 E1 K
  2. /*; O: E4 y- {- m, {8 @
  3. * edma_test.c
    1 J4 O0 T5 B9 F8 x
  4. *9 R9 a1 P, V5 A1 G, }% u
  5. * brief  EDMA3 Test Application% i/ O7 q* |4 j" s+ J% l
  6. *
    6 w  O* _) {2 D. \  g0 o
  7. *   This file contains EDMA3 Test code.) Q, ]$ X4 e* b$ l
  8. *
    0 d2 \9 u4 j5 m. [! C$ y( R8 O3 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 [5 F7 f; \6 P5 @5 w: Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; Y  O! S# t/ N) G7 H' u5 r
  11. *         TO CHANGE.
    9 v- C5 [8 _2 Z# @
  12. *
    5 B/ j9 w5 p8 A2 V8 g$ E$ B) d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . |/ U5 f) p. ^% G, P7 D
  14. *& m8 e" o' R0 \5 T  p9 y3 z- W
  15. * This program is free software; you can redistribute it and/or
    , p% J1 D6 T/ R4 x4 I
  16. * modify it under the terms of the GNU General Public License as0 H. U- D8 ?5 p1 K! U1 o4 U
  17. * published by the Free Software Foundation version 2.' c( F1 Y; P( ~7 q
  18. *
    0 \- V) k& I: y6 x" b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 \; \2 I# S0 G- z1 d* z3 j
  20. * kind, whether express or implied; without even the implied warranty1 R- U' y; d. D( E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) t9 P: C" G9 ^4 {/ V/ X
  22. * GNU General Public License for more details.+ O0 T7 `7 \5 R' ~- A( G
  23. */' [* e/ J8 o6 P, s2 s

  24. 1 s: l+ B4 u% B& P. l$ [
  25. #include <linux/module.h>) N! G+ `# L, m2 }
  26. #include <linux/init.h>
    # N4 [. e, s/ N4 H# m: n! @
  27. #include <linux/errno.h>
    % I' C9 J6 v* \4 t' g" E. ]4 t6 I
  28. #include <linux/types.h>
    # @* n8 `0 J+ w% P$ `
  29. #include <linux/interrupt.h>) _3 ^3 c' Z+ m7 c9 ~; ]6 P3 p& S
  30. #include <asm/io.h>
    1 D; D( }# {; D$ B+ ?3 a0 f
  31. #include <linux/moduleparam.h>$ q$ i& g7 V% g) Q
  32. #include <linux/sysctl.h>  L! V% n# J5 L  u7 ]- T
  33. #include <linux/mm.h>& t" l, a& M/ V: ]+ c! ~5 W
  34. #include <linux/dma-mapping.h>
    ' Y6 G1 t' }- `/ K2 B

  35. 9 j4 ~+ U  t, k/ r7 o- ~! }
  36. #include <mach/memory.h>
    : L# V. t! B8 D
  37. #include <mach/hardware.h>
    % }+ [" M2 L6 s# Z0 r# i
  38. #include <mach/irqs.h>
    # N6 V9 H0 \/ {! s
  39. #include <asm/hardware/edma.h>
    9 \. N$ T3 O  S" c
  40. 1 a) G+ ~# d; x! l
  41. #undef EDMA3_DEBUG" A% F6 J; {4 ^$ q
  42. /*#define EDMA3_DEBUG*/
    ' B, f5 y- g8 V: }5 ]% i
  43. $ a) H4 u' B- B/ P& Z% {5 k1 x
  44. #ifdef EDMA3_DEBUG& n0 k5 }" x7 i) q; ]: Q5 X4 B, w8 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) [& k1 _( s) g. S7 E) N5 b) G5 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & ~7 ]2 g+ B0 l$ ^. I' S3 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 ~2 Y+ z/ o2 t/ N4 ]( p3 n2 _
  48. #else
    * V5 ^3 f: [4 p, P9 ^
  49. #define DMA_PRINTK( x... )
    , i2 l( V% d$ o+ A! k. @
  50. #define DMA_FN_IN0 ]5 M: F$ x  l: |+ x
  51. #define DMA_FN_OUT2 s5 v3 V: j, x8 a
  52. #endif
    , _$ O* N( i( t+ H  Z
  53. ) D& X5 u- I0 Q$ c. E  B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# W0 O$ q  [2 p2 B% J6 U( Q) o
  55. #define STATIC_SHIFT                3  A' O5 c: o; N
  56. #define TCINTEN_SHIFT               202 [5 q2 T) R* h3 a" q( |* Q
  57. #define ITCINTEN_SHIFT              21  B" \* u2 {* T
  58. #define TCCHEN_SHIFT                22
    & s8 ?' \3 m5 c$ P
  59. #define ITCCHEN_SHIFT               239 N& i# g+ _* O' F
  60. + g% \$ i; t  \, Y3 E% [; q
  61. static volatile int irqraised1 = 0;
    # h, q. H4 ~1 L  p: i* |0 T. H! u
  62. static volatile int irqraised2 = 0;
    - m) }  N6 p: Y8 W& F( R

  63. / z3 \. ^' P9 d: ?, G" C' |2 e& Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 W" g( M: P/ |; q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 _. ^+ J( \% z1 Z3 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) R4 N9 `) P+ |6 i5 n' _

  67. ( M$ W/ b4 X. x9 d
  68. dma_addr_t dmaphyssrc1 = 0;
    ; M6 o+ D' |1 H6 W$ H' A
  69. dma_addr_t dmaphyssrc2 = 0;" i& `: F' p3 S0 F9 y- |
  70. dma_addr_t dmaphysdest1 = 0;9 g* Z9 E" m$ a1 `+ O/ v
  71. dma_addr_t dmaphysdest2 = 0;
      V) M6 O" r% _' b' z8 C, B! k
  72. 5 L3 [$ m4 w9 r* @# y# A
  73. char *dmabufsrc1 = NULL;
    7 V5 k: x  E  C; G
  74. char *dmabufsrc2 = NULL;
    2 _$ i4 u+ N% @  D6 K& _& t3 u' c
  75. char *dmabufdest1 = NULL;. _# }0 T$ `1 H* z/ F
  76. char *dmabufdest2 = NULL;
    / [0 E: [! G# X8 U1 N: q8 F
  77. & F7 ]  b2 c$ l2 }( W
  78. static int acnt = 512;
    3 H  ~& ]) Q2 p* t% P
  79. static int bcnt = 8;. m6 ^( `6 `. a$ N1 E' \" P. S
  80. static int ccnt = 8;
    2 o7 W0 V, d) @  h. g' ~) X

  81.   L- @7 d8 t$ x; Y1 ^. T; m' R
  82. module_param(acnt, int, S_IRUGO);
    6 B; X9 _, f0 Z' I. z# ?
  83. module_param(bcnt, int, S_IRUGO);8 Y# C8 f- c( W& i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! D( z, @( o5 l2 m' u: ?' z+ Q( D+ d: c$ a' z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 x0 K7 p  @. Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 t* S/ P! m0 U$ ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 {8 K& H7 a: C$ H) M" F+ Z8 {0 o) K  q1 t

, Y) |6 @0 e) X, I9 g8 e: M; n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 14:00 , Processed in 0.039615 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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