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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % W1 r0 p2 ?: l% k
  1. [code]EDMA sample test application
    ( X6 t9 e0 b, A+ `5 [3 h
  2. /*8 A) k* _, k8 O% e+ q0 M3 P. Q
  3. * edma_test.c# I  r6 e$ c2 m) o* v
  4. *( ^. |. C! i) C' X
  5. * brief  EDMA3 Test Application* b$ y5 w5 V" \3 B9 {% D' O+ _1 O
  6. *
    ) N, }) f7 S: ]- k+ a: B* p: T
  7. *   This file contains EDMA3 Test code.
    * x+ q4 X4 K# E, ], n* w5 N7 G
  8. *
    . j0 y9 K# P3 y0 Y8 {# g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 N; c1 b7 ]! B/ b: ^4 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 ]' B$ X- v& h3 r/ W! s
  11. *         TO CHANGE.
    ' ]( H, e6 L- D. I$ m* N$ `
  12. *
    7 ]9 }! @- I6 K. M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 k7 r$ p( ?& |7 {! _; {: g3 n
  14. *) G  d0 w! h9 ]
  15. * This program is free software; you can redistribute it and/or
    ; }. t9 x) u% ^) u: e
  16. * modify it under the terms of the GNU General Public License as; O9 o( g" D' p. S% y
  17. * published by the Free Software Foundation version 2.
    . |% E4 B) v9 J( x/ y6 a
  18. *  A  `3 h6 A3 M( s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' I  ?+ J6 V1 p9 Z; E) N
  20. * kind, whether express or implied; without even the implied warranty; r4 v6 D% c& I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* \/ R( g/ ^: S
  22. * GNU General Public License for more details.
    ) a4 Y  V/ i: r! v( {0 S
  23. */
    0 F+ }' y- n' s& @9 y; ]

  24. * Q5 N+ K' m/ ?9 j1 d' r
  25. #include <linux/module.h>
    2 z' p5 R: B( C8 @1 ^4 @
  26. #include <linux/init.h>
    - f3 z2 K7 y5 R" f9 R4 _! L: r$ \
  27. #include <linux/errno.h>
    2 M% E8 J" {2 M) t6 v: F2 X
  28. #include <linux/types.h>
    : B. m: h# {; _. |$ ^4 P
  29. #include <linux/interrupt.h>
    , H* ?, A; r" S! O+ ]
  30. #include <asm/io.h>
    ) D  w2 e1 s7 \6 J8 u
  31. #include <linux/moduleparam.h>5 t; J  \" F1 X3 p4 M
  32. #include <linux/sysctl.h># j% t  N3 J& `5 ~+ F" H
  33. #include <linux/mm.h>
    / U% w0 n. @5 p. F/ `
  34. #include <linux/dma-mapping.h>6 X- F' M( ~# e9 ?

  35. 5 J; O% \5 }: v9 f% |$ x
  36. #include <mach/memory.h>
    , R5 w% i- F$ [  k
  37. #include <mach/hardware.h>; w0 t% k2 a' Q8 d. @) ?
  38. #include <mach/irqs.h>5 k/ r/ R' R9 }* I
  39. #include <asm/hardware/edma.h>2 L0 N  ~/ d( R  Y
  40. % z% p: ^. x! B% R$ r
  41. #undef EDMA3_DEBUG
    0 X" \1 ~& [( k% K* E
  42. /*#define EDMA3_DEBUG*/. Q% \5 o% h( u2 G
  43. ( c2 i  h' @" S. D- n/ Z
  44. #ifdef EDMA3_DEBUG& Q& W% T! `8 ^4 i6 v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / Y8 L! q% a4 G; s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' O. X: ?9 @- {# e8 s9 h; _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ J2 n1 @5 p% w5 ~$ U
  48. #else  ]7 K: ~" ?8 ~$ ^
  49. #define DMA_PRINTK( x... )
    % _0 z0 e5 {/ c' F: @& s
  50. #define DMA_FN_IN+ e6 [# T# M4 t1 |  z7 a, j# T
  51. #define DMA_FN_OUT
      c3 }+ G. N; u* O% L$ E. p
  52. #endif
    . ?; k4 b4 ^) M/ w4 ~- z2 S
  53. 6 t0 D5 d  B8 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 H' t/ n* m! B. m1 J
  55. #define STATIC_SHIFT                3
    2 W, y. p- Y+ c0 a6 T5 f  o. {$ s
  56. #define TCINTEN_SHIFT               20
    7 ]- i: z" \8 d7 S0 F! B- g
  57. #define ITCINTEN_SHIFT              21
    & b. l# f9 P; l  `
  58. #define TCCHEN_SHIFT                22) X% @2 t4 p) J; h8 V3 x
  59. #define ITCCHEN_SHIFT               23. P; d4 H7 e. a3 W+ `
  60. 4 Y9 O% S# y- E  g% Z1 @  I7 c- p( t
  61. static volatile int irqraised1 = 0;$ y' M) H1 \# O# f% e
  62. static volatile int irqraised2 = 0;
    * a/ z0 S) g/ t9 Z. ?6 m8 o& P

  63. " O1 o! T0 K/ u, v- J( {0 k7 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' y% Y7 i% T$ U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( w+ o7 f3 S) U& I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & t7 p' [) R1 ]  W7 y
  67. 8 I7 a3 t( n8 T9 l6 Q0 V& B
  68. dma_addr_t dmaphyssrc1 = 0;
    9 [; y. u- B3 K& R
  69. dma_addr_t dmaphyssrc2 = 0;
    3 u9 G; L6 `  N" W, `+ N2 |
  70. dma_addr_t dmaphysdest1 = 0;
    * H  f$ b0 Z$ o. J9 O( S
  71. dma_addr_t dmaphysdest2 = 0;
    $ I& @. X5 R" v  X7 ~' k

  72. % p& o/ }4 Q& |! ?; y# s
  73. char *dmabufsrc1 = NULL;
    ! f8 l' L+ n2 o6 c9 l
  74. char *dmabufsrc2 = NULL;
    9 ~9 x+ X! }0 ^! C! H6 c
  75. char *dmabufdest1 = NULL;
    # c+ M/ g: o2 I6 h8 L
  76. char *dmabufdest2 = NULL;
    0 w4 M& ]; _$ k! A% ?4 H
  77.   V& x& j- _2 a8 v$ p/ ^* g
  78. static int acnt = 512;$ {3 c  L8 |6 [2 r3 m
  79. static int bcnt = 8;# j, U. A, P0 }& {7 F& d$ L% Y- y3 |' m
  80. static int ccnt = 8;
    * v" |* C; ?  D' M: \0 ]0 N& K7 u
  81.   C' C4 P! t# J( |" c
  82. module_param(acnt, int, S_IRUGO);1 N& H% ]7 O& n- \9 L) V7 w
  83. module_param(bcnt, int, S_IRUGO);
    , ?' P; P4 [- U+ A* R! s/ X+ z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, F. W: N- u/ y' C  O3 w- L9 a5 o" _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 g- _2 e* ?! ?" A- B( o1 J( F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ v' V: Y$ j( |2 |( A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# X% B3 z; U, F( W7 V, y. j6 Q) P! R+ Z

( H. k/ y5 N% x0 z  [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-2 02:53 , Processed in 0.048427 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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