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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * h" v0 J2 G3 F( F, F% U- C
  1. [code]EDMA sample test application# ]9 ], i9 o, A2 U, e
  2. /*
    ; r6 h, T5 h" F
  3. * edma_test.c
    . K: t& W5 V3 H0 u6 B9 A
  4. *: Z9 w& P8 Z8 }" b) ^; h, [
  5. * brief  EDMA3 Test Application$ l1 {& u# \; n) E1 t8 w; @; N
  6. *3 t+ M# m/ h6 U* S5 R
  7. *   This file contains EDMA3 Test code.0 l8 [; P1 D+ ]: x0 j+ Q( K% [, S* G/ c
  8. ** T0 _2 p6 Y5 r2 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 d9 C! R- y" X* K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 _$ z3 X; b5 h+ W* M1 u: v+ z% k
  11. *         TO CHANGE.7 \$ \9 u8 U" L6 Z4 q! ?7 x  i
  12. *
    ' I$ v7 W& J% \+ F, v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 ^1 x8 k0 d. o* t% S
  14. *
      |0 d# z) n7 u, ~' s. p! x; a; j/ K/ `0 F
  15. * This program is free software; you can redistribute it and/or
      ^7 E5 q  ?- z9 C' \
  16. * modify it under the terms of the GNU General Public License as
    6 k- A% l$ M8 Z
  17. * published by the Free Software Foundation version 2.& x7 Y9 X9 H# ]* G0 J/ l. q
  18. *
    ' @: f6 R0 K5 l0 m$ m' K: m" c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ e8 K- Y8 O" }  z( R- [+ |/ t
  20. * kind, whether express or implied; without even the implied warranty
    ' J8 l6 A& K( V+ o" d9 T$ J! I& w& X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " {  y/ ~3 {( _; U' ?
  22. * GNU General Public License for more details.
    8 i8 u$ z& L8 ]
  23. */: G! h* |2 X* D: O. R

  24. ' u8 I, s2 [9 `  F; H# z
  25. #include <linux/module.h>6 n+ D( l; P, e  s+ D
  26. #include <linux/init.h>8 R/ B! r! @8 m. I- o. I
  27. #include <linux/errno.h>
    : |& {! Q: t& Q+ z1 g: q0 @
  28. #include <linux/types.h>+ p9 A! {( \* C2 K) w
  29. #include <linux/interrupt.h>3 S& u9 t/ V/ I! X' N7 s. o- m
  30. #include <asm/io.h>
    . k1 D4 o9 M5 X1 T3 [/ G: K& x$ m
  31. #include <linux/moduleparam.h>7 [/ H4 Y' c( C  C
  32. #include <linux/sysctl.h>
    8 i* m7 l% [: F! C6 D% k0 M$ t
  33. #include <linux/mm.h>
    ! G) V! Y: [- S- I
  34. #include <linux/dma-mapping.h>/ Z. `; e/ \9 j

  35. ) i: T. D+ w: S% V5 @
  36. #include <mach/memory.h>% X0 J% W* D+ O; w0 Y% @  K
  37. #include <mach/hardware.h>
    " R  q* u1 s  F. G8 ?
  38. #include <mach/irqs.h>8 a% {3 s& W" Y! @! {7 W! f
  39. #include <asm/hardware/edma.h>
    ( d3 A! Z( [! F2 w$ x) M0 ^
  40. 7 \- N" Y$ w1 p- l$ p
  41. #undef EDMA3_DEBUG& c1 j8 ^1 U3 ~
  42. /*#define EDMA3_DEBUG*/1 z$ g$ u9 z* B, B( F  ]

  43. " y% l  g" {& n- i% V7 N) @
  44. #ifdef EDMA3_DEBUG* N0 b5 l- [0 T$ l; i1 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 ?' d8 B+ ]. G: ]+ q  E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 H8 }2 K! V/ g- ]( i4 X3 I3 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 n! H! g: T! z  n% X
  48. #else
    - G/ P& g6 j) Y; t1 W8 m
  49. #define DMA_PRINTK( x... )
    % v6 L2 @0 `8 F* K7 l+ P5 q* P
  50. #define DMA_FN_IN
    " m7 z& n# t; N& g) {) I
  51. #define DMA_FN_OUT# a8 n7 P( Q/ T1 g5 H
  52. #endif" V/ j; r6 _. v+ g6 h* ^" A
  53. 1 J6 F  b" b. }* L/ {/ V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 \- I6 J0 a1 Z  a: Q, @' ]  H
  55. #define STATIC_SHIFT                3  D( v+ D# t$ i5 d
  56. #define TCINTEN_SHIFT               20
    , x  M/ w6 v9 [
  57. #define ITCINTEN_SHIFT              21
    # f) g& j5 A2 Q0 b; `
  58. #define TCCHEN_SHIFT                22
    1 m( |  d6 X0 Q7 Y
  59. #define ITCCHEN_SHIFT               234 f0 e' j9 L2 B1 w
  60. 5 X0 Z- H" b$ N$ |2 B+ R4 E
  61. static volatile int irqraised1 = 0;$ |9 f% ?/ q. k1 B" u9 A
  62. static volatile int irqraised2 = 0;
    9 f( Y2 [) M# [
  63. 3 y/ p2 ~) w1 p$ R$ X& S- |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; z9 W! m2 J) K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . i# R. {& ]% A, ^% T$ c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * ~2 k) X3 N& `) N# G
  67. 0 J( Z4 f% k+ Q# S9 g; s) d
  68. dma_addr_t dmaphyssrc1 = 0;
      \! \/ a2 B: W6 W4 a
  69. dma_addr_t dmaphyssrc2 = 0;8 y. o  q" q& b2 x5 E
  70. dma_addr_t dmaphysdest1 = 0;
    - G' }+ _5 u6 F( C8 x. S
  71. dma_addr_t dmaphysdest2 = 0;
    * t/ p) M- k8 |/ u: z8 G$ M/ r

  72. " q+ U! ?( U; q7 d- M) \
  73. char *dmabufsrc1 = NULL;
    % Z2 U$ D: S. g: }  Q2 b% S# W
  74. char *dmabufsrc2 = NULL;
    ; l$ b& `  M% b
  75. char *dmabufdest1 = NULL;) U" v% F& p7 ^: I
  76. char *dmabufdest2 = NULL;
    . m+ z/ [/ I& f& {) I8 \! a3 w
  77. 3 t. n4 L0 Y/ E" u5 @& t$ x
  78. static int acnt = 512;
    - D& L5 c- x. b+ H8 v  ?& r2 Q! S" }
  79. static int bcnt = 8;
    1 V" X9 M3 ~4 g7 w; K
  80. static int ccnt = 8;
    ' N' k' v$ [3 ?" Y
  81. 9 ?6 C' ^+ F2 ~1 r( G
  82. module_param(acnt, int, S_IRUGO);
    $ h; k  v/ A( h6 q6 N9 Z
  83. module_param(bcnt, int, S_IRUGO);
    5 G! h0 x3 O2 T8 j1 n  [1 b. m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' ]. e  n6 n0 u8 S; X& s5 s
" D" g( }0 a# Q: s1 ~5 h9 ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 c5 k' _9 x1 ?: P' v, _; L$ Y8 @4 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# e4 C5 L' ~. l7 Y( p1 j4 V0 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 n8 ^0 m8 }" u, R5 m

" x- |1 v) b  }
2 i/ C* V! i( |6 _" K8 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 17:52 , Processed in 0.037852 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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