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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + R3 _! U7 }3 u, T' S. P
  1. [code]EDMA sample test application1 ~' n) l, k/ Y, q
  2. /*
    ' W8 M# l2 A4 l+ _3 p7 @: l
  3. * edma_test.c8 I- ]# m$ }# R9 f+ U3 i4 E4 O
  4. *
    ) |6 Q  D2 S' t# t
  5. * brief  EDMA3 Test Application9 f9 C6 E3 Z3 [# p2 \
  6. *
    $ C8 P. Q0 Z- S! R) Y% ~
  7. *   This file contains EDMA3 Test code.- d4 i* ?$ i8 N3 s% D4 G5 A
  8. *
    " ^  o- Z- K6 `) b" I7 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 }! u- V8 |3 w4 E2 V3 a8 C; u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' O$ x- A+ v/ K$ Q' N
  11. *         TO CHANGE.+ C8 J0 R% k7 l
  12. *
    ' D% P, f& l' s& J* a# P# N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . @' g& K2 U( R8 X/ u+ f
  14. *
    8 X, o5 j; F: ~0 T8 z
  15. * This program is free software; you can redistribute it and/or
    2 s: a& [  L3 r0 @" l$ r; f$ J
  16. * modify it under the terms of the GNU General Public License as
    1 M* |. K0 @' _& y' E
  17. * published by the Free Software Foundation version 2.
    2 o% H2 j5 T0 U" |2 {2 h% Q% `% n
  18. *
      |8 M1 w1 Q! I2 q" S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 E4 m5 Y- V4 \
  20. * kind, whether express or implied; without even the implied warranty6 K- U9 j5 o& \2 F0 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . p: q  r2 q9 M) [, Q# W8 `. d4 D; d
  22. * GNU General Public License for more details.
    4 u% g, Y, ~: z6 _: M
  23. */* s. [# z" T6 B2 K# c0 }
  24. ' x) f7 f6 U: V9 O& J& D2 ?9 U
  25. #include <linux/module.h>
    + l. V; [3 K2 p. T3 ]' h" T7 A1 j9 }
  26. #include <linux/init.h># D  F) u: V+ i' S1 {  C. Z
  27. #include <linux/errno.h>5 _0 R6 c# i" X7 {: N! J
  28. #include <linux/types.h># {- k' v8 U9 l, i; }( n( [
  29. #include <linux/interrupt.h>* F1 Q- s; f/ A& R! Z9 x, b+ b
  30. #include <asm/io.h>
    1 B" j+ a. X3 V1 `* k) k
  31. #include <linux/moduleparam.h>, O7 s6 U3 g0 C9 T# J6 \
  32. #include <linux/sysctl.h>, \3 o0 F  ^) W* _9 b9 Z# m) F
  33. #include <linux/mm.h>) m9 Q8 Y: Y: c1 |( U% V7 P
  34. #include <linux/dma-mapping.h>+ t  q+ U! a3 J! o
  35. & u  [7 m1 A+ {
  36. #include <mach/memory.h>
    ; q9 g: t6 v- |" k7 @
  37. #include <mach/hardware.h>
    - y2 \! T! B8 B+ A% i
  38. #include <mach/irqs.h>+ E. b) h7 l9 k( h, ]! B- f! Y8 o
  39. #include <asm/hardware/edma.h>
    & q) H, j* x1 V. J$ m  F
  40.   G$ d( H" ^$ n* e/ V
  41. #undef EDMA3_DEBUG
    8 r8 o$ ]1 q, V$ f4 V' }, E
  42. /*#define EDMA3_DEBUG*/3 p0 C4 C& t8 d! m* N

  43. ; {# P# [/ @! ~# B" b& f
  44. #ifdef EDMA3_DEBUG
    7 C8 g! g) @7 j- X( T, J- y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ d1 S2 D5 A0 \# Y$ C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * H! |3 u- ]$ y: m/ A+ ?9 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 R3 w' [  n* M$ V6 x# a2 i
  48. #else# g  U$ ^2 v. S0 J$ j9 e4 M: i5 K  L
  49. #define DMA_PRINTK( x... )
      `( n# w3 r; L
  50. #define DMA_FN_IN
      P, k7 p8 N8 B: ?: K' C* A$ c
  51. #define DMA_FN_OUT$ T3 j8 J# t& n* t4 W- R" {1 [( G
  52. #endif
    * I( C2 X  c- g0 q4 U

  53. 6 ]% a5 }' l) Q, r. w5 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 U6 l$ d# |$ I' V
  55. #define STATIC_SHIFT                39 X7 X: [1 f5 [& o& F: H
  56. #define TCINTEN_SHIFT               209 C5 O& O, k: S9 M1 q; c
  57. #define ITCINTEN_SHIFT              216 E* {# \+ q1 j5 }6 r
  58. #define TCCHEN_SHIFT                22# J7 N' P/ P* J. V, J
  59. #define ITCCHEN_SHIFT               23
    7 q5 I# z4 I, t! j3 B* D8 x7 [0 i

  60. ; y  j6 p3 m; T& M
  61. static volatile int irqraised1 = 0;8 \" s3 n' D1 Q- z/ a2 [" Z
  62. static volatile int irqraised2 = 0;) ]3 b7 ^* }4 @' t8 [: X
  63. " C/ R3 h% L& j/ M( ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 R! r% _7 U6 Z3 V* V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 ~, V2 N5 G! Q" x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # U# U. J* u& H! p; H: S1 N
  67. 8 r$ x& e9 F% f- }  t. ~
  68. dma_addr_t dmaphyssrc1 = 0;
    - ^" y# P! K& r$ l3 R
  69. dma_addr_t dmaphyssrc2 = 0;
    . t7 z  G( i9 w- {. n: ?
  70. dma_addr_t dmaphysdest1 = 0;
    # f2 m3 h0 B( V2 V4 y% b' q$ w
  71. dma_addr_t dmaphysdest2 = 0;
    % k2 h3 D1 J9 e4 b
  72. + U+ L3 j) A4 d0 x" z; |3 ?0 _" l5 l
  73. char *dmabufsrc1 = NULL;3 Z: }% {9 D& B3 O. L7 x( ?
  74. char *dmabufsrc2 = NULL;/ P! p# t3 v2 x5 b' }
  75. char *dmabufdest1 = NULL;
    9 H: ]$ \5 m& B" f/ ]  H9 o8 U
  76. char *dmabufdest2 = NULL;
    1 g8 E3 h* j8 b  {. r
  77. + J" B% m$ z: k0 [/ A2 K" t
  78. static int acnt = 512;" X1 o0 l1 |. A2 V% F9 Q
  79. static int bcnt = 8;' t! g; c! C* }6 e
  80. static int ccnt = 8;; d4 \7 E7 @# S' O; Z4 i2 g

  81. & |. f" h& `0 B( H* g4 `
  82. module_param(acnt, int, S_IRUGO);
      a* z* z2 [( d5 h4 R' D
  83. module_param(bcnt, int, S_IRUGO);
    / J( Y, j- c. p4 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* i: j1 O6 J' O3 |' p: h/ F' ?, y. x* q# g, {" ~( V: n# C# H5 ?* ]: U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, M3 C" \  \! I  u7 i$ _& f1 e5 H" t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 z- {) [1 W7 R0 G; K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 b& ?3 ]2 i+ Q, R; X
. E3 q; W& z* p& Q0 N! i

6 r) o$ Z( J$ v- x  |# p" w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 06:33 , Processed in 0.039620 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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