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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 i% c  k7 a) D5 q2 P* ?- s
  1. [code]EDMA sample test application  ~" v% N* {3 `- P3 `
  2. /*
    " y3 n, ]  b' e; e- l- M' ?
  3. * edma_test.c' E# v7 i. D2 Q7 ~
  4. *; g. W( _( D$ K3 J
  5. * brief  EDMA3 Test Application9 P- h6 V+ ^+ m0 t+ m! x3 ?
  6. *: n4 x3 E8 {0 @. n
  7. *   This file contains EDMA3 Test code.
    4 q% [  J0 c: h
  8. *' ~3 ]" L% k# N. e* G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: D  a2 J! J! n1 p( k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , B7 j5 _! K: ]; W' s
  11. *         TO CHANGE./ i# ^& m$ }! H( N9 O& I
  12. *
    " U6 y' a4 t6 t2 `4 n" C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; }7 h& K0 ^: M# {+ Y2 z
  14. *
    . Y% e% t9 M; X1 v2 d- G* S
  15. * This program is free software; you can redistribute it and/or9 k! \, s  q$ t4 O& c# R1 d
  16. * modify it under the terms of the GNU General Public License as
      l5 {2 I6 t" g& Q: ]) T* r8 T/ _' W
  17. * published by the Free Software Foundation version 2." P* J  ?3 `1 @# C+ u1 o
  18. *
    ) P9 g, ~$ @1 a; D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & `+ T# T# W& T% K; x
  20. * kind, whether express or implied; without even the implied warranty" h* I4 d' S+ U$ i4 ?2 E8 W0 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 w! E  p1 L4 d* s3 u- _
  22. * GNU General Public License for more details.
    5 ~- I& j  N; Y6 j7 Z) v
  23. */9 e; W7 Y. c* C- W+ W
  24. ' o3 `- w1 {( m1 `+ F
  25. #include <linux/module.h>6 `* ~, T7 \$ H: H# a0 J6 Y
  26. #include <linux/init.h>
    ' Z+ F3 ^; t4 v; }: j) N0 T
  27. #include <linux/errno.h>$ I2 y; Y/ u9 v7 }1 O2 x6 {6 @
  28. #include <linux/types.h>
      Y, q/ y4 G8 `* x1 a
  29. #include <linux/interrupt.h>
    / P: S. A. S" Q  D
  30. #include <asm/io.h>
      [; O2 n( S3 a2 J/ A% M
  31. #include <linux/moduleparam.h>
    : q  L& c' @- W& L/ G6 z$ ^* [  |
  32. #include <linux/sysctl.h>
    3 g# ?# Z; ^# y+ H2 }( L
  33. #include <linux/mm.h>
    6 j; D8 u; _2 x0 x0 U
  34. #include <linux/dma-mapping.h>- p) K7 e0 r& \* z$ Q. X6 D
  35. 0 R, U+ h3 \; y  @. S" b* w
  36. #include <mach/memory.h>
    " {: L2 ]$ r$ y( g
  37. #include <mach/hardware.h># ~$ J5 O" Z: l  f# E- ?
  38. #include <mach/irqs.h>2 D- v3 t6 Q$ \9 m
  39. #include <asm/hardware/edma.h>2 t5 i5 n5 w" c, @3 W
  40. : ?$ N- p. H. i. \) M9 d9 M
  41. #undef EDMA3_DEBUG# e4 R3 T6 u( J; @2 _
  42. /*#define EDMA3_DEBUG*/
    5 E% A+ O! s& C* k
  43. 2 f! s- A5 N$ p" k/ e
  44. #ifdef EDMA3_DEBUG' E2 P- I# w+ t  t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ?" u( J5 \! m1 a" ?2 Z( c7 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 y0 N! o: Z8 w- g+ Q: D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ a5 I* [9 g. X0 k% |+ x$ O
  48. #else  `) H, O& S, ?4 n: T$ P
  49. #define DMA_PRINTK( x... )" i9 X1 ?6 p# Q+ ^5 Z" A  u. u
  50. #define DMA_FN_IN3 G( e' f( p! Z0 ]  u
  51. #define DMA_FN_OUT
    9 U5 O1 B9 N) v) p- b
  52. #endif9 W: ]' Y- }8 x) y& [* Z& M

  53. 0 V1 n# {: L- O- X! G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 C6 D: ^: ?! u! d
  55. #define STATIC_SHIFT                3& s; m! u. O3 \/ U! [" r
  56. #define TCINTEN_SHIFT               20: g/ o1 Y3 ^9 ^3 y
  57. #define ITCINTEN_SHIFT              21  j2 ?3 I& S6 D0 z) B' ~0 H
  58. #define TCCHEN_SHIFT                227 x' Q' ~: O* P2 G/ u; `
  59. #define ITCCHEN_SHIFT               23% y4 e! S5 j: Y( Y$ S* ]# a
  60. * P- G4 k# D( R3 u
  61. static volatile int irqraised1 = 0;# q7 ^) l2 |, u; o
  62. static volatile int irqraised2 = 0;
    ) w* q, T. H. C3 P5 @( e

  63. 3 ]& |6 r0 d, Q# }* j; r" q/ o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 M4 v' E, ]1 ?: i; ?& G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  T! ]0 C7 v0 M$ M# S7 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ e2 p3 k9 N: L3 r2 q4 ?* y
  67. 0 H. ~, l/ L& ]) b, O8 c7 _4 O( b
  68. dma_addr_t dmaphyssrc1 = 0;7 G$ p, m, R+ G' [  B3 |
  69. dma_addr_t dmaphyssrc2 = 0;2 {+ \. G" }/ Z' p! e
  70. dma_addr_t dmaphysdest1 = 0;
    8 J; b+ K" _! Q5 T, f
  71. dma_addr_t dmaphysdest2 = 0;& ]$ j) h0 E) @" _# F3 o& o, k
  72. 1 i; N( m, k4 t; E: u$ M5 ~7 r( K
  73. char *dmabufsrc1 = NULL;
    # l: R9 w- d; d, G  |! C8 ?
  74. char *dmabufsrc2 = NULL;
    * a* x) Z7 P0 b& P
  75. char *dmabufdest1 = NULL;% R0 l& H& c# f, e+ E
  76. char *dmabufdest2 = NULL;
    # p, m" ^; X$ h$ a, `  Z
  77. 2 }; L5 D. q% b& H
  78. static int acnt = 512;
    8 Q8 H5 `2 o) `
  79. static int bcnt = 8;1 b( g2 \. V* i
  80. static int ccnt = 8;  H; I+ s7 C  P  d" K

  81. / O% D$ M6 s6 [1 q
  82. module_param(acnt, int, S_IRUGO);
    1 }  _# O9 U3 W: C9 n1 G# J: A9 U
  83. module_param(bcnt, int, S_IRUGO);
    0 y  O( q( m/ \7 _% S0 _' h" K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. f0 R, H! z% L8 s' E

1 c5 T6 V! G( {2 V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* m# l" L4 g, ~  g* darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, I8 d% f" l. d. v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# C. L# S& H) Z+ M" q+ `8 h
. d3 z/ }0 N& i# v6 ]0 S
- ]' t  s1 N7 ?+ {7 ?! v* f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 14:04 , Processed in 0.038951 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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