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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' [5 n, O) q& v; m4 V* C: j& K
  1. [code]EDMA sample test application8 N8 n, M; l4 L
  2. /*
    7 @& X4 C6 {; I5 S( q* i4 @9 E; F- I3 \
  3. * edma_test.c8 L0 V) ]. j9 L
  4. *2 Y: p, D4 T) K1 Q, d0 [
  5. * brief  EDMA3 Test Application
    5 n+ s, R: Q. K5 i6 g  |- [' b) @
  6. *; M* I( m5 Y7 `
  7. *   This file contains EDMA3 Test code.$ v6 v4 `% }! K/ l; n1 i8 Q& V9 C$ f
  8. *
    / B; x" R7 M, H' L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) w7 m4 z3 H; g4 V: A( o/ J3 q: U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 }: S  K# ^) k7 o
  11. *         TO CHANGE.
    + F/ U2 U1 R: A# k
  12. *
    9 |; y9 p, V& ~9 }' N6 L. U+ p6 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 G1 }# q) E# i& O, D
  14. *; B' I+ f& x& f: F" e1 l; F4 y
  15. * This program is free software; you can redistribute it and/or
    ) r- R, o. r$ w7 O. k- U
  16. * modify it under the terms of the GNU General Public License as
    5 A5 m) j$ R2 k0 U
  17. * published by the Free Software Foundation version 2.
    / _. ?. H$ r* w, N( f& \  e+ `% l
  18. *
    2 u; }. s2 V6 @2 G7 B! r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& W2 _6 D% ?2 S! U" F. V
  20. * kind, whether express or implied; without even the implied warranty
    ) h7 n2 P* h2 h6 O2 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , d$ a/ t2 [3 M* H2 t
  22. * GNU General Public License for more details.
    ( K0 b: I; r  P5 }, b; n
  23. */3 E- H0 A9 b) m. z% F6 b& a

  24. ' J6 T( ?$ `" C4 w
  25. #include <linux/module.h>* H/ p5 n* e% a, L$ ~% G
  26. #include <linux/init.h>' I1 W, d9 x7 C1 {+ I1 T& b
  27. #include <linux/errno.h>
    2 \' {/ p( b0 f& U
  28. #include <linux/types.h>
    2 R- l  |0 X  B" q4 W
  29. #include <linux/interrupt.h>- c, H* w/ ~% H/ Y( z% h) M5 E
  30. #include <asm/io.h>$ ~  t7 E+ G: y) Q  {
  31. #include <linux/moduleparam.h>
    ' x3 _7 D' s0 z. z% F, }
  32. #include <linux/sysctl.h>6 {) n+ u; S" L9 I
  33. #include <linux/mm.h>
    0 T( A: ^5 z. t" M7 w3 l% y# K
  34. #include <linux/dma-mapping.h>
    2 r4 r1 P( _( K" w
  35. ' k9 F6 p0 E* H( C% Q# i1 n
  36. #include <mach/memory.h>
    % G- T# V8 _* e2 N+ i; V
  37. #include <mach/hardware.h>. R; Y, Q0 ^( A3 p
  38. #include <mach/irqs.h>+ i+ X  }+ C) s2 ~" e) p# a
  39. #include <asm/hardware/edma.h>
    / c# q* w6 B; x$ v, ~* _% i0 G7 K

  40. 1 W7 t/ j0 W$ A. Y! g0 \. H& S! N. i
  41. #undef EDMA3_DEBUG
    7 J0 P. @7 N! I. e; E% h
  42. /*#define EDMA3_DEBUG*/
    ! X" D# i) V' t9 A5 X- \

  43. & k& Y+ `- z" P1 s* Z6 `9 G
  44. #ifdef EDMA3_DEBUG* Y8 z* a8 ^9 b$ x/ [# P3 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- G5 ?" f4 `  m# k2 P/ s# f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); X4 c# s* `: h. X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 a) e( ?/ x  K3 o) x
  48. #else
    5 y" L$ o* C# E/ q
  49. #define DMA_PRINTK( x... )
    * A& e. Y6 D' c" F: z5 v
  50. #define DMA_FN_IN
    ' U; b% i$ C4 H4 d+ h1 v
  51. #define DMA_FN_OUT
    3 v3 `" R8 X* s
  52. #endif9 j5 B5 {: \% T( S' ]: p1 T

  53. ' l( l' u  A5 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); ^$ `" l3 v) |% L  s; `/ ]
  55. #define STATIC_SHIFT                32 _6 Q8 `/ Y* i) z: E# P- P) A
  56. #define TCINTEN_SHIFT               20
    8 y$ ?2 w# {) M7 J! h2 {5 {/ l
  57. #define ITCINTEN_SHIFT              21
    9 b( l& p4 |  t$ l; K( O6 p: [
  58. #define TCCHEN_SHIFT                228 ~2 c: q0 c' |* \0 \, u
  59. #define ITCCHEN_SHIFT               23
    , `/ j; y7 ]7 a9 `2 {& s* T

  60. 0 z7 m1 ~! P/ p5 I" t" N. T6 ?
  61. static volatile int irqraised1 = 0;  s+ ]- H3 Y2 ]3 V
  62. static volatile int irqraised2 = 0;* w7 G5 p  d* E3 s" C  q

  63. 0 G  N- Q0 v( a* a* [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J- m" F4 ?) ]" Q  S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " o; U' O$ y! b) w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      i% j# X7 \4 X; K8 ]6 |) V

  67. * \9 z. ^/ R: o, U
  68. dma_addr_t dmaphyssrc1 = 0;7 e: r9 S. _2 h
  69. dma_addr_t dmaphyssrc2 = 0;! J/ F4 L7 n& w! \. T3 W
  70. dma_addr_t dmaphysdest1 = 0;2 p9 ], ^; X+ n5 o: ]: Z) L, W
  71. dma_addr_t dmaphysdest2 = 0;
    ( Y" P4 Q8 |0 t

  72. , l$ ?2 n1 y3 H3 U/ h
  73. char *dmabufsrc1 = NULL;
    5 E9 j1 }5 F0 [- q1 C: o8 H
  74. char *dmabufsrc2 = NULL;
    0 m4 v3 A  z0 i# ]4 k9 n
  75. char *dmabufdest1 = NULL;3 G6 w; t+ p# B& u2 R5 J
  76. char *dmabufdest2 = NULL;
    5 T  ~& w( F1 ~" c6 ^
  77.   r( l2 k! u7 k0 B/ f
  78. static int acnt = 512;5 J+ h8 S7 w. k* Y. Y& X: W& ^( P% E
  79. static int bcnt = 8;, U+ v8 _: `2 [
  80. static int ccnt = 8;& e4 r, X5 y! a. j. H+ H8 h0 i

  81. ' D% A# s3 @1 O
  82. module_param(acnt, int, S_IRUGO);/ j* _0 @; t2 s! o# D, y
  83. module_param(bcnt, int, S_IRUGO);& o# E- ^8 R) \  m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ P; l% }2 L* f+ L
0 k* w, F& t# r1 a3 X7 _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 Y8 F/ l1 R4 f" f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- f) l: f) B  i7 ]. d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& d! o- @6 k: U* H4 ^2 l9 B+ z

* E- q8 s# ^! F* L& e4 N0 y+ g
& }8 X) R. S  w( t6 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 09:34 , Processed in 0.047090 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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