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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 I6 [! {3 A6 I7 v8 R: l0 l
  1. [code]EDMA sample test application
    / M( M5 N5 B( S  W
  2. /*0 E: v( e. `7 f1 R8 E
  3. * edma_test.c* e3 E6 ?# r! u8 L
  4. *
    1 r$ x3 l+ Q+ ?' u. W; v
  5. * brief  EDMA3 Test Application
    ! ]& J) |. K7 \1 \9 A5 |( P0 y+ J
  6. *2 m3 E5 w/ \2 K, v, i8 e. @
  7. *   This file contains EDMA3 Test code.. F% m, ^; ?; w+ O5 ^
  8. *
    ! D2 w' R8 s  Z) V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 L8 w2 [; Z. Z% Q8 n* _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! Y1 _" o; _& M( x6 O+ t4 K
  11. *         TO CHANGE.
    ; _6 A. \2 g5 B+ N: b/ z
  12. *
    & F/ V) N0 k  F7 q2 V6 M; G: r% |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 T: |: a0 l, [6 \" L) I$ j8 @- a
  14. *2 ~& d' C% }$ J7 n7 m/ _2 T
  15. * This program is free software; you can redistribute it and/or
    - x* W1 e' b. G) n0 F' @$ c. Q
  16. * modify it under the terms of the GNU General Public License as
    $ C8 R! ^3 ^( w" l1 ?0 ]% {, z
  17. * published by the Free Software Foundation version 2.
    6 G# ~& B7 ^  d0 I" F& R& ?
  18. *; ^0 h0 M1 l. e$ Q8 L  g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: C* w; Z% t. ?3 w
  20. * kind, whether express or implied; without even the implied warranty
    ; T3 }0 o% X, k2 D5 k- r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 B  V, I" Y8 ?! z
  22. * GNU General Public License for more details.
    - ?0 q2 R; K+ O8 `
  23. */( q7 ?" q( c6 {1 f6 R" \

  24. 7 z' v. {) x3 [! R( S" J
  25. #include <linux/module.h>
    ! H& B) l* ^9 U! K( F
  26. #include <linux/init.h>6 C( B  J) z( Z% ^# J6 T' _
  27. #include <linux/errno.h>, p  K+ J' u2 C8 y- ?& A& l7 Q8 o  o
  28. #include <linux/types.h>
    1 l6 |+ N9 ^, A- @  V
  29. #include <linux/interrupt.h>' f9 I+ X8 V$ L
  30. #include <asm/io.h>1 a1 K5 Y6 a, q
  31. #include <linux/moduleparam.h>
    9 t; N1 @# X9 g5 Z& a* y
  32. #include <linux/sysctl.h>! A% w. O! D' }5 L' f% f' W
  33. #include <linux/mm.h>
    $ x5 f9 [! O- {) x, _
  34. #include <linux/dma-mapping.h>: S& Y) H: Y/ f9 P1 o
  35. 8 y+ D2 y6 o0 `3 v
  36. #include <mach/memory.h>" U, _# g2 M2 P& B
  37. #include <mach/hardware.h>, c. [: c) K/ v6 x" n( C5 y+ h1 t
  38. #include <mach/irqs.h>
    & [. `+ v) x- J8 j7 g
  39. #include <asm/hardware/edma.h>) q/ ^- P7 g+ v
  40. ) @- Z+ v. z2 D8 H7 l2 ~
  41. #undef EDMA3_DEBUG
    . f4 u" z& f: b  E) Z
  42. /*#define EDMA3_DEBUG*/
    2 x3 h, K  T1 U, g; y8 z) F

  43. ' k0 e: E9 t$ X" p/ N% j
  44. #ifdef EDMA3_DEBUG* u: i- h" A2 ~+ S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" E, j& a$ g" k- q% x! d* w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : M: m% j) ?* I5 S, ~& I& ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ g! t7 T* J; a8 L
  48. #else1 h6 @5 V' ~9 V; U) f7 O! d
  49. #define DMA_PRINTK( x... )1 u9 X$ k& E: t% b8 j
  50. #define DMA_FN_IN6 D2 G. s! S1 [. r" }
  51. #define DMA_FN_OUT
    . b' o' h8 k* i/ @2 b, U6 ?% T
  52. #endif
    " g# D6 ]: K- k7 B8 v* z" N. N

  53. : x; N. E) E! m; }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) g: U( J9 o% j2 O3 X6 A& s1 [
  55. #define STATIC_SHIFT                3/ M6 b, e% K5 k# g6 u% K# V
  56. #define TCINTEN_SHIFT               20! V( {% H: r7 W/ D& S" p& L' m
  57. #define ITCINTEN_SHIFT              21
    , [# x( B3 Z" w  h! }- V
  58. #define TCCHEN_SHIFT                22
    6 x% q" @1 ?' q/ ~' y3 l9 G
  59. #define ITCCHEN_SHIFT               23
    4 s3 z5 M* A9 y+ I' O
  60. $ N: v% g; c5 V% j- t: f
  61. static volatile int irqraised1 = 0;
    8 E( k* [$ t. y7 S/ n
  62. static volatile int irqraised2 = 0;* |3 M% e! U5 w4 e/ [* A+ U

  63. ! g2 Q) W1 t0 T5 ^/ I, k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & q8 M  O$ V8 x- r; M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& n8 O. g  U) {$ F, b6 v( D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 S! [- [6 u# \% n% n, Z; ~

  67. ( S" w2 M8 R/ K: v
  68. dma_addr_t dmaphyssrc1 = 0;1 O% x+ ], A; Z. k- l: ~
  69. dma_addr_t dmaphyssrc2 = 0;
    2 B7 l: z8 A' T8 w1 u
  70. dma_addr_t dmaphysdest1 = 0;
    6 x2 x" k5 I+ x! n: D
  71. dma_addr_t dmaphysdest2 = 0;
    . Z$ @8 J- j6 G! i. t

  72. 4 E6 [5 \& _; S  _6 O- \
  73. char *dmabufsrc1 = NULL;/ ~) R" a0 `: G3 P+ I+ M) v# Z) _
  74. char *dmabufsrc2 = NULL;5 z) R" r  B' d  c
  75. char *dmabufdest1 = NULL;; x5 ^0 e. n1 x3 ]2 r/ q
  76. char *dmabufdest2 = NULL;$ W1 I7 Z( H, }0 s1 P7 v7 c

  77. 6 Q6 ^+ j8 C2 }3 s8 G1 E
  78. static int acnt = 512;0 v% s5 [6 j8 N9 |$ a1 Y
  79. static int bcnt = 8;
    1 e0 H% y! }  b# [. q% `) ?
  80. static int ccnt = 8;
    6 J$ U7 h5 G7 l
  81. 7 f8 |  @5 {& O' Y  ?7 z6 E; X! Q/ f
  82. module_param(acnt, int, S_IRUGO);5 A# ?1 f7 f! r& O* Y5 D6 ]$ c0 n
  83. module_param(bcnt, int, S_IRUGO);
    " d' V# i0 J9 A& w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! z0 ~' e; _: H! E, d) `- D7 H" E! R* S2 h8 I0 t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ G8 ?) _1 Z6 n' e3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ }, A* \+ g1 I, J. \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! v: ^, X% [$ ?- c$ [4 K
  W$ Q' c' H9 S# u) A" T5 ^( e* j7 W4 @6 t0 p2 A3 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 15:22 , Processed in 0.039707 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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