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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. k0 K" A  g. J: c
  1. [code]EDMA sample test application
    , c" a. d# Y$ h* i2 {7 f
  2. /*; L/ G$ N% J) o! X# p
  3. * edma_test.c
    ) u& @0 M( C9 D
  4. *' X9 @9 e, u# I# H2 D6 E) A/ Z* F
  5. * brief  EDMA3 Test Application; n" ^! Q( {/ R* q
  6. *
    ; b, U8 J$ n- P/ |& R4 W' H4 y5 s
  7. *   This file contains EDMA3 Test code.+ M5 X) u6 K! y7 Y
  8. *& \7 Z0 c; n9 S( C5 k# a* P4 Z7 {5 I+ }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: J% B. T$ J% f% }6 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 N4 }6 h7 o* T" r. H) W
  11. *         TO CHANGE.. |' ~9 a4 ~! J2 ?, O5 V: _' N
  12. *$ `, c8 T* n& w+ x' u5 @  R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: P, D8 }7 f6 x7 W: U2 X* D
  14. *
    * X0 O$ u# G- _, f
  15. * This program is free software; you can redistribute it and/or2 _$ I0 k/ S6 K2 K. G2 n
  16. * modify it under the terms of the GNU General Public License as
      }. l# c' C1 P+ }3 F$ K
  17. * published by the Free Software Foundation version 2.( V& j: k! H+ e) F
  18. *
    3 X& ~8 t4 R( }* y2 k, w2 t/ s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 \- ~4 O, `7 c- S& ?0 o, x/ B
  20. * kind, whether express or implied; without even the implied warranty
    $ R9 w. T% y. P+ \) ~$ C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 d4 c; Q. B* d5 _) ~
  22. * GNU General Public License for more details.! p2 f1 _5 l" Y0 e6 }
  23. */
    " A8 }" O0 z8 S: X8 p- Z% S/ m

  24. ' w. R% l# l/ [; @6 `3 c  n
  25. #include <linux/module.h>+ j. W8 h6 F' c
  26. #include <linux/init.h>
    9 P$ L  }( E6 ^' V
  27. #include <linux/errno.h>, |& S* d# x+ q8 j1 h. s  ?) U
  28. #include <linux/types.h>
    & a* B  z5 X+ U9 m+ g
  29. #include <linux/interrupt.h>5 J3 h; [2 L  E7 n! F1 `4 K0 F4 T
  30. #include <asm/io.h>& `+ n9 j2 u* l# Q
  31. #include <linux/moduleparam.h>
      N" X" \' U+ r  Z+ A9 G
  32. #include <linux/sysctl.h>
    ) ?6 q3 S  `1 H
  33. #include <linux/mm.h>
    4 Z: z/ I. e6 L1 K; d
  34. #include <linux/dma-mapping.h>7 ?9 m5 m% d; ?/ \0 a

  35. ) d3 V# O* Q7 @* y/ L; @8 f
  36. #include <mach/memory.h>
    5 ^: z0 l3 X+ X! o4 _! L2 m5 j
  37. #include <mach/hardware.h>
    9 E$ l, l  E5 P# }# m" H- o, K
  38. #include <mach/irqs.h>& x% x* Q1 d& P6 W
  39. #include <asm/hardware/edma.h>% D: E) n' ?# q: D, b

  40. 3 V7 I$ H  \9 l5 Z
  41. #undef EDMA3_DEBUG! Z, N- w; U- J) |
  42. /*#define EDMA3_DEBUG*/0 H" j7 e/ _* X' u9 W' q5 I, ]/ b
  43. 3 g0 K6 R" T% C7 @
  44. #ifdef EDMA3_DEBUG
    9 }" e9 A0 Z% ~5 |6 |' v" w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 i# k! p9 `" J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " b% x. x% ~; ]8 ]* [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' j. \4 q* L0 A# a' @& B
  48. #else3 ?% H7 F& i0 D  @% {/ _
  49. #define DMA_PRINTK( x... )
    7 ?" q3 T: c! y+ d5 A0 y
  50. #define DMA_FN_IN
    % C) m9 r% J2 V8 Q# A2 i( r1 B& N$ }) G
  51. #define DMA_FN_OUT
    ( Y* N1 \7 |3 a
  52. #endif
    3 v6 m. W3 d# ?. [9 a0 m5 a% e
  53. . R3 G5 Z, N3 _2 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) F. z5 [- ]; q# m) q- K4 A4 {4 v
  55. #define STATIC_SHIFT                3' c" M# Z, t4 p$ d/ H
  56. #define TCINTEN_SHIFT               20
    8 C! V) b; {& D' W4 E
  57. #define ITCINTEN_SHIFT              21
    9 m9 z7 w3 R* m" V2 x" V; [; ^7 p
  58. #define TCCHEN_SHIFT                22
    , [4 o+ B$ X; x, {. P; x# T/ q, k
  59. #define ITCCHEN_SHIFT               23& {, Y% ^: U/ F

  60. ; O2 c+ r! d! A8 A; E3 s
  61. static volatile int irqraised1 = 0;; w, y. j1 C& R2 i
  62. static volatile int irqraised2 = 0;
    ( k" g& o$ N, ~+ t( z5 X

  63. ; _* G/ c% I% e" t2 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 \5 Q! H3 [& G" W, d9 h% J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + C2 I& ^% D) |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , Q0 O, E1 ~3 B" P

  67. ) S# s7 N& C4 f) W7 v
  68. dma_addr_t dmaphyssrc1 = 0;
    7 _% L- S4 V! ]0 T' u9 Z5 q/ e3 A: b" w
  69. dma_addr_t dmaphyssrc2 = 0;
    / l! g1 |3 l% D
  70. dma_addr_t dmaphysdest1 = 0;) _3 h: U* @, K# A
  71. dma_addr_t dmaphysdest2 = 0;
    0 F7 ]" O. d) Z) v2 J9 \" O

  72.   p! X  y. G9 y3 V, N
  73. char *dmabufsrc1 = NULL;  {  K% \; G" S& C; j
  74. char *dmabufsrc2 = NULL;2 E  K, c, P0 g, l( x6 r' _' X
  75. char *dmabufdest1 = NULL;4 v* P1 m) `7 g& o8 X" A. k* s" i( X
  76. char *dmabufdest2 = NULL;
    $ e" W9 ^( j% k3 \9 g6 M
  77.   X0 g0 ?; s/ ]" D
  78. static int acnt = 512;
    * b. k% N$ |$ u- u$ M4 c
  79. static int bcnt = 8;" X, l) J; _+ Z- M6 c
  80. static int ccnt = 8;
    - J. q- l8 a" ?6 V* J
  81. ' I7 E2 t# [% s: T7 J9 s3 d3 c
  82. module_param(acnt, int, S_IRUGO);
    0 O0 g8 X1 S( F
  83. module_param(bcnt, int, S_IRUGO);
    7 ?& G2 P7 }. U: |4 l- k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 ?+ T& K% \4 x2 {9 X+ P
8 }9 d; \) K5 ]" d9 m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* T  v8 t1 o0 L5 ]9 Q- v9 V% Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) g+ y8 `" H+ l% B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 I8 x. j  l/ z7 o6 h1 q5 l
+ `3 P9 E6 u" Q+ I" C# U" j  z8 a% X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 10:46 , Processed in 0.051124 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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