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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 }" s+ Y' w! R
  1. [code]EDMA sample test application
    * Z" @' G/ u* Q
  2. /*
    ! X8 O* I7 A: x( q& N) o( n. v
  3. * edma_test.c( M; Q  `1 a3 m/ ?2 n. _
  4. *
    0 \) K! T1 l0 v6 M" J
  5. * brief  EDMA3 Test Application
    9 n3 k# j( ^1 k" }& y0 P
  6. *
    9 Q7 o! N& M9 p; ~# z- r2 G" }
  7. *   This file contains EDMA3 Test code.
    % v& T9 J% W7 {$ ?9 f, t- ^9 G3 M
  8. *
    8 }2 k- w, {1 ~6 }' h9 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 F) z0 N3 o0 I1 O3 G" w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 L- @& D+ M2 k. H3 O, S9 ?6 U7 x
  11. *         TO CHANGE.. m3 R& z* m2 |/ ~
  12. *6 b6 ~; z/ L* H  @! N# R$ V4 O9 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " @* C7 F6 k& r  y' ?5 F( A. J+ C
  14. *3 \% c2 t/ e, d+ B! o. A& o! i0 d
  15. * This program is free software; you can redistribute it and/or
    ( H9 ^& ^% g8 u9 s
  16. * modify it under the terms of the GNU General Public License as
    . d* i, Z. v$ x7 N( h& L
  17. * published by the Free Software Foundation version 2.
    ) U- i1 r  b7 Y0 g9 k' [2 N
  18. *  S5 s- h' Q. j3 ~. ~# H, n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - n: F, t: }2 _5 g! g
  20. * kind, whether express or implied; without even the implied warranty& V2 K$ P& O4 J2 X8 I& p6 g4 O4 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , X# p, l- Z' G9 y. C+ t( o
  22. * GNU General Public License for more details.
    . |  \5 ?/ D7 G/ P; n6 s' w- u
  23. */
    : w  f2 P: _/ N3 h6 k% [" a5 C
  24. * }; K6 R# r$ u+ D
  25. #include <linux/module.h>+ d6 w5 x* q6 B' F
  26. #include <linux/init.h>: A" Q& Y& O, }; i6 z& F4 {
  27. #include <linux/errno.h>
    0 N3 |3 u* Y$ b- ]2 q5 ~: k
  28. #include <linux/types.h>+ z* w) p8 @+ A* t4 v
  29. #include <linux/interrupt.h>
    2 k0 C/ |: e# k8 S) L0 f& `* }5 D
  30. #include <asm/io.h>" _7 y5 Y8 k2 @8 z7 M% x' E* J
  31. #include <linux/moduleparam.h>
      i( E: g& p! R* r, j( A
  32. #include <linux/sysctl.h>
    & F; z+ z) c3 P, z1 i9 c( ]
  33. #include <linux/mm.h>7 ?- X) l. S4 N) i1 q1 V5 x
  34. #include <linux/dma-mapping.h>
    3 C/ @3 B- y; V% e  f  k

  35. , p$ j* M* l% G0 Z( l
  36. #include <mach/memory.h>
    9 w: V  Z1 K" F$ Y3 O
  37. #include <mach/hardware.h>4 E) D! E8 ^2 O9 s+ j. a
  38. #include <mach/irqs.h>
    ) I  m% x" @. K6 n2 B' K$ h+ ]
  39. #include <asm/hardware/edma.h>
    ! p6 S! x3 Z& B* ^, ?" @# p: ?6 I
  40.   I2 D4 u. R8 u+ g4 f* y% U. g9 K
  41. #undef EDMA3_DEBUG
    . N' [1 U" Z# ?
  42. /*#define EDMA3_DEBUG*/: X% e5 O4 B% k" Y" N+ {

  43. 4 q& c( l: w4 ]4 t4 J1 x
  44. #ifdef EDMA3_DEBUG
    1 A7 a) O8 r; D: `  D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 L5 l  ]6 J" N, N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 y& Z$ S. Q5 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* m3 Q; Q2 k# q/ U# u6 l- L
  48. #else
    & u( W! W- D9 r( N: s4 n4 D2 K0 [7 R3 r: r
  49. #define DMA_PRINTK( x... )
    9 k: S6 |9 k' J  _2 u
  50. #define DMA_FN_IN4 x1 s" O. ?' k( h2 k  _" f
  51. #define DMA_FN_OUT
    2 w- y8 V' K4 S0 a4 H% G
  52. #endif
    * P$ F' ]: \4 J; j
  53. # J; l' y7 [3 Y- a' b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . G' W0 n0 ], Q4 I
  55. #define STATIC_SHIFT                3
    ( L7 E% N) b/ X" O) q8 u
  56. #define TCINTEN_SHIFT               20
    " g0 e, q, P, r8 k1 [; i
  57. #define ITCINTEN_SHIFT              214 l: ?% r* C: K3 v. e
  58. #define TCCHEN_SHIFT                22, V' m9 D) K6 |& J: P4 c
  59. #define ITCCHEN_SHIFT               23, r, z+ n7 z  ?$ U( b
  60. 3 z& H, \  f2 e) i+ ]& Q' G, t0 J
  61. static volatile int irqraised1 = 0;& M0 ?4 V, n( T7 f
  62. static volatile int irqraised2 = 0;. B% c" V( h0 T% d& V: k& ]

  63. 4 M8 t# v% U. o  h# R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 G+ z# |  D3 e) v0 C0 `1 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) a2 W% A' H: O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 i1 L" N& U% X0 {- C7 t7 |
  67. , S$ I% Q! f7 G* ~& |
  68. dma_addr_t dmaphyssrc1 = 0;9 `  E7 k4 ^  w7 w, q  L) G+ H" a
  69. dma_addr_t dmaphyssrc2 = 0;
    ! a, z: X8 m) v5 I- i  k* F4 C8 i
  70. dma_addr_t dmaphysdest1 = 0;4 k; e9 @! R" s% z& f
  71. dma_addr_t dmaphysdest2 = 0;
    8 I  j# Y7 d5 K+ }2 S/ ^: X4 q
  72. ; K8 |, n$ m8 c5 n, @* A( [5 ~
  73. char *dmabufsrc1 = NULL;+ C9 E# K2 {. N" Z
  74. char *dmabufsrc2 = NULL;( _/ ^4 j. p0 ^7 x4 I
  75. char *dmabufdest1 = NULL;' P4 o3 I7 ^' |  v' L: L$ f8 ]9 y( l
  76. char *dmabufdest2 = NULL;- B" L* o; w) C& n3 P3 L

  77. 1 t/ G$ Z1 A8 c! ~* c& N
  78. static int acnt = 512;6 V, [* J7 S% ^! M4 S" A8 P
  79. static int bcnt = 8;
    4 c: j. e7 @9 d4 |# o
  80. static int ccnt = 8;
    6 I5 W; g2 O. n! a& ]2 [1 w8 P
  81. " E; b' B+ ?2 V6 u+ q. t0 X
  82. module_param(acnt, int, S_IRUGO);
    8 H/ @; q- B. [& d. T6 \
  83. module_param(bcnt, int, S_IRUGO);1 h& Z# M0 r' D! l# J; s7 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 R) ?5 t( e; Z( |" }  m' {, I8 Z+ k& |* K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 U  J2 @/ I& L) H" [  W. parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 T0 W2 L" H' F3 @) G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  \3 n0 {# K7 H- C8 O# e: @9 P& t2 M* M( p
. G- H) @2 y* c  u; ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 12:36 , Processed in 0.042023 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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