OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- E" E' [" |# M9 m! q) O" x
  1. [code]EDMA sample test application+ q4 j  e0 }+ X
  2. /*- d' q) m9 [6 l' `3 T* J$ W8 G
  3. * edma_test.c
    ! ~; m9 m& L3 `; W
  4. *
    ( J8 Y9 D: a% R; d2 ~) }9 R
  5. * brief  EDMA3 Test Application+ m" P3 \; P: W$ L% ^
  6. *3 ~0 v- m9 b5 I" o" c5 q, z3 a! `
  7. *   This file contains EDMA3 Test code.' L! i/ ^0 M+ i& C3 U, O5 z: N
  8. *
    7 |/ ~# A; ^' x# h& w+ w, d4 `$ r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . \( z9 f& i" f1 a: M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% t$ N" h3 p5 \, F7 h, @8 z
  11. *         TO CHANGE.8 B8 v5 y" k, ~  c
  12. *5 B. C* N/ b" ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 }9 k+ q: v5 h! A# P# I
  14. *
    : ?/ h+ m5 Q/ y2 M* B
  15. * This program is free software; you can redistribute it and/or) T2 m- D+ a0 W$ l
  16. * modify it under the terms of the GNU General Public License as
    ! I3 Z$ a& o6 m+ X$ p  \
  17. * published by the Free Software Foundation version 2.( N3 A' v/ N- h, T3 P
  18. *3 b' q" {+ D$ w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / }6 H0 s% B, g! G5 y/ ?/ u
  20. * kind, whether express or implied; without even the implied warranty
    + u  d4 w6 G$ `, B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( u& F) N# ~6 j* z
  22. * GNU General Public License for more details.
    7 D1 l! z( X! N) G  n5 E
  23. */1 W% ~% ?* i1 ?' X: P

  24. 0 Q: [: Q8 f0 v* X" c
  25. #include <linux/module.h>0 e1 b0 m6 B1 R! i! A/ \7 A
  26. #include <linux/init.h>/ |& B) ?- x. p; [
  27. #include <linux/errno.h>
    - C/ T; j- j1 s. A/ f0 j3 U  w. r
  28. #include <linux/types.h>
    ; s, u& {0 l. l8 Q3 N
  29. #include <linux/interrupt.h>
    & e. o4 F) d9 d4 O( r' m  ~. B
  30. #include <asm/io.h>) D: g4 ~  R. r# z
  31. #include <linux/moduleparam.h>  ]  L( ?# ]9 b: Y+ J% u+ |5 ^
  32. #include <linux/sysctl.h>
    6 T! p$ y4 c" l- h% t
  33. #include <linux/mm.h>
    4 Q$ X* W/ ?8 ~. T
  34. #include <linux/dma-mapping.h>5 X$ Q. [( R- ~- w( F7 _, _

  35. 6 _  C) [# _* ~6 [3 X, x
  36. #include <mach/memory.h>
    ) y0 _3 x1 k9 r. n' l
  37. #include <mach/hardware.h>
    # ?, r9 c1 A; _' r6 p2 W
  38. #include <mach/irqs.h>+ m4 i# l* R2 @6 O' w; [
  39. #include <asm/hardware/edma.h>
    % ?! ~, x/ ]0 E6 E: x
  40. ) s: [' e3 d/ S5 P& l& d- j
  41. #undef EDMA3_DEBUG
    " H. G: o( D  M6 F3 J
  42. /*#define EDMA3_DEBUG*/
    5 m5 A0 A8 n/ p0 }
  43. ; e  ^5 D  U* \) k3 S
  44. #ifdef EDMA3_DEBUG% b  I1 q" ]2 a2 v1 ]8 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( A( w, U# l# c7 M( J* w0 b( G' S; q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 R! H$ k# @  l+ D2 \) G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , v" T% v9 V+ G
  48. #else# \; i$ T$ C6 X( f+ i$ p& n) \( h
  49. #define DMA_PRINTK( x... )4 z& T# x7 x0 O) ~0 k6 J
  50. #define DMA_FN_IN
    / I! U3 S4 }/ A! L+ n
  51. #define DMA_FN_OUT
    1 y# J4 Y$ i: j: k& w, I
  52. #endif
    ' F6 C, S$ C' d+ E0 {& H

  53. 8 ?2 Y! r, l/ b. S* `$ g0 ?5 _; @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . H1 w  V0 u9 e* a) Z. C
  55. #define STATIC_SHIFT                3; p8 p; ]7 A7 h& U
  56. #define TCINTEN_SHIFT               20
    1 ^4 K8 M% m9 A2 T1 K. S# p" Y2 a
  57. #define ITCINTEN_SHIFT              21
    6 _, @* r( L9 N2 D- f' R9 O" M% E
  58. #define TCCHEN_SHIFT                22
    4 H/ `$ G5 O. y, ^; M. m
  59. #define ITCCHEN_SHIFT               23
    * h# O6 |  S  S% H

  60. ' u; T2 E+ l% t: e6 C& C# c
  61. static volatile int irqraised1 = 0;/ t3 K% V7 f6 v( x) W# [
  62. static volatile int irqraised2 = 0;3 v$ U5 L: t$ Z5 _& v
  63. " Q  P2 D; o+ c/ n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! W1 O! C, C% }% ^) j$ Z0 J7 A/ z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 R2 X  I- [/ A3 v8 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & i! p& Q4 R5 R/ V, Q
  67.   H9 n; a% J" K) p$ c0 `
  68. dma_addr_t dmaphyssrc1 = 0;
    2 `) t4 E0 S$ L$ e2 M7 W6 Q
  69. dma_addr_t dmaphyssrc2 = 0;
    3 i8 D2 n  G5 D" @# E; T# U/ V
  70. dma_addr_t dmaphysdest1 = 0;
    ; {8 Q( z3 |+ [& M  r- E7 v8 b
  71. dma_addr_t dmaphysdest2 = 0;
    " d$ N* @& s3 p9 @% j

  72. 9 a! Z# [) f6 ]& n0 \# ?, B3 ^: t8 Q
  73. char *dmabufsrc1 = NULL;9 {( }. D* m; q' X
  74. char *dmabufsrc2 = NULL;! T! E0 F1 f. c9 }
  75. char *dmabufdest1 = NULL;1 L+ V" N! J  W; l1 V( y: H8 f! n
  76. char *dmabufdest2 = NULL;
    5 ~+ v7 i1 r( l
  77. : ]5 I" c/ N, T- t
  78. static int acnt = 512;
    $ G2 K) x, O# V
  79. static int bcnt = 8;8 f1 r6 t! Q# H
  80. static int ccnt = 8;
    4 X5 v( O4 {) R

  81. 7 p# m7 J7 y" O9 F5 r5 ^2 b
  82. module_param(acnt, int, S_IRUGO);
    ( l5 ~5 z& w" o) y# e( O# a
  83. module_param(bcnt, int, S_IRUGO);+ m# a& K6 ?/ v" X7 z, f$ ~; G& u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 F( M3 O  P8 [) ]8 M" _  z
6 y! Y& x" t: w) _" X* S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ c# j3 @8 U0 \% U) c& x+ O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, m! H% Y! Q& B; v2 \6 ~  [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# q* m6 C) t# B- H$ g
+ f: q! `- l6 G
# F$ T( ~) W$ A0 e+ \  _5 z2 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 11:31 , Processed in 0.041584 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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