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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. I$ n7 D+ c  f, L# V+ v4 S2 e# M
  1. [code]EDMA sample test application
    2 i" U* w, u" n( |
  2. /*
    , ~% j; g7 {3 t+ L
  3. * edma_test.c) l9 i0 |8 i0 O  n& l- u- N' Z
  4. *7 \+ c- C  N0 o( y7 K0 U: s
  5. * brief  EDMA3 Test Application$ `0 w$ _$ b6 m0 q
  6. *
    ( w- |' ~* V1 S. K7 a
  7. *   This file contains EDMA3 Test code.
    8 G& t5 f/ w2 P; \% ~
  8. *) t4 i+ s0 s. ^  \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 ~6 x4 P5 \' w0 V! D. l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; }- `9 O3 b# ]+ n/ C
  11. *         TO CHANGE.
    6 p" r" R, i' ^  e4 d6 Y
  12. *# p/ z1 z. C& E+ W: E, x- `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . }3 ^' c3 M" o# ?' V4 D5 i1 z
  14. ** E9 Z: p- u1 t7 q! D3 \/ D
  15. * This program is free software; you can redistribute it and/or
    - _2 G. Y- e! F9 L# `$ f& i1 E
  16. * modify it under the terms of the GNU General Public License as
    " |2 L+ S0 q, ~& }) w, \
  17. * published by the Free Software Foundation version 2.) ]6 m. j1 h' P" l5 j+ K0 W! e
  18. *+ o4 G7 g  W" E! @" ?( G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% c1 E/ j8 f  Y' z( n% L
  20. * kind, whether express or implied; without even the implied warranty! H$ K4 u% ?# x( b6 w5 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 V' e$ e! l# ]) @+ p/ i8 ]
  22. * GNU General Public License for more details.1 ]3 [" E4 v; O' O6 x3 A
  23. */
    4 y, j& R5 f7 c( q% L$ x& t, K
  24. / ]4 D0 ]: X. I* p# ~4 S) }8 k* A: c% v- G
  25. #include <linux/module.h>; g; j: a- W, J. h
  26. #include <linux/init.h>, g5 M5 ?* z( h! q( a7 y% n2 X
  27. #include <linux/errno.h>
    ' d- R, X  x+ G2 e: s" J% b& y
  28. #include <linux/types.h>
    4 l6 E! Y* Y+ m% J' ?
  29. #include <linux/interrupt.h>
    2 q8 a. ^% V+ n9 X$ p* I
  30. #include <asm/io.h>
    ( w7 y) S, ]: a" x
  31. #include <linux/moduleparam.h>+ d% V: E) r7 N
  32. #include <linux/sysctl.h>
    , M- p0 w) d7 v
  33. #include <linux/mm.h>3 a3 L0 o5 S! x) H* T9 P
  34. #include <linux/dma-mapping.h>- v. x% i% R5 y

  35. * k4 N5 y$ a8 _" n9 Q4 H. ~0 V' u
  36. #include <mach/memory.h>) F8 |) y0 }8 l. v# N% w
  37. #include <mach/hardware.h>
    9 p) i+ ~2 X1 L
  38. #include <mach/irqs.h>% x$ H: i+ y  |# O
  39. #include <asm/hardware/edma.h>
    ) q3 w. y8 G, Q: S5 _( i' S4 |% G2 L

  40. 6 q1 @. \. [8 c# U: ]
  41. #undef EDMA3_DEBUG' A1 G  r0 w/ u/ E2 Z% @
  42. /*#define EDMA3_DEBUG*/* z" \( c/ t, c" C4 a
  43. ) d$ E( W% x- u* T/ K+ p
  44. #ifdef EDMA3_DEBUG
    , ~7 i+ i) z; k8 H& B; {* C( `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# J2 G2 L7 ?* \' F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " J+ h4 S/ q3 x0 p7 W/ ~3 M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 k$ d" O& [6 V5 \/ t7 ~) W" G
  48. #else2 Y% x  A+ |, y' m
  49. #define DMA_PRINTK( x... )
    9 p! q! ]+ L, P! x  R2 G' u0 Y: R' P
  50. #define DMA_FN_IN' a, w! t1 u' Q! S/ _
  51. #define DMA_FN_OUT
    6 w  Q+ ]8 A* n, V' t' w
  52. #endif
    : R3 B* ?5 i* b/ D' h4 r! ]
  53. ; d* z) w7 P0 l* ~5 [  D8 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 ?8 ]8 K" W* Z
  55. #define STATIC_SHIFT                3
    0 z* n9 a2 G( a! R4 `# W
  56. #define TCINTEN_SHIFT               20
    : ^7 L. q3 j: e5 X$ B; b2 t
  57. #define ITCINTEN_SHIFT              21& ^- `$ f) ^1 M  T, O
  58. #define TCCHEN_SHIFT                22
    : D( y4 C+ e+ ^( e8 h( {
  59. #define ITCCHEN_SHIFT               239 l5 d  g4 E" D- l) a
  60. ! A- t. s  ]2 A* o. n: {2 l
  61. static volatile int irqraised1 = 0;
    * q& g; M: u% l( j% l' v) v
  62. static volatile int irqraised2 = 0;
    % i; ]7 x5 l" Y9 }$ P% a" Y4 Y3 Y
  63. . K. `4 W+ u& ?2 d" D) C+ S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( |; ?# |7 F3 P& G+ A  l! b+ K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  Y8 U. ?( Q( C' e+ X) R) T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 u2 V% o7 f  U7 r3 }2 `; u- a

  67. 4 r6 a; y  N- G
  68. dma_addr_t dmaphyssrc1 = 0;/ ?( g1 f% v. R% @( s
  69. dma_addr_t dmaphyssrc2 = 0;
    / J! x6 \8 c; r" K. Z, y3 I1 t. ]
  70. dma_addr_t dmaphysdest1 = 0;' w- v  r2 B! f5 q' M
  71. dma_addr_t dmaphysdest2 = 0;# Y( H/ r/ z- H) |& f2 t0 k
  72. 5 ^& S% o% s) X' N2 g- h
  73. char *dmabufsrc1 = NULL;
      S& Z- N% X: o' q# I: Y7 w
  74. char *dmabufsrc2 = NULL;
    $ l6 U/ e6 Z; V" y& S; b! D
  75. char *dmabufdest1 = NULL;
    ! h3 t6 x4 f' F8 b1 C
  76. char *dmabufdest2 = NULL;- J# u# |1 N/ \& b7 w3 u, e/ l' i

  77. 1 t" t  c- t. R  ?' j. B
  78. static int acnt = 512;& {0 U1 k" ~' @
  79. static int bcnt = 8;
    2 @! ]8 q0 n  Z/ g5 m0 t3 W
  80. static int ccnt = 8;
    ' [. m* |1 a5 r! o+ ?

  81. 7 W3 ^9 J+ T" O* ^3 c8 O
  82. module_param(acnt, int, S_IRUGO);
    : R3 O- [0 {, n* k# T/ _
  83. module_param(bcnt, int, S_IRUGO);* A+ |9 m+ f9 j/ T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) O1 C7 d, B" ]! B5 w

+ J9 Q! O1 n; B# A8 V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ [0 W0 z9 c3 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) d" J3 T: h" M6 i4 _8 V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ W" z9 t; |4 D" E
, I# I* c7 h6 R! @

3 f/ v  _( g5 ]; N7 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 12:17 , Processed in 0.038545 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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