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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 `* o& N" b& v9 o; e9 ~/ u# C; C
  1. [code]EDMA sample test application
    6 E$ \. }! z# U7 a  g( ~6 f
  2. /*
    1 u4 u0 N* |  w' O6 C- H
  3. * edma_test.c# U) {3 k8 u# Y5 n
  4. *- k5 s8 H2 I' o8 V
  5. * brief  EDMA3 Test Application* ^8 D& ^+ @# v0 f( C
  6. *4 z  l; l1 Q( u
  7. *   This file contains EDMA3 Test code.7 ?+ L9 }  S/ K" g1 {" |1 m
  8. *) g3 x% ~3 }: e4 S4 N% Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; s& j1 Q8 s- J/ ?. H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 A' Y2 G$ ~3 B1 }  q1 w1 B
  11. *         TO CHANGE.9 O0 ?7 \4 E' h# a9 ?
  12. *' I% p5 e9 H$ ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! k( L$ R) u) e, l  j* p
  14. *0 N# p7 ]8 _' K9 `9 x
  15. * This program is free software; you can redistribute it and/or5 [  O, k0 Q' [% p7 U" J9 n1 B( ~
  16. * modify it under the terms of the GNU General Public License as( V1 |. J- t; u
  17. * published by the Free Software Foundation version 2.
    7 S/ F7 w8 H) Z
  18. *
    5 c: U+ z$ H, }5 U+ R0 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' v1 z  P# X/ O; o1 Q0 ~: U" m5 k
  20. * kind, whether express or implied; without even the implied warranty
    2 x( M( \$ B4 D" i9 f. C  `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; o6 P5 x- Q% _% m8 L! d
  22. * GNU General Public License for more details.
    & D7 [5 h" P- K( \1 ^: m2 h- ]8 k
  23. */
    3 h% G- V% T0 I; X0 Y
  24. * W' g: {. o/ [; Y( r8 w
  25. #include <linux/module.h>, w. U7 z0 N1 m6 Y% u
  26. #include <linux/init.h>( V+ R* V) g" G0 C" w; \3 |6 t
  27. #include <linux/errno.h>
    1 N8 k7 K: Q! `- v/ \& q) e
  28. #include <linux/types.h>1 d) e+ H' q" |3 I' o8 l" u
  29. #include <linux/interrupt.h>
    . F0 k6 w" t/ Y& P' B
  30. #include <asm/io.h>9 d+ K) t( @3 u/ }
  31. #include <linux/moduleparam.h># m$ A0 t- d9 l  V
  32. #include <linux/sysctl.h>
    2 }' p9 h& Z1 Y' ~* s) c9 U2 l
  33. #include <linux/mm.h>
    & o0 Q- ?) m! T: L0 `
  34. #include <linux/dma-mapping.h>
    1 X1 }4 }" |: g" B! L, Z$ _
  35. 1 s  a" e9 m' |& f+ I+ R6 q6 [! Z0 Y
  36. #include <mach/memory.h>* _# e/ |0 X/ ?: f
  37. #include <mach/hardware.h># U0 r) J9 |  f7 X* W+ M
  38. #include <mach/irqs.h>
    % \7 i3 Y+ y( X8 L  M9 W& x
  39. #include <asm/hardware/edma.h># N+ \# g9 m5 N1 ]" h  w/ a

  40. 7 Y" F8 m& e1 H  U
  41. #undef EDMA3_DEBUG
    + K. ^9 o3 A8 T: M7 I
  42. /*#define EDMA3_DEBUG*/
    + K2 g8 X0 i, P2 _- ~  H
  43. " a0 F+ u/ w0 Z6 F2 d4 A
  44. #ifdef EDMA3_DEBUG
    # C2 s) {! M. V& ]8 v2 k. L" _, Y' {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), L+ I; C# A/ \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ x5 B+ U& v  }( V+ ^/ m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " O/ ]4 x9 t; j
  48. #else$ Y; z) x4 x1 ~  Q/ @8 B7 t4 H
  49. #define DMA_PRINTK( x... )
    & L( M1 @8 h% ~9 V) K
  50. #define DMA_FN_IN
    # t5 ]) E; v: c0 F9 ^9 v( }, ^
  51. #define DMA_FN_OUT" O  x$ L' f* [
  52. #endif0 x2 {6 P6 e& B
  53. % ~. t. ]$ |& i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & M6 v; x/ e0 o4 n' H" s8 i
  55. #define STATIC_SHIFT                3
    / S5 }) c2 X$ x* r( g. t
  56. #define TCINTEN_SHIFT               20: x$ @# f. H1 Q+ _& u' o) x7 K/ |
  57. #define ITCINTEN_SHIFT              21
    8 I1 }8 T+ U) u# M. @2 O
  58. #define TCCHEN_SHIFT                22
    / `8 D& Y# s& ~  u
  59. #define ITCCHEN_SHIFT               23. p+ U0 k# w# ~8 u0 D& }* I1 Z
  60. : p0 T6 n9 Y( A+ M6 Z% M
  61. static volatile int irqraised1 = 0;
      A& t" H6 t& Y/ k! ~$ ^) S/ {7 m, G
  62. static volatile int irqraised2 = 0;
    " N: r* r7 v4 w2 H7 Q( z

  63. 0 A6 g0 g" a% N% W( R5 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 b+ f7 f; Z  _+ T( |( \  W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" S, U( f# T: T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. k; B  r% g7 J9 S8 Y# K  @
  67. ' T2 @! }1 U: Q& d& D
  68. dma_addr_t dmaphyssrc1 = 0;
    8 C+ o+ G5 R% [3 r+ ?2 v: B# {
  69. dma_addr_t dmaphyssrc2 = 0;
    ; u2 i6 z- w: X: F
  70. dma_addr_t dmaphysdest1 = 0;3 i& W" \# x; d: a$ m
  71. dma_addr_t dmaphysdest2 = 0;6 E( k' M% N4 E7 I/ H# @: M
  72. $ [) V( V) j: f6 N3 Y
  73. char *dmabufsrc1 = NULL;/ m, q; }# F6 I( R, N1 m9 m
  74. char *dmabufsrc2 = NULL;
    5 Z6 p6 E! N  y  _  t9 f
  75. char *dmabufdest1 = NULL;
    1 ~% G1 d& k6 W% V
  76. char *dmabufdest2 = NULL;' R* A0 `# e% M

  77. " ?) V2 i+ W5 [  O+ @
  78. static int acnt = 512;8 Y3 B3 h: e$ s1 V+ c
  79. static int bcnt = 8;  }+ \5 x$ l$ P7 p0 [6 p
  80. static int ccnt = 8;
    # A) U7 s* n% z
  81. ) h4 v5 B7 K/ x7 V/ r
  82. module_param(acnt, int, S_IRUGO);
    . v! H3 b# ^2 i4 A9 J+ a  w1 t
  83. module_param(bcnt, int, S_IRUGO);
    0 q6 P, Z3 }: Q: A9 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 G! q; Q" h* }/ W

& |- F" S6 x0 x, O- h9 Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 |" D. P, O% {5 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; a* B. @1 f9 [) E  M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% ^2 ^+ \* c+ K& \% {- h2 w. K; i! c
5 n- _8 Z; u: N+ n6 T! R# S
5 S( z3 F' |  [8 Q. Y# A/ z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 18:49 , Processed in 0.039696 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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