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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) t. j+ t6 _- r( a* i
  1. [code]EDMA sample test application# k# d% d" w4 i2 p
  2. /** [. G" S9 Z# x: m: R, a% f2 ^; ?6 E
  3. * edma_test.c
    4 g3 X7 }7 I1 R6 v! z
  4. *1 a( j+ E( y- P) ^9 \" \
  5. * brief  EDMA3 Test Application) p- T3 A6 J9 D# i8 o$ P: G
  6. *: L$ k. Z5 z- H9 ]7 L- L
  7. *   This file contains EDMA3 Test code.- D- S8 L9 }- O6 ]; F: f9 [/ B
  8. *
    $ t: |, {% g; D1 \2 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : N5 c& q) B. c) h1 H. I! L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ c" N, ^4 p4 \+ J! l
  11. *         TO CHANGE.) _' M2 N/ \& f9 Q3 \' r. E+ E
  12. *+ f+ B3 A  V4 E: o! c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% {) P' C0 B0 ^5 l8 F1 D+ [. |
  14. *; |: P4 i9 c  {. I# Y  w) _: g2 Z
  15. * This program is free software; you can redistribute it and/or
    # ?$ n8 a- C* n0 z
  16. * modify it under the terms of the GNU General Public License as
    : R4 F/ V0 e6 [7 ^
  17. * published by the Free Software Foundation version 2.
    - w: Q) f/ K9 i' e$ @  k' `$ m1 p- I
  18. *
    + ]7 C9 g5 C1 r$ M0 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) a9 h; n0 u% G+ N5 e: I
  20. * kind, whether express or implied; without even the implied warranty! Y! e7 G) q/ L8 V, |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " [$ Q2 P+ j) p& N3 R& t# B8 ^- K# B
  22. * GNU General Public License for more details.5 j$ a$ s& {. o1 a! ?5 T
  23. */
    ! H/ B7 {0 `" V( ?$ P+ k, q+ u

  24. ' e. z4 G% B3 j6 K2 Y& z1 A" |
  25. #include <linux/module.h>
    : u7 Y) K( U+ w) b3 J5 `
  26. #include <linux/init.h>2 T% i5 I1 Y8 o
  27. #include <linux/errno.h>
    & }6 _; w+ o% k
  28. #include <linux/types.h>( Z7 S) m/ Z" J( Q6 i
  29. #include <linux/interrupt.h>
    $ L" O6 M, Q: e' s
  30. #include <asm/io.h>
    5 w2 b/ N0 N3 W0 L! L9 q
  31. #include <linux/moduleparam.h>
    2 q2 F' z( X; F  t- F' i
  32. #include <linux/sysctl.h>
    ' [: }5 b  H' c
  33. #include <linux/mm.h>, f! e  z- h" z" _6 S# u# U, U9 _
  34. #include <linux/dma-mapping.h>* {% x+ ^7 g7 [& V: L$ t' G

  35. ) J  j, |& Q# P+ a
  36. #include <mach/memory.h>. e! K. S: T6 ?
  37. #include <mach/hardware.h>
    1 U( s! Y8 b. B( q/ O! Y
  38. #include <mach/irqs.h>
    ' s& J0 z) l1 `8 C6 G6 g: p
  39. #include <asm/hardware/edma.h>9 c2 B5 N* `. Y* v& f* R
  40. , h0 L: p' A( {8 K- B& P$ v9 m
  41. #undef EDMA3_DEBUG
    0 ?) Z0 A8 ]7 s% d: G
  42. /*#define EDMA3_DEBUG*/" z$ R5 n4 q" U, `/ _8 P
  43. ) h4 k" H% c% T- b/ C4 T7 S
  44. #ifdef EDMA3_DEBUG
    & x; g( K  K9 t: c7 C( X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & [" D$ d+ i/ X4 T/ m8 A% E  }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 i3 g0 I4 I  m' _4 I0 Z1 ^& G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 U" T" h# N% @2 K: I- S( X
  48. #else
    , B9 G% K4 |: T. n1 r1 i
  49. #define DMA_PRINTK( x... )
    5 u- R, |& c: K+ ~! r3 u5 I5 e5 Y
  50. #define DMA_FN_IN
    + ?$ N0 j& @+ ?& g" P, @6 Y
  51. #define DMA_FN_OUT
    / S0 m5 B4 p* I" Z- ?+ o- A" V( _
  52. #endif6 d/ D( G4 w& Q* x
  53. + y# g, X# m4 v5 }( z- [/ O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " R; [2 t3 m+ P4 j
  55. #define STATIC_SHIFT                38 J' j7 ?2 c! e& f# b3 p
  56. #define TCINTEN_SHIFT               20
    * M3 @: D. b. b/ ]
  57. #define ITCINTEN_SHIFT              21
    2 D0 ]; D  L% `" c* G1 z1 ^  \
  58. #define TCCHEN_SHIFT                22" r& z5 X; D, a8 t, k" I$ T
  59. #define ITCCHEN_SHIFT               23
    6 e9 h8 w) ^+ s- `+ Y
  60. 6 S4 c' c" a3 T1 i" y
  61. static volatile int irqraised1 = 0;
    $ O0 s4 I% C5 C) ]! v' Y3 J! S
  62. static volatile int irqraised2 = 0;$ t+ P& ?  D/ N
  63. $ R( R6 ]4 _: j; M) N% s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' t+ T7 m/ j/ `5 p4 N3 d* ~& v/ `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# g# u, K6 i1 l' ~% H8 e! {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * I3 X" b: H1 G: [* S) [7 q* C

  67. + Q( B$ b0 T8 I1 Q7 k+ h6 h
  68. dma_addr_t dmaphyssrc1 = 0;
    / S' x: o, _2 o, J. ]; q- W
  69. dma_addr_t dmaphyssrc2 = 0;9 _# O7 N3 r0 M' Y8 A5 [
  70. dma_addr_t dmaphysdest1 = 0;
    ! r2 \: K* G6 t
  71. dma_addr_t dmaphysdest2 = 0;' K  |! h0 B' ?1 P$ j( z& X
  72. / u7 Y8 j( X+ @  V' u/ m
  73. char *dmabufsrc1 = NULL;* [/ R  o: B4 P2 O7 h, {7 v
  74. char *dmabufsrc2 = NULL;' g# l+ [6 @5 D$ ~/ \
  75. char *dmabufdest1 = NULL;
      A( G+ X1 l1 y. ^3 L2 ?5 g
  76. char *dmabufdest2 = NULL;2 |; @& x6 Q' y  U) k
  77.   [* V" R0 I; }7 X
  78. static int acnt = 512;
    & ]3 ?8 Q4 Y& [/ j
  79. static int bcnt = 8;
    8 A6 E7 X: t3 ?! C! I
  80. static int ccnt = 8;+ }; Q* ~. g" b, p( r1 G
  81. 1 z% K' F2 e' l0 h! m# m$ P$ E
  82. module_param(acnt, int, S_IRUGO);
    5 [  q3 H4 w& h% D
  83. module_param(bcnt, int, S_IRUGO);8 [0 ^% C1 T$ G( }6 t. M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% T7 g) f2 n0 z' U. _% r; D
5 S7 L" z- X: s7 |. p& U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. y' S1 d% X0 _* z, K  l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& Y1 F- e6 x7 g. I9 ]( E) Z* e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- [' G" p" r# W! y
2 [. y' w" w* s6 O" @& I6 z; r3 v) f) q, Y! p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 01:30 , Processed in 0.042655 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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