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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , d& g0 o! q3 m+ r) S* P4 q
  1. [code]EDMA sample test application" B! P* n- d! S1 o  R3 ?
  2. /*
    / w, A$ B3 Y" t2 t+ g2 K) ]+ n# @
  3. * edma_test.c( p9 B5 K) f/ |
  4. *% ^! W) s0 C; x9 {( [
  5. * brief  EDMA3 Test Application4 i2 ]7 J" V7 a- K" r2 L
  6. *
    : J+ s  e1 L% f4 e/ c  }! b8 X% s
  7. *   This file contains EDMA3 Test code.
    4 G% N. ~8 G; A  R8 R  u
  8. *( o4 g9 i, e4 v2 r* N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ R' Q. i; D$ A* ?, Y3 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " ^- y+ f& G7 [# x" q, d
  11. *         TO CHANGE.
    " J' m& l- j* R0 S+ J3 Z& A) J
  12. *
    1 I; X1 x" [0 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" b, O! N+ C- R  ~8 f! ?* n, k4 ?
  14. *, ?; d& A" Q5 A
  15. * This program is free software; you can redistribute it and/or* P; g  B8 m7 d
  16. * modify it under the terms of the GNU General Public License as; O) K, V1 S+ b) `/ l
  17. * published by the Free Software Foundation version 2.$ a' M# ?/ [$ q# U+ o* E' q
  18. *' `3 ?: A" L9 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- J  h) j% c( l+ t1 L" A
  20. * kind, whether express or implied; without even the implied warranty8 ^( v( t/ o) w7 |3 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % p; U3 R8 S. }( l9 `5 ]0 Y0 u+ ]
  22. * GNU General Public License for more details.
      o8 n6 G8 C5 N! K  m
  23. */
    9 |& v- r1 L( Q) i3 Z) ^4 ^
  24. * @& x: b9 z9 m0 ~
  25. #include <linux/module.h>
    , x+ `( n! W3 M6 h+ a% P
  26. #include <linux/init.h>
    ! a3 B5 U5 Y9 R5 ]- u
  27. #include <linux/errno.h># F! P1 h5 a; M. g( U
  28. #include <linux/types.h>+ [+ N& ^( B& f% z5 d& n! e
  29. #include <linux/interrupt.h>. w) ]; \9 {: j+ h1 _
  30. #include <asm/io.h>6 }; [! J1 j6 P4 ^
  31. #include <linux/moduleparam.h>: V1 l$ p: \) V$ e4 X; _( k
  32. #include <linux/sysctl.h>1 Q. I/ ^: G! V4 e
  33. #include <linux/mm.h>0 k* ]. b- V  ~) X0 }
  34. #include <linux/dma-mapping.h>1 r5 w3 V  S. ?) W" a
  35. & d3 f, [/ O+ ?+ j$ O2 O" l4 l# x, [
  36. #include <mach/memory.h>
    $ T& `" g5 H' n% S. g# N; o
  37. #include <mach/hardware.h>
    $ x' F5 k1 ~% z/ @: s0 u8 a& U
  38. #include <mach/irqs.h>
    8 @- A) k) P* S! h8 y! c3 n
  39. #include <asm/hardware/edma.h>
    + l. ?. ]2 {3 [6 Q+ n5 E' K

  40. 8 v8 G5 e' p8 P$ c
  41. #undef EDMA3_DEBUG
    8 N6 T( s9 k, \
  42. /*#define EDMA3_DEBUG*/
    0 l1 }( q, [4 A3 f' @( J$ Y
  43. 4 L1 v' q& S" f
  44. #ifdef EDMA3_DEBUG; J" w! ~' w: i8 z& g4 m* C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / z: h; D, Y; k$ Y7 d; D5 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 w. E* v1 A/ L* p# O; J& V9 m  A* K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 c0 p- P8 l. C* Y
  48. #else
    : s/ Y* h; A" F9 Q7 O9 `0 v
  49. #define DMA_PRINTK( x... )- X) `4 X7 F( f
  50. #define DMA_FN_IN1 f2 S! L& b3 u
  51. #define DMA_FN_OUT% h( a6 u7 ?% q/ D! G
  52. #endif
    / l; ], S9 W5 Z' i0 z2 s1 t
  53. . J( \9 a; d- u  u* P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - T% ~% L/ Z. |* I7 d
  55. #define STATIC_SHIFT                38 b2 G+ B% ^# i) D- C/ g& ]# K
  56. #define TCINTEN_SHIFT               20+ m  t! }5 c% P9 p
  57. #define ITCINTEN_SHIFT              21  ^8 E4 d# ~/ z; Y- O
  58. #define TCCHEN_SHIFT                22/ J7 B! U- l. P2 I0 u- N; G
  59. #define ITCCHEN_SHIFT               23
    5 c! a: X: [$ [: o' a

  60. 5 K- Z8 {5 @# |" d
  61. static volatile int irqraised1 = 0;
    * P  |) x, p5 k5 ^& k* P
  62. static volatile int irqraised2 = 0;( N1 o9 b% \# A, B3 L2 ~) K' N

  63. 9 A, F7 P  p* i5 D  h4 X  b2 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : L6 m+ ^# f8 p. B8 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ]% I& a3 B# s, M; F, P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J5 p# R3 ?9 \. N

  67. + ?2 d0 P" E' W" _
  68. dma_addr_t dmaphyssrc1 = 0;9 Z" {3 c1 p8 O2 X% b3 L5 A
  69. dma_addr_t dmaphyssrc2 = 0;9 E! c! Y. ^  f: I
  70. dma_addr_t dmaphysdest1 = 0;
    7 [( h- G- f: J  d0 A
  71. dma_addr_t dmaphysdest2 = 0;+ B8 t5 ]* v2 O9 J, ~1 W
  72. ( Y& c5 c! b& c1 d' u& w6 n' g
  73. char *dmabufsrc1 = NULL;' z7 z$ B: y" Y. B9 B) M+ p
  74. char *dmabufsrc2 = NULL;
    3 b" h! {, _2 k( E+ v- C& _5 g9 D
  75. char *dmabufdest1 = NULL;2 b) J% I7 K9 M- u" w" |
  76. char *dmabufdest2 = NULL;
    ! U* ~+ W; u& z! _' ~7 F2 I2 Z
  77. 5 W# c2 g$ X9 a. d2 l0 \/ V2 }
  78. static int acnt = 512;  F/ {2 h- m4 J/ N9 @  A! Y6 G
  79. static int bcnt = 8;
    9 u, B  K! D; m. J: z3 p
  80. static int ccnt = 8;
    ; ]6 B# N1 G* b! X3 X  c/ y+ r
  81. + w! [/ \+ X0 C3 I( G
  82. module_param(acnt, int, S_IRUGO);
    # Q0 \- |6 @2 J0 {
  83. module_param(bcnt, int, S_IRUGO);
    : E, m5 f# A, _: x4 E$ t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 g* N5 a# L' S3 y1 v- N( |7 A" H: l
# G+ J8 D+ a/ x" ?! L5 n, P4 x/ m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 b) r2 I4 y1 Y0 I; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 G( d+ H& n5 J* |2 d% G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 V9 E1 ]7 j/ V# t* q

+ k6 ?! g0 b8 r3 o* K9 `" n0 N; y- z9 N9 z" k+ v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-13 13:55 , Processed in 0.038662 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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