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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 i: `$ q& a. }# ^/ d, P9 R4 l# ^. O8 w
  1. [code]EDMA sample test application# W7 ^) S, O, F& q& |/ O
  2. /*
    + K3 f& o+ f# z; T5 t
  3. * edma_test.c
    # q2 i& e  V) e
  4. *
    ' [9 ~% V2 ^! r" e4 l5 D; m+ v2 f. {
  5. * brief  EDMA3 Test Application6 r7 F/ v- A; E; S( s
  6. *
    5 c3 P3 F6 s3 u0 b
  7. *   This file contains EDMA3 Test code.
    , m% a2 O6 Q+ ?& `
  8. *
    + S* }! I  m% @! H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / x. e4 k: q( r" B; K% {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! j! y- o4 H& z) j' d4 ?" |& D
  11. *         TO CHANGE.
    1 [  d% C1 {$ Q
  12. *) j: y. s. j. R9 _$ d/ I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; f4 X1 R4 f  \/ @7 [7 z
  14. *
    + i& P/ ?" `- S: U" O6 g
  15. * This program is free software; you can redistribute it and/or
    8 U* l9 h% w# z9 o8 k. H& P1 i
  16. * modify it under the terms of the GNU General Public License as- E+ f" ~1 z& M& z& N, k! s1 N1 Q
  17. * published by the Free Software Foundation version 2.
    3 n0 A8 V1 q4 o# q3 l
  18. *
    & N* m6 F' c- C$ T0 o7 n" e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 e7 W1 R5 _2 l! Q, A. w9 q4 P; H; f
  20. * kind, whether express or implied; without even the implied warranty
    . v6 E6 E1 M6 p5 |* U  a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" F% r+ F4 H" h: ]
  22. * GNU General Public License for more details.+ I: a% g9 n- a
  23. */$ A. b* A! ?6 O3 p

  24. % K; W2 A" Q3 A7 l. c
  25. #include <linux/module.h>
    $ [3 r9 y3 j* |3 P7 d+ _- g6 Q+ Y
  26. #include <linux/init.h>$ M1 M: s$ {3 r* N9 t7 ]/ H. U
  27. #include <linux/errno.h>! l7 P- T2 Y& ?. t2 _7 r6 ^3 B
  28. #include <linux/types.h>) D' c1 ?- T& f6 R
  29. #include <linux/interrupt.h>2 i( V) ^5 u5 q4 J1 y6 q
  30. #include <asm/io.h>2 e; y3 h; e8 g- H$ x9 d+ H
  31. #include <linux/moduleparam.h>, [  p) F1 N- z( M
  32. #include <linux/sysctl.h>
    5 G. U6 G- _! `4 z% E1 X- Q
  33. #include <linux/mm.h>
    5 i' ^& q* U- x$ _
  34. #include <linux/dma-mapping.h>5 `1 N" l9 w3 [

  35. - m. H+ K& E" Z+ _
  36. #include <mach/memory.h>
    5 l6 J4 _0 s- Z
  37. #include <mach/hardware.h>8 z+ v: s8 m# M* g4 S* A' z
  38. #include <mach/irqs.h>
    , l- l5 v3 p  A5 U7 S' \
  39. #include <asm/hardware/edma.h>
    - |9 ^$ K0 _1 r5 \
  40. ; J' Z8 O4 M3 B9 @
  41. #undef EDMA3_DEBUG
    4 {$ q5 u, B* e1 g( u- P
  42. /*#define EDMA3_DEBUG*/
    5 p  d' d4 S* @- Q3 V9 C% ~0 {& P

  43. 3 S. U! j9 ~7 q# I
  44. #ifdef EDMA3_DEBUG( Z* n: c! E$ M! e5 A: D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( K/ b8 Y+ q- x  x2 p& ^+ T5 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ ?) F- \8 `8 V5 [9 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( a( h% }2 ]( @& ]
  48. #else' N8 C# b' w) K' Z, j# f
  49. #define DMA_PRINTK( x... )( x8 O7 K- o* [2 J
  50. #define DMA_FN_IN2 e! ?& B& V7 Z$ A; p7 |
  51. #define DMA_FN_OUT
      t) e. B" ^7 B5 T: c
  52. #endif
    & _& X5 p7 W* Q0 |

  53. ' E1 v3 L) M5 x9 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). Z9 ?5 i5 l0 K2 D- W* J6 `; x; B
  55. #define STATIC_SHIFT                3
    5 A6 e* Q/ r1 l
  56. #define TCINTEN_SHIFT               20$ A7 d4 a# `/ D4 G
  57. #define ITCINTEN_SHIFT              21
    8 R! ~9 J6 q; Z* I' o' B
  58. #define TCCHEN_SHIFT                22  k5 i8 J0 a9 f3 {) y
  59. #define ITCCHEN_SHIFT               231 l$ d, g: }3 ]. `! |% ]
  60. ! H2 B4 k0 o; I  n' S& M
  61. static volatile int irqraised1 = 0;
    2 v9 [! `1 d. d) C1 m
  62. static volatile int irqraised2 = 0;8 u' t- j  J! l6 [9 R9 V% I

  63. : p- ]3 J% f1 p& a" I, w8 G7 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) a* M- J+ X0 F& u7 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " h% ?& e- J# z5 n( ?" W8 s- X* D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % c/ T- j- F7 V7 h- s1 c" f

  67. ; H  W: g0 f0 D
  68. dma_addr_t dmaphyssrc1 = 0;
    : U$ }; p& Y- z4 U6 H# l
  69. dma_addr_t dmaphyssrc2 = 0;, a. p+ d6 @$ [* c& t# e8 y! V
  70. dma_addr_t dmaphysdest1 = 0;% u: r  Z' Z5 k# a4 m- F: G6 ?; z
  71. dma_addr_t dmaphysdest2 = 0;/ c% N0 p% T2 N# I5 K' ]+ G
  72. : @: z- {1 }! {1 }
  73. char *dmabufsrc1 = NULL;
    * C. a2 x, K, ~5 V
  74. char *dmabufsrc2 = NULL;
    ' H0 e; i( ^( h% h
  75. char *dmabufdest1 = NULL;
    * @2 ?- G' }% M. C
  76. char *dmabufdest2 = NULL;- U# x) H, `: o6 o6 s3 s6 }8 b6 T
  77. ' |; x# R; a7 m: T8 \( H
  78. static int acnt = 512;
    0 d7 T& v  V% Z9 ]7 t  }' f4 |, o& ^& f
  79. static int bcnt = 8;
    9 A7 M/ |; r! E
  80. static int ccnt = 8;9 y  Z$ H9 g( ]+ Y  C+ |& B( ^3 T
  81. . \8 N8 T) {  K) `  b
  82. module_param(acnt, int, S_IRUGO);
    + g1 B* G3 |! q6 y! s. i8 T
  83. module_param(bcnt, int, S_IRUGO);
    : x( n1 G8 n  r- }7 V1 E. T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% j( J; i' x1 i) u7 Z# B2 i
) E% A  O% |; f6 y  b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 U; R9 ~; o9 ]+ \# s: Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* |' }% B' M9 D" r7 A* c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 Z) t; s: @" x$ C4 _  ?4 Y

& d- b* ?" b: @
# a8 k3 ~- O; \* q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-9 13:05 , Processed in 0.040529 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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