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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! |4 ^- G3 [! k9 C
  1. [code]EDMA sample test application
    , H9 H# |5 W% a# j
  2. /*% Q$ f% D; G& ~# l
  3. * edma_test.c
    8 r" d- b3 d) v: _$ ]
  4. *, x4 m5 [' {8 E, R" p2 J  K$ z5 G
  5. * brief  EDMA3 Test Application) E' y& k" o1 a4 r. x0 b! ^. _
  6. *
    3 n( |5 w( A( {9 w: k+ }
  7. *   This file contains EDMA3 Test code.  W) |. U* D3 ~8 r, c- u9 A
  8. *
    # h0 ~( p% V! Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / |% _$ l! w3 K! U9 A7 i1 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 ?1 A( \- t; }
  11. *         TO CHANGE.
    ; R2 n% |8 `* U% k
  12. *( w/ r) V: Y1 V6 b7 O( q3 ?8 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " _" h$ L; ^  \% M0 h0 G2 h% E
  14. *
    2 z5 a  _" R" i
  15. * This program is free software; you can redistribute it and/or
    7 @0 p, n3 B- f+ n' V/ X8 g+ Z
  16. * modify it under the terms of the GNU General Public License as3 O& [, N" I) \+ a7 Y9 m8 x
  17. * published by the Free Software Foundation version 2.* B+ _) s% {6 O4 o" n: m' h2 w& `7 _( C
  18. *1 f  L$ S( B' P5 D+ [& @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 m& ]" U8 {' s" z2 P
  20. * kind, whether express or implied; without even the implied warranty7 ^- S+ c2 o) T% N3 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) F- h/ u! b  @
  22. * GNU General Public License for more details.
    + N& @, O% w! |0 \" U
  23. */
    " @) V: ~" e: |* P: `0 Z9 n  L# T

  24. ) i3 x- f3 T6 ]9 L+ R, D) C
  25. #include <linux/module.h>
    0 p% l9 W6 c+ L- J
  26. #include <linux/init.h>% A- V# V1 ~' a. t; E: h
  27. #include <linux/errno.h>. e% }) H" w8 c1 }( a
  28. #include <linux/types.h>! J9 d6 p9 `+ C/ L8 ^
  29. #include <linux/interrupt.h>
    ) L& W) w4 m( l" t8 c; q
  30. #include <asm/io.h>' J5 Q6 N* W. a8 l* A2 K
  31. #include <linux/moduleparam.h>( p: o0 p4 ~; Y' \! a
  32. #include <linux/sysctl.h>
    ; `& r" e4 h) w; ~3 m
  33. #include <linux/mm.h>/ O* F* G( t- N2 s) S
  34. #include <linux/dma-mapping.h>
    ! k' @, b2 p9 M8 u' y

  35. $ Q( U6 q+ V9 D! G0 E
  36. #include <mach/memory.h>
    : y( K' R" p/ ]* m
  37. #include <mach/hardware.h>1 J4 q; R: G4 f  \
  38. #include <mach/irqs.h>$ C# X) f7 [* l+ }( C
  39. #include <asm/hardware/edma.h>
    * d* W) z7 ^* p( n

  40. , X( H1 n4 ]; L% M1 r
  41. #undef EDMA3_DEBUG1 [6 {& N, v; [1 J3 ]
  42. /*#define EDMA3_DEBUG*/
    ' ^9 N7 }; q* N" {, B

  43. # e+ g2 E7 _: r) _  |, Y
  44. #ifdef EDMA3_DEBUG
    ( y+ s  m7 b3 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 F2 o0 y4 ?& @7 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' t6 U6 U6 t  p$ T: [+ U4 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - E5 {2 O& p! L& z. I# i
  48. #else
    3 {1 t6 z7 c8 V9 L) }* c& ^
  49. #define DMA_PRINTK( x... )
    ' N$ K+ E' j- k" s
  50. #define DMA_FN_IN0 o) p' m6 H) l0 N3 h% t
  51. #define DMA_FN_OUT3 k3 c8 Y1 u! }# g  ~7 f! w
  52. #endif
    ! ?9 o7 k! w- ~+ R8 o; x2 {+ ~3 K

  53. # k( f/ }9 }* r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 ?" {- `% m# R/ n* N# b
  55. #define STATIC_SHIFT                3- H2 M# x! X  y8 L7 U( W/ `
  56. #define TCINTEN_SHIFT               20
    : W4 Q6 j" P8 p9 ^
  57. #define ITCINTEN_SHIFT              210 I6 E+ T& `9 v& f, m
  58. #define TCCHEN_SHIFT                22
    / {% K6 x5 }* z: O6 V0 c: B5 I4 g
  59. #define ITCCHEN_SHIFT               23
    2 `3 a: m5 X/ b
  60. - s& {7 i4 N; s. |: F
  61. static volatile int irqraised1 = 0;
    6 ^0 k4 G& [, h1 ?
  62. static volatile int irqraised2 = 0;9 q: ]5 @. Q4 y3 d- F. c

  63. 4 P5 [; z" @+ k( W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - i" l, `' m' s, e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + z7 H2 C3 M: y* V5 V: d0 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  O5 X' q0 c! p0 }/ z% M1 i  U

  67. 1 B7 Q, m4 [& F$ s5 r. o, M; N
  68. dma_addr_t dmaphyssrc1 = 0;- |$ m& c1 ?# O, }' ]
  69. dma_addr_t dmaphyssrc2 = 0;: S" W! _# o2 {/ K
  70. dma_addr_t dmaphysdest1 = 0;8 Z. x& X8 x2 c6 e( M) h- b
  71. dma_addr_t dmaphysdest2 = 0;
    $ A# D4 v4 D& X% P8 Z) P
  72. 6 N; \1 I5 o3 F! s; K# x) W
  73. char *dmabufsrc1 = NULL;$ j+ l" ?0 N" {5 J
  74. char *dmabufsrc2 = NULL;& L4 I* A/ N) o, T- D/ K- S5 M3 M
  75. char *dmabufdest1 = NULL;: z; a  f$ n: c; K
  76. char *dmabufdest2 = NULL;
    ' B' U4 N$ Q) x8 g. t9 q

  77. 2 X! t1 \+ G: ^. |( U- g' k
  78. static int acnt = 512;' r8 Y$ V! K- ^
  79. static int bcnt = 8;  f, D6 w+ X8 {9 p1 v) x. @
  80. static int ccnt = 8;7 Q3 X; j8 a- O- ?$ r, w

  81. ( A+ y" U* D+ J' ~6 w& X
  82. module_param(acnt, int, S_IRUGO);
    4 M. u8 p% B1 }1 I1 [1 l
  83. module_param(bcnt, int, S_IRUGO);
    ' k* i0 O; f- M( w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 d& W3 Z6 y7 r# I3 H) v- Z/ j6 v) y' e% d* ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! p) j# ~6 V% A' p% X2 B/ H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" m- u- e( i0 W6 d+ e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( V% l* k5 |* r/ j' X. I, t) y/ n' r1 z! o) n

: W$ V  g* U3 h1 R, x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-4 14:20 , Processed in 0.045871 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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