OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 M/ {7 }+ I8 F6 T# Z. S0 {
  1. [code]EDMA sample test application
    - H2 \* m# T' N: a
  2. /*- x& n  @$ C- R  |  T
  3. * edma_test.c
    8 u9 b, {! _* u, O! j
  4. *8 X! Y2 Y# o  p' `* K( ~5 \. h
  5. * brief  EDMA3 Test Application+ D, N! |$ P8 a% F
  6. *3 `4 ~4 J& ?9 p% J
  7. *   This file contains EDMA3 Test code.
    - T6 e) ]" O+ U# l: k$ m
  8. *
    ; p8 J& F" w& n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: [+ o5 v8 K% v! S# d" C% i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# W! }8 e6 }0 x) l) D' s
  11. *         TO CHANGE.) Z8 O  r. B. a$ a4 S* b
  12. *$ h* b, z. b+ n! v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 ~& Z5 j- P3 Q9 A
  14. *8 J) a8 v, b, s
  15. * This program is free software; you can redistribute it and/or' e# D. }4 }9 N3 p2 M7 Z/ m
  16. * modify it under the terms of the GNU General Public License as* \- l" U6 _$ G4 ]+ p$ V/ T' f
  17. * published by the Free Software Foundation version 2.
    ; T- v7 \! E. w/ Z; g3 |! B* P
  18. *
    - k: M; ^' O* v5 }6 ?0 \  B; ]; _" I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ _3 h0 G4 a5 d0 y; n
  20. * kind, whether express or implied; without even the implied warranty
    6 ^/ ^* b0 I- j1 q+ V3 g3 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , K1 c" v" @3 Z! {
  22. * GNU General Public License for more details.6 g& A! ~1 ~7 e5 a0 _. n6 l+ T
  23. */1 z* m0 K+ K/ g
  24. * F: B7 J, r8 e3 y4 v+ s
  25. #include <linux/module.h>  L# _$ t# H! [) n: I
  26. #include <linux/init.h>
    . `8 S4 f8 d+ y6 t$ \
  27. #include <linux/errno.h>: C3 f- I2 o/ [8 W, q; R7 s8 [/ y* z
  28. #include <linux/types.h>* M! f8 Z- ?# a4 x
  29. #include <linux/interrupt.h>' n( N; d* u: I
  30. #include <asm/io.h>
    ' _  u7 N/ m) m5 h: W5 r: H' E, T- w9 Q
  31. #include <linux/moduleparam.h>
    : L) ~" a7 @5 B0 W/ ~) Y3 ?7 M
  32. #include <linux/sysctl.h>
    / \+ |5 ]1 H5 U  i& I
  33. #include <linux/mm.h>; N/ b5 c4 X+ t  R5 }9 C
  34. #include <linux/dma-mapping.h>0 o' J( [0 G4 K; w( O: p7 f" v2 F0 ]

  35. 3 k* A' l/ n( _4 ~
  36. #include <mach/memory.h>
    0 Z% r# X  A  n) V' L
  37. #include <mach/hardware.h>8 x8 B0 M# Z" _# H2 ~
  38. #include <mach/irqs.h>
    ! \+ t% [1 N& \& P9 e3 d
  39. #include <asm/hardware/edma.h>
    " j& q( U* g& g* P+ b( _! S
  40. 8 z$ }5 b/ A- y  R: V8 A& \2 F1 y
  41. #undef EDMA3_DEBUG  k6 l& k. f7 f3 S0 i6 v
  42. /*#define EDMA3_DEBUG*/. z' e9 \' d) E6 _* a/ S! p! ~
  43. 7 X  P% u8 q# ?2 O
  44. #ifdef EDMA3_DEBUG+ o: W3 l* v) I* j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % V0 o, D4 `& E; Q7 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 M/ ^' {( J  B2 |# n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 x; A6 g7 R6 n% a' r
  48. #else
    ; Y2 Y1 N. ~% |: i
  49. #define DMA_PRINTK( x... )
    & `- S: G; F+ b& ^
  50. #define DMA_FN_IN9 ]% n! I( ?  V% N9 q% f
  51. #define DMA_FN_OUT0 {+ z6 K; D4 f
  52. #endif
    ! V& J5 @, x/ Q$ T4 s( m8 v7 x

  53. 9 Y% n- I+ c# E( ^7 G( d$ ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ n$ J# C& t$ {2 [* _! d, T# ?
  55. #define STATIC_SHIFT                3
    0 @2 s: H# }0 A+ ~
  56. #define TCINTEN_SHIFT               20
    & f& [0 f$ p6 S; W9 T  q/ \
  57. #define ITCINTEN_SHIFT              21
    # m$ ?# ~* W" v5 x' x; [1 ]* V0 q
  58. #define TCCHEN_SHIFT                22
    + H( _5 O' _# J( _
  59. #define ITCCHEN_SHIFT               23
    4 N6 M. |9 t8 z" `
  60. & W5 t) w1 g' B7 z
  61. static volatile int irqraised1 = 0;7 }7 _3 A; B, H3 n2 ]$ b3 L! [
  62. static volatile int irqraised2 = 0;( i2 I  G9 ~+ N, t& W; ~

  63. * c+ y' P! }; Z, x3 M+ l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 h' d- M- }9 S+ L+ a% c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & v+ o1 \. T. `' p" I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! Z3 U/ U  R8 N( H

  67. , g9 H1 s( o7 n9 s$ R
  68. dma_addr_t dmaphyssrc1 = 0;8 `+ P8 I5 W' T- Q5 P
  69. dma_addr_t dmaphyssrc2 = 0;+ Y, H* C" ^1 U  n
  70. dma_addr_t dmaphysdest1 = 0;
    $ F+ V; c+ r) a7 a  c2 n' _
  71. dma_addr_t dmaphysdest2 = 0;
    ! O; i, a7 v, W$ }

  72. & }) Y# O, W. y  x) p
  73. char *dmabufsrc1 = NULL;
    $ h  s0 s3 x, H4 T" D
  74. char *dmabufsrc2 = NULL;
    + U5 G5 S8 N2 K! ?
  75. char *dmabufdest1 = NULL;
    3 k0 J6 W- Y3 C  }+ n
  76. char *dmabufdest2 = NULL;: R6 ], `# ?' j1 ?! a. s+ g
  77. " B# ~# P( ~( B2 k8 N
  78. static int acnt = 512;; Z$ K& c2 _8 k
  79. static int bcnt = 8;- B( T% X! }& O) F" s/ C
  80. static int ccnt = 8;" i4 m2 R" }# E' Y7 J0 I

  81. + R* \& z' t& X+ o0 F
  82. module_param(acnt, int, S_IRUGO);
    ) N% H* Q6 @4 W+ g
  83. module_param(bcnt, int, S_IRUGO);
    $ }+ R& G- A" u/ Y% A/ M& q, Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; c) V( c3 n( T) K2 D8 H% ?$ J
; _, J; ?& m- m7 r$ N- W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  `8 I0 w  d( \8 p8 P, X3 e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, ?9 \3 P. J9 o, D- h1 z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 t, X8 C: i+ `* Z. P. ~: y! m8 Z; g% Z. h) _% t
( q! P# F: [. ?- F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 08:17 , Processed in 0.039778 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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