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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( U: \$ I9 d6 _2 W, D
  1. [code]EDMA sample test application( U) z( n  `- I2 f. R" ]2 T* W! W8 p
  2. /*  @/ Q& }: P, R: u2 p6 ]
  3. * edma_test.c% v  o( s$ d& m+ }: x3 T$ M
  4. *
    $ j& R; @% v& p" v2 I7 j
  5. * brief  EDMA3 Test Application
    2 P6 d5 S6 b3 W- p8 l- N2 [0 ~6 @
  6. *! D( e# }* s0 a7 M
  7. *   This file contains EDMA3 Test code.
    . t( P$ a' y6 y1 i/ z1 c+ ^
  8. *0 ]; n' p( ?9 Y9 k$ ~& B3 n. C, u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ I) \* B- y8 P, V$ P6 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      \! p+ \* I' |6 A
  11. *         TO CHANGE.
    ( p3 |, e: j6 B* E0 e' U' t- {* l
  12. *
    % o2 A* F. F& D0 ^3 {/ M% j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & q. S" o5 q7 c, x2 _6 @
  14. *
    - H8 w0 k6 Z" J" L- ^: ?
  15. * This program is free software; you can redistribute it and/or( F" T4 R. m$ F% k+ r
  16. * modify it under the terms of the GNU General Public License as6 t& k; ]8 I8 C6 A& x
  17. * published by the Free Software Foundation version 2.$ w6 I2 T. ]! u
  18. *0 {) C. U7 i3 C9 D' W$ o1 \( }# c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / L+ H; ?) {2 I& n
  20. * kind, whether express or implied; without even the implied warranty
    $ F4 w# _* k7 r9 G; U7 B$ \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 B, [; X( z9 c+ ~
  22. * GNU General Public License for more details.) ^( [/ y& ^) S: w4 I
  23. */" A/ l& a8 m6 `' T  b9 G& x% X$ g

  24. ! s" O* m% ^' i, y# X
  25. #include <linux/module.h>
    . a' K3 g" Z0 k- B" }6 v
  26. #include <linux/init.h>: _+ |' w5 \' H9 _% b# i2 e
  27. #include <linux/errno.h>
    / O0 T( y2 X: g0 N" s. p3 P
  28. #include <linux/types.h># u% t+ u/ G6 k& D. d: }( D( v
  29. #include <linux/interrupt.h>* ~8 e8 k7 m( Y7 M0 H# }! }. t
  30. #include <asm/io.h>
    1 @* d- f( g+ M6 y. y+ {
  31. #include <linux/moduleparam.h>
    " c: R: r7 n7 R) Q7 d; u
  32. #include <linux/sysctl.h>
    : {6 i! N1 j) m8 J
  33. #include <linux/mm.h>, y4 c4 D- ?# O: D: w3 r9 B5 d( Y
  34. #include <linux/dma-mapping.h>3 X$ m8 W' V5 h" p2 b

  35. 1 _1 ]  c0 P1 ^0 \9 }: F
  36. #include <mach/memory.h># m# r( x# r7 P) {: H( T! O9 R
  37. #include <mach/hardware.h>+ z0 C6 F8 s* B# D
  38. #include <mach/irqs.h>
    & ^& A; ~/ Y, r6 u
  39. #include <asm/hardware/edma.h>
    ' T' P* @& M  G" n+ z! R

  40. ) i" M5 K7 h; ~/ r" N
  41. #undef EDMA3_DEBUG3 s' V7 j! |# Q# P8 T$ u
  42. /*#define EDMA3_DEBUG*/* k. q& L/ q$ a* M) I

  43. ' x4 L+ B& q3 F3 H2 b( a4 d
  44. #ifdef EDMA3_DEBUG* b. H, @$ p+ s. y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' h( c6 r# p% r0 @1 C9 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( {1 v  c- V  i1 d4 _/ e/ y5 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( f) l2 m' ~( g0 c$ K! j. g  A
  48. #else
    6 ?0 M6 C. B# r
  49. #define DMA_PRINTK( x... )
    4 g. H. f: Q  \- M
  50. #define DMA_FN_IN; S% x+ m* x+ ~# o
  51. #define DMA_FN_OUT% `8 b* R+ p4 X
  52. #endif
    * C3 S. @) D. T- o3 ^7 J3 h! x" S

  53. % p8 Z# H+ w3 M0 ~9 U' _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % d% y- @! I: y$ B
  55. #define STATIC_SHIFT                3
    . w0 C1 s' i+ S( ?3 Y
  56. #define TCINTEN_SHIFT               205 f( B# i2 d* d9 V# G% v
  57. #define ITCINTEN_SHIFT              21
    ' q: o+ C& H, L5 Z/ a& \9 F( d
  58. #define TCCHEN_SHIFT                22
    6 N: R: b7 c; K
  59. #define ITCCHEN_SHIFT               23
    9 Z) c: Y6 K: i& r0 n% J

  60. 3 g" K( B/ h/ A5 i6 I/ A
  61. static volatile int irqraised1 = 0;
    . }% x4 w7 q' e
  62. static volatile int irqraised2 = 0;
    2 B3 U8 P& y7 m1 ^" _

  63. & l$ Y: r+ D6 D* e# r4 f4 ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D: K6 c" V, ^) Q- ~2 _' L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 h* q5 @% p+ y" t' A3 C9 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: v1 p0 }! ^2 H3 ?3 L4 P6 I
  67. % l  J: ]2 }) L8 g% U7 n
  68. dma_addr_t dmaphyssrc1 = 0;, P: q; K7 v, p- V
  69. dma_addr_t dmaphyssrc2 = 0;
    " e; _4 x# G/ m+ ^; F8 v2 B" {) K
  70. dma_addr_t dmaphysdest1 = 0;  L2 ]" @$ i$ r
  71. dma_addr_t dmaphysdest2 = 0;8 @7 U+ a7 F6 _7 G
  72. & m* \% s  p; E( {2 B
  73. char *dmabufsrc1 = NULL;
    6 |+ I4 u  B' L' d: l2 _7 j+ Z
  74. char *dmabufsrc2 = NULL;) M! {" Y0 A7 k7 L
  75. char *dmabufdest1 = NULL;" E& P$ v4 S+ t. H. d
  76. char *dmabufdest2 = NULL;
    + W) n" C: h5 d8 d! }
  77. # Z# S7 S) |0 W. {3 B& r" L9 s
  78. static int acnt = 512;1 f0 H" X0 x& V- M! ]! n$ W9 [8 y8 w
  79. static int bcnt = 8;
    9 i! I0 h' S9 P) t1 b
  80. static int ccnt = 8;9 ]; S2 ]. i( b. W3 m

  81. ; [; B( c1 J5 M2 r
  82. module_param(acnt, int, S_IRUGO);/ y- @) r) F( e4 A
  83. module_param(bcnt, int, S_IRUGO);
    2 o7 e* e7 A5 r5 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 p8 l4 z- I4 w

6 r, X* n& [3 Y# K& _' a; c8 i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ a1 y; J0 ?* b, R8 D7 T! O- zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 L% w+ x+ ?4 F) i8 d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, A9 f4 S6 ]% L5 _" |" e$ F' C9 s9 q9 M6 C

$ W7 [' F* U1 x' F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 11:34 , Processed in 0.038591 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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