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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 S. ?. [9 A) E
  1. [code]EDMA sample test application
    8 q. ~; T* _9 W. f
  2. /*
    : |( y% d: \- Z! r* V
  3. * edma_test.c6 C% u# A# l! ^# r; U
  4. *: z7 ]- m" W# [: k
  5. * brief  EDMA3 Test Application9 p1 _( }- ~+ V
  6. *. L0 Q/ Y- h- G3 r
  7. *   This file contains EDMA3 Test code.
    ' W6 a9 O  C& |( K
  8. *4 k6 Z2 I# P( B& x1 ?) x0 q9 a) e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; c4 d* ?  |, r0 t% R5 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' N/ y' J0 E! V7 C; o( x. m
  11. *         TO CHANGE.8 [. G, Y/ `) o6 a* I& y8 F2 o& }
  12. *% @- T6 K% X1 w# ~: E- t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 H" E7 {) V9 V' e/ G0 v
  14. *
    % D& Q3 m7 d$ ^. O, J8 F/ i/ @; ]
  15. * This program is free software; you can redistribute it and/or3 @9 C$ G2 J0 R5 G- a9 V$ F
  16. * modify it under the terms of the GNU General Public License as
    3 p( E  j# P  S3 n
  17. * published by the Free Software Foundation version 2.) c+ ?4 J' L$ d' S; K: q. d% n
  18. *
    2 I3 _7 s3 K" I& \% }* y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  A& w' P4 p7 K4 s0 r6 _8 D
  20. * kind, whether express or implied; without even the implied warranty0 ?9 H' i9 c0 X* i3 M: X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  v3 z* S3 S: T( N( a
  22. * GNU General Public License for more details.
    2 C! i5 \: o0 f$ X2 z
  23. */' O4 {7 ]  @1 b/ k% w/ n8 S" d% e
  24. # t1 v8 D( u' D# i4 ]
  25. #include <linux/module.h>
    7 H; a$ F' g. F6 h4 D
  26. #include <linux/init.h>
    2 s5 D2 R# E0 h$ Q( Y1 s
  27. #include <linux/errno.h>9 g& B7 Z) g; l' C! c, Q2 `
  28. #include <linux/types.h>9 R, o, j# A! s+ [6 l& l
  29. #include <linux/interrupt.h>
    & n) ~: B3 ~% _0 G% V3 R
  30. #include <asm/io.h>; T+ s/ n6 t7 @2 s" S
  31. #include <linux/moduleparam.h>
    , x4 r# U, o$ T+ P, ~
  32. #include <linux/sysctl.h>, `) Q" R+ n: j) c
  33. #include <linux/mm.h>
    , [9 Q: ?' M, U
  34. #include <linux/dma-mapping.h>. n  d- }% c) H( ?6 g2 y' Q
  35. 9 x  U+ `3 {3 o
  36. #include <mach/memory.h>8 S: F. F0 M* A" O
  37. #include <mach/hardware.h>  `6 _. f/ o$ `) v# i9 \
  38. #include <mach/irqs.h>* @5 p; c: k9 F
  39. #include <asm/hardware/edma.h>  x: o" T* v  k: |2 x
  40. , I$ q' X5 u$ w# I6 `( V
  41. #undef EDMA3_DEBUG
    0 ?$ A% b; `0 H( P6 N+ X* R  j
  42. /*#define EDMA3_DEBUG*/$ ]- {! ~' ^# e9 w, k. `

  43. + I9 d3 h' q* A' P
  44. #ifdef EDMA3_DEBUG2 o+ k. \" q4 v# }+ w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - }8 A* @' g3 z& a6 u+ W# k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ]0 P: S; `% s5 D$ f: }0 H) z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 s! \5 J( i! @( b: G3 o  _6 m
  48. #else# [% m2 w- n0 Q- [
  49. #define DMA_PRINTK( x... )
    7 h! \, k6 Z6 T5 q
  50. #define DMA_FN_IN8 }; b0 w4 t* ~5 I# R) k) Z" Q# \
  51. #define DMA_FN_OUT4 o" O7 c, l. ^. R
  52. #endif
      G* m0 d( Y, |" @7 k5 z+ j* _

  53. % f4 n: S# \3 R' ^2 @5 Y& K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; l) Z: ~7 t9 t  l- A
  55. #define STATIC_SHIFT                3
    ; M, B1 E, E. q6 J+ E1 }
  56. #define TCINTEN_SHIFT               20
    7 g' W" N! {' q4 @1 I  G
  57. #define ITCINTEN_SHIFT              219 p% E( a' W3 X% A
  58. #define TCCHEN_SHIFT                22
    ! F5 o, U% }  w, x" y
  59. #define ITCCHEN_SHIFT               23! S& M2 }% K" N* j
  60. : E; |6 D  }7 ~
  61. static volatile int irqraised1 = 0;: f$ ]  B2 P% a6 k
  62. static volatile int irqraised2 = 0;
    ! S- Q( {8 W1 U- w  G

  63. - h1 `/ _  c7 R; k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . h& n$ K8 K: p; J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , H2 ~4 K5 H& {2 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 p4 K1 D$ ?. C: I. W9 y
  67. 7 V% H- @; g7 t. \5 H1 @1 h
  68. dma_addr_t dmaphyssrc1 = 0;
    % u4 l8 }  D- ~' c8 ?' S. W
  69. dma_addr_t dmaphyssrc2 = 0;
    3 R+ ?6 G! ~- i6 n- D( \
  70. dma_addr_t dmaphysdest1 = 0;
    8 e& S6 o* w- c# Y* F9 V
  71. dma_addr_t dmaphysdest2 = 0;
    . M) T; g3 ?& M0 N+ p5 w( e$ `

  72. 9 C7 o- c/ |9 B/ X' W
  73. char *dmabufsrc1 = NULL;
    1 Z' {& J# H- `! |4 o
  74. char *dmabufsrc2 = NULL;
    6 V5 [0 y& }/ q5 ?
  75. char *dmabufdest1 = NULL;& q6 e) S& ~0 t( C
  76. char *dmabufdest2 = NULL;8 J- G. r6 ]( J; v

  77. * g( g; a2 ]- [* Q% |8 T
  78. static int acnt = 512;4 I6 Y7 L+ k( E" I- y4 T0 ?9 U4 Q
  79. static int bcnt = 8;
    7 R, ]6 |0 A- ^- v% v
  80. static int ccnt = 8;) L3 i. T, n) W" H: X
  81. , H4 F9 r0 N. z5 ^1 S; r3 s7 F
  82. module_param(acnt, int, S_IRUGO);
    ; m1 J- g1 a! b. V, c- u
  83. module_param(bcnt, int, S_IRUGO);
    + I; P$ ~5 G1 K; u- Y( x, {5 N- \, S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) J6 ?, r- M% k9 @) d# v6 ^" E, ~, ?( q1 [1 ?8 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% O. k* @. @( s3 xarm-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 J0 o& j% p5 u0 ~# ^' ], _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; V% r, r# T% U: ?! C, @" q; y
# `$ i7 q& G* t& v" ~# g# L* ?$ @3 ~8 U' V. D2 s( ?# Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 08:42 , Processed in 0.041238 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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