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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 ?8 h. O! h" L7 j( o0 z8 p; r
  1. [code]EDMA sample test application
    1 G* y- }5 [6 T+ {' K
  2. /*8 A. m. L* `4 O( v2 n
  3. * edma_test.c
    1 _. X: @0 \0 l+ g& W$ d3 _1 l
  4. *( u- z# E# |& m5 H2 l4 m) ]
  5. * brief  EDMA3 Test Application
    & [8 f+ r/ }) D, g" Q0 B# \* ]
  6. *
    ' ^+ ]  r; u" [7 _) B
  7. *   This file contains EDMA3 Test code.% K8 ]$ q4 D, o% [! J2 I- U+ P
  8. *
    + U# _6 U; F, {" [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + G, Q  m$ d3 e1 n0 N( j- }2 H9 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : ~8 K8 j8 ?; a; M& e9 _
  11. *         TO CHANGE.* g9 [  E( M# f% n3 h/ T
  12. *. A6 c1 r5 W& v, N+ ~4 Q3 y: _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! N. c$ M/ G# C' @, D0 @
  14. *
    5 D$ S" }" {4 a5 A
  15. * This program is free software; you can redistribute it and/or
    5 X# d0 K' `: V0 R7 P. {! q
  16. * modify it under the terms of the GNU General Public License as
    % ]$ f! t7 s4 s* z& C  E% P0 |
  17. * published by the Free Software Foundation version 2.
    2 p. O6 a( }8 R
  18. *6 q$ ~8 f2 g1 T. b' e' b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - O2 ]7 E$ ]% B: I  \6 V4 m
  20. * kind, whether express or implied; without even the implied warranty  w$ |3 u$ K% Q9 N8 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ j2 i7 E5 I  [0 G% n7 |( c: ]
  22. * GNU General Public License for more details.5 v! @- {1 m4 ]
  23. */+ p$ Z9 T; T. h: A8 V+ D
  24. ) O5 v* z  ]8 ~; E$ ?
  25. #include <linux/module.h>( W; k& H" `( X3 n
  26. #include <linux/init.h>, j9 N$ u* {7 F( e- f; G( f+ \
  27. #include <linux/errno.h>
    $ q4 n5 F7 s: p- h3 f3 H
  28. #include <linux/types.h>2 }: J$ B7 F, K1 G9 V- q
  29. #include <linux/interrupt.h>
    * P& h$ I* A' s, T, R2 Y6 L& Y$ g
  30. #include <asm/io.h>+ y5 p! R9 ^+ V$ e7 l9 `! c$ E
  31. #include <linux/moduleparam.h>9 e; S# D; n; f1 |1 v' i2 g$ K
  32. #include <linux/sysctl.h>
    , f$ c1 `- r) u6 p% l
  33. #include <linux/mm.h>3 m* j# E' c2 m, \4 E+ X( x7 Q
  34. #include <linux/dma-mapping.h>
    7 {* S$ E- i2 Q. R. Z$ u2 E8 |
  35. 5 \+ d- |  Y, \. R% O, t  m4 d2 \
  36. #include <mach/memory.h>
    1 f" b- ?# k' c# b/ X1 Q/ T4 k
  37. #include <mach/hardware.h>
    4 G4 \$ G4 p, W- N( u0 X
  38. #include <mach/irqs.h>; \  Z- ]7 M  v
  39. #include <asm/hardware/edma.h>, v$ l' u7 \5 P) Y. o, B6 I& a2 R2 L
  40. ! F0 r8 w! k2 {
  41. #undef EDMA3_DEBUG
    6 v% p( p# L' l3 \7 }+ `
  42. /*#define EDMA3_DEBUG*/
    3 m# \8 L) v* U/ I; X5 f

  43. / ]2 m& w2 }. E0 [0 Q
  44. #ifdef EDMA3_DEBUG5 q% F; W- B2 x% r: w& a: v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( N( v5 s  H* ]) ?+ D2 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 ]  J5 ~8 Y5 g) q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! Q7 o% z, s! c. }/ @
  48. #else
    ! ?6 z- C/ W8 p- s* J- m
  49. #define DMA_PRINTK( x... )3 A6 y6 ?' ~9 y( G% a
  50. #define DMA_FN_IN' z$ J' i0 L1 p2 T3 x5 |" ~
  51. #define DMA_FN_OUT% F% \+ U+ X7 t4 g6 w
  52. #endif1 C2 y6 H9 N" ~2 t& w

  53. ) ^( q3 |/ K# J0 y9 f+ S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) K0 u/ l+ B% {/ V6 |- L
  55. #define STATIC_SHIFT                3
    " K1 t# a+ ~# J* k$ B4 @
  56. #define TCINTEN_SHIFT               201 A% g" g! E% e  V* A0 o5 V
  57. #define ITCINTEN_SHIFT              21
    . I* [$ ^& A3 X) z" Y
  58. #define TCCHEN_SHIFT                22* V: b! W4 r) u/ V* Q; i$ u
  59. #define ITCCHEN_SHIFT               23
    2 Q& c" j# i- O# Z' q: @
  60. : q6 o4 H  l. a' m  n4 o5 G
  61. static volatile int irqraised1 = 0;
    4 W  t  \8 `5 E: m" ^
  62. static volatile int irqraised2 = 0;2 c+ e: m- ?: ^2 f* n

  63. 9 p8 A( B. F( ?0 t( n: x. h" s- }% @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; W* j$ c# m5 y4 }5 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ^: A& J9 \; N! J: l/ s1 _8 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 t3 b2 F$ N  u( m) f; s$ {3 `

  67. ; D* |8 I  J# q; |- _
  68. dma_addr_t dmaphyssrc1 = 0;
    - ]8 A4 R& k  i# s. G% w
  69. dma_addr_t dmaphyssrc2 = 0;
    " C' e) m3 H7 K' }7 R9 j8 g5 g
  70. dma_addr_t dmaphysdest1 = 0;
    . z1 }; H& I2 p( X7 t* S7 p: w
  71. dma_addr_t dmaphysdest2 = 0;
    $ t/ f& d. _. u) t' }5 \. I% t

  72. 4 e4 u  e- y( T/ [7 V
  73. char *dmabufsrc1 = NULL;% |/ f" S9 K4 O1 b1 d  K# i( q" v
  74. char *dmabufsrc2 = NULL;; c; c) J. {& @) n
  75. char *dmabufdest1 = NULL;
    + i. F* a# p/ ?- C1 w; s5 l
  76. char *dmabufdest2 = NULL;
    ! y! C7 v9 a' p7 E, ]6 [  ]
  77. 7 ~8 y' V5 k9 |# a
  78. static int acnt = 512;
    ) ?# W0 d  x' r- ?* m1 R
  79. static int bcnt = 8;
    * H* G5 \% N" [9 O- l
  80. static int ccnt = 8;
      r- M% g% u- v5 ^5 u5 h) Y: Y

  81. # L$ y5 A. X" F" F, r2 `9 W: a3 l, u2 o
  82. module_param(acnt, int, S_IRUGO);" ?/ h8 }* u- w) ]5 n# P
  83. module_param(bcnt, int, S_IRUGO);
    ( G0 s1 _" i- j2 t& K# O% _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  R  `/ Z5 ~( Q1 p" Z
( G; u) E% n) T1 ]) n: r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 @, N; B9 y* `/ O% g+ |: t+ m/ t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, K# ^- O- ~: w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# ~3 c2 H, q- z3 r8 Q8 K, A5 Y3 k
  x' b  W0 l1 w0 W6 p7 e: A+ g
6 f' I: V8 u# A: R2 Z& q/ }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-27 04:55 , Processed in 0.042179 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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