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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 b. ]: V% k( p' C
  1. [code]EDMA sample test application* v8 q" o( t7 N/ t' H& I# h
  2. /*" L& P- W( s4 G% [1 J. i
  3. * edma_test.c7 S  d& V8 l; J0 [7 B; c
  4. *6 I" o0 T: F: [/ F* ~
  5. * brief  EDMA3 Test Application& m! j' x  e- ]
  6. *" m  }' Y/ Y2 x- Z
  7. *   This file contains EDMA3 Test code.0 K3 X& j% l6 t0 {2 A
  8. *
    6 u- G  f7 p3 c7 M. {) F  P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% o. |/ l5 u6 X1 `# x$ \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! \$ ^  H# @& H) O3 ?7 M
  11. *         TO CHANGE.0 z! B9 W$ D5 i' w
  12. *; m" U+ Y1 |* _% k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! G5 Y& u) I3 P* [, T! v
  14. *9 l) y! @; B" h/ |- W
  15. * This program is free software; you can redistribute it and/or' j( O9 _% n" r) V
  16. * modify it under the terms of the GNU General Public License as
    5 _! F8 u7 Y# E
  17. * published by the Free Software Foundation version 2.
    8 g  K8 J% D! e/ l9 }7 t
  18. *
    1 I' P$ |' a# m# y3 I' H7 ?1 ?1 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# [1 s( g1 p# ~3 b4 D4 Y& W
  20. * kind, whether express or implied; without even the implied warranty& g! U1 T! h0 N- S/ J3 y* T2 w5 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( h& |  F: {7 R% G7 w: F0 \: ?
  22. * GNU General Public License for more details.
    4 B# ^0 Q$ `5 W9 ?6 a& u! Q
  23. */
    0 C. Y9 _2 P4 J7 e/ P+ n0 F* [  b
  24. , _# ?. ^6 h# O4 i
  25. #include <linux/module.h>
    # H- B2 D/ `  g) }
  26. #include <linux/init.h>
    # r0 U( p# G* }" J
  27. #include <linux/errno.h>9 j' c0 W- [. Z( Y
  28. #include <linux/types.h>0 ~5 `& U( g% h! c( }: L& z
  29. #include <linux/interrupt.h>
    - M: e& t! u" A. z# y, \& L  N
  30. #include <asm/io.h>
    % P0 P5 o7 Z2 `" l, d* G4 e
  31. #include <linux/moduleparam.h>$ |. b2 y8 a/ L9 V0 l- g
  32. #include <linux/sysctl.h>
    0 }. Q$ N: N; s# b7 c; C- \# X
  33. #include <linux/mm.h>
    $ H& M  A# U* H& v
  34. #include <linux/dma-mapping.h>
    8 `1 u+ i8 }6 ~% b6 N# Y
  35. 6 C& C# N# g: A" Q3 ^) f1 X' G
  36. #include <mach/memory.h>
    - ^9 |& J( H  N+ X& \
  37. #include <mach/hardware.h>
    1 _7 t" {9 b% ^% O" i' r2 ?7 q
  38. #include <mach/irqs.h>; x% Y0 j9 D2 O1 k; k( p4 m+ g! j2 o
  39. #include <asm/hardware/edma.h>1 W2 t+ F$ v3 L( x
  40. / Y3 P" J3 O0 D/ l. S* o
  41. #undef EDMA3_DEBUG
    % K% E# }0 b5 V: i8 G; v2 E4 f
  42. /*#define EDMA3_DEBUG*/- T3 y, B. u) C. Z- d
  43. : V5 ?9 q# A, W: h
  44. #ifdef EDMA3_DEBUG' s: O/ |, I& H4 s) E" M8 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 Z- u$ K2 k* c9 q( m$ o2 Q6 Y! f/ j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * w1 [; y* Q6 J6 v! t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " ?4 N+ z( `9 \) q, I# n
  48. #else5 k( V4 P5 x8 b$ w
  49. #define DMA_PRINTK( x... )3 @5 |$ {" O6 a# }3 Z3 }4 T
  50. #define DMA_FN_IN
    ' G7 M" g! L7 a0 S, G2 ]9 S
  51. #define DMA_FN_OUT' y  g) b% i# E1 B
  52. #endif0 k! L. ]6 ?, K3 Z1 ]

  53. # L0 w/ N+ w" v) Z' g% ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % I" }0 }0 f- A; ~& F3 e
  55. #define STATIC_SHIFT                3- f9 d: E5 T6 @% R2 a# q4 a+ _
  56. #define TCINTEN_SHIFT               201 b8 F( b1 X1 q' x" B0 T
  57. #define ITCINTEN_SHIFT              21
    ( B) c; ^! n# B& F4 T
  58. #define TCCHEN_SHIFT                22
    ! H0 T7 Y+ W! o' d
  59. #define ITCCHEN_SHIFT               23
      F6 E8 E5 H0 [; f. J
  60. & {  Q! T! X  i6 W7 R1 u
  61. static volatile int irqraised1 = 0;: N2 J5 d- K* a( k. {
  62. static volatile int irqraised2 = 0;
    ' _# S1 A( v" |: @' i% p9 ?

  63. 1 D# w' ]2 ?3 Z7 f% I. |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( r, g3 L- Y4 d0 n- i+ b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ q3 [; ^' J2 D- m1 \) t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  R9 ~0 K" x' [$ K' U' k

  67. : d$ B; ^7 r* `8 p7 n4 s* ]7 ~
  68. dma_addr_t dmaphyssrc1 = 0;
    7 F. ~* G6 W9 k* w3 ~, B
  69. dma_addr_t dmaphyssrc2 = 0;
    ) P* u% l6 p1 I, [$ h' E- P
  70. dma_addr_t dmaphysdest1 = 0;& U+ B7 U3 z% z) ^
  71. dma_addr_t dmaphysdest2 = 0;2 g& _5 c  L8 K+ f# X4 y

  72. 9 K+ h. l; V: n1 L0 t% q
  73. char *dmabufsrc1 = NULL;  h2 k3 g) K% b4 ?8 }8 g: w
  74. char *dmabufsrc2 = NULL;
    / W7 K9 h, h+ |# \
  75. char *dmabufdest1 = NULL;
    : O. J1 H5 J( ?* ]
  76. char *dmabufdest2 = NULL;6 f- S5 a2 q8 R- b6 v+ D* ~: B
  77. 5 f7 m; u: ^1 {: D% Q; K- O
  78. static int acnt = 512;
    4 {4 o, y# g. _  ?
  79. static int bcnt = 8;
    / t# S# q* S- s5 e  O
  80. static int ccnt = 8;
    3 q2 V% h* e+ {1 A" r% K# N- d

  81. 5 d, A6 A7 e3 y+ s8 l# N4 b
  82. module_param(acnt, int, S_IRUGO);4 P5 E) M5 J+ b$ c$ \- I
  83. module_param(bcnt, int, S_IRUGO);& r7 k% a7 y& M$ n* ~2 o( w9 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 R. T: V* s4 G; Q- f" d6 t7 G1 W& T7 P5 G$ Q, C# G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* Z4 h- `  K& F! X% d" y( larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 B, n- V& U' l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 L, D6 m- k+ q' q: E  m4 s2 i
6 v! ]' O6 ~" B! K  B. W' z3 N  I0 J4 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 01:20 , Processed in 0.053449 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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