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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 G* k+ q/ N) J* g
  1. [code]EDMA sample test application
    ; r8 h$ m7 U) a1 n+ E& N6 o
  2. /*: X& t" P# H& ^" h  w
  3. * edma_test.c
    ' `9 d/ O) V8 g: c
  4. *
    4 Z! i' g0 q8 ?( }8 B
  5. * brief  EDMA3 Test Application# u6 |" c6 t5 {2 W0 C: B
  6. *" L1 {7 h: e( X) V+ y# T
  7. *   This file contains EDMA3 Test code.) `7 y  [" B: v; r. C
  8. ** j# a& h4 H! }' K2 o: f0 b. d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ D9 O3 z4 a: ?# |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 y$ o- c! y5 p% ?1 g& n; X" m
  11. *         TO CHANGE." F- J% \  ~$ L8 Z: T
  12. *
    ) p7 U1 _7 T( i" \% C1 L$ r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # |8 t. |( t8 C' }2 z
  14. *$ r7 Y7 w, P# I7 s/ Y7 ^) N/ V+ u
  15. * This program is free software; you can redistribute it and/or; A+ D; e  b) `, x- r1 k" P
  16. * modify it under the terms of the GNU General Public License as
    ( {6 s: e/ T! q+ g
  17. * published by the Free Software Foundation version 2.
    - p' t; x6 d: n: F1 R" Z( @
  18. *
    6 B; `/ t* ]" x/ v! W7 f1 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& }1 {8 c& A4 C( {& w" S  }
  20. * kind, whether express or implied; without even the implied warranty
    ! ^0 t) ?) \0 s+ h+ P  h  d( k! z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; g9 [8 s( t; W( [3 a3 F, Y
  22. * GNU General Public License for more details.
    . H2 J; v  V. N3 v& X7 l& w
  23. */
    ! T- E/ n" F# Z4 O9 S/ ]

  24. # _. H% c  L. s) N4 g
  25. #include <linux/module.h># {- ~$ L6 ?& ?0 `, f
  26. #include <linux/init.h>- R& b6 o: t* T0 K
  27. #include <linux/errno.h>1 s& f+ t# l+ W5 X1 a' T
  28. #include <linux/types.h>
    * i0 _8 s/ i2 j( s2 I
  29. #include <linux/interrupt.h>
      W/ U8 F$ u2 W: `' ^
  30. #include <asm/io.h>; D* C+ d5 w$ O- w6 d
  31. #include <linux/moduleparam.h>9 ]2 ?3 x4 `% E" T' `: D" ^
  32. #include <linux/sysctl.h>
    0 Y7 L: v: ~  l5 |2 D  p
  33. #include <linux/mm.h>
    * O7 ^/ t$ K4 p" B6 m: Y
  34. #include <linux/dma-mapping.h>. T4 V4 Q3 K8 N: I0 Y* _/ ]  e

  35. 8 Z: w; X0 r( m1 m; v2 B
  36. #include <mach/memory.h>
    / N" d7 q! [6 }
  37. #include <mach/hardware.h>
    ' b$ r8 a: n: R
  38. #include <mach/irqs.h>
    ! P8 b# A+ Q! G/ y6 Y6 A' ~8 |& x
  39. #include <asm/hardware/edma.h>
    5 c6 v( W- h& a/ J# v/ E
  40. 3 z) r- N6 D6 T8 z
  41. #undef EDMA3_DEBUG% z6 P3 M; L# c& l
  42. /*#define EDMA3_DEBUG*/
    + X1 A( @3 m  v- h

  43. / @* D/ d+ \2 d, v6 Y) a" \
  44. #ifdef EDMA3_DEBUG' s4 H1 D/ R" w" h7 V; ~9 m& I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! H' ^0 M1 B' y, k* M' e3 U& {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 ?1 B  J8 ~  [9 g# t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& `: `2 B+ B- P0 w. Z3 g* x; D' o
  48. #else+ g2 u! Y9 Z8 \
  49. #define DMA_PRINTK( x... )
    # b2 C% P8 z6 i1 e$ K2 H
  50. #define DMA_FN_IN3 R& z4 J7 n9 E" n1 l8 F0 h& X
  51. #define DMA_FN_OUT$ q1 S: L  g. t9 h3 Z- W2 E; y
  52. #endif
    & ~, o9 g/ W5 G: r2 e2 i6 a
  53. % {4 U6 m! V" I- L/ F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% ]0 h% j$ }9 Z) ?
  55. #define STATIC_SHIFT                3/ \, K' ?! b4 W
  56. #define TCINTEN_SHIFT               208 [0 h$ V9 x. ^. ]; o" G0 N% ]4 M1 {5 w
  57. #define ITCINTEN_SHIFT              21/ O; `6 V0 {9 F, x9 y
  58. #define TCCHEN_SHIFT                22
    6 }  I3 k, J0 g, J4 ~6 V  J
  59. #define ITCCHEN_SHIFT               23
    ; G( r" d0 G( ^4 j; G: x
  60. + H8 K* Q0 O+ l( I- }
  61. static volatile int irqraised1 = 0;% k$ L- {* R( u+ b
  62. static volatile int irqraised2 = 0;
      ]' P: [$ b  h, O2 c! y  k7 N5 D
  63. $ R" o+ s" m% ^$ t% e  F& U6 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" J) E% c4 ^7 I& r8 r% E9 O. C$ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 D: }: V' j2 K( H" L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( `3 n! m+ N/ V3 E# J6 I) C- N

  67. 0 m2 n% w, w. r; N# c1 Q5 q
  68. dma_addr_t dmaphyssrc1 = 0;3 ], o+ }8 w  d3 w/ ^0 h% L$ F
  69. dma_addr_t dmaphyssrc2 = 0;
    1 p1 y" h+ V& [3 s) E8 o* h
  70. dma_addr_t dmaphysdest1 = 0;
    . ~' E1 f) m$ {$ K5 I& {# Z
  71. dma_addr_t dmaphysdest2 = 0;7 ~3 @; F: v7 A, m$ A1 X
  72. # u3 I3 J; F( W& f5 i' P
  73. char *dmabufsrc1 = NULL;; o: l# G* Z& O" Y0 V( x/ ?) b
  74. char *dmabufsrc2 = NULL;
      {% e. T. B- w9 W  w% S
  75. char *dmabufdest1 = NULL;) o1 {. y  L0 ^0 Q7 V" t4 t! H/ `
  76. char *dmabufdest2 = NULL;
    % B+ k5 b5 n) a$ C* T
  77. % }1 ?7 h8 s) S/ ]$ R
  78. static int acnt = 512;7 r+ l2 t. A! N- h1 J6 G
  79. static int bcnt = 8;3 W- y0 @; q% @# e0 n( e, O
  80. static int ccnt = 8;0 k; @! G1 |8 D, Z* w* V

  81. ( \- N( _  Q7 p  E
  82. module_param(acnt, int, S_IRUGO);4 v( P3 H5 |9 v. ^1 L' n$ S* L4 ]7 L
  83. module_param(bcnt, int, S_IRUGO);
    2 w: A+ d1 L+ x: ]/ `7 j. \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* }1 z# R9 b, s) J( m  Q
1 g- @* r, X8 l( X; ~4 _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* A$ v  ?9 C/ j1 p. I6 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: T6 w7 G% e2 ?8 Y7 h, M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" }; ~3 f+ b8 d. O
9 h; X7 m- h8 m& B
, a) K! n7 M8 ^) C- {$ n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 05:22 , Processed in 0.044256 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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