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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : c6 d# P# ~* B$ |
  1. [code]EDMA sample test application/ s3 g/ Z7 v6 l( Q5 C; f  [, b6 f
  2. /*
    4 a1 R, k+ H& Q" d+ N/ j' O
  3. * edma_test.c
    1 ?$ ?0 c8 M( z* x% W
  4. *
    8 k& p+ e$ n) X2 `3 X5 A
  5. * brief  EDMA3 Test Application& m, U, Y7 a! \& O. [8 l
  6. *
    1 v! b6 H6 d  D
  7. *   This file contains EDMA3 Test code.( S2 y# |: V2 P* ^0 a' e1 i2 M! H
  8. *& ~, T5 Y9 _/ b& o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 x. e0 R% V: Y. o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ E0 v" s1 E$ G2 Z
  11. *         TO CHANGE.
    5 p9 d, M$ }- W3 u
  12. *
    1 O" P0 C1 M5 c7 p1 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 V; o+ S% s. {% a+ t; f
  14. *1 Q8 @! m% O5 y' u( D6 W
  15. * This program is free software; you can redistribute it and/or
    ; f2 \7 n7 b# y3 k% q  {5 a% W
  16. * modify it under the terms of the GNU General Public License as% ~9 e* Q* T3 R2 ~
  17. * published by the Free Software Foundation version 2." `9 a# G2 ?! @" v8 D
  18. *
    $ G" X  c. Y: Z7 {7 h) C  F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- W7 a" ?. X1 {8 J2 N
  20. * kind, whether express or implied; without even the implied warranty
    ( I3 u- r$ S' Q0 _7 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' n2 z& w; S- }2 O# z
  22. * GNU General Public License for more details.5 W( P8 C3 g- N
  23. */
    & T' V: Y, f8 Q! A- @. e
  24. 3 @, ]* f* i5 e; [2 n8 c
  25. #include <linux/module.h>7 n& N( l! Y& X2 p% z" W
  26. #include <linux/init.h>1 w4 \4 [# Y9 h$ M
  27. #include <linux/errno.h>, i, b" [( n$ ~- m. g
  28. #include <linux/types.h>6 @* z3 {1 y; r* }: J5 s7 g
  29. #include <linux/interrupt.h>
    1 ]- G5 ]; M! L. d( h  X
  30. #include <asm/io.h>
    . O5 s  f" Q# h4 p- T# g  z  C  ~
  31. #include <linux/moduleparam.h>
    / c; p1 O, C# |. E; T
  32. #include <linux/sysctl.h>, _1 O' K* D; S5 i. L
  33. #include <linux/mm.h>7 g0 v- c9 o! \$ |. J# M
  34. #include <linux/dma-mapping.h>/ m7 ?% X1 i+ I  d
  35. + x/ G  L/ X5 N
  36. #include <mach/memory.h>6 @  V3 i; _2 ~1 n
  37. #include <mach/hardware.h>
    7 X' a# p/ C/ N' m+ \- l2 F3 ?
  38. #include <mach/irqs.h>
    % X; {* |' j  @) w
  39. #include <asm/hardware/edma.h>
    " t8 }/ T  ?( `" ?9 @
  40. & Q. l0 \+ g: Q5 C  V
  41. #undef EDMA3_DEBUG# e8 A; o) n1 J0 h
  42. /*#define EDMA3_DEBUG*/4 T; J% J& \1 @, Z  J9 ~
  43. 4 [) L& f5 M& n% j+ F
  44. #ifdef EDMA3_DEBUG
    , H' y" z+ V! h$ I( ?+ L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) H  Q: k. m* H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 ]( q: n( d+ `# ^4 Z' P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( D( r. r, F3 b5 r- [' ^
  48. #else
    , h( q2 A( k3 t1 L) d- a
  49. #define DMA_PRINTK( x... )1 M3 O7 T6 J9 {. \& y2 `) y$ W) @2 k
  50. #define DMA_FN_IN
    1 \. L3 z9 D# q$ y5 z
  51. #define DMA_FN_OUT
    3 o( E$ ?" I/ M: E0 c
  52. #endif
    5 K& o" v# a8 ], C) `% ]5 H- |
  53. ; D1 w- K7 Y3 o% v" z4 \  E2 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 m1 H: i# a2 c* k7 l
  55. #define STATIC_SHIFT                3
    # X! Z0 ^& z" C/ k" _9 l" n* i
  56. #define TCINTEN_SHIFT               20/ E+ _2 Q/ F* `' d7 @7 j
  57. #define ITCINTEN_SHIFT              21
    6 G( y" \2 P; y
  58. #define TCCHEN_SHIFT                22
    ; J( p. G1 ], }  t* E& C) O
  59. #define ITCCHEN_SHIFT               231 y& T( B; x0 Y* {
  60. 5 ~7 M1 R7 b7 v" z1 I0 H' z, c
  61. static volatile int irqraised1 = 0;. G5 ?& ]0 ?9 Q3 B0 v6 U9 h6 ^
  62. static volatile int irqraised2 = 0;0 a8 x3 j6 a1 n) y, K6 c% }
  63. ) g& h( P2 a, ^- }( I# A& k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ?; ?$ c" n4 Z2 @& C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 M5 a/ ^6 v4 x2 k# n/ S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. q! V: R7 w5 D
  67.   Q2 v7 }1 s4 D: w6 h
  68. dma_addr_t dmaphyssrc1 = 0;
    & E* t. p+ F, Z: j! R& Y3 X
  69. dma_addr_t dmaphyssrc2 = 0;+ n: ?# F( t! t% e7 n8 `3 j: z
  70. dma_addr_t dmaphysdest1 = 0;  D  {( U! _1 Z' k1 ~, \
  71. dma_addr_t dmaphysdest2 = 0;) O3 ~, k0 a+ o2 B# ^+ Z& i0 c+ b$ O5 Q
  72. + t: M! Z/ N- U. D  b
  73. char *dmabufsrc1 = NULL;+ w& d$ D/ q3 W6 ?4 |% R4 l  e
  74. char *dmabufsrc2 = NULL;+ P4 Z$ d* N: f) s3 s: X
  75. char *dmabufdest1 = NULL;/ |3 q" ^( l* X) ]4 i( A1 W# {% H
  76. char *dmabufdest2 = NULL;4 b' `* k& |5 F" V( p

  77. 6 w; G. [2 A9 T
  78. static int acnt = 512;/ k- A5 ?. p( G" y$ `& z% |3 X
  79. static int bcnt = 8;# t8 i, X- C: w1 f9 X, e7 v
  80. static int ccnt = 8;
    # r  ~0 V8 v" |$ P
  81. ; X$ ^  \% Z) q$ y" @
  82. module_param(acnt, int, S_IRUGO);$ {. l+ {9 W( I; k0 C
  83. module_param(bcnt, int, S_IRUGO);
    & @6 Q3 D2 E4 m, t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& ?+ K6 J# [* @: p* }7 @3 D
6 _  p3 E' z9 O$ @$ a! Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 b# N7 G  n" m/ @# W. U: e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 i2 G- K, a' y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; o+ m7 M: s* S
# ]7 h- t: ?, T, O3 K
4 @: u! V' I$ j7 l  }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 09:57 , Processed in 0.038861 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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