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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " ?& Z/ y9 q/ s! A9 L$ A
  1. [code]EDMA sample test application' L2 u/ v5 H4 x$ D9 V
  2. /*
    # K. F. F/ ~2 X
  3. * edma_test.c1 [5 G) z3 h9 j6 V6 r
  4. *, @+ @) k7 U- q/ m8 T) [% u/ \
  5. * brief  EDMA3 Test Application
    3 U2 J0 T* ]. }- F0 T% C2 Z
  6. *
    0 D) A: M" z2 d6 `4 y
  7. *   This file contains EDMA3 Test code.$ l6 e9 ~, P7 K- x
  8. *1 G9 }2 F1 J' I3 s2 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 j; f* K1 @* r/ q, m3 l4 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# q& z6 N! E) Q0 u( v" g: g' w
  11. *         TO CHANGE.
    , U' h1 Y  r* r: m* j( Z' f1 |0 P
  12. *
    4 S/ x9 r3 a5 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , y: r/ m% Y4 Z) p% r% G# e
  14. *$ I* j: \8 b5 N+ d
  15. * This program is free software; you can redistribute it and/or& Z: a. p% R6 D: W" a; ]0 y
  16. * modify it under the terms of the GNU General Public License as
      }, W* P2 ?) j# ^: e, Q2 t+ L
  17. * published by the Free Software Foundation version 2.+ u8 X5 T; V$ Q/ V, t0 D# S# \
  18. *3 }1 E) C& P2 T6 }8 c% _, l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 z& s: l1 z- z: m
  20. * kind, whether express or implied; without even the implied warranty" m: a. k# L  i8 l' ]7 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* J; W) c, A+ m  L( _
  22. * GNU General Public License for more details.
    9 K9 Y( G( n* n2 g; [3 J
  23. */
    # A9 m+ g/ a  @

  24. 3 Z5 ]# Q0 U2 s4 C
  25. #include <linux/module.h>
    ( `4 M. A: ^& Z$ l/ Y! c
  26. #include <linux/init.h>
    1 R5 S  [7 T# z# L6 ]5 z3 O
  27. #include <linux/errno.h>
    , p+ @& i! p7 D9 U3 w( t
  28. #include <linux/types.h>! N* x- e# @: j  [# \" W
  29. #include <linux/interrupt.h>
    8 U/ R9 C1 l1 B8 x, [
  30. #include <asm/io.h>4 v. V" v2 }! v
  31. #include <linux/moduleparam.h>: V- I6 O+ T, n7 @, R
  32. #include <linux/sysctl.h>; P5 q) H+ m- W. X# P) ?( _2 V$ T
  33. #include <linux/mm.h>
    + c& f- t3 {$ t+ F+ H* c7 V
  34. #include <linux/dma-mapping.h>6 x/ I; a8 N- B5 ^' d8 ]& B& z

  35. 4 }7 U. N& z# l( ^% B
  36. #include <mach/memory.h>
    ' v! ~. ?" c6 I% `6 o
  37. #include <mach/hardware.h>; B  u9 ?& ]2 @, m6 T
  38. #include <mach/irqs.h>
    5 t0 z# R+ K! Y: X
  39. #include <asm/hardware/edma.h>
    % `6 O. g" K' \0 M6 L. W

  40. , w  h# v  ~  G" G# z0 d
  41. #undef EDMA3_DEBUG
    & M2 @1 s1 j+ @" ~- w! W& ~$ R
  42. /*#define EDMA3_DEBUG*/
    ! P) v! k) L' D. |5 M

  43. 5 M, k. s9 k. G, d9 I
  44. #ifdef EDMA3_DEBUG4 @8 H% t$ r% m' ^4 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( z8 }+ |" k3 v  Q! k. C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  @+ W4 q6 l$ ]3 K( ~& {/ O$ V5 Y0 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & }7 \" W. ^# S) `. ^7 G
  48. #else  r7 v6 M: Q& q) `: ?
  49. #define DMA_PRINTK( x... )
    4 j5 y! E0 ?" T; R8 K/ e7 L( U# I* Z
  50. #define DMA_FN_IN% E' ]* \: K4 n/ c" F* g+ ^2 v
  51. #define DMA_FN_OUT
    - e3 u! e9 ^+ a: C. \# S
  52. #endif
    9 s0 A. `! S, Z( I8 a% d

  53. / G$ s2 Q1 c& n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 C4 v: g' s8 t
  55. #define STATIC_SHIFT                3( S3 B; B3 \( A  B
  56. #define TCINTEN_SHIFT               20$ R0 ~* F8 {1 K& ~# {, f; q2 ]$ Z* ]
  57. #define ITCINTEN_SHIFT              21/ W/ C& n: }7 h/ m0 Y9 c
  58. #define TCCHEN_SHIFT                22
    # ?  q( A4 }2 t. s" [) g
  59. #define ITCCHEN_SHIFT               23
    # a7 S, d! j. K# u$ s) H- m1 f2 Y. P

  60.   R3 |7 _5 e6 F- r) c8 G6 g0 @$ F, n
  61. static volatile int irqraised1 = 0;
    & p# P, Y0 {; V8 q/ p. R
  62. static volatile int irqraised2 = 0;
    . q9 C$ X1 p& y( O3 p, Q& y3 u. O

  63. 8 O; q; Y  h0 K4 G; L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" k) |8 c' ]2 P# z: }% [8 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 \# g4 U8 M" u% S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& z$ ?% h- F- w; L
  67. 6 k# w/ G- V7 V6 b& h
  68. dma_addr_t dmaphyssrc1 = 0;6 q$ K- g4 [4 l6 W* o2 \8 x
  69. dma_addr_t dmaphyssrc2 = 0;
    & y' a1 a( `- x! W/ j& l
  70. dma_addr_t dmaphysdest1 = 0;; p! z# N, g. r& W- I; y) C  k
  71. dma_addr_t dmaphysdest2 = 0;' |, C- @' g/ \: E& J2 v8 [0 _6 N( N$ b

  72. # q- t+ D/ d/ x. \
  73. char *dmabufsrc1 = NULL;
    : x# j! Y( l* b
  74. char *dmabufsrc2 = NULL;
    % I+ r! Y) `2 W" M/ h3 [; v
  75. char *dmabufdest1 = NULL;6 h) t. p% m/ c  |) R7 X5 T
  76. char *dmabufdest2 = NULL;
      u! z  k9 e. t6 p1 v( @
  77. 5 d2 }4 q6 B+ D$ J
  78. static int acnt = 512;. k/ S+ i8 B; G+ z0 y" M# ^
  79. static int bcnt = 8;
    " U  M- s  f# T* s! l! p
  80. static int ccnt = 8;/ ]) W" n( L& r1 c: m

  81. : V* ]. S# a5 r, X; ~: |
  82. module_param(acnt, int, S_IRUGO);+ C) g5 Q2 K7 ]6 P% l' j7 B
  83. module_param(bcnt, int, S_IRUGO);
    4 @* w! r* z; e# T! T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 c  `* o2 K$ u$ w. A! u: e% q  V3 j  p. A7 M8 }& o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 x; U: \- Q( W8 u# x3 n- G1 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- K+ R7 v; V+ s$ l6 \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. z5 C: `8 e0 g6 L& h" ^/ o; Y2 g# T
/ S3 {9 }. H" V6 `6 q/ |( O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 05:51 , Processed in 0.039962 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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