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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 G* ]& }8 p' s7 I6 o; L$ r0 f
  1. [code]EDMA sample test application
    & q: m" y- M8 b4 U: `* \' V
  2. /*3 G1 X. t. d0 `( o
  3. * edma_test.c* o4 M  G3 B( {9 g( z! R
  4. *$ G8 f5 D1 @4 a+ S6 Q
  5. * brief  EDMA3 Test Application
    / e) w* K" V) D, Y$ B% p
  6. *
    ) T0 B1 H! r1 B8 L6 j9 C
  7. *   This file contains EDMA3 Test code.
    3 B+ W, r& m# }5 L! ^
  8. *
    3 s. H/ ?+ Q4 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 ?- i) F" e6 K+ L; i9 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 Y. u2 F4 `" l. u: E4 k
  11. *         TO CHANGE.
    # U+ T: F  k! ?* O9 U
  12. *
    & n" N9 o& P; m% i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 ^: F6 [( V* Z; a! m+ ?
  14. *
    4 A! @0 q$ A$ j( m- |) Z- e
  15. * This program is free software; you can redistribute it and/or
    ! W+ B! R" w- r. b
  16. * modify it under the terms of the GNU General Public License as
    0 T# E$ N$ @$ z4 k0 `, q* H
  17. * published by the Free Software Foundation version 2.- \& ^& e# ]6 p+ @+ w
  18. *  \6 B, z0 R1 X% ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; O1 K1 ?, a$ O8 A( P. c) F
  20. * kind, whether express or implied; without even the implied warranty8 i7 C# t- }- _2 _0 J% z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : t1 B/ ]3 M( H0 `3 g, z
  22. * GNU General Public License for more details.
    7 {( R2 g7 ^* Y
  23. */
    , W7 P, H9 z: |) y
  24. # ]" y! D9 M  l' {' t1 @% [: z7 R
  25. #include <linux/module.h>
    4 p1 E( L8 G0 k3 A' o. u. y
  26. #include <linux/init.h>7 e- O& t! E. ^* o
  27. #include <linux/errno.h>
    ) V# S- h# v) T9 w1 N
  28. #include <linux/types.h>, `& X8 \4 C4 F! b2 p
  29. #include <linux/interrupt.h>+ _! y5 O, Y: a$ A3 c4 ^
  30. #include <asm/io.h>
    , T( h: ~. P# \
  31. #include <linux/moduleparam.h>: e1 W! d: \# r1 q2 X9 }" H
  32. #include <linux/sysctl.h>, z/ g6 r& K$ }2 x" y1 L$ `7 K
  33. #include <linux/mm.h>9 Y5 D6 ^) N9 r, i, V( }3 o0 ]
  34. #include <linux/dma-mapping.h>
    5 d8 v2 |- N9 l  g- m# d& U# j
  35. 2 j: D3 @8 R# u
  36. #include <mach/memory.h>
    : s0 @- _9 S$ O8 R1 v5 {& h7 S7 g$ p
  37. #include <mach/hardware.h>
    ' r* b8 d3 q. G5 G
  38. #include <mach/irqs.h>
    + V( O# T4 F% Y/ G4 D
  39. #include <asm/hardware/edma.h>- W: B! \4 P* S- K
  40.   x& ^4 c1 H% `+ B% j  V
  41. #undef EDMA3_DEBUG1 \7 n- S, v9 H- C2 H( r$ r
  42. /*#define EDMA3_DEBUG*/( [. H- j( t: e$ o( v

  43.   |- Q; m) `: _" J
  44. #ifdef EDMA3_DEBUG
    ) l+ P4 b. C. k, }3 |" k$ D* k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % ]- p0 V0 i, o) e. H+ O5 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 @- }+ h' ~5 Q  O) H6 v. W/ T9 E$ z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% _& O$ T  q4 f$ {# n& Y* w+ `
  48. #else5 \( H1 s: u/ S) g- z6 K
  49. #define DMA_PRINTK( x... )
    ; N9 i( P' y8 f
  50. #define DMA_FN_IN
    1 {* H- J5 }4 X4 Y2 e
  51. #define DMA_FN_OUT$ b; g, @4 A* q: d* S# P/ T
  52. #endif
    3 C0 w* Y' p7 k4 ^

  53. . Y$ c9 c) p% u2 h5 `0 @) j( l9 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 j0 O  T& |) p( m
  55. #define STATIC_SHIFT                3+ |4 h: Y8 \$ O; M8 _* K
  56. #define TCINTEN_SHIFT               207 o1 I3 y) X, l$ o/ w! r3 ?- f3 b
  57. #define ITCINTEN_SHIFT              21. b/ \& l7 [) H9 B
  58. #define TCCHEN_SHIFT                221 {& r" F6 _% c4 k0 f9 G
  59. #define ITCCHEN_SHIFT               23% P' ~2 G; g% L4 z0 n" z( |( C

  60. 1 C2 ~' k$ t7 v1 f& s
  61. static volatile int irqraised1 = 0;
    ( _% S% a& L! B6 l, H' {
  62. static volatile int irqraised2 = 0;. Z$ S0 R1 o$ |9 v' `: T

  63. % b* R# ?2 A& x/ z  L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 l: t& [3 D# p% ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - P2 ?. @3 ?+ H: }/ K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ?7 p  n9 ~" c' m: i7 W

  67. # q2 R0 `( }8 e7 k
  68. dma_addr_t dmaphyssrc1 = 0;
    * [* X: b" E* Y& w
  69. dma_addr_t dmaphyssrc2 = 0;0 ]" r1 Z: Q4 c9 ^# C4 ~- `
  70. dma_addr_t dmaphysdest1 = 0;
    7 u5 V6 l9 u, w/ A4 V
  71. dma_addr_t dmaphysdest2 = 0;
    / e+ T5 P+ p3 k5 v$ N
  72. 6 l8 ?) H8 u* x8 q; o9 t+ [, g% E
  73. char *dmabufsrc1 = NULL;
    ' m' g1 v  q2 L$ v8 w7 L
  74. char *dmabufsrc2 = NULL;* `# ?$ n4 P) U' K% Q
  75. char *dmabufdest1 = NULL;
    ; P" a# ]# G3 z# U$ _, |. n2 M
  76. char *dmabufdest2 = NULL;
    5 I7 U( i$ e$ r0 k8 M# A
  77. 0 L2 c6 ?6 A; y# e
  78. static int acnt = 512;$ h! n, {* O; {9 m
  79. static int bcnt = 8;8 r( v% P/ t2 F
  80. static int ccnt = 8;
    : T6 u- f4 S" K- i4 p) H$ [- V
  81. 1 s5 R. r& n; F2 @) D$ |! M
  82. module_param(acnt, int, S_IRUGO);
    . J) ^0 }4 A% \" C' B/ D/ r
  83. module_param(bcnt, int, S_IRUGO);- l1 A# F5 B; s- m, u$ P+ A7 d0 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ Z$ u* w; W8 [) i6 {

7 H8 z; b1 \6 S# x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ E0 A5 e: l: v2 l8 J2 e  Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 ^7 f5 V, B- E$ W7 y# ]' }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& \4 k. o' n9 J: `; ]: [8 P) }2 S) T3 g+ u" d

5 w1 o1 }. S3 x0 l6 j' K+ ?" Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 15:51 , Processed in 0.039598 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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