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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 t* z& L) O% Z5 J; S+ A! q* L0 W
  1. [code]EDMA sample test application
    4 P2 m& F8 s. }9 Z
  2. /*
    . L' H' l6 \/ M, p+ ~$ v
  3. * edma_test.c  @3 _  y( Z+ O3 _, o! ?
  4. *
    ; S3 y+ W  e( l! L: M
  5. * brief  EDMA3 Test Application% c6 ~- F& E) {; p3 V8 B6 s
  6. *2 }: j- S& U  O9 J
  7. *   This file contains EDMA3 Test code.9 \* n( U& e3 l' {
  8. *" q4 ]* n" c3 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 x& u/ z/ b/ P5 a/ P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, A+ c5 b3 g) T. a+ j0 ?
  11. *         TO CHANGE.1 J6 V3 D" b6 d
  12. *4 K8 D& x4 D! Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # E2 B( k, {: h. t1 L
  14. *4 K4 h# |0 I8 E! N
  15. * This program is free software; you can redistribute it and/or3 H3 T2 A* x% o" A, `8 e
  16. * modify it under the terms of the GNU General Public License as
    1 h& ?+ b& R7 z& G3 y
  17. * published by the Free Software Foundation version 2.5 U% w6 {+ s+ V: Z5 W" O5 H
  18. *
    - U0 b, l  c" _7 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! [5 }# E! I: }; r
  20. * kind, whether express or implied; without even the implied warranty
    2 Q* {  r/ q& t+ r. u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ V. Z9 |6 \' F8 ]' ~1 ^
  22. * GNU General Public License for more details.2 R) d3 ?: A% k- j1 l8 F/ b8 I
  23. */+ r" b- {1 g# v5 r. N  R# e* P

  24. 8 X( A: O* _; ~/ Q" I- I, H
  25. #include <linux/module.h>
    7 X0 s; C0 _9 u6 g$ u4 G
  26. #include <linux/init.h>
    , k& O% k- Z4 r9 H" @
  27. #include <linux/errno.h>
    6 R. t0 {2 d4 @' [! I# ]
  28. #include <linux/types.h>  c1 \# O0 h, u" l7 ^7 W
  29. #include <linux/interrupt.h>
    1 j0 @* [5 L+ w: x( G8 J  g5 U
  30. #include <asm/io.h>* j+ H3 |6 ?# g) |  b
  31. #include <linux/moduleparam.h>
      {3 d8 f: b. A1 C$ I
  32. #include <linux/sysctl.h>! y, H6 D5 }$ M9 X
  33. #include <linux/mm.h>
    ) @' g) ~: g1 ]8 F) b6 C! ]5 w5 P
  34. #include <linux/dma-mapping.h>' o  l5 T& x, t3 W  G, x

  35. 8 T  W! ~3 C, U
  36. #include <mach/memory.h>, l" S' N4 Z' @7 B% }# K- M# q+ z
  37. #include <mach/hardware.h>
    ; E: o! z4 P, @1 L1 p
  38. #include <mach/irqs.h>5 y6 r2 X; V; @2 w. B$ U4 k( T
  39. #include <asm/hardware/edma.h>
    , f% a) S' G3 h7 h
  40. : z' }5 D( R; i9 z* B
  41. #undef EDMA3_DEBUG
    ! D/ R& ^' j! y
  42. /*#define EDMA3_DEBUG*/" e( Z. r# z& f( ~, W+ w* y( ]$ u
  43. 0 P. g2 V8 d8 D& G! R
  44. #ifdef EDMA3_DEBUG# A6 b% A" ]+ V; [9 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ x1 C- I5 ?# m1 ]# w% |# v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 H% z; |) \( Y' H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ]( ^7 m. h5 C9 h
  48. #else9 t2 d% E; L! t2 w
  49. #define DMA_PRINTK( x... )
    % W) U/ F$ R9 o( B
  50. #define DMA_FN_IN
    : `, J6 [& [: X7 z0 ]
  51. #define DMA_FN_OUT- X. a1 E- t( b0 g) F
  52. #endif2 j. A5 O6 o4 g/ H5 \

  53. - T3 R& W3 h" K6 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); W7 _& @. F- n
  55. #define STATIC_SHIFT                3
    & G' a0 R5 {) E# r) Z  ~
  56. #define TCINTEN_SHIFT               20
    ; ?; v- o+ \# a
  57. #define ITCINTEN_SHIFT              21  H$ L0 A# {! S
  58. #define TCCHEN_SHIFT                22% Z  v. C/ d5 }6 N( |( |
  59. #define ITCCHEN_SHIFT               23, ^8 G* Q% @5 v1 m

  60. ' h9 \1 N% T1 D0 p
  61. static volatile int irqraised1 = 0;; D+ j; k9 ~3 R, W) [
  62. static volatile int irqraised2 = 0;8 I* W( ~! c6 n+ F& b) e: w
  63. - y* y' f4 A$ B& k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# h& r3 v. \. T4 O$ ~) l& C$ O: B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 k5 J6 o( U6 r+ _8 _+ \# a! u9 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * V& X! ~6 m, X0 U! y1 \
  67. 0 Z) N% T4 d8 b: ]" e; G7 ~; ~" P1 A
  68. dma_addr_t dmaphyssrc1 = 0;5 U$ s# l$ C( U1 d
  69. dma_addr_t dmaphyssrc2 = 0;& R" U9 A5 k0 }" Y) w8 T7 k  |0 L
  70. dma_addr_t dmaphysdest1 = 0;/ D$ ~2 m- E# ^1 S; b. A8 w
  71. dma_addr_t dmaphysdest2 = 0;  E: g) |& O0 F3 h+ Y  t0 g6 v) ^/ F% J

  72. 1 r7 b; z- B) m7 L$ R4 h7 O
  73. char *dmabufsrc1 = NULL;% U7 y5 b* w/ X, \% P( H
  74. char *dmabufsrc2 = NULL;
    * _  a" H8 h' b6 w- P) _, n
  75. char *dmabufdest1 = NULL;* J' i1 @$ L2 M8 \
  76. char *dmabufdest2 = NULL;9 \) i! o% h3 J5 g& L3 k0 O9 }
  77. & l" k+ O( f8 I. P7 f& L$ v8 C
  78. static int acnt = 512;
    7 K- T; \6 J4 H5 ?  C. _) y0 k
  79. static int bcnt = 8;
    8 |: v# O. F* k& k8 U1 B$ ?) e
  80. static int ccnt = 8;5 W1 a  m% S  r- `, u: l2 y

  81. + h) c2 u" Q2 C
  82. module_param(acnt, int, S_IRUGO);
    % C& f( A3 Z  C0 S' i4 G, U6 F
  83. module_param(bcnt, int, S_IRUGO);
    & D0 n0 H/ B- p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& Y/ k$ `$ w. c" Q  A6 a: g9 S8 ]8 y: O2 D2 W: D( P) @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) o+ s+ y1 {  a2 {4 u! |; D. qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: I- F& K1 T3 [% w0 f5 S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( i2 ^4 U) D5 v% f6 V
2 @: a) T/ K( d2 k% }) z/ C

( p. T7 H! T' B5 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 22:52 , Processed in 0.038994 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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