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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' t$ ]0 Q& |8 y  ^. i+ W
  1. [code]EDMA sample test application
      J+ d4 T  H4 l7 q
  2. /*
    ; p+ I) @3 ^% g% s4 U' ]
  3. * edma_test.c
      [/ G5 B! H" L4 R, x
  4. *
    " d6 ]& O4 D9 E6 K! ^+ r3 @% W; z0 ?
  5. * brief  EDMA3 Test Application
    , J! m* U# y- b
  6. *
    ; _, ]6 f) R* p  b0 D2 r8 F
  7. *   This file contains EDMA3 Test code.
    4 Z& t; g9 }# k
  8. *
    1 n. Z( e7 \* C9 y1 G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( u% W  W( V: F/ z) a) l. B' s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; H& m" r1 [5 w5 a0 a
  11. *         TO CHANGE.- W2 X* F& N3 {3 ~0 T
  12. *% x) O; n6 V& N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// u& j' e7 y- `5 w4 s% k/ }9 P
  14. *3 _/ _' |- D2 z) w3 ]+ ~
  15. * This program is free software; you can redistribute it and/or
    $ l, ?% S7 {2 A2 ?' ~4 B: C
  16. * modify it under the terms of the GNU General Public License as4 w8 [  K- @& `/ ^# k* x. Q8 s
  17. * published by the Free Software Foundation version 2.% W: W7 b% j4 g3 X' ^; o$ ^
  18. *
    5 U% R. |; B- H; h, W. B/ U2 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 L6 d* l: T: Y  k$ |' S/ x: E
  20. * kind, whether express or implied; without even the implied warranty
    / g# ^4 ]" Z$ p: n: h6 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  c/ c3 G5 t8 M" h4 l4 @. h
  22. * GNU General Public License for more details.; x; @/ L6 L/ F& ?4 s* N/ }( M
  23. */
    0 E; h, o2 J+ [# J8 B" T  y+ v6 b
  24. 6 L5 y- |9 x! C. @! ^6 o
  25. #include <linux/module.h>/ x0 c3 l; Q9 T4 @( w8 d
  26. #include <linux/init.h>
    $ {6 q1 c; V( {" h; O1 |+ M
  27. #include <linux/errno.h>
    6 T1 d: M( Z$ j
  28. #include <linux/types.h>
    * \2 z  s2 I( g* ?; `
  29. #include <linux/interrupt.h>3 ^1 P9 o  |( Z! |; w7 u
  30. #include <asm/io.h>
    , d0 \% Q: z. r# j# {2 N! m3 y
  31. #include <linux/moduleparam.h>
    * ^+ ]0 r) `9 f1 r4 y6 z
  32. #include <linux/sysctl.h>5 S( N* n+ t+ t. j' E  c+ R3 o( ^
  33. #include <linux/mm.h>
    ; u- K" S8 z. `9 o4 Y$ ?' k
  34. #include <linux/dma-mapping.h>
    : o5 Y! \+ B; L( A+ t2 r0 J" p+ O

  35. " u3 e) N; J9 j% o1 o; Y& K
  36. #include <mach/memory.h>5 G+ g1 ?8 X  T5 X! {" Q* I
  37. #include <mach/hardware.h>3 |2 W/ ?- {6 z; _
  38. #include <mach/irqs.h>
    2 ^# m- i/ `* A3 t
  39. #include <asm/hardware/edma.h>4 A" J3 |8 g: B4 @

  40. $ Q! L6 l/ s$ r9 G, j
  41. #undef EDMA3_DEBUG
    / b7 C  P: I; z5 e9 T( ~: U4 q) h  R
  42. /*#define EDMA3_DEBUG*/5 _2 `5 \7 x# O9 W+ f' Y9 }
  43. 8 F5 p, u0 O3 j+ @/ o4 c3 o
  44. #ifdef EDMA3_DEBUG
    ; r1 W7 ^' Y& |0 X# N0 _  I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 `) `1 U& w/ G' U  R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! }! g; m( y# t5 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % ]8 q& |* y7 S2 l1 A* a. \
  48. #else
    , J$ h0 Z# D  Q% g- @4 |+ C
  49. #define DMA_PRINTK( x... )
    * b+ r% @! X" l, v
  50. #define DMA_FN_IN
    8 Q: u. J( G; ~% n5 M
  51. #define DMA_FN_OUT; u# a1 u0 i: a! M* d5 i' p
  52. #endif/ e) T4 h. {# `# T
  53. ! ~$ C- @! e% _; V5 T  u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ x8 S1 i3 n9 ]* l" E1 T
  55. #define STATIC_SHIFT                3. Y! T0 k4 t' b# V3 B7 i8 ^
  56. #define TCINTEN_SHIFT               20
    0 D, j  b8 w$ l8 ?& T
  57. #define ITCINTEN_SHIFT              21
    & p" h! y. k& N4 ]
  58. #define TCCHEN_SHIFT                22
    ( z  K: P4 E/ C/ _2 \8 P
  59. #define ITCCHEN_SHIFT               23* o+ u- r6 o9 }% K# Y
  60. 1 H% H! @# D, J0 k
  61. static volatile int irqraised1 = 0;
    3 Q$ h# F  n* o8 B
  62. static volatile int irqraised2 = 0;' [5 y; @, J1 u! _
  63.   T; K0 C8 C0 W% S9 M$ X( e$ b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% m  Y, W$ o9 L8 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % v: L3 u4 Z+ v0 d* a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 |' f7 f0 ^4 d+ n+ Q3 M$ K7 O
  67. ( E  K: C7 j2 o) k( {& }
  68. dma_addr_t dmaphyssrc1 = 0;
    # t0 E! q9 {' d# \8 U5 m
  69. dma_addr_t dmaphyssrc2 = 0;
    - d5 e& O# f/ F- R: ~7 M2 {
  70. dma_addr_t dmaphysdest1 = 0;; V: ?! f6 h8 T( X+ n2 B4 W
  71. dma_addr_t dmaphysdest2 = 0;: U3 L6 L# [( K, X+ q" {+ `% `
  72. % i" t' ?9 D- _) g; T
  73. char *dmabufsrc1 = NULL;
    # a' u, n9 g( ]" f* X+ w
  74. char *dmabufsrc2 = NULL;' T3 {( j( f; e, |( t# j
  75. char *dmabufdest1 = NULL;% E0 e" ~& m  b4 H, n
  76. char *dmabufdest2 = NULL;7 O* ~/ o5 e+ e- Q) s
  77. # z0 F+ y7 V! G: Z
  78. static int acnt = 512;% o. P6 P/ x9 S; B4 c
  79. static int bcnt = 8;
    ; y+ y) h4 l' Q, s! E9 M& `9 M
  80. static int ccnt = 8;( Z/ i; g  Q/ u5 S
  81. ) I! @- ?5 l: x  n
  82. module_param(acnt, int, S_IRUGO);. m& m' S+ w1 E0 V
  83. module_param(bcnt, int, S_IRUGO);) d* n2 i& k# @* |- x  D! w! Z4 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" h# ~( i; _5 w6 m+ I, `

  x7 F$ w4 K* T  T, I" u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 A, u1 j; F! K9 |, Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! E+ c5 c+ l3 }2 a8 D; L1 F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 X6 S. u7 W" u  _  v; Q4 k( T  x3 W. B. |! f
4 g% M% F8 ]$ P3 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 13:28 , Processed in 0.038868 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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