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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " B# h, J/ V2 Q) G# t
  1. [code]EDMA sample test application0 V* R/ {' S( [: V
  2. /*" u& z: J8 W6 r6 k% L! C; E, I+ H
  3. * edma_test.c* s& t' T. i: {7 r9 g5 r
  4. *  \4 [- C4 u& P9 q. {" X* @
  5. * brief  EDMA3 Test Application
    4 c9 v; Z3 y' {1 f% n
  6. *
    , `$ ^2 R# S9 e8 v+ b; s
  7. *   This file contains EDMA3 Test code.1 G6 I. m- F7 H* n6 e: h0 X8 z
  8. *
    , H9 R) U, U; D+ h/ S9 `# l( n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # A$ p: f# U, F6 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 c; O* l$ f: {7 U$ Z. x7 b' _0 D
  11. *         TO CHANGE.
    " j0 \5 M7 O0 P7 V9 ~3 b
  12. *% @7 c7 r+ O, ]( i0 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ z5 Z" e  y, _; k% B
  14. *
    ( w) @# a5 r- ~8 }; s
  15. * This program is free software; you can redistribute it and/or
    # G% Z9 M7 v5 L! G% T# P4 e
  16. * modify it under the terms of the GNU General Public License as
    . V# [% V: P( g* s: N/ O
  17. * published by the Free Software Foundation version 2.
    % b# J/ ^( _# l/ t1 r
  18. *
    3 X# N( ]: h, f: F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % G  \* I: L" L- O5 s' R3 W2 I
  20. * kind, whether express or implied; without even the implied warranty
    - y% R$ ]; {' y4 a% B, L/ q' ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# s# j- `) b, o
  22. * GNU General Public License for more details.7 c) ?3 A# o" C; m: j' E* D0 O* j5 ?
  23. */. e: z7 @( U& I9 H

  24. 4 s3 j$ {9 Q, U4 r
  25. #include <linux/module.h>3 l  ?4 }. U, v! a1 O  O9 L( T5 \
  26. #include <linux/init.h>
    , T% p" N: w9 j
  27. #include <linux/errno.h>
    / q4 S! d9 T8 i9 ^: M& d; }, f
  28. #include <linux/types.h>
    1 C' L% g# r4 j2 {7 u. U
  29. #include <linux/interrupt.h>
      [! \+ A7 \- \/ L) c0 Z2 q
  30. #include <asm/io.h>
    . \! k- R, p5 c
  31. #include <linux/moduleparam.h>
    4 ?8 q. j3 U" p7 V; T# U
  32. #include <linux/sysctl.h>
    1 p' I0 b2 ^% G5 z; c) [
  33. #include <linux/mm.h>
    5 f, J3 P  i; p3 T5 n
  34. #include <linux/dma-mapping.h>
    " {& C5 P. ]; C) Q2 r" w
  35. 5 ]; t6 x7 b6 E* K1 _  X1 V  b6 T
  36. #include <mach/memory.h>8 A, S7 Y* c) G4 n5 k, A/ J
  37. #include <mach/hardware.h>
    ; p& f8 D0 V7 \7 ~
  38. #include <mach/irqs.h>
    " k: z* B( e' Q9 N# @$ ^3 W" T
  39. #include <asm/hardware/edma.h>
    % D% B9 \3 `1 t: o1 |

  40. 8 n% _% V& b2 L$ W* _( W" s& s
  41. #undef EDMA3_DEBUG
    $ [' U) z2 k0 Q7 e) R; M+ w
  42. /*#define EDMA3_DEBUG*/% _( x! k7 b7 Q; j7 D9 }3 x

  43. ; d1 w( _( d4 W" p  F; E3 T: e" Z
  44. #ifdef EDMA3_DEBUG0 R$ i; q2 |% c+ @  X9 w9 P' ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 D) ~( T/ d8 w8 c2 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% T9 Y1 t7 U) P) f1 w) Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), h0 A* |, [- F
  48. #else
    / _. e5 Y/ T3 R# k/ _2 P, {' e
  49. #define DMA_PRINTK( x... )
    * D& q5 t6 v, s2 I- H2 g' l
  50. #define DMA_FN_IN4 p' t2 }' y1 O: @
  51. #define DMA_FN_OUT
    : i6 g* J6 A+ }. Y( @
  52. #endif
    , C2 I. i* l9 h" b
  53. % ?; v1 c$ F. B6 g: G$ `1 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' p% m- k! {" Q2 R5 C% `; t8 J
  55. #define STATIC_SHIFT                3
    " ?4 ^8 C+ C; S% a& W
  56. #define TCINTEN_SHIFT               20! w9 ^. M! z) P5 l( B
  57. #define ITCINTEN_SHIFT              21
    9 i9 L1 d/ v: Z$ ^+ z
  58. #define TCCHEN_SHIFT                222 Z) a3 f$ W9 h( y8 W5 s& T
  59. #define ITCCHEN_SHIFT               23% y2 q3 I' _# ~* D" k) Y! @$ F

  60. 1 k6 F  z  b# R8 I  c
  61. static volatile int irqraised1 = 0;
    $ @$ a. J2 m4 u+ [+ _7 e; \/ A
  62. static volatile int irqraised2 = 0;2 V& O, f4 A; h& E% R

  63. : G  S  u4 p  k) H# \( k1 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      P' T( @* }' f  ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , q4 O% G% H1 j4 C, B7 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - d  w8 A3 V3 l- T
  67. 7 i7 Q% `. m) ~3 [% V% y. W
  68. dma_addr_t dmaphyssrc1 = 0;. W$ Q2 U' }+ h2 S' i& o: ?
  69. dma_addr_t dmaphyssrc2 = 0;( l9 E3 V; H4 O4 G
  70. dma_addr_t dmaphysdest1 = 0;' S9 ~, X8 R: T' }" K7 V
  71. dma_addr_t dmaphysdest2 = 0;" t" g5 s1 o$ N
  72. 5 E' ?) D: u* S" g  l2 s
  73. char *dmabufsrc1 = NULL;
    & w8 W4 c0 E5 c- x$ g/ \' J; \
  74. char *dmabufsrc2 = NULL;) t: M6 B! q$ p5 r9 L8 R) v
  75. char *dmabufdest1 = NULL;5 a/ K$ h' @5 x9 a7 H& {
  76. char *dmabufdest2 = NULL;
      W" e9 ^& v4 S

  77. 3 W  g: X0 x( O
  78. static int acnt = 512;
    . p' R7 s0 E1 {6 U, J8 @/ F
  79. static int bcnt = 8;
    4 z' E3 T. \, W6 ~! b* l6 H
  80. static int ccnt = 8;) W: g. a: ?- ?, g9 p
  81. + p! i! I0 ?0 d, W( x: v" C# B" c
  82. module_param(acnt, int, S_IRUGO);4 F3 W9 {  U* d3 ?  z
  83. module_param(bcnt, int, S_IRUGO);4 l0 w* V& s4 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) s8 }& f! {, Y& C7 Q9 `- O: i  j3 M; I' Q+ W: j7 V. |* i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 m6 H& O) S* s! V5 @
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 J: Q" b' E* L/ T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 `* L( k$ j9 F$ T! _

0 {* L* y; T4 L- i/ c. c. P3 P+ {7 x6 \. m5 I: U* u! M6 u* _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-5 10:18 , Processed in 0.047800 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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