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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( A. i, V9 l8 |2 P
  1. [code]EDMA sample test application
    5 W# l$ J4 M$ R
  2. /*
    # B8 r& U1 X; l0 \. t
  3. * edma_test.c
    2 a7 N9 g4 w: z3 y8 B/ f4 `3 K8 N
  4. *
    : A' {$ Z) K6 g9 c" O: ?$ B
  5. * brief  EDMA3 Test Application
    . H2 f% ^" x8 @, c' ?1 r
  6. *
    / t/ Q( P' y) P& N, ]' v+ u  p
  7. *   This file contains EDMA3 Test code.. [1 M& ?$ ~1 o* S7 A" h7 y! e7 P, B
  8. *- u  x0 l+ M9 D2 A- _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 j6 D* Z  |4 X: _, K+ v% R/ [3 [$ E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; j  n/ S# A6 W
  11. *         TO CHANGE.
    3 j2 S! M$ j9 Q6 O+ m- s6 b; T
  12. *9 f. D- o+ B; }. D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  I( s9 T! B9 q$ X
  14. *
    - T8 `6 a7 Y3 r3 U" b8 F) S- F
  15. * This program is free software; you can redistribute it and/or9 I2 X) c6 F# F! H$ U, h! a
  16. * modify it under the terms of the GNU General Public License as0 A) z  ~3 E+ \& d1 z3 U
  17. * published by the Free Software Foundation version 2.
    1 ~5 M2 T( d: }- x6 o# f
  18. *4 Z5 z& @- X/ a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, V5 e* j9 C- j! |  i0 k
  20. * kind, whether express or implied; without even the implied warranty
    & n- ?+ V- u5 P4 B" o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 A4 [; Y+ J- ^! i" a9 P! o* g6 j5 E7 l) ~
  22. * GNU General Public License for more details.
    4 y! ?$ T7 k: l
  23. */  r$ F7 a8 `/ ~
  24. - k' j. w/ e* Y/ C& c! W5 R2 f3 ~
  25. #include <linux/module.h>
    6 \# G( @; K6 }. V/ g% M- \
  26. #include <linux/init.h>
    " Z" b0 U% ]9 n/ `: \) ^0 X
  27. #include <linux/errno.h>
    % k+ o2 ?+ p+ \
  28. #include <linux/types.h>8 H' Q+ r& ?. ]. w, n( w
  29. #include <linux/interrupt.h>
    - k" O% E: z; Q7 z& ]1 x9 y* [. [( Q
  30. #include <asm/io.h>$ p! }3 O9 @1 S: {% Y
  31. #include <linux/moduleparam.h>
    5 J- F5 t7 m/ J, \' A9 r* m( W
  32. #include <linux/sysctl.h>
    . R9 t' D; Z, x7 `' r% w' |
  33. #include <linux/mm.h>
    ; G& y' h! z  `4 [
  34. #include <linux/dma-mapping.h>% x- i# y) S+ s2 i; v. K
  35. + H  k9 L1 j; u
  36. #include <mach/memory.h>; y) X1 R( X/ }0 l0 B
  37. #include <mach/hardware.h>
    ) E  \% g4 S8 n& X6 E' T- u
  38. #include <mach/irqs.h>4 F5 {+ ~/ ]* h, E/ t: s
  39. #include <asm/hardware/edma.h>% P. U) S  ?; m9 Y& `/ n! N
  40. 4 q4 S; n" ~1 q' d/ f3 |, i% L& h: q
  41. #undef EDMA3_DEBUG/ B& j" E% q' ^. ~) \  d
  42. /*#define EDMA3_DEBUG*/( V' R- _9 m- P1 w! F
  43. 2 c: f6 ^2 v) T# i
  44. #ifdef EDMA3_DEBUG
    / L3 s$ `4 ^# R) p8 W: I6 ~$ A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 _7 w# Z+ c' q4 ^  @. Q3 ]8 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & U+ n7 ~# ^0 X( T! p1 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * N( p' f% F, I0 o
  48. #else+ B) _) I7 e" a+ J1 e  m) E2 H
  49. #define DMA_PRINTK( x... )* ^/ z' B  ~- M9 q9 ?& t: W6 f' @9 G
  50. #define DMA_FN_IN
    6 Z. {$ \- a  w- N# Y
  51. #define DMA_FN_OUT" d" K. `/ z9 w$ t6 B6 W* G$ q+ R
  52. #endif
    # f  ^# D: ^' h

  53. . ^$ `/ e. f) y! p/ l' }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 G2 }# m4 s( h- Y& {
  55. #define STATIC_SHIFT                3
    - W/ z, a! V2 K$ F( B+ e  }
  56. #define TCINTEN_SHIFT               20
    " v0 X$ f! s8 |2 ]& E, G( }
  57. #define ITCINTEN_SHIFT              21
      Z/ s7 g2 z: x5 Z6 B
  58. #define TCCHEN_SHIFT                22! a( K! P+ h  U2 e% g- |9 D6 h+ F3 n
  59. #define ITCCHEN_SHIFT               23
    8 w( f* a2 I0 h

  60. 3 x8 U0 ?! ~# N3 R8 w
  61. static volatile int irqraised1 = 0;3 W. u6 R7 O3 ]" r
  62. static volatile int irqraised2 = 0;
    & L- v% a) M; s6 n" E

  63. ! G# X7 s: U9 N' l4 e& m, U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) T. t/ ?: W& F- h+ O( B: c  H6 H9 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ]+ w; f( ]* L$ B; {/ S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 I4 u- |+ s% b( n, E5 }/ @

  67. - F4 Q0 C' M0 _: X8 T2 d* @6 z) b
  68. dma_addr_t dmaphyssrc1 = 0;7 L, x0 |; v! H6 N/ L
  69. dma_addr_t dmaphyssrc2 = 0;
    5 d  p/ k6 d( K" h; e* L6 z) X
  70. dma_addr_t dmaphysdest1 = 0;
    3 R7 I4 b* P! J( j
  71. dma_addr_t dmaphysdest2 = 0;. E' g$ X) Q5 ?- |# F, \5 X

  72. * C* u4 \9 \+ ]
  73. char *dmabufsrc1 = NULL;0 p0 N7 g. O7 ~- |
  74. char *dmabufsrc2 = NULL;
    " n1 n. U8 E3 Z8 l* F
  75. char *dmabufdest1 = NULL;' j# _) _& f3 b
  76. char *dmabufdest2 = NULL;/ @. g: k2 b& O% F% K9 U( Q; a
  77. ; w2 ], x5 U# M/ f
  78. static int acnt = 512;: a2 b  c2 ?  b. p: ~* l( T
  79. static int bcnt = 8;
    4 \6 ~' L8 h8 E0 y. |" @# V
  80. static int ccnt = 8;/ N' a& ^* {  [5 }  [

  81. # s' ]( n" A: c
  82. module_param(acnt, int, S_IRUGO);
    & _5 G3 P6 o. G5 v
  83. module_param(bcnt, int, S_IRUGO);
    ; n6 P# O0 i" J& n+ g% S1 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ F# ~; r6 i* \/ [; k
; n9 |* C  \3 w4 g" l4 l! |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ j- {% V4 R; N6 j1 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& L( _2 d1 b: t: K/ l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, q0 V0 ^. g( c0 j. T  ?8 \
* q3 X( T% B5 l- ?2 n5 o" _2 x; M, F: S1 ]8 m0 q0 _3 V; o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 15:45 , Processed in 0.038384 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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