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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 U1 M' W$ h0 J8 @
  1. [code]EDMA sample test application
    ; q# N; ~6 Q6 S( W
  2. /*
    ( |, B1 K6 }3 N; x* X; d3 H
  3. * edma_test.c2 A; l( E, a6 _  T
  4. *- n1 P: p5 W7 S& F! a* F5 }$ K9 Z
  5. * brief  EDMA3 Test Application- b: N0 k( R. ~9 g0 Q3 h( N& l/ W
  6. *% }* B  f) ^. H) Z
  7. *   This file contains EDMA3 Test code.- E! q1 W5 f) ^$ l
  8. *' p0 }4 q  \% E2 D. O+ Q: a3 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 R. L. v5 d9 w$ p& u( v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* m9 s6 `; }, q. D1 w$ R
  11. *         TO CHANGE.
    ! s7 Q' v3 v# x  C8 Q$ p6 v  V
  12. *. l" m9 g2 Y7 E. Z0 O, w. s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- U: e+ u9 j. L' O3 S
  14. *3 X' a( ?" R0 h1 r+ N( H  x% a
  15. * This program is free software; you can redistribute it and/or  k8 Q; d* Y* Y$ X
  16. * modify it under the terms of the GNU General Public License as$ X, h/ H! p7 Q4 g9 T  R: k
  17. * published by the Free Software Foundation version 2.' b- d% S3 l( ]6 U, u
  18. *+ _. u  q! A6 T$ S8 K6 Y" w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  B3 r7 M  I, B, Y
  20. * kind, whether express or implied; without even the implied warranty/ T( P; g8 [' B! ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / N2 G, A" [/ I0 u- X) l! V
  22. * GNU General Public License for more details.  Q  z/ [8 i! Q+ ~1 K- X3 O
  23. */
    : P4 x7 F; P& l7 U- F: r4 T8 V) S

  24. 6 y, g) ~. L) G1 L
  25. #include <linux/module.h>$ C9 k, P5 F  u3 ~* c$ C9 f% `
  26. #include <linux/init.h>
    2 D, p# s0 ], z3 W' M' n
  27. #include <linux/errno.h>( d4 X( x! V8 x- K
  28. #include <linux/types.h>
    7 @/ W( |  o, b) J# M' v) [
  29. #include <linux/interrupt.h>+ n7 c  f8 x! L8 N& T
  30. #include <asm/io.h>( x$ q3 J' U) g
  31. #include <linux/moduleparam.h>; I$ u4 f# e2 y7 [4 m& S# D0 t
  32. #include <linux/sysctl.h>
    % n/ j& E, i5 B0 T4 W5 o" K5 J9 P
  33. #include <linux/mm.h>! Q% [; ?/ W! W/ O% P
  34. #include <linux/dma-mapping.h>  U5 z( Y9 M- ]: N

  35. ' R5 A6 w' a6 X2 R' Q
  36. #include <mach/memory.h>
    1 u2 F( m% v5 R1 |/ A
  37. #include <mach/hardware.h>0 Y. }3 @( _6 S( {7 X+ [% e- z
  38. #include <mach/irqs.h>- h& x# [6 J/ I+ c5 |
  39. #include <asm/hardware/edma.h>
    * `4 k/ p. I- H8 D- M- x: f
  40. ! v8 ]+ L, Y6 O& F. }4 a
  41. #undef EDMA3_DEBUG
    + c  A% c! @; x) c# P
  42. /*#define EDMA3_DEBUG*/
    5 X% h+ C6 u; B6 J. e$ N! F
  43. . h  j! S( Q, d, N
  44. #ifdef EDMA3_DEBUG
    / F. W3 l; n4 z- s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! [+ s" k8 u* c3 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) v6 m7 a  s( r$ i# h2 }) C* u( C$ J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): Q1 A$ {6 \) G4 T1 w- a0 e
  48. #else
    6 M/ a3 b& v4 {& c3 M0 ]7 i
  49. #define DMA_PRINTK( x... )4 M8 G4 K+ H. g$ b
  50. #define DMA_FN_IN8 ]- O, X$ ^# ~: X1 J( B8 j
  51. #define DMA_FN_OUT* v4 e" x5 [# u/ _, q5 h
  52. #endif4 j5 F' v+ ]; D. }5 e

  53. 8 F, u4 T5 H1 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & N& [  w9 `. f3 e9 D, A  J
  55. #define STATIC_SHIFT                3" C) \4 |( e1 g0 T8 p
  56. #define TCINTEN_SHIFT               20' p* T2 y+ B5 A. k1 r
  57. #define ITCINTEN_SHIFT              217 f( H- H4 b0 g% ~% F
  58. #define TCCHEN_SHIFT                22+ |; D: a! s( U* {( G+ @
  59. #define ITCCHEN_SHIFT               23
    8 e2 |' [6 w7 |7 ~( f

  60. % G# U2 H3 x: _- J1 m" H7 I
  61. static volatile int irqraised1 = 0;7 L5 R3 @- _. ?/ K: b2 y
  62. static volatile int irqraised2 = 0;
    . }  X. R8 O! U9 q; @7 `3 D% a
  63. 2 C# ~  k& I6 X- b8 |) s" ~/ m) Z: x5 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. \. e: ?3 ^3 u* ?3 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ S* ]. A) g" Q  l: \/ |& }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 @! n7 q% D8 t+ o% k; P) o7 S2 V3 S

  67. 9 ]7 P6 b$ w* g
  68. dma_addr_t dmaphyssrc1 = 0;
    0 D2 F/ J! {2 p
  69. dma_addr_t dmaphyssrc2 = 0;
    4 E6 |2 u5 G5 ]
  70. dma_addr_t dmaphysdest1 = 0;
    & ]7 v. i0 r( `7 @# y; p
  71. dma_addr_t dmaphysdest2 = 0;' M5 @3 h2 `' \( U/ `; }' b
  72. ) V+ I+ o" l# L' z
  73. char *dmabufsrc1 = NULL;8 s' e5 l0 l5 {
  74. char *dmabufsrc2 = NULL;/ Q5 M0 c0 i- Q
  75. char *dmabufdest1 = NULL;+ ^0 H/ E" V  }: r2 v
  76. char *dmabufdest2 = NULL;% C- z- m" Z" D4 _9 R

  77. $ A$ s, ~0 C1 E8 v% B
  78. static int acnt = 512;2 V% h8 j6 a2 a8 p# g
  79. static int bcnt = 8;6 a# Y" Z+ I$ A
  80. static int ccnt = 8;! [- f; H. g( S& Z! U: S# R9 p

  81. $ A: {- d6 z% ~5 L
  82. module_param(acnt, int, S_IRUGO);
    3 [0 `* Y5 ]' e2 ?; ~8 \
  83. module_param(bcnt, int, S_IRUGO);
    6 D1 p+ ~+ z! _7 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% d& M; P* ]! t* U& ~* m+ h7 \8 m  M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, `% H( z8 v0 G, v8 }% iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 R' d" c( {/ H# L( p; ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) l# J4 c; j& t0 [$ q$ _. W3 L; s8 l* h% a, z# G

+ H0 z( ?) L  {% X* f( m. m7 Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-20 07:33 , Processed in 0.039701 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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