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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 [0 {% e7 D$ b$ X
  1. [code]EDMA sample test application; ^/ h6 [8 d4 \* D/ q0 |
  2. /*
    2 Z* }' _: T8 z4 B: ~+ ^) s8 @
  3. * edma_test.c- j8 {( i7 V* x; P3 }
  4. *. B; N1 n+ t4 \" |- L: W& r' u5 d
  5. * brief  EDMA3 Test Application/ U: ]7 {+ M. `5 R& ?1 j; Z5 ?
  6. *( I; N" H! Z/ k
  7. *   This file contains EDMA3 Test code.# p* b8 C# g  F, n( r! W
  8. *
    6 a$ I* k) ]& t* j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 J9 m$ V: z1 ]" r9 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 I1 z$ Y& j( Y0 A6 p
  11. *         TO CHANGE.
    0 \0 }8 U) i/ D+ H* T
  12. *! Y" U7 F! [# c& U! u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " E9 o/ E# C/ v/ T( k
  14. *
    : ]& z+ T% J# P) _' |
  15. * This program is free software; you can redistribute it and/or
    / L: v: N# o1 P6 @
  16. * modify it under the terms of the GNU General Public License as
    , x3 V' P, h  ^5 a
  17. * published by the Free Software Foundation version 2.  x- O- T9 S2 ^: u  T' [: K0 u
  18. *, @2 ]9 L0 U& t) ?2 y: l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 T3 |& g& `! E! K$ }
  20. * kind, whether express or implied; without even the implied warranty) c5 l& k) g0 T# K$ e2 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) N8 G. t- F1 n, b
  22. * GNU General Public License for more details.
    : j# s( E/ O, |3 `, }
  23. */
    : i4 [  F3 e" m6 @
  24.   x( [4 V6 Y" d3 Q( i3 _2 }2 y
  25. #include <linux/module.h>$ v7 c8 x+ C, v2 a
  26. #include <linux/init.h>
    ) u( a, m5 T% [
  27. #include <linux/errno.h>' @8 o3 j6 L3 |9 r5 q
  28. #include <linux/types.h>2 Q$ t8 {" b. N) \: w: E' m
  29. #include <linux/interrupt.h>1 l( P3 [6 l7 [  _
  30. #include <asm/io.h>
    ) j8 a: O6 y( M; [! ~$ a
  31. #include <linux/moduleparam.h>: P/ o) y& e4 n2 r, u2 _7 B
  32. #include <linux/sysctl.h>
    # ]; A3 c; a! l8 D$ V3 X" \& A9 O( k
  33. #include <linux/mm.h>. k+ }$ ^9 z4 Y) l! S) m4 O3 Y
  34. #include <linux/dma-mapping.h>
    : h: a/ Q' L3 p: j2 X; g, p
  35. 9 ~% C7 k& Y$ N& }' n* K4 I
  36. #include <mach/memory.h>
    / s$ H! l) h2 ~8 k2 O, d
  37. #include <mach/hardware.h>
    ( O  k: I* J3 L# Q, k" W! o% _8 S
  38. #include <mach/irqs.h>! n1 A. r& e5 U& }" P+ W
  39. #include <asm/hardware/edma.h>* b+ g9 w3 i7 h; i/ W
  40. ( U8 t* }$ j; T4 e# E, k
  41. #undef EDMA3_DEBUG7 V; @  s2 b2 E! P
  42. /*#define EDMA3_DEBUG*/! B4 c6 ?- }9 ~/ X! R
  43. 4 Q8 {% t0 ^6 e) Z& X
  44. #ifdef EDMA3_DEBUG
    # c' l7 b& c; r& H; ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 E; b# n- c7 l+ T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 [* J" s$ ]+ L9 a- M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 D: s$ w+ ]) a+ F& Y
  48. #else6 v/ k" \" D; z
  49. #define DMA_PRINTK( x... )% W; i$ |1 ~, e' L/ R
  50. #define DMA_FN_IN
    ) h  K& x) ^. Z) J6 K# U
  51. #define DMA_FN_OUT
      Q& k$ H1 {, x0 Z- R* c- b
  52. #endif' Y' z' Z. \0 ~- ~2 o; B/ y% i
  53. , O+ i9 F1 g: {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 ?, Z! b# R% u2 L8 F
  55. #define STATIC_SHIFT                3
    + ]( A/ `1 E2 A) S0 |
  56. #define TCINTEN_SHIFT               20
    / `" J+ a9 n2 o# z% e1 V% O
  57. #define ITCINTEN_SHIFT              21
    , G9 J3 |5 y8 v
  58. #define TCCHEN_SHIFT                225 G5 [0 q: k* |
  59. #define ITCCHEN_SHIFT               23
    5 d0 w4 X: R9 S: M/ D' X( \

  60. + G$ n: o  `6 }; j( s; B7 [
  61. static volatile int irqraised1 = 0;! z9 f9 a. C: X& b1 I. t
  62. static volatile int irqraised2 = 0;$ R) ^% ]8 Y5 U4 C
  63. 0 x3 ^* x0 K+ I9 m! W2 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ^. |% v6 G: @) y( a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# F/ H  `9 c% \( e) f" _$ }! H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # u$ M, c# W) c; G0 Y- w4 P

  67. + ~" w$ b  @/ l' z. M. c
  68. dma_addr_t dmaphyssrc1 = 0;2 G2 J; D. _7 R% n" w+ M0 i
  69. dma_addr_t dmaphyssrc2 = 0;
    5 Z* h" b( E( V* v
  70. dma_addr_t dmaphysdest1 = 0;
    5 q/ @0 R+ l) Q
  71. dma_addr_t dmaphysdest2 = 0;& o2 ?  F! i# M6 Y. G9 M2 a$ e
  72. ( G3 n/ H. q! N& V' M- s
  73. char *dmabufsrc1 = NULL;# g9 |! u% j+ C" A
  74. char *dmabufsrc2 = NULL;
    6 r" o6 J$ O& N' R3 _) l5 V, `$ |3 F! k
  75. char *dmabufdest1 = NULL;1 w3 n9 F( l& a1 Q6 N( G
  76. char *dmabufdest2 = NULL;7 j8 m) @; s" ], T2 M' j  A8 k& f9 d
  77. ! ]- r/ r" V! Z8 X
  78. static int acnt = 512;) H. y# o( p5 F3 |6 E1 q
  79. static int bcnt = 8;
    : T3 h' A9 L+ y5 w; ]& w
  80. static int ccnt = 8;
    ( @8 i/ K6 [& r1 @6 d9 M
  81. ; K+ R1 z( P" |3 |
  82. module_param(acnt, int, S_IRUGO);
    * I+ `0 c9 E- D4 B/ N3 w  J" T
  83. module_param(bcnt, int, S_IRUGO);+ \0 t* c: a6 n* L7 I& Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) k! S3 f+ {5 }& s' k7 c7 Z0 g( t+ k
9 H5 z6 I' F1 t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% n& u+ ]4 d2 i# p' ?. d( Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& [! o! {( b/ J; d* @5 F1 f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 f8 g( B" Q- T1 Z8 _0 U
$ V, x4 D) K) E. c3 V! `
" c7 t. S6 q3 p! L. |9 w  D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 16:08 , Processed in 0.045257 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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