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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 k1 \. ?$ \) @2 Z7 }2 v
  1. [code]EDMA sample test application  y3 X% J8 S) L2 X
  2. /*
    9 I' a2 Y$ m) c- G
  3. * edma_test.c* Q- t& W8 b# v, |& S& n! A1 K
  4. *
    % ]/ @% t# J, }* q& e. ?$ C4 V
  5. * brief  EDMA3 Test Application1 W. n6 i% ~- H. i  g
  6. *
    6 l  Z% b% f( w3 y9 p
  7. *   This file contains EDMA3 Test code.
    $ \" ^, O4 M+ K" P/ y  p% C
  8. *$ d0 i0 Y4 U  s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 G3 D% @' t' f" x' t6 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 y. X- ?3 I' P- C( c
  11. *         TO CHANGE.: x  f2 D" G. x8 |
  12. *. U" X: q, y4 w8 z# u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. h6 q* t) `; Q# \% D  Z6 I
  14. *
    9 Y% b# H/ c" D) ~
  15. * This program is free software; you can redistribute it and/or
    6 n4 J2 i5 W: N& I
  16. * modify it under the terms of the GNU General Public License as
    6 J: N: I+ U$ Y; F8 ^( L8 K* R
  17. * published by the Free Software Foundation version 2.
    $ P. p0 N3 M( m; k
  18. *3 R# D8 m$ s5 x2 p) |1 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 Q% i* R; F+ \$ [" {
  20. * kind, whether express or implied; without even the implied warranty
    & T0 b: P. L- A$ C1 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' X" X; N, z5 j
  22. * GNU General Public License for more details.
    9 y- T, V  q* Y/ B( E
  23. */
    " U" t2 S6 G9 S1 y+ P. H$ v

  24.   N' Z6 t5 t" z- \
  25. #include <linux/module.h>  r+ |' E2 w! Q& q' n  y0 h
  26. #include <linux/init.h>
    ) A; h4 D& t( p- L( h
  27. #include <linux/errno.h>+ B! Z7 U- J; ~
  28. #include <linux/types.h>* X" l2 m. f' B% I; w
  29. #include <linux/interrupt.h>
    9 R& w. s# S1 u) h! L2 [* ?/ K
  30. #include <asm/io.h>
    - ^5 k: g& n0 q! D+ V& I" Q4 x7 k
  31. #include <linux/moduleparam.h>: X5 |- V+ l0 C, E+ P. P! C
  32. #include <linux/sysctl.h>- ]( C6 J+ S) ~2 ~
  33. #include <linux/mm.h>
    + g- v) K+ a, P4 x
  34. #include <linux/dma-mapping.h>4 |( D2 a! j+ p: a1 X& A
  35. 3 x( i" q$ O. L. {5 L6 {
  36. #include <mach/memory.h>
    $ R1 H& A! r; f3 Q) I1 b( W9 S$ s& Q
  37. #include <mach/hardware.h>5 `$ Q" ~; c% m0 p
  38. #include <mach/irqs.h>  j# M3 q# }% r2 C8 H% W. j, ]5 v- p
  39. #include <asm/hardware/edma.h>! r/ {! y1 o# T- ^
  40. 0 o( B; y3 W5 L+ ?9 A8 Z1 n( N
  41. #undef EDMA3_DEBUG6 l( ^% p6 ~* @
  42. /*#define EDMA3_DEBUG*/
    9 J* v: G1 d+ ~$ r9 C4 [

  43. 0 t, [' F. b0 {
  44. #ifdef EDMA3_DEBUG
    6 E6 z1 [2 ~/ m# t1 v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 D9 l8 ~$ S( I: \: h  H8 i  U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & ?! ?/ s  ~, W& l' x& Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) \2 I, h1 R+ [2 R8 W" {
  48. #else" O2 s; U2 P$ q2 m+ C: j
  49. #define DMA_PRINTK( x... )
    * m! ~: N$ S  K
  50. #define DMA_FN_IN  G  q9 {6 V* W, S1 z2 g# I' E
  51. #define DMA_FN_OUT
    7 s8 l: q& ^( P+ f! B" X
  52. #endif* Q+ f2 B" X6 P$ R% Q
  53. % J& w9 n& m* D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). c( E7 r  f- F' o: W
  55. #define STATIC_SHIFT                3, q" y; T. D( }' t" q
  56. #define TCINTEN_SHIFT               20$ \" B6 b/ r6 W
  57. #define ITCINTEN_SHIFT              21! P5 X, W1 C$ @' j! h& z
  58. #define TCCHEN_SHIFT                222 A% x, e4 o( g5 h0 g5 _% W( q
  59. #define ITCCHEN_SHIFT               23. S6 f: _9 j. H! m& B) z2 B7 ?

  60. + h+ O+ P3 }" `4 m& G, t3 _
  61. static volatile int irqraised1 = 0;
    0 i5 A% o: Y9 J4 g4 S3 }; f$ F7 D
  62. static volatile int irqraised2 = 0;8 w5 a' o$ h8 _& C

  63. 4 h) s' Y4 |8 v5 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; J! D1 G  M, D! m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 g3 j. r6 O  w( x  Y6 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 u# Y' x- d7 v. v
  67. / p! H( U& w1 X: }2 ?! ]+ \
  68. dma_addr_t dmaphyssrc1 = 0;" m/ v/ D/ P; G6 l7 N
  69. dma_addr_t dmaphyssrc2 = 0;
    3 m/ S. X1 s& n& D( a9 C
  70. dma_addr_t dmaphysdest1 = 0;
    & K7 g% `1 S# o8 W. e2 R
  71. dma_addr_t dmaphysdest2 = 0;) N8 J# X+ E  C+ g

  72. 0 E9 ~  P' {0 ~" W+ i8 {& ]
  73. char *dmabufsrc1 = NULL;3 |  M% W5 k$ l4 x# h
  74. char *dmabufsrc2 = NULL;$ z1 ^  B- x0 }- L# X' j
  75. char *dmabufdest1 = NULL;
      i' ^/ q5 a( E3 F
  76. char *dmabufdest2 = NULL;
    4 }* r! o2 d, s  ^- b- _0 P

  77. & U* \2 S+ Q. B0 }, b
  78. static int acnt = 512;7 |3 I3 }7 [# v/ h1 j
  79. static int bcnt = 8;
    3 x# e' h$ E0 O3 T: Y( a. _) S5 l
  80. static int ccnt = 8;: u+ s8 C4 M  ?8 J
  81. 7 v, }( G* a+ ^
  82. module_param(acnt, int, S_IRUGO);
    3 p6 o) d* o5 W/ k: Q6 S! K- Q+ R
  83. module_param(bcnt, int, S_IRUGO);- [5 U5 j$ B; e& O: c+ N1 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# l2 q$ D& h- g  p8 M$ a/ A1 ^. b( _9 p! \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 D; \( ~: V1 }' Z& harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) g" E% e+ D7 L) k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ p3 ~; J& @' W  d1 X1 ^# M1 B
/ f0 F( j; q( H6 e! E0 ~9 ?. p: Y8 {2 _' f0 @% N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 14:02 , Processed in 0.048363 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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