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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; b8 b6 T  ~3 a% q
  1. [code]EDMA sample test application
    / G) U1 t  v8 W
  2. /*
    0 g% F4 U/ I( y' e9 Q
  3. * edma_test.c
    8 J; _- y8 s4 D) m) z
  4. *$ R6 g! g  N- ~$ V; R
  5. * brief  EDMA3 Test Application9 N6 P0 S8 H. H0 t
  6. *' s& f* G) V- A0 Y7 G* n
  7. *   This file contains EDMA3 Test code.
    1 L0 y9 t* }6 s6 u" {4 g& ~6 X
  8. *
    ( J* p; Y8 v$ h6 n0 G& M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* q% L. Y2 i  A' h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# U6 L( E0 E1 u
  11. *         TO CHANGE.3 M2 V# b5 V# ?# \- @6 c8 Q. M
  12. *. j" ]% k+ {+ `1 a& K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" b% N5 c$ N4 m, j4 D% y) y: z
  14. *
    # S4 |5 e/ i1 J  Y/ Z
  15. * This program is free software; you can redistribute it and/or4 B, g: _3 c4 m8 y
  16. * modify it under the terms of the GNU General Public License as4 ]0 w' e4 `- _# I: G
  17. * published by the Free Software Foundation version 2.
    2 I7 w/ m7 a0 ]3 k5 b
  18. *
    ; Z% n$ A/ g7 B/ F; z3 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! E5 j/ Z( ~# v" U1 s2 {) [
  20. * kind, whether express or implied; without even the implied warranty0 [; h/ B$ W) `& g. G0 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 l0 R& D4 `2 m3 T+ R
  22. * GNU General Public License for more details.: a2 A! G, Y  M
  23. *// w) I' ?2 Z! B; a5 n9 c

  24. 3 ~7 u& {7 W. l7 H5 P
  25. #include <linux/module.h>
    $ v1 S" x6 ]6 K# w! h( V2 S
  26. #include <linux/init.h>
    , Q& b- h& J1 y1 ~( W+ x
  27. #include <linux/errno.h>
      n, D; c9 Z  R
  28. #include <linux/types.h>
    6 f% d/ \$ @  u& ~. g5 h
  29. #include <linux/interrupt.h>' N# b" [4 D7 `+ {
  30. #include <asm/io.h>: x. |; W( E9 K* Y
  31. #include <linux/moduleparam.h>: y+ y% s6 B2 ^, [/ x5 r% h
  32. #include <linux/sysctl.h>8 i, ?6 _0 h$ t# S( m" R
  33. #include <linux/mm.h>  m- M; e: X% s1 J! e
  34. #include <linux/dma-mapping.h>7 c: g. S/ a( y
  35. ) n9 D3 T* Y+ W. ^! g% D
  36. #include <mach/memory.h>
    1 y6 z8 G2 t' {8 v. c0 g! i
  37. #include <mach/hardware.h>
    4 w! d$ K2 m$ U
  38. #include <mach/irqs.h>
    8 |9 ?) B8 I' o
  39. #include <asm/hardware/edma.h>
    / h! s4 k# E6 e7 l- ^

  40. 0 V% w3 |) R2 b: x7 S) q* O
  41. #undef EDMA3_DEBUG4 {; k/ e" }9 y& m" s
  42. /*#define EDMA3_DEBUG*/3 o8 W  G! O/ r8 A7 P. J
  43. * {5 ^2 i# W$ d0 i& z, o4 C# R
  44. #ifdef EDMA3_DEBUG
    0 `. F( c  q2 M! G2 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). r' I7 E) v6 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 J3 i7 ]* L; b. z. M# v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; y" Z1 U. D( ~! f
  48. #else, z4 A% C$ g0 A  [: o
  49. #define DMA_PRINTK( x... )" l( j) Q2 B: N. S' J# ~% Y6 R) _
  50. #define DMA_FN_IN7 [3 W: {5 ]4 _' ?1 Z$ O
  51. #define DMA_FN_OUT, W6 M8 l+ ^& _3 r
  52. #endif0 E* u* a) B! I/ l) B
  53. / u  E) @3 [; u/ j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 W" O# k( @9 w% v
  55. #define STATIC_SHIFT                3
    # W' t1 R! P# o2 [$ a4 I
  56. #define TCINTEN_SHIFT               20
    / H, v0 Z6 H& e' T
  57. #define ITCINTEN_SHIFT              219 G( W3 f, Q' k' w: W
  58. #define TCCHEN_SHIFT                22
    . H0 G- R- |) c$ _: I
  59. #define ITCCHEN_SHIFT               23" C# f7 D* |7 \7 @8 \
  60. % ~, A2 [7 e, i5 }' T3 ^5 ]
  61. static volatile int irqraised1 = 0;
    ( e: T- ^/ s9 c6 Z  Q8 K
  62. static volatile int irqraised2 = 0;. f- y# s' R+ K4 V
  63. ) V5 M! N! a) \* @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 d* x9 o9 c1 v& Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 k( O+ |$ s1 l9 H/ j( n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 M0 O+ y9 j: a* e' ^
  67. 3 j& _) Z- r: S/ g
  68. dma_addr_t dmaphyssrc1 = 0;% u* u; R4 @1 Q+ c% D  K! `
  69. dma_addr_t dmaphyssrc2 = 0;
    ) Y. i2 C2 @- E
  70. dma_addr_t dmaphysdest1 = 0;
    : N3 n0 |/ ]1 M
  71. dma_addr_t dmaphysdest2 = 0;
    ( M/ C+ ~1 S$ \# O$ Z2 U

  72. 9 J$ J" F  n6 l2 T
  73. char *dmabufsrc1 = NULL;6 g4 B0 ?4 d. J7 h; J: t  l
  74. char *dmabufsrc2 = NULL;
    ! r) J: v( C; f: F& ]" K4 l: `& @
  75. char *dmabufdest1 = NULL;
    2 e# y+ v) u4 ]; `* B2 A
  76. char *dmabufdest2 = NULL;
    * @6 R0 R7 o5 f! g- e$ Z. }% r
  77.   j5 q9 ^( U' W  i6 E/ |4 R+ L* ~
  78. static int acnt = 512;
    " `+ u+ d4 r" d9 X2 [
  79. static int bcnt = 8;# w2 D' K% ?; U, x- W$ u/ J
  80. static int ccnt = 8;
    1 i. Q$ }7 k4 d$ f  T0 `
  81. . d$ A8 H6 A& Y1 J4 q! l5 _- o7 z' \6 E
  82. module_param(acnt, int, S_IRUGO);; g! M5 }. Y& g
  83. module_param(bcnt, int, S_IRUGO);; w$ M' C* I4 i/ ?* ]* H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 J$ X! x9 A7 j) L! d! ?
7 \4 ?/ @* B6 D3 S8 |- U" T- O/ ^! m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% w% Y; G/ F) C$ g7 t) B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; Z, \! W) Z( q$ i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: C( E- L; c% @. w, e: D8 v. C! b% _
* B7 E4 O1 {6 ?$ z3 p) N1 y" d* V  I
; t+ L& b  ]2 x) z2 C. ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 21:16 , Processed in 0.038977 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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