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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 F% E2 \8 I& U! E0 i* }
  1. [code]EDMA sample test application
    0 e% _) K  A' t! f, N# l/ T
  2. /*
    . i6 q% X( [% e$ ]+ M! {( v) K
  3. * edma_test.c
    6 L' S3 {3 m+ V5 {% }
  4. *
    6 f0 H$ x3 e* R, U
  5. * brief  EDMA3 Test Application) J! Q% R  T" s: h; L
  6. *4 ]" H. d+ \0 Q9 \7 r
  7. *   This file contains EDMA3 Test code.
    1 L/ ^2 _* Z# V3 n* s8 ~4 `
  8. *
    6 H5 G7 a6 _5 L8 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ T3 S/ v5 S8 K- |5 k) k% ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; R' D' c3 b' a0 A' h  Z
  11. *         TO CHANGE.9 G4 q4 B+ ?7 W7 e
  12. *
    5 C/ u. a2 K4 {6 `2 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 x- U  J( Y9 U1 G( ]
  14. *, {, X" y, j0 q: u
  15. * This program is free software; you can redistribute it and/or
    & p) V/ S; V, _% n9 w, A. s
  16. * modify it under the terms of the GNU General Public License as
    " j7 _0 v" `1 K) W8 @
  17. * published by the Free Software Foundation version 2.- K; k6 U  H. p4 g$ E% b3 |0 B' F
  18. *
    7 W4 d- k4 Q3 t7 O. ~% \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 h" D, ~0 i  R9 x0 ], u8 R9 Y. w
  20. * kind, whether express or implied; without even the implied warranty
    4 P8 r3 u3 n  @1 ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( f1 Z. I+ k$ l0 F+ j# B. Q
  22. * GNU General Public License for more details.
    5 P& }. ~: x( }
  23. */& Q( T/ \0 C, L7 S  G# S

  24. : v4 W) V* u# U3 p! e8 @% F
  25. #include <linux/module.h>- M9 a1 Z4 m) e  O1 j! a/ D3 e
  26. #include <linux/init.h>$ [0 J2 M) z1 P
  27. #include <linux/errno.h>
    . s0 L2 u9 c* ?* _) l
  28. #include <linux/types.h>
    ( M7 O2 @6 R  g
  29. #include <linux/interrupt.h>( l1 {* E; h9 s2 A4 Z; @2 T' f4 Y
  30. #include <asm/io.h>
    " @; |7 q" O6 c5 w+ f
  31. #include <linux/moduleparam.h>6 w1 X5 {+ f- @
  32. #include <linux/sysctl.h>, B3 t, Y9 o$ d" z; w
  33. #include <linux/mm.h>% }/ C% b2 T7 Z7 _
  34. #include <linux/dma-mapping.h>
    : U) D7 g- y3 n1 J6 n* a1 B1 F' `
  35. 9 c9 S5 z7 N" z  C2 x5 C
  36. #include <mach/memory.h>/ Q5 ^8 K7 c8 a; I, Z/ q( I
  37. #include <mach/hardware.h>
    % x& m5 w( ]7 n$ v
  38. #include <mach/irqs.h>' B# I. y4 z2 @# `  w3 z
  39. #include <asm/hardware/edma.h>$ d1 O2 t0 H  C7 n+ W8 ]% G5 }/ G
  40. 3 r" U- }2 ?" R1 y- l+ c
  41. #undef EDMA3_DEBUG$ H4 o! \0 r+ N4 {; V; g. e
  42. /*#define EDMA3_DEBUG*/4 _) O; C. ~% \* z1 T
  43. " q) {9 [7 g- W9 M- |
  44. #ifdef EDMA3_DEBUG
    ( \! m, E+ A8 ?9 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ n) }  V0 J; S8 }+ j2 s3 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 @) Y6 D$ p7 H( K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # }, a+ s* A  W, w5 \, U
  48. #else+ K) g. n7 r  N: }  g4 Y+ v
  49. #define DMA_PRINTK( x... )
    - b( j. N; |& `* ?9 L. p  k
  50. #define DMA_FN_IN+ f; M+ U# b4 }
  51. #define DMA_FN_OUT
    3 W% g' N) E4 c4 h# w9 l
  52. #endif- q4 Q+ q$ P1 ^1 u8 {( J- g0 b. p
  53. 9 u0 [6 V7 v; e( U) V7 e. V2 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; z2 C+ o. Y8 K4 V
  55. #define STATIC_SHIFT                3/ ^- P9 a9 E/ N3 v
  56. #define TCINTEN_SHIFT               20/ a+ F3 P4 E( @3 A4 d' B6 B, W
  57. #define ITCINTEN_SHIFT              21
      U& e& H3 B7 O
  58. #define TCCHEN_SHIFT                22
    2 a, W" ?, j$ o4 g* K
  59. #define ITCCHEN_SHIFT               23
    2 [4 L$ k  h" O6 r

  60. % c* ~% t  {7 ?  i* ^7 Y4 l( m
  61. static volatile int irqraised1 = 0;. J7 J& k: ]4 n& A" b
  62. static volatile int irqraised2 = 0;
    * T3 Z0 L. D: [4 I* n
  63. 8 ~3 t* ~- j# i# v0 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  k& H, K4 w! o  l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) L" [, D" V5 H  V* ^' j1 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      U4 E3 p+ a6 N+ |0 w% ~
  67. % D6 X: G5 q( ^# h
  68. dma_addr_t dmaphyssrc1 = 0;' z5 w( W  [9 d$ S! X/ `# h3 L
  69. dma_addr_t dmaphyssrc2 = 0;
    3 }. m2 p9 E3 [9 ?
  70. dma_addr_t dmaphysdest1 = 0;
      _  `: x0 t  I8 h
  71. dma_addr_t dmaphysdest2 = 0;
    % N- m7 e" P7 C: A

  72. ! S: t3 r8 s9 N1 q( I
  73. char *dmabufsrc1 = NULL;
    3 o9 O4 S: M1 |5 q7 |) b
  74. char *dmabufsrc2 = NULL;6 q+ {' S- r" `! ?6 O2 C: O' U- Y
  75. char *dmabufdest1 = NULL;6 M. L  V+ [( d* V  R
  76. char *dmabufdest2 = NULL;6 V) X! R2 }% Y4 e% n7 [

  77. : u9 Z! B8 q: Y3 q
  78. static int acnt = 512;
    * V7 j8 _4 u8 z% O2 d
  79. static int bcnt = 8;
    5 C1 @" o5 g5 \% x; N* O2 a
  80. static int ccnt = 8;
    : x! T" u, ^2 N5 [, P; ]8 G

  81. - w8 ^0 ~( ?1 ]$ G* G6 L' i
  82. module_param(acnt, int, S_IRUGO);
    & g8 j* {: \9 r* N
  83. module_param(bcnt, int, S_IRUGO);  _$ C% F; l) \' X6 @. N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. F0 V) [/ M7 P4 a- W- ^
( |' u1 T1 |4 `6 x) r0 h1 p1 W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- j* |' b0 z8 y0 o0 W* I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# c% e0 o) a/ B# ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' L" m* {9 g. U  p" ?2 F, Y
, T% A& }; a& o$ b# B/ ?2 |, P* L1 E! L% W# E5 x: `' S' _( G# N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-4 03:40 , Processed in 0.044185 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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