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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ j& C/ s  x1 A- V
  1. [code]EDMA sample test application
    . e3 i. T2 ]5 |# S0 D' M
  2. /*
    ) }0 P6 ]4 p0 R) f% v' g
  3. * edma_test.c3 b3 N, g3 j2 ]( t! K
  4. *' G% y  V: ~: n0 ]" l* x4 L1 a
  5. * brief  EDMA3 Test Application
    0 @. o# _1 n8 C2 [# ~
  6. *8 v- R6 Y6 D! F2 |0 p& m
  7. *   This file contains EDMA3 Test code.
    $ E8 t1 x* l  W5 A( B
  8. *( M/ \4 S" k) R* A. i" b$ i6 `  Y4 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 s, g6 k$ ?2 @: O8 N  Q& t$ W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; y5 k  `; R9 S6 Y2 m- f$ }
  11. *         TO CHANGE.
    ) F2 N" q+ K% i' F/ i* ~  O
  12. ** S: K$ z2 c* e/ x  N& U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / y7 P2 U$ h8 J7 f8 ?0 l
  14. *8 G  W" _1 s3 Q2 ]9 Z
  15. * This program is free software; you can redistribute it and/or
    $ O* s) ?/ ]( H, T1 }
  16. * modify it under the terms of the GNU General Public License as* _; e1 x/ o& H# f) i
  17. * published by the Free Software Foundation version 2.0 R& l' r! u: x6 S* q
  18. *6 A$ T. u5 Q% u6 G. ]) L4 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 `. {5 C# ]1 ^( I: [
  20. * kind, whether express or implied; without even the implied warranty+ G* `; {& Y- P( e+ A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" {" q+ o; P7 Z) M& l2 r+ L7 u
  22. * GNU General Public License for more details.
    2 ?3 T( Z( a, z2 D
  23. */
    2 J9 V: B! p# M/ z1 F

  24. 1 q- E, `$ ?. ?" y( L
  25. #include <linux/module.h>
    3 D$ L; _7 z* W9 @4 r, G( E
  26. #include <linux/init.h>+ t' P. Y' v# d/ z! a
  27. #include <linux/errno.h>- W2 ?$ O' Q: h  e" C
  28. #include <linux/types.h>" ?3 S! }5 j/ P5 k, G4 g2 @# L
  29. #include <linux/interrupt.h>! A0 V, r# ]5 D, i+ |' x
  30. #include <asm/io.h>! Q, m4 F) |* m; w9 q6 B3 f% T0 x
  31. #include <linux/moduleparam.h>
    . C2 f% `/ e* f' g, E9 o
  32. #include <linux/sysctl.h>1 p- ]3 C/ m: f) J
  33. #include <linux/mm.h>2 _  O+ S6 h6 o& O" ]7 h" [) X* A
  34. #include <linux/dma-mapping.h>1 N" ]" g& R- k* V$ i( [  ~
  35. % P" T; f+ z5 w% n
  36. #include <mach/memory.h>
    " q' j- `3 R6 A; f8 F, n& ]! x5 \- g
  37. #include <mach/hardware.h>
    # u/ n$ v# I# E! k9 K
  38. #include <mach/irqs.h>4 }2 v+ s4 P( g0 V4 c  ]" R8 h% O% B
  39. #include <asm/hardware/edma.h>
    ( q; O$ K8 g8 S4 t, }- {4 K1 {$ o
  40. . E# [( X8 B/ m( m* f: p( w
  41. #undef EDMA3_DEBUG
    9 g  d! I8 \* [% f% I/ W$ n
  42. /*#define EDMA3_DEBUG*/
    , J+ y, Y0 S7 |" x% v6 u
  43. + }1 O* @5 z7 ^/ j+ i
  44. #ifdef EDMA3_DEBUG
    ) ?4 t  g  ^/ S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). z/ X$ t& r/ k5 L7 |7 Z) X6 u3 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * r: c6 ?) V3 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % `2 \' B- N4 F/ b1 X
  48. #else
    $ X/ q) {0 U/ k" `
  49. #define DMA_PRINTK( x... )& S8 l5 m* b; Y* @
  50. #define DMA_FN_IN
    ; w  \; }4 }# x) U5 o% ^( v
  51. #define DMA_FN_OUT) ?8 Z1 K8 D% \
  52. #endif
    ; l' o+ G: y$ `0 z3 s# v

  53. 2 c' y% e$ Y$ Q: l7 n( n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( O7 z$ J' e/ L1 s
  55. #define STATIC_SHIFT                3
    7 g! N; Q' s9 ~
  56. #define TCINTEN_SHIFT               20
    1 Z$ \0 m/ b' y% Q- g5 ?) n5 n
  57. #define ITCINTEN_SHIFT              21& w+ n4 I" u+ F% A0 d5 |: C9 c" w
  58. #define TCCHEN_SHIFT                22
    3 J) g) J: [5 s2 o: N
  59. #define ITCCHEN_SHIFT               23. S: m: ]( U9 _' t" U

  60. + t* s% n+ X% K% b( k
  61. static volatile int irqraised1 = 0;
    4 G! ~! G1 f9 s4 \5 h6 s0 C& T
  62. static volatile int irqraised2 = 0;
    ' P3 x4 @2 N- q0 q! V3 M/ _

  63. 3 N/ y1 P& J6 U0 o3 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 [: I7 w' y, V1 f: ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 C9 T) W8 {8 G$ a5 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 [! W- {6 t% z. l) q1 z+ Q

  67. 3 I. t) B8 {3 o. o! z. j% X
  68. dma_addr_t dmaphyssrc1 = 0;
    " t# J1 {! j& h1 d# S1 q
  69. dma_addr_t dmaphyssrc2 = 0;. S% z+ H5 e( A: l
  70. dma_addr_t dmaphysdest1 = 0;8 q7 @5 p! O  g5 M  Q* M- [
  71. dma_addr_t dmaphysdest2 = 0;
    8 \3 i: a$ {. g
  72. 2 L$ F. {! o  t. E
  73. char *dmabufsrc1 = NULL;2 i* i$ w6 ~! M1 H0 e
  74. char *dmabufsrc2 = NULL;6 ^. s- f- [6 x
  75. char *dmabufdest1 = NULL;
    . W8 \% L' H/ F2 _7 C; P
  76. char *dmabufdest2 = NULL;6 O  o! D4 \( l  i
  77. & s5 e% b' @9 H& u$ U( f* z& i- u# V
  78. static int acnt = 512;
    ' u4 b& p, C. j; I/ a$ c0 }( P
  79. static int bcnt = 8;9 R7 J! U4 _( `- b* j& x, m4 D
  80. static int ccnt = 8;8 j- K+ v* P( x( B. Q
  81. % U! T, y* V6 B3 Q
  82. module_param(acnt, int, S_IRUGO);
    + i1 E8 W- v8 e
  83. module_param(bcnt, int, S_IRUGO);- I+ F- \4 W! K& x; f& c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 t( S  u" q$ m: R# ^. {5 |  u( t" I5 _8 x/ ]6 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) R4 O+ D7 t. ~8 n/ {% Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 \2 X. ~( P7 y- o7 o- C- c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% m1 ], J. K% U- j% Y5 l

# E. }, @9 ~( s# o" t1 n3 K+ \* ]1 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 21:28 , Processed in 0.041327 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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