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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& i" `- R  a. I( M4 E: t1 r
  1. [code]EDMA sample test application
    ) L% d/ Q, x8 {, E  K( n
  2. /*
    ; L3 f( l  u7 n  Q6 {
  3. * edma_test.c
    2 b* ?/ Y) l0 p- F
  4. *
    $ w. K5 t: \4 Z+ X! k
  5. * brief  EDMA3 Test Application
    / U4 d7 g+ R# n
  6. *% A7 d, D1 d! |7 T0 t7 _; K6 v2 k
  7. *   This file contains EDMA3 Test code.
    4 O$ K- u9 l+ }  b/ q
  8. *- w" k' I' |* a6 G5 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * F3 D3 {; ?  r  R. N# t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ g" E: |* Q6 r$ H( @3 `) W% Y
  11. *         TO CHANGE.4 j" j, h& t1 }; f+ `4 }' ~
  12. *
    , E. V" O  q; p! v% ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 x1 ]4 s4 K* e# A# N* @
  14. *
    4 P  s! f7 ?7 k6 H7 Y- s
  15. * This program is free software; you can redistribute it and/or
    ( }& Y+ ~9 Q; W0 A0 W, X) t
  16. * modify it under the terms of the GNU General Public License as
    ; R* }1 o) k# o0 |3 m% O
  17. * published by the Free Software Foundation version 2.: o1 `9 E: G+ m, `* T! z( d
  18. *" I0 b- m" W9 O9 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' s2 h& [. D4 b1 E7 }) L( F* R" c" F
  20. * kind, whether express or implied; without even the implied warranty
      w; K+ k4 t5 S; A; r6 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - Q2 N7 }- k4 s
  22. * GNU General Public License for more details.
    & v* Z% ^  t# i% p; U& g! S" b  q% x
  23. */
    ) `; z, s1 T1 v& z; Y- A

  24. $ f9 v, s' r  Y  r( ?/ }9 M% Y% X
  25. #include <linux/module.h>
    5 H$ Z( |% X$ ]" r6 e7 H; W2 j5 E
  26. #include <linux/init.h>. [4 \6 t( m* |7 w- ]
  27. #include <linux/errno.h>
    + |% M$ m5 F7 C; T' \5 u
  28. #include <linux/types.h>
    . v2 q3 n- V# k) Q9 B
  29. #include <linux/interrupt.h>+ E& B  T! v4 u' L; `/ D
  30. #include <asm/io.h>5 Q/ f' L( `  d
  31. #include <linux/moduleparam.h>0 i4 z7 n* H8 x& }1 I1 U
  32. #include <linux/sysctl.h>+ M; t8 T& R5 v- o4 x. [
  33. #include <linux/mm.h>
    / U5 t3 d. z8 S0 _
  34. #include <linux/dma-mapping.h>
    6 R5 M- l: _9 y. u6 ]

  35. ) v! W, d4 h! K
  36. #include <mach/memory.h>( R+ i  \  M5 a& n& V9 v. ~
  37. #include <mach/hardware.h>
    6 }% Q2 N0 ]2 r0 g1 F8 G- l$ h
  38. #include <mach/irqs.h>
    6 k2 I% X: _2 K* }3 I
  39. #include <asm/hardware/edma.h>
    + ?3 k/ e* Q' F" C
  40. ; f7 ~3 f# v- Y
  41. #undef EDMA3_DEBUG
    $ a' p- R9 W) x: z. l* a; J
  42. /*#define EDMA3_DEBUG*/5 I' L9 |% k6 s% q" Y
  43.   R% K/ U( a, z3 C1 l
  44. #ifdef EDMA3_DEBUG
    ( o; ?% y1 p1 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 _. y% Q! ?" G; c$ f& p& O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; b6 o3 n. u0 z7 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* e3 y+ T* p8 ]6 o* T; z+ r, w9 V
  48. #else
    4 }- v( F2 i% f% m5 q
  49. #define DMA_PRINTK( x... )" Y7 |  b! J6 M& B4 E; T) I
  50. #define DMA_FN_IN* z; j' V, Q2 S% f
  51. #define DMA_FN_OUT
    " C" n2 ~4 o9 k5 W) ^9 F
  52. #endif4 p2 `2 n( n2 N4 A$ M+ y

  53. - L+ O8 c5 f" l2 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : a7 j" m1 i/ ^+ H. C
  55. #define STATIC_SHIFT                32 ]+ P' y6 P7 p0 ?
  56. #define TCINTEN_SHIFT               20: [8 z) i& Z2 s) B
  57. #define ITCINTEN_SHIFT              21
    1 I0 }" n0 t, j7 C
  58. #define TCCHEN_SHIFT                223 h" y& v# m% d$ C7 x
  59. #define ITCCHEN_SHIFT               23
    / j/ f" v1 X: s6 `
  60. ' O4 z$ U2 t/ R+ z2 X& t" c
  61. static volatile int irqraised1 = 0;+ Z; [% [4 k4 ]  m* y3 v* M
  62. static volatile int irqraised2 = 0;
    8 w/ l$ j- p0 W) y& [2 V( U1 m, J

  63. 7 j9 T6 P. p- |9 @2 v! }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 z1 @: |. Y: I* h% [; l3 X/ g: ~& i" t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 h9 h) e' z4 I' m+ Z" H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) r8 c( }6 J- W  M/ @
  67. ! h5 P( i4 a8 Y- L
  68. dma_addr_t dmaphyssrc1 = 0;
    + a4 }9 O: j( O* b- R8 B, F
  69. dma_addr_t dmaphyssrc2 = 0;, I. S! ]' P% P. p: S
  70. dma_addr_t dmaphysdest1 = 0;
    5 ]* l7 d8 n. X; _7 ^$ k7 K7 c
  71. dma_addr_t dmaphysdest2 = 0;
    # A$ i' l3 C: m9 q/ t. H' p

  72. ) X2 ~5 F% T+ h( d7 j) d$ E
  73. char *dmabufsrc1 = NULL;
    : H/ t0 N% {0 b# Z+ b' {; A7 L
  74. char *dmabufsrc2 = NULL;
    7 L  W9 n5 m( ~+ R; \7 P0 }! }
  75. char *dmabufdest1 = NULL;
    2 g7 B9 J* B8 q1 e. X. u" f
  76. char *dmabufdest2 = NULL;
    + j7 O8 c( j- I' \& ?
  77. 8 L+ ~2 \4 r6 f: b
  78. static int acnt = 512;
    ) F% @  M% k! E2 k, H/ h1 e
  79. static int bcnt = 8;/ `! O8 ?' H& g
  80. static int ccnt = 8;- u2 g7 p2 S8 O; y" p
  81. 2 h* {5 ?$ e  u: R( l/ C' I
  82. module_param(acnt, int, S_IRUGO);
      x/ O4 w- S8 C
  83. module_param(bcnt, int, S_IRUGO);
    3 M+ {' c/ I9 d) v5 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 a- m) y8 a, Z1 \/ q% V6 ?7 t2 V( h. i- X" [. ~2 U% d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 T( _  V8 Z" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) a  O& }9 @/ v+ n' z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' k  W. L" W% T1 O* q+ L& k9 n$ ]) P/ M" R) g1 _" T
- f' G4 e5 C  i* e8 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 21:52 , Processed in 0.039918 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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