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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 N: @: S5 g) {% T# f% o
  1. [code]EDMA sample test application
    9 a! r1 S+ U4 K' w, k3 r1 I
  2. /*
    6 n' C$ v' {; W& j' d
  3. * edma_test.c
    : }3 b( g+ J- a* e8 W: h! n
  4. *
    3 E  U/ d( l7 [5 F4 |# s
  5. * brief  EDMA3 Test Application% j9 v* q: \0 {4 i& ]- y
  6. *& |  R8 h$ b5 N6 x6 P
  7. *   This file contains EDMA3 Test code.
    3 r1 X" s( H1 I
  8. *. d/ h9 u& K& l. u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 ]. A8 K' G  [+ w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & _7 X4 X  A' h/ `( [( I( S
  11. *         TO CHANGE.
    2 }/ K' U3 \! a5 ]
  12. *
    : w/ c$ c3 i& G  t' l. |  k4 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 @( B  E8 k) F0 l' O
  14. *' d7 M" |$ W4 h' A5 `
  15. * This program is free software; you can redistribute it and/or$ b0 H0 U7 _0 U9 B
  16. * modify it under the terms of the GNU General Public License as/ [% r' U; {/ U. k' _, K
  17. * published by the Free Software Foundation version 2.
    , P" r- I. C( Z% L7 o
  18. *
    8 G( Q. g4 R; p6 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& N/ A: m/ a5 d2 P
  20. * kind, whether express or implied; without even the implied warranty. R3 p+ d" O9 ^  Q* b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% V5 [+ u* C, G; K  L8 b
  22. * GNU General Public License for more details.
    & ^, J4 ~5 V+ ?1 v; V4 M: k2 b: C
  23. */8 D8 S& d; j5 \- \5 i8 O

  24. * z( c+ f$ ^& V$ n3 A
  25. #include <linux/module.h>5 M) B; M7 C4 H# T$ `
  26. #include <linux/init.h>
    + G' b3 u* U8 \+ }8 ~( J
  27. #include <linux/errno.h>, P  h2 [8 |9 D6 S8 h) A
  28. #include <linux/types.h>( @2 }4 ]$ f$ U! [  T2 A+ d
  29. #include <linux/interrupt.h>6 {- B2 t7 j( j9 j8 T" [0 z; C
  30. #include <asm/io.h>9 g( Q8 B& W  o, g4 g
  31. #include <linux/moduleparam.h>
    1 I* P+ v! D$ H$ d- H8 N, F
  32. #include <linux/sysctl.h>( A! Z( |" f, L
  33. #include <linux/mm.h>. i5 H+ X% A- E2 M) |' q( ~6 g2 M6 N. p
  34. #include <linux/dma-mapping.h>
    . z1 l3 R9 z: ?
  35. . S: ^2 L) t% K# _7 Z
  36. #include <mach/memory.h>
    4 y- W/ }; {+ Q5 i; u. I- t) G
  37. #include <mach/hardware.h>) j, ~* Z2 }; B" l: S
  38. #include <mach/irqs.h>
    - O- h/ p" p5 x5 V. M- A& D
  39. #include <asm/hardware/edma.h>
    8 s- F; j  S8 Z  \! D% q" s: {; B

  40. ' w' x7 |4 e; }8 ]
  41. #undef EDMA3_DEBUG) G' |7 L& F! I$ M# N
  42. /*#define EDMA3_DEBUG*/& r$ ]9 Z! j6 D5 Q

  43. ' H2 }( U1 @8 P' r5 I7 d* ~
  44. #ifdef EDMA3_DEBUG
    & P; I6 R- i+ t# e6 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - E3 L+ T& m9 ^1 N3 R" P+ ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 d: [, Q6 z7 `* k0 w* P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( o4 U, M, Q- i( C1 v; [- ~$ K
  48. #else( a7 W1 P' {1 C  B3 s
  49. #define DMA_PRINTK( x... )
    5 A$ ?% V% C) Y( G6 Q
  50. #define DMA_FN_IN: J  i. p" |/ s2 T" P
  51. #define DMA_FN_OUT
    3 Y9 {3 y. v" p7 r, C) q" x- f
  52. #endif8 T$ ^. g+ d) D9 Z4 ~+ h1 W8 W
  53. 4 t# z, M% M( N3 a  j8 S0 @! X- X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 ?* q; \# S! r, s* g6 O0 y9 O
  55. #define STATIC_SHIFT                3
    0 c7 @; a( K) p0 f
  56. #define TCINTEN_SHIFT               20" X- N0 C. v* [
  57. #define ITCINTEN_SHIFT              21, W4 o9 I* U# f  q
  58. #define TCCHEN_SHIFT                22; H! ~3 M8 U1 ^- c5 T& `
  59. #define ITCCHEN_SHIFT               23
    4 r/ }/ h% W  c, P. v8 u: F  n; R& f. x
  60. 4 c/ O$ ?7 i; C3 A9 s# h7 ?5 i( H
  61. static volatile int irqraised1 = 0;) I) K4 a( y( d, ^2 I% n- O
  62. static volatile int irqraised2 = 0;# k: b, X1 M7 ^# J
  63. : [, s& X+ `2 d  p* [) m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# V# \4 x$ x0 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) c% m$ B( C6 L- k) M6 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 @0 d: A' B0 e2 E$ s& a7 E

  67. " [) }* ]. _- b
  68. dma_addr_t dmaphyssrc1 = 0;
    / X' {5 c* @! i2 A
  69. dma_addr_t dmaphyssrc2 = 0;5 }- S5 E% ?* y5 B3 k
  70. dma_addr_t dmaphysdest1 = 0;
    . t5 j9 L9 q4 w! y" `
  71. dma_addr_t dmaphysdest2 = 0;
    9 I6 Y5 Y! Z: N; B  c4 F

  72. 1 u, @1 Y7 `& K: ~" W4 [
  73. char *dmabufsrc1 = NULL;# ~- t# k+ r2 M3 B+ `' m% x( ~5 w
  74. char *dmabufsrc2 = NULL;
    1 G9 o7 U; ?0 }# f) X8 P
  75. char *dmabufdest1 = NULL;
    & u' H8 L9 d& ^' ]
  76. char *dmabufdest2 = NULL;& o$ g" N( l+ |- t/ [- [
  77. , T# B5 [* P8 L4 A: y- b2 a
  78. static int acnt = 512;7 F5 W! A4 d' R, Y
  79. static int bcnt = 8;
    * p1 `7 T# r3 j, N2 S9 Y
  80. static int ccnt = 8;! B$ n7 e5 Q( a7 g$ {& U0 I

  81. ; C  P/ Q) A3 D9 S; F
  82. module_param(acnt, int, S_IRUGO);
    + P$ C/ [1 D4 v
  83. module_param(bcnt, int, S_IRUGO);
    4 v! O4 g/ ~. t3 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- S2 {/ `& S. p0 P( i- @5 }- B! Z& Y
# L1 |6 w  I: Y$ d+ n0 z' M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% v, h" U- w/ y" ?  D* Z  V. 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) O+ g$ ~( {* v/ h* z, Q) n/ L9 c4 D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ |5 ?7 w* `5 _8 T& Z' l4 J* c/ \
- l: t6 I, i' z
* c: Q0 J) K' j2 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 17:36 , Processed in 0.044250 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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