OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 s+ @+ E4 |8 A3 A; u2 d" E. W
  1. [code]EDMA sample test application
    1 _6 G1 B1 P! D/ O4 q
  2. /*& e) ~4 g9 l; h6 t8 s9 Q5 T
  3. * edma_test.c) {1 w( I2 X4 t& D1 m
  4. *- Q6 h9 v+ I: A
  5. * brief  EDMA3 Test Application2 [5 e& l% d  {
  6. *
    1 L1 r$ u" ]. o6 Q7 p
  7. *   This file contains EDMA3 Test code.
    2 V; z' u1 \' L: F
  8. *
    ! q* L6 B; `, L7 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" b- @' M2 |. Q2 u2 h# u/ _0 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ V) C$ _7 s( T+ G
  11. *         TO CHANGE.! P3 ~, ]5 B$ H6 G( i% q
  12. *  ~% `# x( a; _- a' t" O, O7 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 j' }/ ]2 y+ F% _7 T3 P
  14. *
    1 b! i# {( u9 e
  15. * This program is free software; you can redistribute it and/or
    4 I% a/ P! |8 |9 ?% _' X
  16. * modify it under the terms of the GNU General Public License as, w  y. J& b- s& J4 d; Q' X
  17. * published by the Free Software Foundation version 2.
    ! t5 l! p! E& p; p/ Y4 |4 I( d6 `7 z
  18. ** R. c; n1 M2 y$ S$ p. L/ \$ @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' ^! y+ q( p+ k# B9 ~; t3 }
  20. * kind, whether express or implied; without even the implied warranty% a( b; R8 B5 M. }( ^8 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' C' e+ w  b& ?0 V& P
  22. * GNU General Public License for more details.
    $ V/ K6 `) b3 V% N! f; ]
  23. */* R3 t8 g& J8 [! S
  24. 7 K7 Q( `; n4 w% a
  25. #include <linux/module.h># K% T! G5 H9 c% d$ [( l) K
  26. #include <linux/init.h>9 \; m& V9 \& q! T4 j5 G0 a9 u
  27. #include <linux/errno.h>0 {9 E9 K' `* @8 }2 Q
  28. #include <linux/types.h>( d7 n! v: y% c$ x
  29. #include <linux/interrupt.h>
    9 D$ p. @1 \+ b+ G0 [
  30. #include <asm/io.h>
    $ P. g3 J$ _7 f( }) y0 w
  31. #include <linux/moduleparam.h>
    & g" M; E% l8 \' Q
  32. #include <linux/sysctl.h>! W9 O- h0 q' o% ^
  33. #include <linux/mm.h>+ p8 V7 x, c* Z
  34. #include <linux/dma-mapping.h>
    7 \: _* [3 r% Z3 S6 q+ y0 U

  35. 1 n! N0 I5 S& C6 k, f
  36. #include <mach/memory.h>2 f( c/ H, {, l3 i
  37. #include <mach/hardware.h>
    . ]  r% X& Y2 U1 f' w
  38. #include <mach/irqs.h>8 q$ Y# @  f9 w- X
  39. #include <asm/hardware/edma.h>
    . j2 ^# a) p  t$ J7 t+ j4 f6 z
  40. : t# \) G% G& b( c1 M' ^# E
  41. #undef EDMA3_DEBUG
    $ N7 \' U9 M4 a% Z
  42. /*#define EDMA3_DEBUG*/
    $ ]) K8 [/ {* G  [

  43. ' V/ t" k: E* T% p2 p- a
  44. #ifdef EDMA3_DEBUG
    6 o: B, j$ s& P1 g/ h0 s% S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  `, H0 q3 s/ f, \8 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( j8 J6 W# ]/ G/ a1 c: l) d$ M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) w+ P9 L  \9 f" N1 V9 E4 z$ F
  48. #else4 l- Q3 l1 c1 r4 W1 W6 m! F
  49. #define DMA_PRINTK( x... )
    3 ]; X8 L7 _2 E5 b$ p" d* |; B
  50. #define DMA_FN_IN
    . L4 G) k" A8 O. Q
  51. #define DMA_FN_OUT" z6 r4 P& F2 D+ o' W4 W
  52. #endif& r$ Y+ j. S8 T. O$ v" I+ G; {

  53. 8 A" ?+ j& _! j. w) ]# Q% E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ H7 ]- V9 v, ]% m, D+ v9 |
  55. #define STATIC_SHIFT                3* s' F( J* ]2 `( D
  56. #define TCINTEN_SHIFT               20
    % i7 R  ]4 A8 ~4 L; O
  57. #define ITCINTEN_SHIFT              21. a0 a9 s  z# X$ \- s- A; q% q0 `! S
  58. #define TCCHEN_SHIFT                22
    & F: D# H' A" Y& o* W9 }
  59. #define ITCCHEN_SHIFT               23
    & ?) `; v8 Y" k  h
  60. ) k$ F2 J% S# e" D2 o
  61. static volatile int irqraised1 = 0;
    ( [: w7 K! d6 u) q# D$ R
  62. static volatile int irqraised2 = 0;, g  Q: i+ X/ r( K, N

  63. 9 q$ [* G$ g* U9 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ W0 a  H/ B4 T: {7 c) O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 h. U( j. x  Q# o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 _; z9 N) ~% b
  67. 1 W' N: k6 b0 f' ]1 f3 ?
  68. dma_addr_t dmaphyssrc1 = 0;) ~0 ?. R; G1 X% C
  69. dma_addr_t dmaphyssrc2 = 0;6 n% B7 ]( f4 |& u
  70. dma_addr_t dmaphysdest1 = 0;: @: a4 \- @  w3 X; b! g9 L& ~
  71. dma_addr_t dmaphysdest2 = 0;
    , t4 N8 O9 J2 _; |
  72. 3 r; N) D# s, w
  73. char *dmabufsrc1 = NULL;% m9 A* s+ B9 p9 K2 r
  74. char *dmabufsrc2 = NULL;
    + Q' U1 [7 {6 ]5 C  z& S+ e+ f
  75. char *dmabufdest1 = NULL;9 ^6 H! ^$ s5 P( C! c/ d
  76. char *dmabufdest2 = NULL;- Z4 d6 _. N/ ?' I% I0 E9 G0 r. c. V
  77. 2 z7 I: I6 `" _
  78. static int acnt = 512;
    - o. ]1 i  r+ X" ^% J
  79. static int bcnt = 8;
    6 W% z9 v  z5 A, a8 u5 A% o
  80. static int ccnt = 8;
    3 U% D' u/ i% d" i5 \& u( r

  81. ( ]: I) L) `. i% g( n& X1 I
  82. module_param(acnt, int, S_IRUGO);
      t& J; V4 m! E$ V; n; x! O
  83. module_param(bcnt, int, S_IRUGO);  p1 |, Q9 u1 _+ w/ J8 Z% U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' I! I# \, Q& X5 T+ b. s' a3 ^: I0 \
( t  J, G2 W% f: N3 v, Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, I% z+ @  p) `3 u& F" Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, k7 l7 v! Y7 E9 l$ K0 n, o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( w! \9 @$ t  P" @) p. z- z# @4 ?9 T
6 b$ b4 o( |, G/ \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 01:46 , Processed in 0.051197 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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