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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 B8 A% Q9 T* C& N* }6 Y6 _8 z
  1. [code]EDMA sample test application
    # k, |( T  T+ N, r, d# a* L# C
  2. /*6 X: E1 ~  U- r0 n
  3. * edma_test.c, a$ o# [$ o' D6 C# x
  4. *
    ' h, ]  c/ Y" N8 v
  5. * brief  EDMA3 Test Application
    5 n- c1 \9 X5 Z2 _2 k9 c# O
  6. *
    " p( V. _$ h! a# d: k
  7. *   This file contains EDMA3 Test code.
    $ [! a. J2 x3 i7 t2 K& m1 }
  8. *2 a) R' [( \- A* X9 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- E- W" Y: h3 E" L( y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  Y$ D2 y) w8 r% A
  11. *         TO CHANGE.
    ; E' w9 i- `& X* c* L; w6 _
  12. *- ^. X/ U- ~1 l/ i8 o& i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 r7 s( T" o( j4 }$ p% ]2 x5 `
  14. *, s' N9 F$ j+ W7 E
  15. * This program is free software; you can redistribute it and/or; ?4 o) A$ a2 {% n6 O
  16. * modify it under the terms of the GNU General Public License as1 H( E4 t) O# B& E/ ^; g
  17. * published by the Free Software Foundation version 2.# Y0 u8 i/ H5 Q4 K( ^% L
  18. *
    + b2 `4 o  X( d: D+ r8 P$ ^0 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; r9 W* I3 W/ H2 l
  20. * kind, whether express or implied; without even the implied warranty' Z) Z- ^  S' s* \& T7 S1 A* S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ P; @3 F3 M& W) d2 e
  22. * GNU General Public License for more details.3 n/ U+ N9 k0 b2 Y) J, @+ A
  23. */* N7 D, ]" G3 I

  24. 8 }) A' W8 i( p) i4 H
  25. #include <linux/module.h>5 F/ r. b! M7 S" K) W; f% }' I: `
  26. #include <linux/init.h>
    ' m! G+ U% x2 U( m( }5 S
  27. #include <linux/errno.h>6 `3 Z/ w' x* Y8 K
  28. #include <linux/types.h>6 D; L4 u4 S  z% X8 \
  29. #include <linux/interrupt.h># U, A* m8 n  ]. i1 ~" h
  30. #include <asm/io.h>
    - y; I5 }" O, z) D
  31. #include <linux/moduleparam.h>
    $ ]7 T! ?. |* z  T$ K5 x
  32. #include <linux/sysctl.h>
    5 _- V8 l6 d, h) T& F
  33. #include <linux/mm.h>
    7 H! c. B% x& L. e2 U: g- l( E
  34. #include <linux/dma-mapping.h>, P' _6 S- V9 K. x
  35. 0 y+ q- v# o9 V# l; j9 p9 s9 _
  36. #include <mach/memory.h>
    , x3 t$ A$ o) Z# c. o+ r3 S/ L( B2 P2 O
  37. #include <mach/hardware.h>
    ; @3 w# i  I2 a* J4 \8 r
  38. #include <mach/irqs.h>
    / B; G5 t5 d! ~( X4 x
  39. #include <asm/hardware/edma.h>% P  @: U1 ^& c/ ]$ Y
  40. 1 p4 j4 }7 Q/ K/ ]# |; B2 b
  41. #undef EDMA3_DEBUG3 J0 b! a6 Z9 m$ p& B
  42. /*#define EDMA3_DEBUG*/
    0 {" J$ A  M" }: |8 R7 f" T

  43. 4 F( F: m! u* X- U
  44. #ifdef EDMA3_DEBUG
    & F# b  x8 M6 s" N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  @) M: v* X. j' z+ v. r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 |/ s' v; |9 e! V3 \& N, V8 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 \7 o. I4 J" L) S! ?7 ]
  48. #else
    " r! A0 A& q" Y* h, d
  49. #define DMA_PRINTK( x... )1 Y$ c3 R0 d) o; b/ g" ~5 [
  50. #define DMA_FN_IN
    ; A; x; }+ q; u% w& z  i8 \. B% U  o
  51. #define DMA_FN_OUT
    5 ]3 Z: G3 P) e
  52. #endif
    9 H6 |1 T; y3 U) s4 q/ @3 i) _  P

  53. 6 \! l0 J0 _5 |( W* j. V2 r! E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - X# K& Y- E- F0 Z. b# X$ v8 q" f
  55. #define STATIC_SHIFT                3
    2 y) J" t4 s, v; Q' a
  56. #define TCINTEN_SHIFT               20
    * u% s* L: T3 X. v
  57. #define ITCINTEN_SHIFT              21% G: g# a! F$ U) a1 s/ b! V, \( U+ p
  58. #define TCCHEN_SHIFT                22. k7 S' Q% S7 N1 C8 `6 o
  59. #define ITCCHEN_SHIFT               23/ D: |, d- B2 T2 C
  60. % c( W! i: v) H6 Z2 a4 P
  61. static volatile int irqraised1 = 0;
    3 z  K2 ~( x0 W& L2 h
  62. static volatile int irqraised2 = 0;# g  u; F- E0 I/ z8 |6 p4 r

  63.   F2 y7 k: h6 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" k4 r4 T: E; d& r; `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & L7 p* d% j: Q3 t$ O( x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" u. I9 ]6 M2 r( A4 P+ i

  67. 4 w$ N/ r+ @0 b6 c
  68. dma_addr_t dmaphyssrc1 = 0;
    : l4 k" Z2 J  O3 [; e5 g& H
  69. dma_addr_t dmaphyssrc2 = 0;
      _1 ^9 R; [" F( q* v
  70. dma_addr_t dmaphysdest1 = 0;
    0 [  Q$ f! T& ]% @& @) N. C+ k$ o
  71. dma_addr_t dmaphysdest2 = 0;) C! |; H7 i! c8 M6 f9 n( {
  72. & {# b5 |4 y1 z) F/ V
  73. char *dmabufsrc1 = NULL;
    , O: o0 \  J$ V1 N% n* @
  74. char *dmabufsrc2 = NULL;/ a- {* ^" V" S$ r
  75. char *dmabufdest1 = NULL;
    . {  U% B! ^0 y; ]* w3 z* i% j
  76. char *dmabufdest2 = NULL;7 I5 P* X5 i' w- z( E! s
  77. 9 a; x/ ^/ {7 {0 E$ N% b" N
  78. static int acnt = 512;4 J& L5 H% s3 {6 O. @1 J0 R1 L% C
  79. static int bcnt = 8;
    1 U; _% d  G7 m- f" ^7 L
  80. static int ccnt = 8;/ \5 M2 o; s( N% n

  81. , h1 u/ n5 Q2 E$ h( L5 i
  82. module_param(acnt, int, S_IRUGO);
      b7 z9 {" @8 m
  83. module_param(bcnt, int, S_IRUGO);
    5 d- h& F3 G; Z+ Y) ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 ~. u9 X9 B  o+ \9 u6 U5 y+ E, l  T, i; s: z: M; u5 Y3 ?6 Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 h) I( E4 H0 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" q" |: g* [: e" @( h+ k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 @# ^" ^* ]8 d* ^4 G" `3 T+ }$ R5 ]% n# ]1 o# u% Q" ]

; D) q0 T5 ]' f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 18:58 , Processed in 0.038306 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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