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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 @# C$ d1 V$ C7 w1 R
  1. [code]EDMA sample test application
    & Z6 r( s! x  L! Y$ w+ g& R
  2. /*& K- Q3 S1 T. W7 H$ j
  3. * edma_test.c- h" S' W. ~, Q4 e
  4. *
    : P% n6 A( }, s( Z
  5. * brief  EDMA3 Test Application6 V5 E) L! o' }% }# j
  6. *
    ' S) h# R' H5 {
  7. *   This file contains EDMA3 Test code.8 p% k+ \+ l" D
  8. *
    0 Q* ^, C4 f# O: ~' M+ r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ P+ v9 w9 T) ], w5 f4 C7 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : A6 J8 H2 C" M" `
  11. *         TO CHANGE.) O) J6 T  N# N+ D( a9 ]
  12. *
    . J' i4 _4 h. |( T) q" O1 ^- n2 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ R( |* T9 n7 Q3 ^& `9 }$ q
  14. *
    3 i, \4 k8 h8 X7 _! l8 ]6 W# B
  15. * This program is free software; you can redistribute it and/or; T0 B# J9 r8 S2 }2 l4 a5 W; R
  16. * modify it under the terms of the GNU General Public License as/ ?  S8 b! K. \9 X$ q3 o! N
  17. * published by the Free Software Foundation version 2.# e4 w) y) T" ?, y7 C
  18. *7 K: }3 X, ~  s/ l4 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / n* x1 q7 ?, i* w' @8 k" w
  20. * kind, whether express or implied; without even the implied warranty: E( D9 w1 A' y# H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % E& ~, `8 \+ `' t! y9 e
  22. * GNU General Public License for more details.
    " A6 f/ n  G. U/ L* s2 D9 c
  23. */
    7 A1 A4 [% b1 v5 a  a" z

  24. 4 l  d* x# R1 g. n# V) X: o
  25. #include <linux/module.h>
    : w  h, k) \  b6 m# a% }; v
  26. #include <linux/init.h>! Y8 F8 _+ F5 c# K& w
  27. #include <linux/errno.h>5 M0 J7 B9 B. U
  28. #include <linux/types.h>  X* @+ l5 c9 O$ b; D' A
  29. #include <linux/interrupt.h>
    2 O0 K9 X, f- f* m. I* e/ D3 [# c
  30. #include <asm/io.h>
    + t- c# J* b$ }
  31. #include <linux/moduleparam.h>
    * ?. C/ a- N9 O
  32. #include <linux/sysctl.h>0 S0 \+ {/ O# J4 h) ^5 W4 z# H
  33. #include <linux/mm.h>
    7 c" Z( @; u- L
  34. #include <linux/dma-mapping.h>
    % q6 p8 c2 X4 A

  35. , P& [* J: n0 O* S
  36. #include <mach/memory.h>
    , x, j4 W  e: G- ?( _) K
  37. #include <mach/hardware.h>
    2 u& j5 X- d  `  D6 y1 u
  38. #include <mach/irqs.h>
    7 B1 f2 ^7 U; W4 B3 V1 t
  39. #include <asm/hardware/edma.h>
    6 G2 Y3 W/ y# E$ g  f

  40. : N1 P$ v9 e" i6 j8 Z4 M
  41. #undef EDMA3_DEBUG( e! O9 R8 v) i8 q- P
  42. /*#define EDMA3_DEBUG*/
    * b3 q0 `5 }7 h0 I) Y5 N
  43. & X0 k: l3 `6 O! Q0 f  V
  44. #ifdef EDMA3_DEBUG/ R8 p+ |* R) W/ r2 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' s$ @; {$ W+ {6 d1 h6 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % k; \, `) c  l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ |0 x2 {- T! H- W% `) ?$ W
  48. #else
    , G6 k4 T, w5 }1 A; j2 f
  49. #define DMA_PRINTK( x... ), T, R, O) M. C4 H
  50. #define DMA_FN_IN: c& o$ A% i% W! D- G- s2 f3 [& ~
  51. #define DMA_FN_OUT, d; Y. V0 U. _5 n2 c
  52. #endif
    5 N7 s. {: P0 R: L; O7 f1 x
  53. ' g. D, O* @6 I* D, A1 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " Z7 ~# \( l+ W* p! B+ t' |
  55. #define STATIC_SHIFT                31 W  {! @8 H" l# x. P  S' H9 e
  56. #define TCINTEN_SHIFT               20* U% _/ P: ]* E3 O+ L8 c) R3 P7 X
  57. #define ITCINTEN_SHIFT              21
    . P% a$ k, }  B6 k, Y4 D, M# `
  58. #define TCCHEN_SHIFT                22$ W  H7 F0 K: J* j+ R( E& d
  59. #define ITCCHEN_SHIFT               23
    $ E9 O/ o; U+ n( G) E

  60. 1 y& e% l( d0 G7 l: m
  61. static volatile int irqraised1 = 0;
    6 n, B$ U1 g1 }1 \( E1 S6 Z  W; H& y
  62. static volatile int irqraised2 = 0;1 g( C* n& k+ {& P
  63. # U9 ?6 P  A0 x, b) a! ~- k7 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* g% B' }- {% D) s6 y3 c1 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! o+ \4 M2 V* h- }$ }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 J- u5 f8 F* W7 I- n' D& J! r

  67. $ z* m, ^1 |! Y
  68. dma_addr_t dmaphyssrc1 = 0;8 V) X- j: ]" ?  h
  69. dma_addr_t dmaphyssrc2 = 0;8 V8 O6 c' y2 g
  70. dma_addr_t dmaphysdest1 = 0;
    4 J' K0 d& n, K5 L! d+ m
  71. dma_addr_t dmaphysdest2 = 0;: A. S3 n: Y% @/ }, D& t

  72. 5 `  z1 }7 u) D" T! E+ `4 a2 L
  73. char *dmabufsrc1 = NULL;
    ) M0 ~* ]0 G# U- i  K9 a6 g
  74. char *dmabufsrc2 = NULL;$ A+ v, }; P. U! z% N( f" J
  75. char *dmabufdest1 = NULL;) H2 d) v& e, b3 b2 K8 Y# H1 l2 E
  76. char *dmabufdest2 = NULL;
    - N$ O" ?1 G3 {! k% o
  77. 0 u. g9 v8 @+ i* E
  78. static int acnt = 512;
    0 q* b7 \4 T5 `  d, k
  79. static int bcnt = 8;% h5 R# y- N5 x5 o, _$ B
  80. static int ccnt = 8;
    2 n$ L6 {8 t9 I7 W; b5 L4 B8 ?" O( x

  81. - k. c& Y/ G3 R  f/ e9 D
  82. module_param(acnt, int, S_IRUGO);4 E1 X* D: m/ x
  83. module_param(bcnt, int, S_IRUGO);
    1 K; G# D+ K( g2 e0 X8 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 C" b2 K, x  F) p% _* P7 _
5 H( o/ D; G: S$ W& t0 |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, p! E+ n; T, karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ {7 a' `5 x5 _# `* i, r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) k4 U. j9 m. A( b7 n5 B9 B$ V: \
! W( `3 F1 P8 q7 b2 {3 J' X6 g6 m6 h/ g$ ?& i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 08:59 , Processed in 0.042735 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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