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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % [3 n: h" ]. w2 H
  1. [code]EDMA sample test application/ [5 O5 \9 l* J, r
  2. /*% E; E2 ^- D6 d5 j3 U) W
  3. * edma_test.c, N9 n+ V1 m& r  R# d$ Z
  4. *; S- T2 O' a; @% ]( a' o; x
  5. * brief  EDMA3 Test Application$ c( m7 k; P% ]6 Q0 ]4 |/ J9 O
  6. *
    , P9 e' i$ @; ]5 j# P! P
  7. *   This file contains EDMA3 Test code.$ J, ^) w: ?+ q, Q
  8. *' R4 `$ }: t$ ?+ r3 Z/ m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( S8 |$ Z. h9 h( q! z# c$ e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % L' b5 B! j% `
  11. *         TO CHANGE.
    5 H- X( C& I. h- T
  12. *6 i. P2 j( q0 o/ p# o: u- X) M4 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 _" _/ _4 B& _  \( u2 _
  14. *
    & p$ e; X0 m0 \
  15. * This program is free software; you can redistribute it and/or7 r4 _: B. p, {* ^! N7 I
  16. * modify it under the terms of the GNU General Public License as0 c% F! Q$ z8 M* Q
  17. * published by the Free Software Foundation version 2.
    / s2 f8 ?# p1 i  N9 [9 a- ^1 S8 K. e+ C& H
  18. ** @6 w& d) w; F- s8 d5 b  e# I; E6 u: j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 v# k3 \. h6 x, X) {3 \7 n9 A
  20. * kind, whether express or implied; without even the implied warranty
    0 ~1 Z. Q5 l/ E5 W, }- K0 K  c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 ~/ F5 d* k6 n3 w4 P
  22. * GNU General Public License for more details.5 x( p' t9 D' u% e) e+ @
  23. */
    8 U) ?& o5 }$ h3 E- A  u

  24. ' p8 Y6 o9 O, k
  25. #include <linux/module.h>$ D4 ~9 ^" J  \- ^' t0 }' H4 X
  26. #include <linux/init.h>
    5 x  I) I" V5 g+ F, u  Z5 }' i
  27. #include <linux/errno.h>
    1 z2 j2 e" C9 P, x9 f) |+ Y
  28. #include <linux/types.h>
    4 |. E: q) ~/ c% C5 v2 }
  29. #include <linux/interrupt.h>
    ( A7 Q' Q4 Z2 _8 W9 i2 o# u
  30. #include <asm/io.h>
    & S9 K% i9 z& M* f! [* h: _+ S- {
  31. #include <linux/moduleparam.h>
    ! v/ i0 B( e# j  ?3 N+ u; o
  32. #include <linux/sysctl.h>
    4 j# q, s3 E! i7 H8 _
  33. #include <linux/mm.h>
    - L) f. w! K" i& C; |6 j0 T3 I
  34. #include <linux/dma-mapping.h>
    - P* M, U: I/ W" |1 R

  35. & t9 h. Q" _0 w7 H
  36. #include <mach/memory.h>
    ; H5 o/ V+ S7 \5 q5 K, S3 c$ v
  37. #include <mach/hardware.h>/ ~% b* ?' \" ^' J
  38. #include <mach/irqs.h># o$ M. V2 d, ~' d
  39. #include <asm/hardware/edma.h>
    ; |; k- p. i+ E. i8 }
  40. ' g9 B9 a' j/ H# d9 r* B, Y! V2 i
  41. #undef EDMA3_DEBUG# ]# s% n7 u% P1 @; C5 |7 V
  42. /*#define EDMA3_DEBUG*/6 w- ?: A. z! S# {9 y- d
  43. 0 }$ F& l$ V6 D3 N
  44. #ifdef EDMA3_DEBUG
    4 O7 L' G" A3 M+ i/ P+ f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - N& Q/ i0 o5 R. H' A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; x) ?4 G. E& [7 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : G6 q8 [8 X- F6 H, A; X6 X
  48. #else( S3 S* B) V: W. ~# O
  49. #define DMA_PRINTK( x... )
    4 y* f* W( l4 K( j
  50. #define DMA_FN_IN3 H( o/ d: ^# P/ T6 q
  51. #define DMA_FN_OUT
    8 H5 w1 X2 Y' a, G
  52. #endif
    ' K4 O6 A6 D. O1 ?
  53. 5 D9 r4 ]' O) [8 G8 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 s( y& I* V- v6 q3 {* _
  55. #define STATIC_SHIFT                3
    5 L9 d9 N9 Q: E8 a" }0 i- j
  56. #define TCINTEN_SHIFT               20( I" A3 |; f$ j+ A' n' q. }
  57. #define ITCINTEN_SHIFT              211 y; |% w) G* M+ H  i( [8 T
  58. #define TCCHEN_SHIFT                22* l% M' p& m* z9 a8 |
  59. #define ITCCHEN_SHIFT               23
    * L" Q6 S, I; U" R0 b& c( r6 g) g- x

  60. 4 H* J- m. j- v2 a
  61. static volatile int irqraised1 = 0;
    4 U7 W4 u) [6 _0 V
  62. static volatile int irqraised2 = 0;
    % g' [" u9 d$ E) b0 ~
  63. % J; n' u8 a- C; i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) S1 M$ `1 l4 e3 J( B1 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 n7 M: [; Z) a' O- i) \9 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ ~! \& ^8 r( a$ U& W+ [7 A! u
  67. 9 k9 U! }# E8 {2 u1 `( k6 c' r/ B7 v
  68. dma_addr_t dmaphyssrc1 = 0;: j( x5 p1 s; `* u. i
  69. dma_addr_t dmaphyssrc2 = 0;
    % Y' l# G! A" [2 `7 W1 V6 q# u
  70. dma_addr_t dmaphysdest1 = 0;, L) B, P$ H! D2 y0 Q: u6 J
  71. dma_addr_t dmaphysdest2 = 0;' y4 i9 C! V3 L  ~
  72. 8 Y" M7 ?9 n4 N2 }% j
  73. char *dmabufsrc1 = NULL;
      \8 G2 ^- @% W. c' G6 V
  74. char *dmabufsrc2 = NULL;
    0 Q, ]* G* I8 O5 C' X- s% l
  75. char *dmabufdest1 = NULL;: J) R  Y1 B; s  j) g# C
  76. char *dmabufdest2 = NULL;
    ; }* Q* T4 w7 ~# V% W, u! M$ f
  77. + t: x3 `) l/ k6 S  }) v) ]
  78. static int acnt = 512;" ~# j9 m% O) E6 O1 ^( Z) ?/ J, ?
  79. static int bcnt = 8;
    0 g/ x. P" z2 z- ], i
  80. static int ccnt = 8;
    ' p# N- C' h* a5 u. T

  81. ; `# m4 @  @- B  o& k
  82. module_param(acnt, int, S_IRUGO);# S8 S; R: b6 b8 L
  83. module_param(bcnt, int, S_IRUGO);
    ( |9 ]  X8 V* w5 a! q% `, q% ]4 Y/ U# @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% Q: l1 A1 W# ^- p
9 f! c5 W4 W, `$ B# h7 i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 i0 h' d% L. P# C. G- u7 `5 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ a/ V/ _4 h! M* v+ t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" g: S) r, ^1 p
; s- G. V, _4 m! U8 C  }6 i
4 K2 l, C7 Z8 n2 `) E/ X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 19:21 , Processed in 0.039902 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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