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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 y' |7 m1 X; [& S& R
  1. [code]EDMA sample test application
    / R, p8 m  ]9 a* k
  2. /*
    , a/ s- p3 H+ m( e' n; }. @
  3. * edma_test.c
    * g, ]! T) d( o7 _
  4. *3 c. [" ^* i! r5 W" l7 M$ ]
  5. * brief  EDMA3 Test Application
    & B- N3 o' Z* J* @$ p9 t
  6. *
    ( W9 I" c: w# K7 `+ l$ P. R
  7. *   This file contains EDMA3 Test code.
    " C, w9 p( W* h: g
  8. *
    - [2 `, \7 m# x. T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( N% j9 V# j! Y3 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 N, p8 g; M9 T
  11. *         TO CHANGE.
    & P* G/ O; l! i# a
  12. *, ~6 [, H1 x2 F& t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( w  P' K. X/ L1 h# {
  14. *
    $ [' {. q& @& ?7 {7 w
  15. * This program is free software; you can redistribute it and/or
    6 p0 f* V: k! C% o) q; `
  16. * modify it under the terms of the GNU General Public License as) s7 C7 }% G$ K
  17. * published by the Free Software Foundation version 2.2 K1 l4 _" s/ L" X
  18. *
    2 ^/ C6 c" e7 [( z! P$ w% ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& T8 [$ x9 R6 p) y9 o6 `9 `8 u
  20. * kind, whether express or implied; without even the implied warranty
    7 B5 L' g$ z( z0 k. {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : c/ ?" r6 ?% m7 m0 w  `# G- k
  22. * GNU General Public License for more details.4 S5 [+ y! K/ c7 l" J% K
  23. */
    1 l" K0 M! }2 I- u
  24. % l0 I& e5 ?- X! c, c# }: v% p0 y3 ~
  25. #include <linux/module.h>
    5 M4 C# {7 o5 [& C
  26. #include <linux/init.h>; B) t. I1 J# w, W) r+ [
  27. #include <linux/errno.h>
    * s5 l: B9 i; L( z8 U
  28. #include <linux/types.h>
    3 H, Q& L: x3 G# }5 }
  29. #include <linux/interrupt.h>" E+ h. k$ [( |9 A) ]( _( _
  30. #include <asm/io.h>" Q$ v* K; J# y: ?! a
  31. #include <linux/moduleparam.h>
    2 q8 n' C6 \+ o, T1 ?  n. q
  32. #include <linux/sysctl.h>
    9 _* F1 d+ m* U2 X0 B" x
  33. #include <linux/mm.h>8 u( v$ Q$ t) f8 x
  34. #include <linux/dma-mapping.h>$ X2 y: Q' B  F  c

  35. : Q( y( {$ K$ ]" ~4 b0 M$ L1 R; e
  36. #include <mach/memory.h>2 c% p  Z8 b; K$ w6 g. T
  37. #include <mach/hardware.h>- F2 Y3 t& h( c: p: z9 s/ O
  38. #include <mach/irqs.h>7 f9 J. K1 U) J7 y4 s# X  `& s* e: V
  39. #include <asm/hardware/edma.h>
    7 {! O  p: n1 H% y7 e+ ~

  40. 1 j3 N9 Z- |* n; ?
  41. #undef EDMA3_DEBUG
    * @' c' \: c& b9 b: c- A; b! m
  42. /*#define EDMA3_DEBUG*// t$ ?8 k" c, `. ]* o

  43. 4 R- ]- k" h" L# Z0 A
  44. #ifdef EDMA3_DEBUG
    $ e+ G! G. O0 X& W- S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( T* g, z* T% c0 J% A( k$ S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 y1 n$ E% J  c; I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# o7 {4 X4 U5 i; o! O9 n1 y
  48. #else: U1 V% I. K, \5 `$ v4 ^6 }3 A* v
  49. #define DMA_PRINTK( x... )
    ( X3 {: V3 B, e  e/ P" O$ ~
  50. #define DMA_FN_IN3 ^  J# ]1 P2 ^( k% {5 J  j$ N
  51. #define DMA_FN_OUT8 j4 h9 S) B, \9 w9 B: I/ H5 e
  52. #endif& a" B2 p9 x3 n4 T' v
  53. ) R: y- l0 D4 q! K. U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" A: z- W$ |# G, x5 ^
  55. #define STATIC_SHIFT                3
    * x8 o) g1 }0 t# Q2 D
  56. #define TCINTEN_SHIFT               20
    ( V: X. H& v3 D6 G+ W2 n  C
  57. #define ITCINTEN_SHIFT              21) P: P2 Q5 ^: R" a
  58. #define TCCHEN_SHIFT                22
    / i3 c! }0 j3 \9 R& y, [6 M
  59. #define ITCCHEN_SHIFT               234 m( b5 G6 X3 x
  60. 2 w' J/ y3 n+ [# D; L
  61. static volatile int irqraised1 = 0;
    ! |9 ?6 [5 c( I0 O! d. T" H2 g
  62. static volatile int irqraised2 = 0;' v4 o7 i) ^/ }( l
  63. * {* U8 m& F3 Z/ b, j3 `# l, T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# O4 a- w$ k" r7 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 H; I2 S6 e: R- x6 h' C& ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . ?& M3 P$ B6 [! V, a& L/ t

  67. % i! f2 f8 C$ I/ C
  68. dma_addr_t dmaphyssrc1 = 0;$ d. I! @; w- a" \7 ]
  69. dma_addr_t dmaphyssrc2 = 0;
      x% A8 v+ n$ D( D6 `0 x! R
  70. dma_addr_t dmaphysdest1 = 0;, G. Z/ m" P" H- H
  71. dma_addr_t dmaphysdest2 = 0;0 Z9 T9 _; K1 O0 K
  72. 9 b, P, J2 u6 `/ O# \
  73. char *dmabufsrc1 = NULL;. b/ ^! \" T. m3 Q
  74. char *dmabufsrc2 = NULL;
    . Z9 A& ~% E/ Z3 ?) o% V' L
  75. char *dmabufdest1 = NULL;
    + \! W( o+ p6 Y: A
  76. char *dmabufdest2 = NULL;2 e8 l# J. a0 Q  g
  77. ) N, ?( s; o7 e) n/ v' X
  78. static int acnt = 512;
    ) v2 U: j8 G$ G3 d8 R" a7 H6 _0 _6 B1 [
  79. static int bcnt = 8;
    - R# E: c3 H: p7 }( s8 Q9 \
  80. static int ccnt = 8;/ k, C4 X& }  [7 }2 o. {$ `
  81. 5 E, r& P1 w/ w* R1 h0 u5 J
  82. module_param(acnt, int, S_IRUGO);* d( H3 Z( `& A( X! _6 ?
  83. module_param(bcnt, int, S_IRUGO);
    ) o2 @/ u# D3 p1 V! o' ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- m6 x" o3 u6 L+ c' \* N- z
3 V. u+ q9 i3 S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. j" N: X- a; U6 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 S$ p/ q2 B) V  R! w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* q3 N( a( j" _0 Z
) C8 c2 J  X/ w; e( E- m! D& v) |1 k4 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 16:02 , Processed in 0.053230 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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