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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" P* s  Q  t2 A1 V" U* R: Q
  1. [code]EDMA sample test application4 C3 g2 n0 c2 ?* D$ U3 D# Q3 v
  2. /*
    . g% C+ ~, C4 f* J" q9 i
  3. * edma_test.c
    : c- l0 i2 K1 Z- u' d3 e4 p
  4. *
    ( T' e  f! _4 v8 p
  5. * brief  EDMA3 Test Application6 ^4 A0 |3 B8 N, ^
  6. *
    2 e7 K% ]% ~' z6 g" }
  7. *   This file contains EDMA3 Test code.0 ^  t) C3 ~. x! e( s  _
  8. *
    3 `8 N- z  Q; L& K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      v3 G+ }! G9 k8 y: U) I1 q& A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& S  X$ A5 F- ~' r; Q
  11. *         TO CHANGE.
    6 g3 B; W6 E: |3 k( Z% u
  12. *4 d; C! Q! E$ n( O( }, V9 v# u4 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; m* J0 J. i/ E
  14. *
    5 ~! ?6 J. T; n. O
  15. * This program is free software; you can redistribute it and/or4 y" Z) T+ ?) t! W4 r
  16. * modify it under the terms of the GNU General Public License as
    ' Q& X, A  s) A/ q- g* q1 A6 Q( r$ w
  17. * published by the Free Software Foundation version 2.( _. |  H. V2 g$ ]' y( }. W: k  h
  18. *
    8 s, R1 c; w3 A/ q) i( a  w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ S4 I0 w2 C/ a3 {) Q
  20. * kind, whether express or implied; without even the implied warranty
    ! ^1 W7 G2 R# v. }& w! h$ s3 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - f1 u4 e8 m$ T2 c/ l9 c! ^
  22. * GNU General Public License for more details.
    ; B& ]9 H, r" a/ U5 t- Z5 q
  23. */
    3 F& F# ]  I+ K& B, l. |

  24. . Z1 o* a& M0 L  `! j
  25. #include <linux/module.h>+ U) _7 t+ j& C4 K4 Q
  26. #include <linux/init.h>
    " j) X$ \6 N$ `" a0 M# ]% z; Q
  27. #include <linux/errno.h>2 _& v5 B/ B7 n4 \9 `
  28. #include <linux/types.h>$ A! Z% T+ Q2 k1 I7 N
  29. #include <linux/interrupt.h>
    0 ?/ Z: k& D+ K$ [
  30. #include <asm/io.h>( @8 W- G/ @  ]
  31. #include <linux/moduleparam.h>* w: [1 J2 n8 e2 B0 C' t
  32. #include <linux/sysctl.h>
    9 H* k7 E2 T# P! c  b8 r& C& U2 p3 G
  33. #include <linux/mm.h>
    $ C, s( K9 M* j  F( I( }
  34. #include <linux/dma-mapping.h>
    . T+ u! g, y2 @, \2 [
  35. 0 @" Y+ L% X$ `7 B
  36. #include <mach/memory.h>
    # [) ^  U9 R& h8 p5 r
  37. #include <mach/hardware.h>* m2 h5 ]5 s8 i( R) }- x! j' O6 F3 Y
  38. #include <mach/irqs.h>
    , ]3 Z4 N  p" x1 \) g, r
  39. #include <asm/hardware/edma.h>" ~2 H0 {- C- m' \0 C; Z

  40. ! S  h$ _6 Q& j7 Q+ M0 H2 B( B
  41. #undef EDMA3_DEBUG
    ; i$ \$ {/ c. Z: D7 ^% C- e! e4 F
  42. /*#define EDMA3_DEBUG*/
    * i# g( a/ }) I$ ?
  43. 6 H- H) Z  a3 S$ k3 k
  44. #ifdef EDMA3_DEBUG
    3 }% R, T, v2 p# _; y; K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # N2 N# H4 i6 D2 Z& c6 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ m; r# O/ p0 R0 U! S4 D, S1 V! s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + F/ a3 y, q) H4 U; D
  48. #else
    8 l4 b: Y. z4 J6 f" _
  49. #define DMA_PRINTK( x... )9 e6 u0 `1 S4 ?: |  o" ^/ F
  50. #define DMA_FN_IN
    ; u; G9 \9 C9 a4 l( @
  51. #define DMA_FN_OUT( e: C% C* n8 W, F1 d. j+ l0 }
  52. #endif! h" M4 W, Z' ]8 }) D
  53. ) w& n/ N7 b" \$ @5 @! u! G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 K* t: j. E3 @: w/ h
  55. #define STATIC_SHIFT                34 @- l; L" k& c# k
  56. #define TCINTEN_SHIFT               20! }" O  \# W! w* S
  57. #define ITCINTEN_SHIFT              212 l6 l; ~0 x/ a4 T
  58. #define TCCHEN_SHIFT                22
    . U* v  A: |+ h$ Z* ^" R. j
  59. #define ITCCHEN_SHIFT               234 y+ m9 R4 f1 t$ b
  60. % k; c; R4 v+ H9 T2 k
  61. static volatile int irqraised1 = 0;
    / c: i0 Q7 ^: D' X8 Y
  62. static volatile int irqraised2 = 0;
    6 b$ g: i7 H' G5 H; \

  63. $ l# ]+ {! \! E$ f+ O9 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - d* L* P1 X9 L$ f; n( b) p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" W/ A! R& j5 h/ [! O4 V0 ?: }) ?, j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : Y  N) f  e# P: `. y

  67. 5 R9 j6 o* r/ U0 h4 y! p1 U
  68. dma_addr_t dmaphyssrc1 = 0;
    $ H/ U+ w0 U2 A
  69. dma_addr_t dmaphyssrc2 = 0;
    ( J  ]& h' [# P
  70. dma_addr_t dmaphysdest1 = 0;. h+ f/ b7 s# n
  71. dma_addr_t dmaphysdest2 = 0;
    8 J0 c7 S/ x+ ~' u

  72. 6 k( [- r8 G5 |8 ?, ?
  73. char *dmabufsrc1 = NULL;% G2 k3 I3 o) {. f4 ]& z: r, a; G$ n  ~
  74. char *dmabufsrc2 = NULL;; p" b7 }1 Y0 o8 p5 C3 Z
  75. char *dmabufdest1 = NULL;
    * |; O! B6 z4 B! z& K
  76. char *dmabufdest2 = NULL;
    ; i. a: l; f5 b5 Z( x

  77. ( T# Q. h+ R; k. l2 R5 j9 d8 T9 f
  78. static int acnt = 512;( X0 J6 H: p0 _
  79. static int bcnt = 8;
    . [' T  H0 {4 V1 U! N% |4 k8 ]
  80. static int ccnt = 8;
    1 X6 t9 D, X" E! q9 ^; j, C4 L
  81. 5 F$ G% I; h) a- j9 |& G. r2 l
  82. module_param(acnt, int, S_IRUGO);7 w. v& G  x8 s$ E% t& T
  83. module_param(bcnt, int, S_IRUGO);0 H: N. P2 `% B. I0 m/ n( \; b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* C+ Y6 z( Z, ^# x
/ C$ J% q$ e- m6 V" ~4 A: O6 N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, r2 g8 [# _+ r; k/ [% i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ u% u; V0 Z- j9 }/ Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 c3 T: U! H- f) r  f- T; I' t' H
9 v' f! _8 \/ i! @+ F* Q8 |6 R

' E" e: R+ g7 x' p- u- k1 [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 00:04 , Processed in 0.038091 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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