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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( d7 A. P+ ~; F0 O2 Z) A8 K
  1. [code]EDMA sample test application) O. J  V; T. ]/ q0 y
  2. /*" C: {# y+ ~- j9 g! M
  3. * edma_test.c
    ( R$ E3 R+ O& z8 |1 U
  4. *1 k$ W+ c  R  T) h7 t& |! D$ O
  5. * brief  EDMA3 Test Application
    ! K# i, a  o. b7 f) {* L" N3 B  M
  6. *
    * ?4 T: s2 ], P5 [5 M
  7. *   This file contains EDMA3 Test code.
    + w2 C% U' ?. H  k) b0 E
  8. *
    5 x3 N5 M5 V- E' U6 {1 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 U  f" [, O+ _; |( k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' O# o" H: L. L; ^
  11. *         TO CHANGE.
      E/ q1 E: `4 C
  12. *. x7 i3 J& O1 M8 `8 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) ]5 v" H% l4 h7 u3 M; w% h$ _- k
  14. *$ T: o  l0 p4 l
  15. * This program is free software; you can redistribute it and/or
    0 K# x: A  V8 _( N- P
  16. * modify it under the terms of the GNU General Public License as
    4 e4 O" E% b: S( [% t
  17. * published by the Free Software Foundation version 2.
    # r" T! t& e, M2 o9 @- d5 J, H
  18. *
    - I8 @' a, s$ G8 [. P  O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 S5 X" H, C% n, M7 T7 i
  20. * kind, whether express or implied; without even the implied warranty
    ' c4 e4 G( ^8 [. O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % e: Q: A/ d/ @2 g8 `. J3 t# z5 b
  22. * GNU General Public License for more details.; N5 @4 U0 [1 |# M, b! G
  23. */$ R# P- }; |+ L& r; p! I% i5 j2 Z
  24. ! ?. ], J, |( @  R! b/ `
  25. #include <linux/module.h>; N' n- a, C. z& m
  26. #include <linux/init.h>' l2 K2 Q4 |. \2 _
  27. #include <linux/errno.h>
    3 i0 Z) c3 `6 S
  28. #include <linux/types.h>
    ' N7 S1 T: I) G# e7 s+ }3 g9 X7 y
  29. #include <linux/interrupt.h>
    + ~, ^; E: u! a6 S6 `
  30. #include <asm/io.h>
    : V( K3 P! O( X5 }
  31. #include <linux/moduleparam.h>+ F+ G) h. d/ k/ A" C( g7 |6 i
  32. #include <linux/sysctl.h>
    9 l1 p0 L* F) S  i+ {# n$ r" V
  33. #include <linux/mm.h>% {' t: }* n2 P! J' Z* [0 y
  34. #include <linux/dma-mapping.h>
    + c$ G$ o+ ]& b& j

  35. 1 J% S- v/ c" Z. h4 @
  36. #include <mach/memory.h>
    5 T7 b8 x& E- n2 K" ]- \
  37. #include <mach/hardware.h>$ _% k% E6 v) J* y% J
  38. #include <mach/irqs.h>
    + g) V- J! I; k5 X
  39. #include <asm/hardware/edma.h>
    ) n, b& ?1 O) N
  40. % U" M" q( L* R) y
  41. #undef EDMA3_DEBUG/ [( a# D0 G! d3 m7 c
  42. /*#define EDMA3_DEBUG*/1 [% Y: q7 g9 X+ W+ P2 m

  43. ) |2 q: a: L* k* V- J6 p
  44. #ifdef EDMA3_DEBUG9 A+ K2 |( @2 O7 @; ]- E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . V, R& E  Z  L/ k0 Y$ x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : W5 b% Q  z7 a) P: U& O9 f$ h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 [' y0 V2 B$ [. v, X) D6 W
  48. #else. a9 {- B9 K$ k: }+ R
  49. #define DMA_PRINTK( x... )
    : K. W2 G, j1 j% }4 _
  50. #define DMA_FN_IN& U! y7 _5 ^# @2 A" q5 ^
  51. #define DMA_FN_OUT
    ' i( i  e+ S: `' w. T( W9 W
  52. #endif$ G" L+ J# @) z9 g0 Y8 T  P' p
  53. ( Y& a8 X! \6 B6 f! ?: ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' O% |  \) z  j
  55. #define STATIC_SHIFT                3
    0 l2 g- f) [' `4 q
  56. #define TCINTEN_SHIFT               20' {$ Z9 \% Z* h; C( ]; u9 H1 h
  57. #define ITCINTEN_SHIFT              21
    ' a% x1 A( |4 U0 Y6 H# I$ C2 H
  58. #define TCCHEN_SHIFT                22
    ) M% x! `: Q8 V. x
  59. #define ITCCHEN_SHIFT               23
    + L9 J& h+ F1 u7 c. f
  60. : _3 g+ S( D: @) C+ j
  61. static volatile int irqraised1 = 0;
    8 c& J! D1 K8 c* t) ?8 X8 Z$ e
  62. static volatile int irqraised2 = 0;1 E. t5 T  g! C/ |7 A6 ]

  63. ; N; I4 X" D; x" l$ f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ~1 h9 W- y4 ^0 B1 Z& `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % g8 c3 Y6 d; q& E! e& o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 k: I! w: E. {6 e
  67. & h( |" X2 r, R- j% P/ Q' H! U
  68. dma_addr_t dmaphyssrc1 = 0;$ E: t5 X3 s/ e& n: X# C
  69. dma_addr_t dmaphyssrc2 = 0;
    , `( g: v0 S# v
  70. dma_addr_t dmaphysdest1 = 0;# N1 M$ r/ f) Q
  71. dma_addr_t dmaphysdest2 = 0;. F8 j$ S+ H% A0 P

  72. $ f/ Q4 e- k6 \+ |) ~
  73. char *dmabufsrc1 = NULL;5 o+ d( y6 j7 w8 |  ]& P
  74. char *dmabufsrc2 = NULL;: o0 A: V  D  v3 F" E
  75. char *dmabufdest1 = NULL;
    % g0 l+ M  \0 Y; W4 F4 f# L
  76. char *dmabufdest2 = NULL;8 z) u/ N3 b! r" M3 ~' C8 X

  77. , |  E, }- G6 E# g, w- N6 l
  78. static int acnt = 512;
    $ A  L4 w: q4 X
  79. static int bcnt = 8;0 g& o+ l9 }. @" T/ t
  80. static int ccnt = 8;
    & b# c1 D' L2 g! u. L

  81. % T# |4 _& O  P  P+ W
  82. module_param(acnt, int, S_IRUGO);
    , t+ ]# ^0 {7 c7 i7 X" A5 B
  83. module_param(bcnt, int, S_IRUGO);9 p' J6 p, {( O1 O  e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# Y+ s; k- u% \; x: f, d& A* ^& s$ |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- t$ w5 ^1 o5 N8 L+ B' x, `4 parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; G% {5 s& c6 e$ J4 i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: V1 V/ Y) l+ _0 b, o3 |6 O8 X" ]0 a$ n, f! D! W$ W$ s- o# G
. e" u# l5 S) O5 G. W1 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 12:49 , Processed in 0.039803 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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