OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 @1 f* ]- T/ G9 B9 W
  1. [code]EDMA sample test application8 k) \! j2 W# f  F& J7 W
  2. /*0 A; b# p% a+ s2 r
  3. * edma_test.c
    / G& {) Q" M/ L! e  X
  4. *9 @% _& u; ^5 p' d& w
  5. * brief  EDMA3 Test Application0 ^) Z. h! \) z) V8 X
  6. *
    2 G' f) V* J5 d: f% f
  7. *   This file contains EDMA3 Test code.; J5 m& V; K; n9 B
  8. *
    & M, _. j, P! t: Y8 c& d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : A( {3 B2 K+ j& K! u8 S& F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ w; S, ^0 n3 E
  11. *         TO CHANGE.
    6 n! t  {0 J& e- p/ A  U! `2 V
  12. *$ d# ?7 Z5 y* ^! o" r1 M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ N+ {8 S# O: [
  14. *4 ?( _8 E$ n9 r9 y' T+ \6 V
  15. * This program is free software; you can redistribute it and/or
    3 r) A# X1 q0 V% P
  16. * modify it under the terms of the GNU General Public License as
    " S6 B, C) u+ O& O$ f
  17. * published by the Free Software Foundation version 2.
    ' v) E5 X4 P/ k( v+ L( E
  18. *
    . g6 o, Q0 c3 V6 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) y' @% @% ?! X  @) U' Y
  20. * kind, whether express or implied; without even the implied warranty
    ) x6 }% c' x; p2 r2 X4 d9 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' T2 a8 B9 S1 N/ k0 n8 t) T
  22. * GNU General Public License for more details.
    " Z( J/ m$ H2 N9 ~) M5 {4 x) N
  23. */9 c+ k1 e; ^7 g

  24. * R" y. w; i+ D  K( N8 s
  25. #include <linux/module.h>  ?# `% @8 z7 \& s7 ^! m
  26. #include <linux/init.h># _" [8 c/ J5 a9 Z4 p) a
  27. #include <linux/errno.h>& e* ]! r* N2 ^3 ^" a& J4 [/ R+ K
  28. #include <linux/types.h>0 C' v0 d. l  \, x' G; h
  29. #include <linux/interrupt.h>+ O, {& A+ F& d% _  b% C0 H
  30. #include <asm/io.h>
    6 x) u3 D/ \/ [4 P% r9 K
  31. #include <linux/moduleparam.h>9 L' k' p; A) R' P2 F2 [4 d/ ~. f
  32. #include <linux/sysctl.h>
    - F# D% Z4 j3 ^/ M$ j2 `
  33. #include <linux/mm.h>8 S# ~: R" h- k
  34. #include <linux/dma-mapping.h>
      I& ^. Q7 {4 b' K, W: g5 {$ p1 Z& z

  35. + s- `4 ?6 ?! _5 \
  36. #include <mach/memory.h>. j# [  R6 h) t' u' f& p
  37. #include <mach/hardware.h>9 Q: I" {( K( p0 v
  38. #include <mach/irqs.h>
    ' K' D9 B2 `! }, y3 V2 s. W
  39. #include <asm/hardware/edma.h>
    . k9 S$ J6 I  F

  40. 5 Q, R; Q! `1 K9 d" s* G! U
  41. #undef EDMA3_DEBUG, }) v6 \% ?" U+ x7 X5 n; M. F
  42. /*#define EDMA3_DEBUG*/. G8 D$ m$ h6 M* G& E/ Q# H0 o, P
  43. 7 I1 f1 s# i9 T6 A) H& `  e
  44. #ifdef EDMA3_DEBUG
    % M/ V, }: f1 }: {/ j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 q- M% Q9 R' L% {8 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 T7 N& U) y( }, R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . a- ^, G. F% ^# j
  48. #else
    3 H+ {3 l5 Z( I3 _2 N9 z
  49. #define DMA_PRINTK( x... )+ d! M; _/ u! H7 u' w
  50. #define DMA_FN_IN
    6 v8 F: ?- z2 F
  51. #define DMA_FN_OUT, I( ~% y( [: T
  52. #endif! P& X+ B! }8 p% M# O6 ~
  53. ) V( C8 l7 d) r0 c. c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " `' \- u3 k8 s7 Q
  55. #define STATIC_SHIFT                36 _+ L/ a- O$ f8 `' A: ?2 A" a
  56. #define TCINTEN_SHIFT               20
    & F1 g0 [; n# G4 S6 `) @
  57. #define ITCINTEN_SHIFT              21
    ( s. I" J9 @% y0 u6 F% f
  58. #define TCCHEN_SHIFT                221 H  D; A& e: @  ~* O
  59. #define ITCCHEN_SHIFT               23  k) r! w1 k# q' v- g) M

  60. 4 \4 S" Z5 h, e! V0 m* W. \& n7 D
  61. static volatile int irqraised1 = 0;
    3 N9 `3 Z& y, l, c
  62. static volatile int irqraised2 = 0;, }1 o& ~+ W- l3 c1 g
  63. 3 ^. K) g* n% f! S0 _& x% \  s* [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, G' m8 T$ P7 z" n) u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* d9 w5 W0 S+ \" m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! f! d9 X/ D; G/ U8 W0 r& {" w

  67. + J% r/ _0 k" \' E9 e/ u
  68. dma_addr_t dmaphyssrc1 = 0;
    # z+ r( o# U2 ^4 b
  69. dma_addr_t dmaphyssrc2 = 0;
    4 B) R. B! c8 e9 p
  70. dma_addr_t dmaphysdest1 = 0;/ M/ P0 a+ ^5 \$ F2 d
  71. dma_addr_t dmaphysdest2 = 0;- ?3 R  B: Y; [+ }: k- h& X, y
  72. # J# e6 k" N- E1 j  a' q0 r
  73. char *dmabufsrc1 = NULL;
      f& l+ }8 A* u. |$ M" S( r/ g
  74. char *dmabufsrc2 = NULL;
    ; m% k4 y" ?+ T5 X2 P! M2 s, F5 S
  75. char *dmabufdest1 = NULL;
    3 J+ _, Z4 _+ P" i8 W' Z# Y$ b
  76. char *dmabufdest2 = NULL;
    ' O% I, f# f) t  L7 t, ?2 c; o) d0 r8 h2 Y
  77. 1 r- [. Y) w8 o3 `6 |0 F
  78. static int acnt = 512;
    ! W  ?4 S. n: c% M( w6 o
  79. static int bcnt = 8;
    5 J! `  G  B8 x
  80. static int ccnt = 8;0 t- D2 `" C% y& c$ s. n1 ]

  81. . L6 x* l, P5 E# {  N7 a7 p1 P
  82. module_param(acnt, int, S_IRUGO);' |" \/ U) a: z7 d% B# _2 `+ c
  83. module_param(bcnt, int, S_IRUGO);
    % r( g9 E) Y# c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# E6 N7 R9 w. c) E) ~+ ~
% o' u+ E+ @. |5 p0 O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& M7 Q2 V, A% J- l& S. w7 H- O) I6 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) i2 u1 |$ }. p* i2 e8 B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ h7 k# x3 T* ~, T/ `0 Y- ~
0 o% N  ]  z& H, K4 g$ {  X/ y- T7 R8 \, b' z2 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-9 11:16 , Processed in 0.057240 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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