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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' _2 C: T& R, k/ P1 |/ }: K# i
  1. [code]EDMA sample test application5 m" _1 H: U8 v5 f! Z
  2. /*
    " O" {' \: w, Q0 U* O' u0 z0 O1 j9 b9 A
  3. * edma_test.c+ l+ I/ `- G5 C) X
  4. *
    ' n& m, e9 I  t5 ?  f8 }% a
  5. * brief  EDMA3 Test Application
    & T  q3 P4 r8 P  ?+ G
  6. *
    # F% o+ e# R" d; g  C
  7. *   This file contains EDMA3 Test code.
    : X* C: ^9 P4 @9 J% Z% {! k; t
  8. *
    3 \! i3 U- F4 Z! _& a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. z- I1 j4 v/ w. \$ }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% D5 e0 `- L8 {( o6 o
  11. *         TO CHANGE.
    ( g* b( v% Z2 Q0 }
  12. *+ a+ v+ \6 M5 g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. b0 w. m2 M) q" g
  14. *1 n$ p3 t* Z/ k) d/ T
  15. * This program is free software; you can redistribute it and/or
    & H, {% I. X- d" L3 ~$ G: f- v' y2 C" A3 [
  16. * modify it under the terms of the GNU General Public License as
    / X5 T/ W' o$ d: G: g
  17. * published by the Free Software Foundation version 2.- \1 c( P7 h$ m# M9 r) ~+ v$ d
  18. *3 K) S6 K) |- _+ ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , ?) P( [: c) Q$ W/ A
  20. * kind, whether express or implied; without even the implied warranty) u5 T4 M' G, I0 s: v# `" i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ v1 J' |$ E4 i' Y& n
  22. * GNU General Public License for more details.
    ' I; {4 G5 n$ {" n
  23. */
    $ R9 R  q: U# H2 f; H! S

  24. , b$ C* M5 L! l1 R  _& `
  25. #include <linux/module.h>
    5 {% r" w: a. o* T" D
  26. #include <linux/init.h>5 z) O: u5 L; I
  27. #include <linux/errno.h>7 Q, r: s& e5 C" U9 |0 t; j
  28. #include <linux/types.h>
    6 m# L  P0 X! n6 e, }2 P# w
  29. #include <linux/interrupt.h>
    + [$ ]& n0 ~4 w9 c$ b
  30. #include <asm/io.h>
    ( a. T4 _) a* J- [" {; [; A. Z9 {
  31. #include <linux/moduleparam.h>3 H% m+ [/ ~' |+ E7 N; z. d
  32. #include <linux/sysctl.h>
    2 w5 I3 D. c% G; K
  33. #include <linux/mm.h>& I9 k0 T) j: D. J% t  L  a
  34. #include <linux/dma-mapping.h>' Q2 L6 I! T+ H* j" j  q, L: ?* d( u

  35. 7 b5 I  s/ d9 t5 g
  36. #include <mach/memory.h>
    ) `8 J' i/ I; F& s' c" F
  37. #include <mach/hardware.h>4 E" D, Y, t$ q5 R, ?5 i. o  W* d
  38. #include <mach/irqs.h>* K- i8 v; a! }
  39. #include <asm/hardware/edma.h>
    % r5 h4 ]5 B+ C$ w% }9 H5 \# h
  40.   }' Y3 J5 H7 @6 J: {
  41. #undef EDMA3_DEBUG3 o) k6 K2 |% e7 u5 d
  42. /*#define EDMA3_DEBUG*/
    ) b- p8 r- d, h8 W. r0 w! {  M  P
  43. : H( ^5 P& D4 J+ y$ F& k2 ~% u
  44. #ifdef EDMA3_DEBUG
    , x1 Z6 l5 B  b( \9 b' C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& k( F  Q9 B  G: B, K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! n' R$ D$ {5 d1 \7 V& C% [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 a8 C( T4 x1 K/ D- O/ b) p* r
  48. #else
    " f. s) m) M  l: z" f$ M) \9 k3 J. n; k
  49. #define DMA_PRINTK( x... )# g: c1 d; T2 r5 r: y4 T$ L
  50. #define DMA_FN_IN
    ! B: d' Z( v; A) P% o
  51. #define DMA_FN_OUT0 p9 `8 S- b& H
  52. #endif( \6 a$ f2 e2 t$ }

  53. 7 c0 f+ h6 h* z" ]" F: g" x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). ~$ ^, A: ^; I- q# C% L5 u2 V! {
  55. #define STATIC_SHIFT                3
    4 K+ i  d# m; A: n- v( _" Z& r6 h
  56. #define TCINTEN_SHIFT               200 I) s. m, \* s. S6 j4 h" V& D
  57. #define ITCINTEN_SHIFT              21+ I% Z! L" h- S- x) i6 g0 }
  58. #define TCCHEN_SHIFT                22+ {, K1 a: u  z9 e) U% D0 l6 r! |
  59. #define ITCCHEN_SHIFT               23) l9 v" Z* Y. C8 x! S* V/ y) ?

  60. / |# B. r, e! G2 t- }
  61. static volatile int irqraised1 = 0;
    % s& L. X7 [8 p! q
  62. static volatile int irqraised2 = 0;  L, c! ]/ m6 ?
  63. ( O* R% n# L: Z0 Y  O% z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * b7 t# S; X2 `" {4 z3 m7 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 t) P. R3 u0 j9 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 j+ x- C  ]5 l' ^$ J$ S
  67. % U# a( C4 V5 ~
  68. dma_addr_t dmaphyssrc1 = 0;: F& t: n2 T. t
  69. dma_addr_t dmaphyssrc2 = 0;( Q  x  M! c# h, H7 ^. ]) z
  70. dma_addr_t dmaphysdest1 = 0;# X' d! |: n, @4 Y5 y/ u
  71. dma_addr_t dmaphysdest2 = 0;
    5 M8 U6 _! B) B4 B2 t2 Y
  72. , n" c. {2 F* Y4 z8 a% ~+ }" [
  73. char *dmabufsrc1 = NULL;7 p  X  p! z* }$ Q) X0 l  x
  74. char *dmabufsrc2 = NULL;
    2 q1 G( X  v  c& |" s
  75. char *dmabufdest1 = NULL;
    ' H$ k6 b2 D  }) z# z8 v
  76. char *dmabufdest2 = NULL;
    - d% L$ b7 o9 o! y
  77. 4 k) |) s9 G3 J- `( T) s
  78. static int acnt = 512;
    8 e. u2 }# V7 S) H
  79. static int bcnt = 8;
    ; l, W" g" `6 l& R4 @# B
  80. static int ccnt = 8;
      G2 X2 ^8 F$ Q1 I: C
  81. ; M' k. p  a* F* c, o  u+ r; t
  82. module_param(acnt, int, S_IRUGO);
    3 x: o5 \7 l( ~: }: E
  83. module_param(bcnt, int, S_IRUGO);
      i  c, ~* m: T0 f1 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 G' L' {, a* i8 G5 {2 t# G7 e
6 f# D4 g0 k5 N, V( s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. O" x" i/ |' x& Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 y$ M1 Z, H: [% s3 i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 K% L6 `. z8 m- K

2 b4 A; w0 |: }9 }
% L5 o8 M) @$ Y# ], Q! M7 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-23 03:22 , Processed in 0.049133 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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