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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 T/ ^" z% {. v( l" s/ e! Q
  1. [code]EDMA sample test application2 h9 ~, f: o$ D, o+ |
  2. /*
    # L( V' J. \* U3 j0 j' A
  3. * edma_test.c
    / U5 y" b5 i, l. X4 F/ J- T# K) |
  4. *
    6 F! e1 y5 X$ r; C7 N! e; F
  5. * brief  EDMA3 Test Application
    : d4 H0 {, l# C# d6 v2 s" b6 }/ e6 o
  6. *. ~8 X" j$ v3 Y$ I
  7. *   This file contains EDMA3 Test code.
    + ]& H% ~! Q6 [/ v. E
  8. *9 ?, w/ W  z9 X2 P+ ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 P1 r, M7 U9 Q# Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ C& K4 x) k( V% y
  11. *         TO CHANGE./ Z/ Q5 G* J3 P( r- [, ]5 r! j
  12. *' u0 ~9 @3 F; L1 r) [' l- O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; d. P8 N: [: @; H
  14. *
    ( m1 X$ V1 h/ P. L
  15. * This program is free software; you can redistribute it and/or
    " b8 |% i# J' b# v$ E
  16. * modify it under the terms of the GNU General Public License as! X: m% {4 r! O4 `) ?! g' J1 o
  17. * published by the Free Software Foundation version 2." }3 T$ R, |4 ]* N; z9 X
  18. *; ~, |3 S) x: R6 y- O  V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) L* J8 A7 ?4 P  v6 ~
  20. * kind, whether express or implied; without even the implied warranty6 I2 O2 D" I) m. I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, O, R; S7 i' P+ z' v% o
  22. * GNU General Public License for more details.# v" N! R6 ]; _
  23. */  h9 \7 `. a: S, S  s  j" m; b

  24. 6 L/ v) M% ^/ _% r
  25. #include <linux/module.h>
    8 r5 M* Y5 S# R& t" \
  26. #include <linux/init.h>) C" ?7 \& ]6 K* b) M3 U  J- Q( l
  27. #include <linux/errno.h>' c# H* ^- O! V- r; {
  28. #include <linux/types.h>
    " z+ m+ J1 x( ?( s0 ]: Y
  29. #include <linux/interrupt.h>
    9 U3 [4 X0 i5 o' }9 U, i
  30. #include <asm/io.h>
    5 X8 I/ S+ X1 p$ B
  31. #include <linux/moduleparam.h>
    , |! H% F: j5 |
  32. #include <linux/sysctl.h>& d6 y* ~. ]! T
  33. #include <linux/mm.h>: n: M5 P9 ?; i* e" r! [
  34. #include <linux/dma-mapping.h>' E+ Z6 m* T, R' ?2 W7 u% n) ]: N

  35. : d) ^& L1 I: x' t
  36. #include <mach/memory.h>- S$ E' P4 r- L& [3 ?8 t9 Y  M
  37. #include <mach/hardware.h>5 k2 j: F- B) X$ g) @6 [' h
  38. #include <mach/irqs.h>3 o( Y) M" W' ]! C
  39. #include <asm/hardware/edma.h>2 d) C5 N' d0 I5 I

  40. " ~* @6 @! U, K3 F- V" t
  41. #undef EDMA3_DEBUG9 C0 v1 N0 @: h) C
  42. /*#define EDMA3_DEBUG*/4 Q) V* W- D9 u
  43. + P  b1 h# n( J1 F
  44. #ifdef EDMA3_DEBUG
    ! r- U2 b; M) w; q' h5 H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 G: Z- d; m1 K9 Q- l" o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & `+ ?( O9 \: h( O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# n/ W+ x; X+ O" @/ i
  48. #else
    " y0 K% Y1 t+ m  n4 j7 B
  49. #define DMA_PRINTK( x... )2 E* c6 }% |" A; g& e
  50. #define DMA_FN_IN
    1 c% A& i9 L; N/ U$ I$ ?
  51. #define DMA_FN_OUT
    , r3 ?4 h* j- W$ O* `
  52. #endif
    ( u4 _. w0 j+ J' I* Y
  53. 8 K7 T# K' y) [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - c9 P6 z# |' Y* J/ U( ^7 R
  55. #define STATIC_SHIFT                3
    ) S/ E* K% w2 |, K( T' u6 ~
  56. #define TCINTEN_SHIFT               20
    8 x% c5 k8 c9 {
  57. #define ITCINTEN_SHIFT              21
    5 G& v' Y& l  _9 F; q
  58. #define TCCHEN_SHIFT                22
    - h8 V$ |6 H% i+ g0 N
  59. #define ITCCHEN_SHIFT               23
    ! }1 r. W$ {8 u) o

  60. ' i+ |. e$ ?8 P: F$ S  J
  61. static volatile int irqraised1 = 0;
    # d/ c% |2 l! V- q6 y
  62. static volatile int irqraised2 = 0;% I5 Z0 V& h: i5 q% L

  63. . {3 y  n7 |# b" C: ^3 O7 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 j0 ^* p& S9 ], B: G# w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ?+ d; ^7 S5 E9 P, g* Q4 m" i" z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # e6 j2 P5 p4 D

  67. 9 f* ~# c! J% H2 J0 x! o
  68. dma_addr_t dmaphyssrc1 = 0;  U' C' i6 [+ d/ ]
  69. dma_addr_t dmaphyssrc2 = 0;
    + u; [, I+ U9 l( ?
  70. dma_addr_t dmaphysdest1 = 0;; f9 n8 J! g" l
  71. dma_addr_t dmaphysdest2 = 0;
    ) l& X- p( ^7 D2 v$ g

  72. * H0 Q0 u* Z9 e& V! T. ~" R
  73. char *dmabufsrc1 = NULL;
    + H$ \# G8 w! f2 p
  74. char *dmabufsrc2 = NULL;+ d: z% O  h2 U- X# h
  75. char *dmabufdest1 = NULL;
    8 z) `% i' M0 d
  76. char *dmabufdest2 = NULL;
    6 P4 e; j$ s: h, N" h  s
  77. 3 c5 D( U: k$ |! n/ h
  78. static int acnt = 512;% B- @; y! M5 j! f6 D: o
  79. static int bcnt = 8;
    2 k; Q3 v$ G2 S' e1 D2 ~/ j
  80. static int ccnt = 8;
    % j6 g: k3 {0 F" g5 Q! [! V+ h

  81. + a+ M& u# e, ]* I, K
  82. module_param(acnt, int, S_IRUGO);7 R$ h, _3 m- O
  83. module_param(bcnt, int, S_IRUGO);
    + d! l+ E- V) E! h: K9 B  T$ }* O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 u* k$ v8 o' M8 T  Y+ q% c5 ~5 i% r7 \- w" w& o1 i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  \3 {: P5 m2 X1 v# R7 w" @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' {3 l( g/ A2 |/ `( _# V4 j' b3 k$ f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) W, z' r; l( O- @" r3 ~* ?8 N7 Y4 H7 o% C

3 y1 j' m9 X3 S8 t9 ^& z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-1 12:25 , Processed in 0.039497 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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