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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 ^5 Q  S& e3 G
  1. [code]EDMA sample test application
      s( S- f5 ~1 ~
  2. /*
    & r6 E2 K) k5 N6 Q/ h
  3. * edma_test.c% Q* f9 `: F( k6 }# w# p! q- `
  4. *
    9 O! s. W" I% s* f
  5. * brief  EDMA3 Test Application2 o$ C, n; p3 m) O
  6. *& I: ~6 Z1 O7 q& {
  7. *   This file contains EDMA3 Test code.
    ( Q# o' o1 `" I: K! @
  8. *' l+ t5 c" _% H! I" \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- l+ i; U. P% P( y' O3 X4 Q, X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 I- X0 U6 q+ H4 s7 J
  11. *         TO CHANGE.% i4 o1 _" T: F  q( Y; `
  12. *
    ! r. w7 G2 m/ f2 E" i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / E* I9 {, Z* B. D- f6 g
  14. *1 ?4 {( _# L% Y5 R) e; u5 x2 P
  15. * This program is free software; you can redistribute it and/or
      W1 X; @$ [5 W6 o  c" i. p
  16. * modify it under the terms of the GNU General Public License as1 u4 X# |) g2 C9 T  [) s0 c
  17. * published by the Free Software Foundation version 2.
    2 ?! r3 u! ^2 u2 ?1 k" b$ s- c9 m5 U
  18. *8 e) X) M6 W3 J2 B% \. s) i; s1 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 ^3 ?( Q5 {. v9 G; H3 V+ K3 M
  20. * kind, whether express or implied; without even the implied warranty8 {2 u3 ]! o) l" t1 R: ?& P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 I; T. T  m: ]3 H
  22. * GNU General Public License for more details.
    9 \! p3 T# r2 `" \
  23. */) h- S- \5 G+ ~1 B# b) k
  24. % f+ h: f; W+ B6 f$ M  f/ J4 k
  25. #include <linux/module.h>
    ( h$ O. |7 p' i6 U! q0 M' H, x6 n  V
  26. #include <linux/init.h>" j2 I: @: Q4 K8 y/ g  E: z+ ~
  27. #include <linux/errno.h>  l4 e) [8 M* Q9 s
  28. #include <linux/types.h>
    ! q9 a) V) I" N6 E$ `% T5 P( U, j* i
  29. #include <linux/interrupt.h>
    : F% T5 ~$ w- c4 l
  30. #include <asm/io.h>0 d/ Y3 T4 v( O
  31. #include <linux/moduleparam.h>
    , i5 ~: ?. E, Y
  32. #include <linux/sysctl.h>
    0 @8 Z& t. C7 O2 @8 V* y
  33. #include <linux/mm.h>, g. r1 Y0 O0 l: h2 `
  34. #include <linux/dma-mapping.h>2 s+ f3 e/ h; u
  35. / V* B; W/ G# c3 g
  36. #include <mach/memory.h>; M2 C2 ]7 f; D9 S
  37. #include <mach/hardware.h>
    # \6 Z' }$ f. k' `& g
  38. #include <mach/irqs.h>- ]1 D- _5 P6 q3 ~* F
  39. #include <asm/hardware/edma.h>
    ) D# A$ e/ o5 A& T( {3 k
  40. 0 g0 t/ S! M+ l
  41. #undef EDMA3_DEBUG2 }+ \9 S9 K9 o. ?9 y
  42. /*#define EDMA3_DEBUG*/
    - e4 j- T( w- K! [/ M& j: K0 i9 i

  43. + _6 r& z  z7 @6 r0 W
  44. #ifdef EDMA3_DEBUG
    # `9 q# ?& \8 [! j7 n% ]- c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 D6 W% [; U  k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) m7 h. O% H, ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      M+ l( E' G6 _6 R7 s" }
  48. #else
    " u  U. a* f5 ~- ~  l6 b4 y3 k
  49. #define DMA_PRINTK( x... )% H8 K( S: `, D4 k
  50. #define DMA_FN_IN
    0 S4 n6 b, [  `* K: w
  51. #define DMA_FN_OUT
    ; c0 Q2 v) v; x- \4 C
  52. #endif$ \5 V% X& q4 t% [: v5 N2 B
  53. # O8 j# u* c- G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% O) Y& E1 P8 d) t
  55. #define STATIC_SHIFT                37 E, j' ~3 r2 U6 n
  56. #define TCINTEN_SHIFT               209 }& Q0 }9 R; N6 N( J) i: B1 I5 T
  57. #define ITCINTEN_SHIFT              21, M. _% }0 {5 ?$ W
  58. #define TCCHEN_SHIFT                22
    7 T/ q1 q1 u" n8 l( O0 v
  59. #define ITCCHEN_SHIFT               236 ?, d1 `. N/ ?. N- {
  60. + Q4 E, h+ G0 w( |+ u" q6 c1 O/ [
  61. static volatile int irqraised1 = 0;1 z4 B5 D  H8 ~- a
  62. static volatile int irqraised2 = 0;/ Y& x* ~' q3 S, z

  63. 8 c' J7 k& p4 J1 w! v' i% g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) Y6 Z  G4 W9 p% q4 n8 V8 d7 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % [$ k4 ]/ Q- Z4 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 P3 k' r3 Q) [7 f' A/ R0 w
  67. 2 d7 y$ j! Y, @7 _, ?6 p6 \* }0 Q
  68. dma_addr_t dmaphyssrc1 = 0;
    5 A& R' {$ o7 }9 Q5 _
  69. dma_addr_t dmaphyssrc2 = 0;/ y( @% S) d6 d8 Y2 D8 g7 o% d
  70. dma_addr_t dmaphysdest1 = 0;. Y9 u4 x: O9 D
  71. dma_addr_t dmaphysdest2 = 0;
    ' Z: r7 g' I! m2 b2 e

  72. ) o/ W  G: t: S6 D5 e$ o
  73. char *dmabufsrc1 = NULL;
    5 w- G; q2 F3 S# N: z
  74. char *dmabufsrc2 = NULL;: w2 e/ U% o7 p
  75. char *dmabufdest1 = NULL;
    % m& `+ `7 ]* {: s4 @! F2 a- G
  76. char *dmabufdest2 = NULL;
    % q% B3 |8 @- q: T. F4 U+ ~

  77. 2 x: ~( n6 Z$ V  F* F: d( O# O
  78. static int acnt = 512;8 G# K; U' w: M0 g+ k% V
  79. static int bcnt = 8;. z0 B* b- D" o6 v& B
  80. static int ccnt = 8;
    ) N3 _9 r8 R& y) A& R

  81. 6 n- \4 N) H8 B
  82. module_param(acnt, int, S_IRUGO);# e. |- R5 J% d8 e6 \& I
  83. module_param(bcnt, int, S_IRUGO);
    ! w# B, T* y1 u# K( |. V5 A! L9 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, S8 a# E) a  R( s8 N5 I+ i' y. \0 |
# J- G8 r0 Z+ y! W1 B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 g& }+ s8 W0 ]' p. k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  a5 F7 t- y3 C8 G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 e. S" A% [+ d
* l, W1 v9 _* D/ M4 B+ f9 K

4 T" V# }7 V2 K9 _5 l1 y( G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-13 04:03 , Processed in 0.044750 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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