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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . u) D/ i1 Q. t
  1. [code]EDMA sample test application
    4 q4 @9 V1 P4 p( C$ R
  2. /*
    , x& F5 B% q4 G1 S" l
  3. * edma_test.c
    " h0 |/ O, I. I' S! `: D
  4. *
    # Z$ P6 q# O# D+ f& @! d
  5. * brief  EDMA3 Test Application' M8 e* A5 _9 y/ v/ ]; x0 b* F
  6. *
    & S4 u; V; m6 i
  7. *   This file contains EDMA3 Test code.1 y3 O( u- `, P& ^
  8. *1 N; I, C: Y* i4 E% o* d/ ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 @% R8 c( }, E' G$ u" T! t/ l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, W$ \& f$ `" {5 Q2 ^* d$ D
  11. *         TO CHANGE.
    # w/ X( G8 c$ z& e: V" {; Q
  12. *
    ) R* U' R& e: v6 c, s5 b- U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- {" l  u' {- \4 \8 Q2 i4 j
  14. *0 A. Q1 E5 n! N* c
  15. * This program is free software; you can redistribute it and/or, b9 l/ `2 a5 z7 t0 B
  16. * modify it under the terms of the GNU General Public License as: D# c4 u4 g. O* L) `3 s
  17. * published by the Free Software Foundation version 2.. y5 x" [4 ^6 Z
  18. *
    $ g" d, P% w8 S, Z) T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) P. x) L2 {  c- x- d
  20. * kind, whether express or implied; without even the implied warranty
    1 e8 d2 Z. H, ]4 W& @* E7 o: j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , P2 K7 M- H: n" Q& ]4 k
  22. * GNU General Public License for more details.
    , u2 X# z1 c' n! u+ ?' T' p3 B
  23. */. H. X4 \( X  t3 {  f
  24. , u- l/ w: e0 C! x3 i! \/ A" q( Z
  25. #include <linux/module.h>) S& q9 T0 O4 B: _6 I
  26. #include <linux/init.h>
    # z9 M" p6 k& _. S% [
  27. #include <linux/errno.h>
    % A  t! ^9 P+ E) `  U8 E" w
  28. #include <linux/types.h>; r& |  y& |, t% W8 w
  29. #include <linux/interrupt.h>
    . w! P- A% N* b3 @. U/ N# j
  30. #include <asm/io.h>) d! B& B' U* V7 Y# H5 Y: F
  31. #include <linux/moduleparam.h>
    ; F: K7 v% W7 d* y: c
  32. #include <linux/sysctl.h>/ F" K+ [' x( @; X+ C9 f
  33. #include <linux/mm.h>
    - U- L; x( a: l' L- i, h" i
  34. #include <linux/dma-mapping.h>
    2 R" [- ?: `- V
  35. . I7 H+ ]' h8 t
  36. #include <mach/memory.h>: x* V, u4 o; o9 V
  37. #include <mach/hardware.h>
    1 R0 z5 l, a9 S/ `) p: `5 G4 e
  38. #include <mach/irqs.h>
    5 X& p1 _1 c0 L% q" U% X" K! J" j
  39. #include <asm/hardware/edma.h>* W; L! S6 b4 Z8 E( C
  40. $ W. l7 j4 i1 u/ A8 J) T( U; i
  41. #undef EDMA3_DEBUG
    : f/ A: |, |6 C( Q6 p+ G8 }
  42. /*#define EDMA3_DEBUG*/
    0 X7 d) z( [. P% L: _# r

  43. 1 K$ U% \) h& C+ A
  44. #ifdef EDMA3_DEBUG6 Z' I5 J8 L- m1 Y9 D1 a2 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 J! }5 N2 M- G2 ~6 c5 Y. z& \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* f5 k" m5 x' u- Q( f3 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& i! W, I+ e$ D( s& G6 ^# h7 V
  48. #else
    , A  c  q( c2 T5 ?" Z6 P& X, P
  49. #define DMA_PRINTK( x... )2 Y, d5 @6 A* R% _/ M* z& I
  50. #define DMA_FN_IN
    $ `& d  `! |  |; ~1 [
  51. #define DMA_FN_OUT9 s# X# g) F; k; l1 L  V9 ^( t
  52. #endif4 I9 D: j6 r- S( s/ S* p( L  U

  53. 4 i; U; b" k9 }6 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 Z" L/ {6 K9 U. I
  55. #define STATIC_SHIFT                33 t" ^, i; w/ \4 ]7 m4 m" r+ ?- G
  56. #define TCINTEN_SHIFT               20
    0 w, H" t  e0 I" V5 s/ h* |
  57. #define ITCINTEN_SHIFT              21
    2 U# j  A. e( I0 r2 w
  58. #define TCCHEN_SHIFT                22' b+ ]& J5 M% W: g9 {9 ^" f  v
  59. #define ITCCHEN_SHIFT               23- @# s5 H& D/ }& k. {7 f
  60. ( J: X: a4 K- T1 ^( b6 e( ^+ E7 ?
  61. static volatile int irqraised1 = 0;. s- R/ M, W  N* [1 \; i' Y
  62. static volatile int irqraised2 = 0;0 Z( m/ \- v4 f/ q# [. D

  63. 9 t' `" }! q, h2 T7 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 z- V! `3 P/ t- b0 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 l  {8 [5 @% G/ @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# F; l( D) W6 g0 q

  67. 7 h- u0 m. I& ~9 j* L$ J  y: }9 z3 Z
  68. dma_addr_t dmaphyssrc1 = 0;
    # h+ h( }9 p; p- }; i1 ]
  69. dma_addr_t dmaphyssrc2 = 0;
    . f9 V! n: ^% u7 |
  70. dma_addr_t dmaphysdest1 = 0;9 _% I) f" \/ o! b, I
  71. dma_addr_t dmaphysdest2 = 0;
    " t! i' M  a6 F2 {* M/ }5 o

  72. 8 ]- i# n& _: }
  73. char *dmabufsrc1 = NULL;4 }0 i, |6 O9 e: s( w
  74. char *dmabufsrc2 = NULL;
    % F% d$ [: X7 f  F& a
  75. char *dmabufdest1 = NULL;
    : \1 U8 A# ]4 ]) i0 [6 }! n& y+ s
  76. char *dmabufdest2 = NULL;( c8 c7 y- Z' U& G2 d# M8 e8 Q

  77. 3 W( w9 H1 r. c( f7 F5 v
  78. static int acnt = 512;
    7 h) R  ]( `* C" ^2 D
  79. static int bcnt = 8;; O6 \' c) p# @: K  o0 H! r+ G
  80. static int ccnt = 8;
    * J9 K9 S7 K+ Y6 b" Q

  81. 6 ?. a6 h, H7 o
  82. module_param(acnt, int, S_IRUGO);2 |9 R3 e% x+ e: g9 T
  83. module_param(bcnt, int, S_IRUGO);$ d% ~/ C+ X$ T. s( B8 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& B: n4 ?* k7 d' ]- S
7 f. y) |$ X1 P' x. C/ X- ?) z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! J6 Q9 b& {/ E' n8 W7 V0 A) xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) X+ _$ ]6 ^1 V$ |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: f! o; t3 s! o
8 S$ F8 K. R, m  o
6 x0 N) T# l. O% I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 15:00 , Processed in 0.043458 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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