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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 `! p- g5 G- ?( o  d
  1. [code]EDMA sample test application$ I/ b2 d) p+ @5 ]
  2. /*
    * O/ [% o% P+ k" B4 x
  3. * edma_test.c8 g3 }7 u" g2 E: A$ T( |) J* r
  4. *
    6 ?6 b6 j# s/ j) Z6 x$ \1 s
  5. * brief  EDMA3 Test Application
    / r- F& X/ T: S* P' H# q" W# J) M4 W
  6. *7 T& n3 i! `6 U9 E
  7. *   This file contains EDMA3 Test code.0 v3 u+ E+ v2 X3 F( v6 q4 ]' \) \0 }
  8. *
    ; g3 J: P0 z9 B" t# }0 C3 k4 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " h: K( \7 b' g$ S0 M) t0 H8 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) Y: U3 C2 \3 f, ]8 n  b9 L
  11. *         TO CHANGE.
    * \3 L+ W- O0 v- ]; M/ ]  H
  12. *" t. r3 O  m) A0 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; [5 r5 l3 \( q8 ?5 s
  14. *
    & z9 e4 g1 J/ f  f
  15. * This program is free software; you can redistribute it and/or" e9 t  ?  S4 b
  16. * modify it under the terms of the GNU General Public License as
    ! U+ @- |3 m9 k* y1 v" M
  17. * published by the Free Software Foundation version 2.0 _6 O1 _. a, _- G9 ]
  18. *2 A% i* h+ ?$ K+ K4 l; f) t3 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 ?+ {8 {- Q* V% p% `# Z
  20. * kind, whether express or implied; without even the implied warranty
    - a: y+ f5 `; a4 G8 B0 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' K7 P: K$ B. ~2 a' v
  22. * GNU General Public License for more details.6 l2 [+ x- F( W* Z0 Z
  23. */; h2 Q9 S2 C; B  D9 H% ^4 {

  24. 3 \5 z' R4 x/ y7 T) F  O9 V
  25. #include <linux/module.h>8 N" {. V/ ~' u( f
  26. #include <linux/init.h>8 j  i+ ~, c6 G! h+ t; W- l: x
  27. #include <linux/errno.h>6 \4 X2 D  Z% D" J
  28. #include <linux/types.h>& F" N& L! ~$ u, u
  29. #include <linux/interrupt.h>9 W" z! H4 W" [1 N! O
  30. #include <asm/io.h>  N  L, s( V3 G! A5 J2 I: I4 G
  31. #include <linux/moduleparam.h>. u, y- K3 g  g2 o* @& i3 l- Z
  32. #include <linux/sysctl.h>9 H" L6 B0 U, ]$ v( Y
  33. #include <linux/mm.h>
    - P3 J+ N' E/ R5 Q: ]7 B4 f
  34. #include <linux/dma-mapping.h>
    & [8 n# W4 Z1 @8 @+ F" t( |! B
  35. 1 V6 V, m9 k' u) n& N
  36. #include <mach/memory.h>
    ' ?* P3 H6 l! @3 K
  37. #include <mach/hardware.h>5 O0 S7 ~( T" x, {6 ?
  38. #include <mach/irqs.h>; b1 a3 D- J4 B* D
  39. #include <asm/hardware/edma.h>( F/ n( \' F+ i6 I4 q; J  n6 Y
  40. ) h2 S  K* I5 G3 r4 t7 J; V: b
  41. #undef EDMA3_DEBUG
    $ s$ {" y: _# T
  42. /*#define EDMA3_DEBUG*/
    ; }( o7 T5 ^2 i6 F1 A9 E# Q2 m

  43. 6 j+ t( C& e; x! z, x$ k, M( ^
  44. #ifdef EDMA3_DEBUG) J- s& Q! ]: Z3 @# @3 N2 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 w4 m' p0 l2 f9 t8 v. q! l  f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ \% ]# p" s7 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 d* a& S( n$ m1 n0 V
  48. #else
    ! Y/ I% ]: j" a2 M9 `
  49. #define DMA_PRINTK( x... )# ]5 s% h: @" `4 Z* U6 T9 m4 I
  50. #define DMA_FN_IN
    / f: ^8 Q) b  l  j
  51. #define DMA_FN_OUT
    8 C* r" n% C$ \/ z6 B: ?. I, v
  52. #endif
    # o0 k! a% v2 z5 @5 M, h

  53. * ?3 Y9 t  `) i; N& d) M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 J6 X" a8 j& [& q0 S) k
  55. #define STATIC_SHIFT                3- ^; z$ }- n" i
  56. #define TCINTEN_SHIFT               20( M, V' B% U; K  p/ ^$ U  v9 ?. h
  57. #define ITCINTEN_SHIFT              213 e2 R+ h- k2 v6 H0 J1 l& y; Z3 B: m
  58. #define TCCHEN_SHIFT                22
    3 b0 ~" D; p3 S# {7 C
  59. #define ITCCHEN_SHIFT               23/ I- _  {; V0 m' G* B% c
  60. & p7 r* B9 X- a& y3 \  X1 _
  61. static volatile int irqraised1 = 0;% P9 w) U4 y" G: Y0 E
  62. static volatile int irqraised2 = 0;
    / d4 G7 y# C7 }6 f$ B$ q

  63. # h  C# L6 x" N4 c1 |. U* n0 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# {2 c5 q5 q9 a; J4 @' V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, S/ C  Q$ C0 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * z) ]' B8 Q6 x* b" ]
  67. * A  V6 o1 g0 k# O! P* u; V/ _1 ^
  68. dma_addr_t dmaphyssrc1 = 0;
    ; P# d( s: c' c/ M9 K' m4 I4 r
  69. dma_addr_t dmaphyssrc2 = 0;7 N+ j* G: ]% T
  70. dma_addr_t dmaphysdest1 = 0;/ {" \8 T- h( C# ?
  71. dma_addr_t dmaphysdest2 = 0;
    9 A) H1 {/ ^) I4 b

  72. : Z; T6 G. F3 F6 ?# Z  \. V9 a/ h
  73. char *dmabufsrc1 = NULL;% L( T) |1 m% s/ F" N4 u: t
  74. char *dmabufsrc2 = NULL;
    9 G& Q, |8 q& l) k- T
  75. char *dmabufdest1 = NULL;& h: ?& \% o7 y  m. ^; \  _. x
  76. char *dmabufdest2 = NULL;8 s2 e% ]- O5 \9 r* X9 y
  77. 7 u* C3 j5 t/ Z9 i9 X2 _
  78. static int acnt = 512;! G7 J! a3 A% s2 H. I+ G
  79. static int bcnt = 8;1 C/ j4 C4 U1 ?. T! t6 V8 j. g; M# N4 W
  80. static int ccnt = 8;
    % V( J) i: t( {- A, g5 u7 m

  81. ; i, V) G! m* |+ `! ?) l7 u( W! p( V
  82. module_param(acnt, int, S_IRUGO);
    2 Q. l  y1 W# \' F& ~5 w) Z
  83. module_param(bcnt, int, S_IRUGO);
    # K, B! a, E" @/ V3 z* o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ ~8 L$ q1 w! C4 E

  E* c2 ]1 a" ~' S/ D" P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, j0 n  K6 H( R" S3 y4 Z. e) Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: X9 p/ b# P! L6 R5 x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* i* f- j: ~: M) O! V& |

2 M) Y+ Q7 }- t0 k! N' Y2 ]/ J9 m& D! @4 {, l$ y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-6 12:01 , Processed in 0.045606 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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