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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. _- d4 S, r: }
  1. [code]EDMA sample test application( g8 N0 `5 g* \" {1 G- h6 y
  2. /*
    / v/ r* I3 E, P7 ?3 M' n
  3. * edma_test.c1 j% i! H' b0 b5 S; r4 c/ c
  4. *$ H% P: V( x9 g. C! t
  5. * brief  EDMA3 Test Application
    & n0 ]  {2 E9 x) U2 z
  6. *
    0 B+ F: H" T  o5 v" n+ f
  7. *   This file contains EDMA3 Test code.
    , N' l: _0 z8 y, x2 m& z6 }8 Q
  8. *0 F* B- D- D, @5 P1 P! o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 m; d$ G  V! t* P# U5 S8 h- l  r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      v! G- N3 d2 T' }1 Z; [
  11. *         TO CHANGE.
      ]$ j2 ^! r$ N/ z
  12. *1 ]' z) k& G' d$ q7 _. ]4 e) G, C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 B9 e( S, A4 C4 J. V, I- L
  14. *3 a, @4 D& y6 A5 X- u, E( O
  15. * This program is free software; you can redistribute it and/or- N2 T  I+ s& z9 K, l
  16. * modify it under the terms of the GNU General Public License as! d, ^7 c# ~( I! c4 t; B# I
  17. * published by the Free Software Foundation version 2.2 T( F! l1 {9 y' W
  18. *" i2 O3 |, l6 ~. J' O- m+ ^! y( Y& {3 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 m: R2 U  l# q: G! {% \  ?( V
  20. * kind, whether express or implied; without even the implied warranty
    - O  ~" e  n0 }* v& G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( u" ?6 `% \* E9 j: G8 i1 H
  22. * GNU General Public License for more details.
    " E; f7 b3 w. D% ^( L  @
  23. */
    2 `- Z  H; N  c' ^

  24. / H: G; Z4 ~9 v4 p
  25. #include <linux/module.h>
    $ `) N2 T2 D9 r# i
  26. #include <linux/init.h>
    ) w! `3 j) ]5 d0 q; ^. ]5 x
  27. #include <linux/errno.h>4 v  I- c4 U& D! m
  28. #include <linux/types.h>5 k5 f! N( C! `" R9 n& `
  29. #include <linux/interrupt.h>8 ^% d9 }; ^- R9 O2 \$ t
  30. #include <asm/io.h>
    ) K) g' n9 b. K
  31. #include <linux/moduleparam.h>
    / F3 o; j! s; E8 ^6 p
  32. #include <linux/sysctl.h>1 L" R; e5 A5 n: ~2 _9 y
  33. #include <linux/mm.h>- b" d; d  X$ E" u: e
  34. #include <linux/dma-mapping.h>  g2 B% e  G8 h, }5 J1 T
  35. % T+ s5 e; m# p  `& K
  36. #include <mach/memory.h>
    ' X" m( c, k" O* g& [  k
  37. #include <mach/hardware.h>7 d! [0 S, \0 s3 b9 E0 P' M; k
  38. #include <mach/irqs.h>
    , J7 _5 b. l8 @9 x5 }5 }
  39. #include <asm/hardware/edma.h>
    9 J" _$ u4 T9 e$ T8 i3 K+ G

  40. * Y1 a$ u# H. \
  41. #undef EDMA3_DEBUG: u' C3 |6 C! S* x* ]
  42. /*#define EDMA3_DEBUG*/
    : Q/ \3 [% K/ F+ r2 h

  43. . ?/ |% o( U& N1 s, k6 x
  44. #ifdef EDMA3_DEBUG
    # b0 @2 {3 s  M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( I# X1 B% G; b5 o9 J! e$ K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ g  b, a# g$ i; n) I6 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) V( m# \6 n9 J# l2 N
  48. #else
    2 m4 h. L7 }# f) e! Q, N% n
  49. #define DMA_PRINTK( x... )  N9 e  D7 W) T, s$ j
  50. #define DMA_FN_IN/ ^" o, _: Q7 ^
  51. #define DMA_FN_OUT. ?; `& {8 ^; Z/ H4 ]3 b" {
  52. #endif
    6 a# T$ u  H7 V+ G, j
  53. . \9 w: F. t  b* q  f+ t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" |) Z( Q9 E- D, f7 u0 M5 j5 d* x
  55. #define STATIC_SHIFT                3
    % w4 F& u; ]4 m8 Z. P
  56. #define TCINTEN_SHIFT               208 D, {9 ^2 C, a+ F
  57. #define ITCINTEN_SHIFT              21
    # v2 p, ]' E9 |& t) N$ u
  58. #define TCCHEN_SHIFT                22$ u: g3 y( Y( X3 X/ k# q5 f. n; n: E6 ?
  59. #define ITCCHEN_SHIFT               230 s$ e; @& M- c

  60. # k. Q0 X: B; Y- Y4 k& ^) w9 u; \
  61. static volatile int irqraised1 = 0;
    . k" D- {% p& U: l& u- \
  62. static volatile int irqraised2 = 0;8 Y+ M: p+ Y1 P. D0 o" N6 Y* o# v# A

  63. + b6 Y0 H5 f; r0 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " j  v: D) U- G( y- ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ]% t6 I2 ?9 F8 N5 d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& T8 D4 ~8 g8 `: K5 `) s: u/ Z
  67. 4 [! p' u0 [/ x; i$ x. }' @
  68. dma_addr_t dmaphyssrc1 = 0;
    ) T$ A* L3 h( |8 @! A0 v
  69. dma_addr_t dmaphyssrc2 = 0;9 V& C+ v0 J% L4 L# o/ n. u# N7 C
  70. dma_addr_t dmaphysdest1 = 0;; }/ e, n4 l, t6 J: g
  71. dma_addr_t dmaphysdest2 = 0;
    0 m2 w. a1 N/ U% A0 c! Y

  72. : C, W& S, |, G' ]% U& d! \7 G3 ]
  73. char *dmabufsrc1 = NULL;/ I! J) {$ ^# e3 d' U
  74. char *dmabufsrc2 = NULL;
    , L+ h6 \  ?8 m1 z: f  a
  75. char *dmabufdest1 = NULL;5 Y1 C! v& p8 D# e* b
  76. char *dmabufdest2 = NULL;
    ' t& {+ y" x) [& _( j5 D0 _

  77. % S' \) k* E# Z# B7 V
  78. static int acnt = 512;# h$ `7 x  F. q3 E  w: x( U
  79. static int bcnt = 8;/ \, b+ ]1 v5 P+ N" W
  80. static int ccnt = 8;
    6 d* a0 M4 s1 a3 N  [5 r

  81. ( P9 b4 h2 t* W/ H: j5 ~2 L5 Y9 E
  82. module_param(acnt, int, S_IRUGO);  k: h: G$ y: M, S8 w# p
  83. module_param(bcnt, int, S_IRUGO);
    8 k; C* ?8 _/ Y( T$ T/ s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 F# s/ }9 m7 s$ @$ K2 d) I, Q% d6 b' |0 m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. h% k% D4 M3 R& N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 l( h' p" I2 K0 z& w; W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: K) O7 P9 N) R  m# {& B4 N% E- m4 i9 e
2 ^" q$ d* N. O/ Y! ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-9 15:59 , Processed in 0.043230 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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