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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 j4 M; A1 T% B
  1. [code]EDMA sample test application
    $ w, _! o- q% B# Q' C1 G2 r+ w( {
  2. /*7 J& Y" T. E* |/ O# g1 R! W) n
  3. * edma_test.c
    ) O, x  P, s2 \4 V7 v
  4. *+ U2 O8 g. b! A. a  B7 h* N. q
  5. * brief  EDMA3 Test Application
    ! E7 @; E3 {. U5 j- I7 X
  6. *4 i; f7 d% a8 r& T  T
  7. *   This file contains EDMA3 Test code.
    # m+ I$ ~5 m9 m! S4 X  X
  8. *6 X# F/ F0 ~! L1 ^' n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 ?. ^6 p, E5 X+ ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( {  i& C% {& e+ ]6 A- h
  11. *         TO CHANGE.
    4 n' M8 F/ g: l, E
  12. *, h( w' z$ y, r  V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 b- z+ ~3 m! f5 P" ]5 J6 A; o
  14. *
    9 r7 ]* X. r. I3 U+ B6 |* x
  15. * This program is free software; you can redistribute it and/or
    % Z: m* f3 }, f5 W5 F/ k( G. @( a; i
  16. * modify it under the terms of the GNU General Public License as
    . ?. [( {' ^: v$ o
  17. * published by the Free Software Foundation version 2.; D) o; g" F( x9 E+ g
  18. *# w; y2 E$ O  _2 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( _: _$ X/ Y! P' h1 o
  20. * kind, whether express or implied; without even the implied warranty
    6 n8 i7 j8 @  f# ?, P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * K: `" T7 a5 n7 |/ Q& h; ?
  22. * GNU General Public License for more details.9 q2 y1 W% N1 Q9 I
  23. */
    3 X( H  b+ J9 P9 g) w) o
  24. 0 P& N: ^* z% Y. [( k
  25. #include <linux/module.h>
    ! e1 @" d5 ~! l. _0 ~; ?1 j
  26. #include <linux/init.h>
    2 `! {# C9 _6 W
  27. #include <linux/errno.h>7 a6 h: A) \! ~; U' H( \2 y$ W
  28. #include <linux/types.h>6 |  _* }7 N7 I, p  T
  29. #include <linux/interrupt.h>  o" |0 s1 W( i: o! O" S
  30. #include <asm/io.h>
    8 y, c) [* K) K" d" b2 t
  31. #include <linux/moduleparam.h>* W: j' _8 a- V, E# h7 D
  32. #include <linux/sysctl.h>
    4 B  h- Q# @6 n$ ^
  33. #include <linux/mm.h>- B/ h' @* S) X8 \. {. C3 `5 ]
  34. #include <linux/dma-mapping.h>$ i" j# o8 \4 f1 T

  35. / N* E) ~. T) Y2 T0 g
  36. #include <mach/memory.h>& {  _' z, P4 S1 w* x
  37. #include <mach/hardware.h>1 B- f1 V; B. S+ }
  38. #include <mach/irqs.h>* ^7 a; j0 z* @# `2 G3 p6 U
  39. #include <asm/hardware/edma.h>
    ) Z4 A$ a' I) p: l# m

  40. 4 T. c* f+ N! l6 }# Q/ x
  41. #undef EDMA3_DEBUG
    8 J& E% _9 ?* a* q$ {2 s& E( N
  42. /*#define EDMA3_DEBUG*/
    3 N  P8 R7 `* h; N3 t+ J# o
  43. + c) h5 F& \. S5 d
  44. #ifdef EDMA3_DEBUG2 ^3 W4 }2 b* T7 T4 n; f8 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): {1 p. Q, P3 N: B+ Z( S7 E# ~+ Z" G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). o4 t5 Q2 D- J! D# U1 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* M: t( q- Z) K) ?! e6 S, C
  48. #else- \% _# j+ v: g
  49. #define DMA_PRINTK( x... )0 U3 C; L3 M7 O4 `
  50. #define DMA_FN_IN# J4 H# Q- R7 `& Q4 F( J4 B  e
  51. #define DMA_FN_OUT
    ) z6 |& P# I3 I- u$ B
  52. #endif8 d3 a5 l3 e! A! a/ x

  53. + n& B( o; f! R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 |* G' M8 A/ D9 z
  55. #define STATIC_SHIFT                3. [6 t. b7 K: q0 o8 C1 q4 g% h
  56. #define TCINTEN_SHIFT               20
    ) z& g! Q- r" _) n8 A- @
  57. #define ITCINTEN_SHIFT              21; p* [  S% i1 A7 P0 |
  58. #define TCCHEN_SHIFT                22
    9 x  w9 u' S9 v3 S0 t3 w+ f
  59. #define ITCCHEN_SHIFT               234 B) k/ n0 N$ \8 ?6 f
  60.   Y- o* j5 G5 y/ B( U: I" {
  61. static volatile int irqraised1 = 0;
    6 \% \- i; a" c1 T/ x
  62. static volatile int irqraised2 = 0;% X( j: U; r' V+ m; p

  63. , n& E0 `) W3 B1 @6 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ p& C* P4 z3 m9 e) C* }8 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( f1 K/ g- _2 I0 j  K, `+ m9 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; S  m8 u/ R8 h
  67. , V# Y* q+ x% Q) q3 k" J8 o- @* `
  68. dma_addr_t dmaphyssrc1 = 0;. j1 e5 L  }+ \" v
  69. dma_addr_t dmaphyssrc2 = 0;2 W' w* u+ A% {4 y. Q& P: ~! ?5 z# _' u
  70. dma_addr_t dmaphysdest1 = 0;0 E5 z$ B- \9 K
  71. dma_addr_t dmaphysdest2 = 0;
    1 S- u1 ?: z1 Q7 u; k4 O: n

  72. ( H. W& A, J& F0 l
  73. char *dmabufsrc1 = NULL;( L4 y, K+ r" M4 C
  74. char *dmabufsrc2 = NULL;
    1 Y# s8 D; ], @3 G; d7 x7 S, M, ~
  75. char *dmabufdest1 = NULL;
    ( j7 l/ m1 v: i: K+ d3 j
  76. char *dmabufdest2 = NULL;
    ! }/ E: m8 ~' ~" W: K) k

  77. & D" m2 U, H5 E6 x+ H9 N% x# M
  78. static int acnt = 512;% I  i' N: d! |# h
  79. static int bcnt = 8;
    5 F  R2 ~% w, o, ~! j$ U
  80. static int ccnt = 8;
    * L) u$ ~8 T  t8 x
  81. % {; Q7 Q6 }: L3 u/ D, [& c* ^* c
  82. module_param(acnt, int, S_IRUGO);* g/ W* d4 a: A: S1 F) ?
  83. module_param(bcnt, int, S_IRUGO);
    : ]3 r2 O$ Z" h* C# D' E" N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ G# V) g7 h5 ^# F$ z5 b, O
# h* E" N6 @% R) \& G1 P: g; @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# {- d# H$ Y5 I5 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ H% Z# M! i3 ~( l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 q' q7 i0 k5 C$ A" _) i6 U% C6 L! W

  k/ w9 E; y1 @% H8 c* I0 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 19:54 , Processed in 0.040533 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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