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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! f  x5 Z* n! E$ N* k1 M; K: M
  1. [code]EDMA sample test application
    . D( _, J+ G  w4 j9 i# `# L
  2. /*3 ]  y+ Q# c( P2 {' f/ m6 t; }
  3. * edma_test.c# V  f. w3 t# T4 B3 q
  4. *
    ! r$ v* y) D6 j7 p- c: A; e
  5. * brief  EDMA3 Test Application0 y! V1 Z  J6 |7 x( A
  6. *: f0 I4 s& s# L7 ^* [2 i
  7. *   This file contains EDMA3 Test code.9 H* e% E6 K* {$ t
  8. *
    4 [3 u. e3 ^% c( [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 B; F' j# H5 U) s# n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , y0 [$ p; L0 D' p
  11. *         TO CHANGE.! E% d1 z4 @/ V
  12. *. L( g0 w8 ?) Y7 ~. n5 J, Y" P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 T- k% d! Y, B: S0 F
  14. *
    . c+ `+ u2 X- u+ f
  15. * This program is free software; you can redistribute it and/or0 l: ]/ N( c9 s& N% d
  16. * modify it under the terms of the GNU General Public License as; h, o" s) n6 h1 n% J/ p0 H
  17. * published by the Free Software Foundation version 2.- G- v1 K0 [0 Z% l& d8 s) w% ?
  18. *' r, R7 W" H9 ?! h0 A; h5 [9 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 n3 U( |! R1 D) u' D2 ?; l
  20. * kind, whether express or implied; without even the implied warranty
      _9 R  F5 N& s8 P1 N. S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * D: e$ y% z7 O5 i6 G
  22. * GNU General Public License for more details.5 K2 g0 }, m4 Q" V9 X/ C: [) t2 C
  23. *// o! k1 n, z- W( R, I% w9 h" _

  24. 4 J1 g- h' G* Y4 P! c" \
  25. #include <linux/module.h>
    . f5 F! V+ @3 p3 J
  26. #include <linux/init.h>" {) Z* @" Q$ l5 @: l6 K
  27. #include <linux/errno.h>$ T* R: H1 L+ k$ s
  28. #include <linux/types.h>
    # @% b; |" e5 h
  29. #include <linux/interrupt.h>
    ' @# T. _6 `2 h8 z+ w( H0 |) L
  30. #include <asm/io.h>
    % T, e& |* i* j9 X/ ~1 L0 f$ W6 ?
  31. #include <linux/moduleparam.h>
    1 A! N2 P4 ~5 s9 ]! _9 O
  32. #include <linux/sysctl.h>+ L- `; J9 j6 f# Z% ?
  33. #include <linux/mm.h>
    , G/ p* n  U' [) r- ~
  34. #include <linux/dma-mapping.h>- x; S, w4 Z* l' z8 {
  35. : m' u  j2 ^+ a
  36. #include <mach/memory.h>
    ) J0 s  D( s" `( W+ B. m4 S
  37. #include <mach/hardware.h>
    0 g. a8 a$ q" D/ I2 B# c  H
  38. #include <mach/irqs.h>
    $ Z0 L; R: R! C$ d( o4 {
  39. #include <asm/hardware/edma.h>* N5 `9 Y/ a6 g! V
  40. + ?. h1 Y, x% h$ W! E
  41. #undef EDMA3_DEBUG
    5 ]# n: |2 P# f% z& k
  42. /*#define EDMA3_DEBUG*/. ^* t0 p. c& u* Z$ m+ W
  43. ; c0 F+ r9 z/ P8 x% o1 ^( U
  44. #ifdef EDMA3_DEBUG2 O8 q2 b7 I& i2 P0 H8 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 J) Y" F6 C, K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & H/ J. B* s! o% f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), h$ V2 H" j8 I
  48. #else
    ! r7 T! a% _6 j
  49. #define DMA_PRINTK( x... )! G; o7 T$ S8 ?4 R
  50. #define DMA_FN_IN9 M  P# v' P, `( ^- b2 c7 V
  51. #define DMA_FN_OUT
    2 Z& W( v1 u5 L% C3 F% N  H
  52. #endif5 @! r, L: ~& Y) P& S2 X

  53. 2 v) u% F+ ?' k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; J# x, k/ A5 I3 |- H$ ?
  55. #define STATIC_SHIFT                3
    6 U0 C, \7 g* t- @) n
  56. #define TCINTEN_SHIFT               201 p# Y9 n+ n' M
  57. #define ITCINTEN_SHIFT              21
    # {: C2 r6 k+ |0 E/ _5 \) Q! ]
  58. #define TCCHEN_SHIFT                22
    3 a0 K# U% G+ N. q0 g
  59. #define ITCCHEN_SHIFT               23
    ' M+ O; e& i: V8 i" n! [9 i7 ^

  60. 8 A% O: k: d* G! j  V/ B
  61. static volatile int irqraised1 = 0;
    - {% U* L% o1 w/ r2 w$ o1 c# K% o
  62. static volatile int irqraised2 = 0;
    2 H! W* F/ B  c: e

  63. 7 s! X2 o  s; ~+ g/ Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # n" s! W* |5 K4 Z; z) U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % Y% C# N8 a, N, `! _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / q; t# w: l6 j$ w& W

  67. , e+ N2 x! }9 H6 N
  68. dma_addr_t dmaphyssrc1 = 0;7 S$ b6 J  ~& e$ H$ x# [, s3 |
  69. dma_addr_t dmaphyssrc2 = 0;$ d# g8 m/ g' B- u& T
  70. dma_addr_t dmaphysdest1 = 0;- J7 \7 f- F! T" z' i9 f: p$ r
  71. dma_addr_t dmaphysdest2 = 0;& s: w  r4 j* S2 v: O

  72. 7 Z. w. }0 B( X7 ?
  73. char *dmabufsrc1 = NULL;
    ' v1 }2 C, o- j! x  [$ T6 M  J
  74. char *dmabufsrc2 = NULL;& z: I( X, ]' q" U/ a4 O
  75. char *dmabufdest1 = NULL;
    - [( j- z4 |  \5 S2 G2 |9 _, L
  76. char *dmabufdest2 = NULL;4 }  H" J) ]3 P. b% D( b

  77. ; R+ l7 i5 [: P' I4 ^0 H
  78. static int acnt = 512;9 m7 V1 e: S7 _7 k0 w
  79. static int bcnt = 8;% M2 k% |0 k: x( N
  80. static int ccnt = 8;
    5 R" }4 w2 ^+ A4 o- Y

  81. 5 {, q* H# I9 G
  82. module_param(acnt, int, S_IRUGO);
    ! r. B% o* G0 w- o) S- C+ j! U+ T9 L
  83. module_param(bcnt, int, S_IRUGO);/ A. Q8 W8 Q( C  r5 [8 Y: W0 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# Z: j9 n% |7 O9 A! S( B& ?# e" y- g" D) Y- X- F! K2 G$ {& h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 P6 b1 L# O1 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# f' P8 [& _, j( P: r- x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" h9 ^7 a5 b5 @/ ]
. _# V/ i; Q% V0 g: P! x! a
7 L7 T5 {( O  S: k/ ]; B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-6 07:03 , Processed in 0.046918 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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