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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 ]% c$ X) \4 Q" r
  1. [code]EDMA sample test application
    # W* X" |5 ~. c0 s
  2. /*+ g; _5 f- T- E+ G' I; W# d" ^, _
  3. * edma_test.c
    6 l# Q$ k! B, Z) i0 W+ z9 I
  4. *
    ! ^, C' a$ a) N5 j" S
  5. * brief  EDMA3 Test Application) S8 F; `7 `2 x( x: b/ Q9 D
  6. *( F! ?$ n! _, A. g
  7. *   This file contains EDMA3 Test code.# e" q, D3 R6 K/ M6 r1 J
  8. *
    % T" [, ^" E0 o" A  ~3 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! K" T+ _1 m1 J& Q, A1 {5 b% \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 H9 K, {0 z/ c
  11. *         TO CHANGE.
    2 x5 C+ Q. e- o
  12. *& U7 ~/ ]3 l1 f( x0 p4 J5 k- m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 L+ f% t# X8 r7 W! O* Q( U/ i
  14. *
    ) _" ?0 o6 ?  S8 n. I8 V
  15. * This program is free software; you can redistribute it and/or5 z2 z# G. H8 ^# q. z
  16. * modify it under the terms of the GNU General Public License as
    ) j# @; L. a' d; d- Q
  17. * published by the Free Software Foundation version 2.7 W! S6 S3 S3 _4 ^+ Q9 G& o0 I
  18. *8 @# m+ d, b; ~4 w3 f; P2 U4 w* O) ~- N- q  Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" p4 p3 T$ {/ x, i
  20. * kind, whether express or implied; without even the implied warranty
    * ~" ?) R6 @' Y! N# F1 s7 X+ l" ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 Q5 p  R$ \4 Z! l( t
  22. * GNU General Public License for more details.& p' P; _5 O- K0 ^3 g& Y& B. r
  23. */8 p" {$ G, \/ p2 U# I, c

  24. ; F) @, Y: _9 f# Y- F9 H
  25. #include <linux/module.h>
    + m. l: x5 o8 W/ d/ X
  26. #include <linux/init.h>
    6 @* t7 n7 F. o$ f
  27. #include <linux/errno.h>2 }" \+ H* W) m7 a
  28. #include <linux/types.h>1 T/ d/ c3 m/ v$ a" B& t
  29. #include <linux/interrupt.h>
    $ u5 j* }9 R' p5 P
  30. #include <asm/io.h>
    1 v* f- u) r+ G- y
  31. #include <linux/moduleparam.h>2 {4 R7 T  a+ d" {) e
  32. #include <linux/sysctl.h>& u3 m. j/ E/ h+ k9 P
  33. #include <linux/mm.h>- A8 R, j% \# u+ w+ R4 l
  34. #include <linux/dma-mapping.h>
    . B- s4 j; M  s% _: j3 x1 L, z6 r

  35. 1 p+ q, a* V4 Q8 E! e
  36. #include <mach/memory.h>
    , d$ ?* a( M3 p1 ~: I% a7 k1 ~* s
  37. #include <mach/hardware.h>
    0 e; N) b2 a2 z0 R& \2 x" i- q
  38. #include <mach/irqs.h>7 o1 X3 p" r  P3 M
  39. #include <asm/hardware/edma.h>
    + k! ?  e( f; _

  40.   U( U/ B6 k( P0 p
  41. #undef EDMA3_DEBUG
    ( x& `+ Z; F% C
  42. /*#define EDMA3_DEBUG*/
    ( t" A- a1 A% O7 W( X6 F# Q- ~: p! M
  43. * J- O- G0 B3 V  P7 w8 K
  44. #ifdef EDMA3_DEBUG+ p% E* p+ Y2 H7 S+ O! F1 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " D: p0 [( F1 D8 W, \% _& Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; K# n/ E1 W/ l3 g0 \! T0 [9 q: p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* i: {+ E, ~$ v5 p4 A* I- Y9 I
  48. #else
    0 w/ e  c3 x6 C0 P! I% O
  49. #define DMA_PRINTK( x... )
    % m4 b( y3 r+ ~$ Q1 B
  50. #define DMA_FN_IN
    : w) x2 E) _6 [) I
  51. #define DMA_FN_OUT* h& U! P: D$ g) J
  52. #endif5 `1 T9 }& d0 l) v5 p7 y0 k4 l- l
  53. / v& A; y% H3 b6 O* f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 `) K+ f9 S5 h8 e! @
  55. #define STATIC_SHIFT                3+ C, g6 b, L: b. H( K5 f
  56. #define TCINTEN_SHIFT               20$ Z4 F) a; [! C+ o. f( u, x! r
  57. #define ITCINTEN_SHIFT              21
    + F5 m0 R) M% T1 C/ E
  58. #define TCCHEN_SHIFT                22
    - R2 |  r/ i3 R
  59. #define ITCCHEN_SHIFT               23+ d: y( G! K. e; R% Y2 P

  60. 8 n" {3 E0 |% W( P. Q$ B4 F" Z
  61. static volatile int irqraised1 = 0;2 g5 i( |4 ^  p) E6 i2 ]' O) g
  62. static volatile int irqraised2 = 0;
    # I# c# P; d9 [" L4 Z: I6 t. g8 D

  63. " f8 K) o; \- M( J2 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % o- y* T" G5 ?# K9 |$ `: T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 v& |1 i' v! z# y8 e1 g* X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# U% s! E7 }7 V0 u

  67. 5 T! j# }6 q& U( A/ }! W' {
  68. dma_addr_t dmaphyssrc1 = 0;
    + N5 {+ q3 L8 d1 f
  69. dma_addr_t dmaphyssrc2 = 0;* V( w1 @; P' a2 B( V! H0 O
  70. dma_addr_t dmaphysdest1 = 0;
    & }5 s/ B* w1 s0 a7 A
  71. dma_addr_t dmaphysdest2 = 0;
    0 t, H" ]( |; Y& U, p" X

  72. + L8 D0 B( ?0 f! I* y. [, N
  73. char *dmabufsrc1 = NULL;+ x* U- z9 B' l  ~1 a
  74. char *dmabufsrc2 = NULL;  B. K' F3 g, Z) x4 Z
  75. char *dmabufdest1 = NULL;
    ) ]7 S' f# z& j- \, \
  76. char *dmabufdest2 = NULL;
    . H; I' j' C8 U3 W! H( ^+ b" R" G
  77. 9 I: t3 J( v, x5 \5 f( s: L0 n8 y, t
  78. static int acnt = 512;
    , V! D2 n# Z! O, B
  79. static int bcnt = 8;
    5 D% e% G" X2 H4 M( D9 G5 U- \: u
  80. static int ccnt = 8;
    0 \+ q* M& w% b$ F
  81. * M4 z; j* x7 S* M4 C
  82. module_param(acnt, int, S_IRUGO);
    : o/ Y7 c2 I% p, |
  83. module_param(bcnt, int, S_IRUGO);# }# B) F# |% o7 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! U5 {; ^- Y# H4 e& \8 j& U8 S5 T( I5 u2 i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 l$ k# |9 R. i; Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" s1 O! `. g7 F" d7 [( x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: j6 q. t* r% R# }- v' y0 o/ r
) \+ w$ r8 P, D

% _; G0 J$ G5 m- L! A, m" _3 f5 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-7 14:08 , Processed in 0.048608 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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