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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  _+ O. T5 o: O4 _% d& O
  1. [code]EDMA sample test application! r( y1 P' @9 r5 Y
  2. /*/ d$ M' \: o/ [4 c8 ^; C5 C
  3. * edma_test.c
    / x2 P) T9 M, h0 `, U8 J# P
  4. *1 G9 x) o) Y$ L' ?
  5. * brief  EDMA3 Test Application9 s. _1 c7 q: V0 s
  6. *2 s' M6 e. I1 @! V; Z+ G
  7. *   This file contains EDMA3 Test code.: q; L1 g& V+ R( x+ P
  8. *( O- }  G# L- ]4 G+ f2 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 Y+ B! k/ F) A, v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 J( K# S! U9 N! e! F
  11. *         TO CHANGE.
    # A, Z- }1 _2 S( Z! b5 I
  12. *
    " ^- R- f, d" @& Z, |, d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 c2 B$ x. _, K9 @
  14. *
    5 Q+ w: H  D0 g' h) R4 I% R! ]
  15. * This program is free software; you can redistribute it and/or! @0 d5 Q* H1 F0 D
  16. * modify it under the terms of the GNU General Public License as
    4 o6 M% A% V( g
  17. * published by the Free Software Foundation version 2.' w% a- L- Z% U$ l3 w  f
  18. ** M4 U0 S( u2 F& Z) B$ h+ A# U% D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- j3 O% T( y( H6 ?- ?- b8 r! w4 t
  20. * kind, whether express or implied; without even the implied warranty
    2 _- A6 ?6 m% N  p& n9 Q5 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! s: D7 W* i6 G; h# x0 _6 i; B
  22. * GNU General Public License for more details.
    4 u& w; s  E4 S5 R# l9 ^8 I
  23. */
    , [9 @& L  G: ]( N2 J
  24. % _3 M5 U# `' h5 t9 u
  25. #include <linux/module.h>  l/ Z, t3 g/ h3 g7 s1 c' t5 h  d
  26. #include <linux/init.h>+ u  X4 L: E# n9 r1 x* `, L
  27. #include <linux/errno.h>
    ) m2 V! s4 E  A  H# p2 X/ y( j
  28. #include <linux/types.h>7 ~6 I1 K  E2 `  t+ R
  29. #include <linux/interrupt.h>
    6 A( N+ U, M+ R, ~9 y# z
  30. #include <asm/io.h>
    # s. b6 @  D0 [* w
  31. #include <linux/moduleparam.h>
    % g, |$ v3 o& D9 c+ r1 X
  32. #include <linux/sysctl.h>
    6 V7 z: V$ B, X+ K" B. H. ~, V
  33. #include <linux/mm.h>
    2 f, K, V  s; y! L8 U: }
  34. #include <linux/dma-mapping.h>
    9 j) n1 {) i. i0 T
  35. " R5 n) o) D* {1 q0 V4 _
  36. #include <mach/memory.h>
    / \& Y2 x& [4 u; ~. s# f
  37. #include <mach/hardware.h>
    $ N+ N( D  i! V# c$ s1 a
  38. #include <mach/irqs.h>/ b9 _- F. n# b1 N' N
  39. #include <asm/hardware/edma.h>" c1 @: D8 }) p5 ^9 \

  40. 1 k9 e6 g+ k* ^
  41. #undef EDMA3_DEBUG" Q7 Z- y5 ~- J8 A. j6 J$ Z! ^
  42. /*#define EDMA3_DEBUG*/: d; l& X& J9 e3 n% E' h& [8 s

  43. ' ]- Y/ X' Z* H) \! r# C6 }
  44. #ifdef EDMA3_DEBUG
    8 U; J) K8 [' w* u$ d6 Z8 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); `% n! z: F4 c( W0 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( w1 I& V8 V0 P9 H4 H6 @; w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , \9 q2 L4 G. z5 B' w
  48. #else
    * o5 w& e5 f7 Y
  49. #define DMA_PRINTK( x... )
    . m. c) |; C( I7 C
  50. #define DMA_FN_IN0 U2 F. i. m& K5 w) M2 @4 a
  51. #define DMA_FN_OUT
    & g" p+ E8 E: X# {4 c
  52. #endif
    0 q5 K7 r* |$ y- u0 H# U$ u! A

  53. & z' X% M7 ~8 H1 E& N, ~$ P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 R9 h$ i# k6 B- X# e# S+ q
  55. #define STATIC_SHIFT                3' L8 w$ r# J% a( \% s- S
  56. #define TCINTEN_SHIFT               20+ U) m; O( b$ N" Q4 G
  57. #define ITCINTEN_SHIFT              21
    2 z# f! g( P0 A4 W0 g2 \/ \" h
  58. #define TCCHEN_SHIFT                22* w  `) t7 J  F5 `' L
  59. #define ITCCHEN_SHIFT               23
    / F; l2 o( m. |+ N; S

  60. ( W/ S, F9 j8 }0 K7 `% s- m# b( c
  61. static volatile int irqraised1 = 0;" W2 x; o- O3 s: P0 G- E# }
  62. static volatile int irqraised2 = 0;
    " C3 J+ k7 [* v
  63. 1 F  r5 L8 [  [" M" f7 Y' C5 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ _* h  e8 \: }, R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) x4 a3 r" c9 w4 B$ ]5 k' `7 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! N6 @  h  |- U  I2 F: }% \

  67. # N7 z4 h4 \; H1 z  `; C4 O( \! C
  68. dma_addr_t dmaphyssrc1 = 0;
    ( x6 g3 J  z* G, l( Y- j% J% m
  69. dma_addr_t dmaphyssrc2 = 0;
    $ S# `) w  b' b% w3 u9 |
  70. dma_addr_t dmaphysdest1 = 0;9 X. H0 \3 A5 P/ Z
  71. dma_addr_t dmaphysdest2 = 0;
    / N  Z4 w) M" @$ i( H; w

  72. - b. P4 {7 f% s" _, i# g3 |
  73. char *dmabufsrc1 = NULL;3 \# c: K9 @8 ~3 @6 o% A4 U% z( C5 ^5 X
  74. char *dmabufsrc2 = NULL;
    : l) I/ i, d' y7 W* G% k' `
  75. char *dmabufdest1 = NULL;0 O6 @) U  c! @1 V9 O$ c( ?
  76. char *dmabufdest2 = NULL;3 r- f7 a8 T# J+ f
  77. 4 O. J$ {& y3 w# }  J
  78. static int acnt = 512;4 u4 h4 x, q% p6 Z, E( }+ f. S8 E
  79. static int bcnt = 8;; t. M) M# T: m( Z
  80. static int ccnt = 8;
    - V& W; a- _9 k' t; H5 k- }

  81. , l! E0 ~' t$ ~" u
  82. module_param(acnt, int, S_IRUGO);1 L/ }+ t8 x3 I) r- u; F; F
  83. module_param(bcnt, int, S_IRUGO);
    5 o) J% A! G7 a, G  A+ A2 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) O; z( t5 f$ y

) O( p. u" E  G6 X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; H2 J) a/ b& f3 R
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) t# ~* ?6 e5 I( b% }5 d" R) A" @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ e3 b( h" P& c- ]( L4 j& q6 v( b: K4 q0 s
2 s6 _1 X. ^4 N' Q/ W) z; V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 06:37 , Processed in 0.040559 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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