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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* y, X! t; m2 O& b& W& M! K
  1. [code]EDMA sample test application+ x" C1 q* t% z$ j, O
  2. /*3 N) \* m) {- \8 R3 Q
  3. * edma_test.c
    1 ]! G2 z% h5 D! ?+ {: C
  4. *: z  l; i3 Y+ _
  5. * brief  EDMA3 Test Application
    5 t. N; L5 Y$ X6 n
  6. *
    / L: z& J' E. l0 K; ~# J6 _+ ]
  7. *   This file contains EDMA3 Test code.
    4 D+ d) D7 w; E; X/ @
  8. *# G2 {# b5 [% X0 }7 ~6 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ L5 @9 c! ]6 h' J# f+ O" O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * h7 q- w7 w: A% ^0 ~  ~. M1 t+ H* Q
  11. *         TO CHANGE.
    2 }1 I  }5 D+ p0 \1 R
  12. *
    5 h6 H; R6 R2 F2 H% ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& X) D) m8 _& M8 d) w$ \. P0 |: h. f
  14. *2 w% D. ?6 F8 b5 h
  15. * This program is free software; you can redistribute it and/or# Z8 [, ~$ \; Z" ?3 w
  16. * modify it under the terms of the GNU General Public License as
    6 e* G# z8 A, T' l3 f5 a1 t
  17. * published by the Free Software Foundation version 2.
    3 [7 M% Q: z, e1 z7 ^. W
  18. *
    " o6 N; ^( ~5 V$ z/ Q* S; O' S" I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: X1 ]- ^; c3 b6 K. ~/ s+ H" H
  20. * kind, whether express or implied; without even the implied warranty$ V9 C( o  B% K. V7 K& N" h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! I2 E- ], R  v: s) b
  22. * GNU General Public License for more details.
    ; r% J/ K5 u" h6 |0 P
  23. */- B  c6 X' c# R
  24. 5 O  D9 h3 I" a- T3 R- p
  25. #include <linux/module.h>  k- B" K  C! m& C, `
  26. #include <linux/init.h>8 N3 l( H" M% B9 g7 a4 D* L
  27. #include <linux/errno.h>
    % w; H$ G: j. O
  28. #include <linux/types.h>
    4 ^2 ?" [5 H. L& ]7 r
  29. #include <linux/interrupt.h>6 v/ F; G; C3 K* J1 r
  30. #include <asm/io.h>& \  M2 E2 {" T% W% U" X. s
  31. #include <linux/moduleparam.h># `& \* ~2 B. i! k
  32. #include <linux/sysctl.h>% t) j  V  w  m/ Y, {5 n
  33. #include <linux/mm.h># U/ D9 Y# I$ n! W. f) s0 s; k
  34. #include <linux/dma-mapping.h>- ^: W% K/ _4 i; [, a2 ?% Z
  35. : U9 _; B0 i7 _& R3 L/ f! q
  36. #include <mach/memory.h>
    8 P$ P# y8 C+ a* l" G
  37. #include <mach/hardware.h>
    5 P! p) u& |% v
  38. #include <mach/irqs.h>; Q  k6 D7 G8 P+ x7 y- u
  39. #include <asm/hardware/edma.h>
    1 H: B  j( T& {" B& G, y

  40. & e/ I0 d+ j3 r4 i8 P
  41. #undef EDMA3_DEBUG
    , W5 W) {0 @2 q- p+ b& D" E  U
  42. /*#define EDMA3_DEBUG*/3 i: [  D' T) e
  43. ) ]; g% ?: R0 a" n8 ~* t! M+ ]
  44. #ifdef EDMA3_DEBUG
    5 l  C* f& T" N% u5 E& w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): e! W+ Y; ^& A) D1 o7 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Y0 J" C7 Q/ ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ Q' t( Z8 s2 r1 N; u5 n7 l
  48. #else1 `. j% M. F- K3 M
  49. #define DMA_PRINTK( x... )
    8 `0 l6 M6 M' z8 C* L5 c  Q0 d
  50. #define DMA_FN_IN% R: y" c, @9 M1 [' f
  51. #define DMA_FN_OUT
      O. _% S% o3 g7 C
  52. #endif
    - |! }, ]# p5 T3 F+ K
  53. - o& q- {1 k3 w7 X4 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 q6 X! N: K$ P
  55. #define STATIC_SHIFT                3! ?; P  k6 K0 ?3 l. O$ a% @
  56. #define TCINTEN_SHIFT               20
    # J& }1 \( a7 C  x
  57. #define ITCINTEN_SHIFT              21) [, E" N# l1 I/ b: P: w
  58. #define TCCHEN_SHIFT                22
    4 @, ?* l2 |4 z+ d
  59. #define ITCCHEN_SHIFT               23
    " p0 m5 d; Q  K  D% X9 w. I8 E
  60. $ `) V. r1 c7 U* l" t6 `; ~
  61. static volatile int irqraised1 = 0;
    / H7 I3 c$ V+ E# g
  62. static volatile int irqraised2 = 0;+ d4 s1 p) J! @2 a
  63. ' H( R0 F# v5 ~4 `3 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 c3 W" H4 r: Q  j! j3 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ A( e8 w; F' s) q0 t8 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' h' q$ z# R( D! ]6 f4 g. O: G1 y

  67. ) H- }- i5 T. ?5 J
  68. dma_addr_t dmaphyssrc1 = 0;
    # y/ G2 e4 P! q. Y, F$ v: T' N) O" ~
  69. dma_addr_t dmaphyssrc2 = 0;
    1 i. r4 H2 y; V+ O% e# c
  70. dma_addr_t dmaphysdest1 = 0;
    4 Z3 z' V0 P( T. [
  71. dma_addr_t dmaphysdest2 = 0;" e4 \/ j9 I- s6 s2 D
  72. 6 x! s" V7 W- y, L0 O
  73. char *dmabufsrc1 = NULL;
    % I% d6 G3 a! v1 _
  74. char *dmabufsrc2 = NULL;4 O4 h% q# T7 ]' L) T" s" B# m- X$ }  {
  75. char *dmabufdest1 = NULL;
    7 P4 h, V  z5 Z# d+ j
  76. char *dmabufdest2 = NULL;$ e( z0 R) G! F* v: c  e2 E

  77. $ [& p- _- T3 q, }
  78. static int acnt = 512;
    & W6 ~2 x0 U' c9 O! a
  79. static int bcnt = 8;
      T, z% w- r7 b+ w" x  h5 n
  80. static int ccnt = 8;2 G; K- ?3 B3 X

  81. 0 j( F' u& U( X' ~
  82. module_param(acnt, int, S_IRUGO);  u) ]) K, i& B$ ^
  83. module_param(bcnt, int, S_IRUGO);# C2 A4 F" U' b. ~4 u4 o3 O6 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) [" I* c  B3 y/ x( d# S
4 u1 i& o* N7 ^! r4 T; W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 s0 J  G$ S1 X$ {: t8 e4 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) f- o  C" E9 R! d' K# m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 C' _: i/ u) t

- n& _$ ~& z8 c/ {2 O( h
9 J+ M' s, C  x' P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-19 00:45 , Processed in 0.037816 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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