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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( @5 h0 a) J, S+ V
  1. [code]EDMA sample test application) I& D0 J1 l9 h: I6 l
  2. /*3 d* H7 z/ o; `7 K3 Y
  3. * edma_test.c
    6 @4 Y3 \4 P. V$ ^- L- H
  4. *7 t, ^# Y, o0 E1 A
  5. * brief  EDMA3 Test Application% m2 p" t9 H! d9 m7 ~1 y% ]
  6. *
    7 M2 G1 j- L0 D5 j
  7. *   This file contains EDMA3 Test code.6 B/ m' j5 _. p& f7 Y# f
  8. *: P, `2 N4 U4 _1 R+ a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; O  Y; C3 S: ?! |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 v# C/ v) V5 \) ^+ F" Y
  11. *         TO CHANGE.
    3 b" j: H* B7 y: v5 E9 u3 p3 c0 J
  12. *
    " I" u# u' u" x/ p4 G6 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 C$ o* R/ d% @/ G
  14. *5 P8 k/ B# d: V# V6 Z
  15. * This program is free software; you can redistribute it and/or
      g8 h- X9 z# y4 @' ^; |
  16. * modify it under the terms of the GNU General Public License as9 f, }/ b; g1 i; {
  17. * published by the Free Software Foundation version 2.. }- y, O0 p5 {& j; c5 b
  18. *
    ' t8 o% @+ k" E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 N6 C1 I# M; j2 h1 f2 q) ?. L
  20. * kind, whether express or implied; without even the implied warranty
    4 n' N+ M8 f: E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. n" d- O- ?# N- s
  22. * GNU General Public License for more details., ?+ }( j6 b4 J
  23. *// y7 c; C$ Q' f3 z+ R
  24. ; r4 X  }* J' a- `! K
  25. #include <linux/module.h>
    4 V5 s; I( `7 T! T6 w1 T1 {
  26. #include <linux/init.h>
    7 K" V9 }! G4 e# ?7 r
  27. #include <linux/errno.h>
    # y: ~" K! G* d* \, A- l% _
  28. #include <linux/types.h>
    8 \5 ~; ~) i! y0 V" Z7 \
  29. #include <linux/interrupt.h>; Q  q  T  W( q/ |9 j  |
  30. #include <asm/io.h>' _& k6 o9 M2 n( V" L
  31. #include <linux/moduleparam.h>7 V6 P4 z/ R0 N- H+ O+ `; q4 s
  32. #include <linux/sysctl.h>7 ?3 N" ]! r1 W" n2 d
  33. #include <linux/mm.h>
    ' K8 X0 _7 F" T; @! h
  34. #include <linux/dma-mapping.h>
    " j. X. z& F1 S& C/ J
  35. + p3 I) P$ J$ B7 d8 m! r
  36. #include <mach/memory.h>5 C+ s3 w* n2 o% x
  37. #include <mach/hardware.h>
    & p  g) j. c1 W5 [
  38. #include <mach/irqs.h>8 o% _6 Z3 q6 d* ]
  39. #include <asm/hardware/edma.h>" k1 t! F, f' F& J# y! \

  40. 0 \+ I, K# M% w1 {+ }: r' q
  41. #undef EDMA3_DEBUG
      G' f: j, s) G9 G9 b
  42. /*#define EDMA3_DEBUG*/% x. Z& Z( Z( Z* T( g6 t9 [( o

  43. - K: L- M) p* q
  44. #ifdef EDMA3_DEBUG
    - i2 h' e' P$ `$ \) L0 K+ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 J6 l% c( v5 \. A& _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 v- M1 u5 f5 y; [6 u6 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% L1 H6 t. q0 B9 }7 T  h& ?) q% M
  48. #else
    7 q, Y) N3 |+ X# s+ Z2 s0 T. q5 G2 i
  49. #define DMA_PRINTK( x... )
    * k+ w6 E4 V) a
  50. #define DMA_FN_IN
      R  v5 @3 H1 q5 r& ]
  51. #define DMA_FN_OUT
    3 i; T2 k& a7 C: g: ]% b
  52. #endif$ `4 E! \- V7 ]9 m( V

  53. 8 D5 J. m5 t; B) ?2 L3 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 q2 F9 {" b+ l! H6 A8 z* B- \9 R, a
  55. #define STATIC_SHIFT                3
    ; J( T! X* u3 i( y; l
  56. #define TCINTEN_SHIFT               20
    / T$ W; }3 \3 ^5 |( C  j# u, N
  57. #define ITCINTEN_SHIFT              21; w: x6 O7 @6 ^* L) K6 a  o1 ~: |: Q
  58. #define TCCHEN_SHIFT                227 ]% T. V  ^% S( B- m5 _
  59. #define ITCCHEN_SHIFT               23
    $ L9 w8 q$ v5 F2 J: h! L" z2 r

  60. , J1 T1 V1 \9 K# Q: Y; N
  61. static volatile int irqraised1 = 0;
    + T3 ]+ i/ ^5 K, M# N3 n6 V
  62. static volatile int irqraised2 = 0;2 [8 E  [( p$ d

  63. 8 c# {# ~) u0 ^! _/ g# U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , r0 s+ Z) |$ m; h4 y6 N2 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( T+ y( e* \% x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - M, E! a. r5 W

  67. 9 d6 j8 W0 T& Y2 J, l& K+ ]: O
  68. dma_addr_t dmaphyssrc1 = 0;( w. ~0 U8 {  H6 d6 M7 P# v
  69. dma_addr_t dmaphyssrc2 = 0;1 g, q" ]) x- S% W# [" k. ^4 w" S
  70. dma_addr_t dmaphysdest1 = 0;
    : f( S: j& M/ N9 }. |3 I6 y
  71. dma_addr_t dmaphysdest2 = 0;
    ) t+ O$ C# \+ W: }* o+ m* Z

  72. * y9 w; W$ V, A9 v. F# G
  73. char *dmabufsrc1 = NULL;) S9 ~. e$ _+ u4 H7 y' s: o! {
  74. char *dmabufsrc2 = NULL;& u2 D+ [4 z+ C9 v! V; a6 O' q+ i
  75. char *dmabufdest1 = NULL;
    1 j5 W! `  N* t1 `6 M
  76. char *dmabufdest2 = NULL;( e# Z+ e* Q0 e
  77. 1 N& N! Y" X/ t8 R9 Z6 b1 \
  78. static int acnt = 512;9 _( B7 [! I8 m5 x% D
  79. static int bcnt = 8;
    ' M$ A" |& r9 a/ c/ p, ?
  80. static int ccnt = 8;; G8 I; E3 p$ _
  81. * c1 L, c% d" y; j9 @
  82. module_param(acnt, int, S_IRUGO);" z" l4 `- a6 t* w) L/ E4 e) ~$ n
  83. module_param(bcnt, int, S_IRUGO);
    $ q1 H& i5 o5 E8 K1 B4 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. ?; B6 U) I$ ?+ G3 j: C; q) D' Y
& V) s" q" M5 Z" U# C8 J" X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 Y9 u* r# y+ r
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 u& j; w, o# o; _+ i/ }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( y2 E! j; T4 g% N! J$ d% n( Z- b( s0 ^5 t1 U4 O

- y/ |9 Z; b4 ^1 ]. ]3 ?3 V/ E' n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 14:25 , Processed in 0.039854 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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