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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 S: _: p; R* M+ D
  1. [code]EDMA sample test application) }$ r1 n4 |1 q3 T3 [; ]
  2. /*! ~. `! V" o; h0 t
  3. * edma_test.c
    + E6 I; W7 U* |. \7 p2 V
  4. *, @: Y8 R8 N; e5 q, Z
  5. * brief  EDMA3 Test Application) u8 W1 s; y, ?8 m8 @( x+ Z/ J
  6. *3 r; z! m2 `2 V& q: w( e0 V3 C
  7. *   This file contains EDMA3 Test code.
    ; O) A) |! n0 T/ p! `5 s4 ?. z2 y
  8. *
    , T0 n  H8 ^1 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 z4 I4 M0 {- _. t# {. G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 ^! g! Q6 }5 }9 P& S: F
  11. *         TO CHANGE.
    ' _4 M4 m% e9 f/ b! v( Q) Q+ j3 b
  12. *2 R+ r. W0 u1 `  D' O, s2 U1 g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 f' _& Z: }4 K1 ~, [/ C1 ~
  14. *
    * j4 E6 Y& r! t# [5 w' a
  15. * This program is free software; you can redistribute it and/or2 x% o# B/ V2 V' I. j$ [
  16. * modify it under the terms of the GNU General Public License as
    * H  u: W. T! v
  17. * published by the Free Software Foundation version 2.# |7 L4 j& B: ]/ M/ a8 K" H
  18. *
    5 r+ l4 s. u% l7 \5 S, }" t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * g3 P* O" h* d, X% U% J+ H% B) n2 j6 F
  20. * kind, whether express or implied; without even the implied warranty
    ) K3 n, ^2 @; ?: E4 ^& i% C1 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 f- k  E7 U5 m8 P0 s5 w4 ], y
  22. * GNU General Public License for more details.& _+ H5 k0 A7 [6 O9 {9 e5 R- x- h
  23. */
    2 o5 K' W) k9 L% ]5 f1 b
  24. # l. k: a; b: H+ R
  25. #include <linux/module.h>
    ( @5 `6 F2 V3 L" K  T* P8 E
  26. #include <linux/init.h>5 g/ |: E+ A- ^* r% m
  27. #include <linux/errno.h>. q7 }9 o# I2 s) @9 v
  28. #include <linux/types.h>( G6 }! @) K3 M
  29. #include <linux/interrupt.h>
    % A' G" q* G+ m& F* @
  30. #include <asm/io.h>+ J/ N* k1 o" O7 j' f: |0 p
  31. #include <linux/moduleparam.h>: K. a8 ]* p3 E; }- ~
  32. #include <linux/sysctl.h>
    - `" b9 ~/ h  f0 f
  33. #include <linux/mm.h>
    3 o8 I; T) E, A( \5 J' [
  34. #include <linux/dma-mapping.h>9 C+ B9 D! l0 Q1 F# F

  35. , M" c+ G9 z2 x; _
  36. #include <mach/memory.h>+ h- D! }0 x/ E7 I$ @
  37. #include <mach/hardware.h># i) f3 c' t% h* B( e5 l+ e
  38. #include <mach/irqs.h>
    ( @! Q5 J& S* N* X. w8 c
  39. #include <asm/hardware/edma.h>3 l) |8 X0 K. Y% Y8 C
  40. 9 e& w5 z! r# m, Q
  41. #undef EDMA3_DEBUG% B' @! d# ~2 p3 I6 v" `! a
  42. /*#define EDMA3_DEBUG*/7 m7 l6 S4 V  e; G6 K& W1 H

  43. $ J) I5 M6 f, P
  44. #ifdef EDMA3_DEBUG
    7 e, X" t' D3 ^3 M' W; e+ ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ l, i6 i" g, F- ^" W7 H) f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . S& G& C* Q1 m1 v6 K: M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 y+ y: a' ]$ E6 Z
  48. #else# ~+ C; U% g0 X7 u
  49. #define DMA_PRINTK( x... )/ H/ C. n3 r9 m7 v+ w
  50. #define DMA_FN_IN7 N; d9 |) s( Y& \  g
  51. #define DMA_FN_OUT
    6 h! \1 U2 B$ b* B+ A+ k
  52. #endif
    7 W4 u8 C% Z8 Y0 @# v. H' b
  53. ' i3 Z$ N, M* ^) ?2 ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ Q+ c! y4 c/ k  ~) h4 H, x# R$ w
  55. #define STATIC_SHIFT                3
    ( ^% b8 `1 H1 x
  56. #define TCINTEN_SHIFT               206 J* x# ]% x! a* g5 F/ R) N& ~7 O
  57. #define ITCINTEN_SHIFT              21& {7 h0 j% |9 a+ \8 d3 D+ x
  58. #define TCCHEN_SHIFT                22$ M! W# e  v! c( F  Q! {
  59. #define ITCCHEN_SHIFT               23! W5 d9 z5 D2 E# ?8 c, b0 ]
  60. & \8 g  f1 F, @- S5 u
  61. static volatile int irqraised1 = 0;3 {/ C7 M2 v9 t
  62. static volatile int irqraised2 = 0;' r9 Q- V/ y8 u% |8 L5 U% |

  63. , F2 c0 P) e: D! F5 r8 M& Y6 G: F1 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) x$ m' J. u8 U; a' p. N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / [4 L. z( ~+ n. B* I  X0 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 v7 O' n; \  S1 W% \
  67. ; x& j  h) U5 _8 B7 u9 e
  68. dma_addr_t dmaphyssrc1 = 0;% l% I) U1 A" X* ^3 ?
  69. dma_addr_t dmaphyssrc2 = 0;& I2 L4 m+ E2 ?- x+ Z% u
  70. dma_addr_t dmaphysdest1 = 0;0 v6 K0 c8 D$ c5 L: y1 A6 }' H3 R
  71. dma_addr_t dmaphysdest2 = 0;/ p8 x$ q0 u3 Z, Z3 D' U1 D
  72. 7 G0 B; D& _5 |" n
  73. char *dmabufsrc1 = NULL;
    * a+ ?8 R" n# O7 E% p, B! L
  74. char *dmabufsrc2 = NULL;
    0 |' ^2 W% J0 n
  75. char *dmabufdest1 = NULL;
    " l0 g/ z/ [9 m
  76. char *dmabufdest2 = NULL;+ R4 C. V$ D, N' ]! `

  77. , D: X0 K  T% B
  78. static int acnt = 512;4 Y( j& w4 `* ~# w! M
  79. static int bcnt = 8;
    5 X' x* H  c& D
  80. static int ccnt = 8;
    3 B/ f0 _' [; S) D1 I
  81. , V0 S3 Q+ ]' f( L! \4 K
  82. module_param(acnt, int, S_IRUGO);! r. e! q0 E6 p
  83. module_param(bcnt, int, S_IRUGO);
    $ H" x+ l/ G% O5 Q- [# B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 O1 u$ [' ]9 }
3 t* x  W( F, c: D8 v4 t2 @4 X( c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- Y8 Q- E- Q2 Y. v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; }3 O4 q$ @0 z% p1 ~2 k$ {1 s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 [: k( I/ {/ E* J
5 `1 R4 f; ^3 U
/ X4 {4 {1 H( R/ y  K: G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 16:40 , Processed in 0.043923 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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