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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 Q6 s/ g" m: d) O
  1. [code]EDMA sample test application
    3 [/ S* R. Q  w* J  @- q
  2. /*7 R1 c+ \8 V: l* z
  3. * edma_test.c
    3 F, e$ l6 W' r) W) h( T
  4. *; I6 o3 X& \4 }: ^7 o
  5. * brief  EDMA3 Test Application8 U& `9 H/ }( R
  6. *
    - c. ~) l7 U0 L5 B. f; `
  7. *   This file contains EDMA3 Test code.
      H; {1 V- z$ J! F7 k# \
  8. *  p: S. y9 p2 \8 [* ?# ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 a' ~- l; _' f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* j( y; `0 b7 m2 t1 H
  11. *         TO CHANGE.
      ?, F; e8 n# b1 E( W! G
  12. *& T$ s# X9 n6 N+ I$ {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, A' F$ x; Q1 q% \% ?5 @
  14. *
    & Q) `. ?1 f( ?& X! b9 {+ D% e
  15. * This program is free software; you can redistribute it and/or
    & E: q5 c) o  {9 |! Y" @$ r  M
  16. * modify it under the terms of the GNU General Public License as
    & H: H) q  |" [' I* n( y1 s
  17. * published by the Free Software Foundation version 2.. U" h6 j& n% y% n1 q. |
  18. *1 N; e8 |) Z' }, N" O; j8 X; y0 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, J* n. }  v: ]% r& \
  20. * kind, whether express or implied; without even the implied warranty
    $ O' b) D. _6 N; q& V! ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! x9 O3 O, C5 g
  22. * GNU General Public License for more details.+ r7 a& V" e0 b. {# s8 C
  23. */- x7 i# E7 t0 v: M6 S6 q
  24. 1 o7 V. @$ w- |. y% b" d
  25. #include <linux/module.h>
    " F: c" |* x+ F/ T: B2 o+ I& j
  26. #include <linux/init.h>
    : x8 F+ o! e9 P( E0 F
  27. #include <linux/errno.h>
    ) b( P$ k; s2 B. ^& r$ Q7 j
  28. #include <linux/types.h>
    ) M' h4 h; {4 e  o4 |4 m  y
  29. #include <linux/interrupt.h>* X' O8 z3 l; d# o; M
  30. #include <asm/io.h>
    5 X( C1 X  z# E# _
  31. #include <linux/moduleparam.h>* U9 G" B. Y2 I, t
  32. #include <linux/sysctl.h>8 y7 w/ J6 h4 D+ l* C2 w
  33. #include <linux/mm.h>) T6 d" x3 t! h
  34. #include <linux/dma-mapping.h>
    2 a  {- e) L  d; k8 R

  35. 5 o6 b4 D: {! z+ v) J- [& v9 v1 W
  36. #include <mach/memory.h>
    $ n6 j9 y, m9 n% o
  37. #include <mach/hardware.h>
    1 ]+ w0 T: A% p! E. Y1 v9 P
  38. #include <mach/irqs.h>
    & P. d! L" `% Y
  39. #include <asm/hardware/edma.h>
    4 C  O' G+ ?# y- {4 o
  40. - j6 E/ l' T/ B7 z* s" K
  41. #undef EDMA3_DEBUG( F5 J8 J$ M. W! F- N! a+ m
  42. /*#define EDMA3_DEBUG*/1 t: u, W+ p/ D% o& ^
  43. % a# B( c" _! e
  44. #ifdef EDMA3_DEBUG
    5 @$ F& ?2 I" p  K8 U+ }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 X, X- a+ G3 O' a( F' g7 r& Q  \- N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' J* w  i' s; i' C* g. M8 W, w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      i& N: W+ b* n6 Y( }3 \% w
  48. #else
    2 A4 J/ L; Y' I9 n4 c: D- E
  49. #define DMA_PRINTK( x... )
    / Q' a+ A  L6 h$ B9 X
  50. #define DMA_FN_IN
      G3 M9 X  G% b9 e$ r0 ^; X5 i9 {
  51. #define DMA_FN_OUT# V6 s7 x! i7 k- q
  52. #endif
    * D" @$ L) _4 _. o% J

  53. " \& C8 S7 ]' Q& w' B8 K8 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 ~8 j" G% P5 ^
  55. #define STATIC_SHIFT                3' X  n  u+ q: A/ ]& V3 L
  56. #define TCINTEN_SHIFT               20
    ! j) c+ W/ x" Y! Y/ [' w- N
  57. #define ITCINTEN_SHIFT              21
    : {5 ?  f( O. z2 f
  58. #define TCCHEN_SHIFT                22  b0 i7 o2 g: B+ {
  59. #define ITCCHEN_SHIFT               23
    1 R" G0 ^5 d- U5 l8 Q+ ~0 Z

  60. 6 E9 Z" c+ T; h: n
  61. static volatile int irqraised1 = 0;  }3 f9 N0 m# E
  62. static volatile int irqraised2 = 0;
    # q6 T- Y) N" K3 C

  63. ' @. h. r, L* _/ A" w; D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 q2 h, k/ v6 `- N2 v4 S8 O1 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 @- W$ R$ [  E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + \- {; y1 ?- A8 c

  67. 5 {4 a. I  J  t4 ]- j, s& V+ [
  68. dma_addr_t dmaphyssrc1 = 0;
    , i5 w2 S- ^3 x6 |1 n
  69. dma_addr_t dmaphyssrc2 = 0;2 ~& q3 R* n; y1 i
  70. dma_addr_t dmaphysdest1 = 0;6 o$ V& A8 ~: D7 h) |) H! x
  71. dma_addr_t dmaphysdest2 = 0;
    ( u9 j) H9 p! K$ ~
  72. 5 Q3 S. B% n/ S) A5 S9 f& u1 G
  73. char *dmabufsrc1 = NULL;
    3 v0 t9 R* h/ ^/ F, K
  74. char *dmabufsrc2 = NULL;* U0 k  K2 u3 N, c8 [: x
  75. char *dmabufdest1 = NULL;
    2 P1 r7 D/ }; c- t. }1 G' k( ?
  76. char *dmabufdest2 = NULL;
    ( D9 K8 g* p$ f( @# r. J+ d
  77. ! ~& @4 T, M! r. m/ [. ]
  78. static int acnt = 512;) I! n! q, U; ^
  79. static int bcnt = 8;: K- o6 F0 \* ~  `4 V& f
  80. static int ccnt = 8;  z) C" O; F/ _( V+ W3 P
  81. ; O8 x2 h, Y+ _2 l5 J6 g
  82. module_param(acnt, int, S_IRUGO);8 X0 P! D4 _0 o4 J6 P
  83. module_param(bcnt, int, S_IRUGO);
    ( g. f1 t& l+ N/ _8 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, Z% Z( z$ A9 C, c3 w
( P. r5 K, x; {2 P0 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 I5 k3 l+ w" Q6 k# ]; v; ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! e: w! v6 T2 X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! b( B; a: k9 G* z* r/ F3 K8 ]! H
: T2 }" g- W- M; ?- v
6 x+ z8 L/ q; X- b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 12:54 , Processed in 0.044069 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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