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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 y  Z9 b; j. q' X. f* R
  1. [code]EDMA sample test application0 y$ L- C  }5 a1 D- n3 Z
  2. /*
    , |  u6 _3 A8 i; b$ ^: [
  3. * edma_test.c' N( \. o5 i/ M0 X) C" M% p' ]
  4. *
    4 y% p& R+ s3 a& ~; q
  5. * brief  EDMA3 Test Application
    " p6 }# S) U( g5 ~  A6 r
  6. *
    3 ^+ d6 `9 [( M5 \
  7. *   This file contains EDMA3 Test code.
      S9 p' G- b+ r  }6 C4 g$ R
  8. *' V$ Q* ?! g: K+ h2 z1 c; {9 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 B* [7 K% Q* ]. l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + i. f% S5 \& ]5 M$ }  z+ ?
  11. *         TO CHANGE.
    ! Q4 M! Z  f/ P' M4 K
  12. *
    * X9 Y3 ?+ g. S6 A) J8 v7 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      g+ N# E( C! [! ^
  14. *8 n( p7 Q% T$ Q/ W
  15. * This program is free software; you can redistribute it and/or
    . B" J- G# ~4 c3 _1 ]: t
  16. * modify it under the terms of the GNU General Public License as
    2 y9 r9 y9 ?4 n6 G. k+ J
  17. * published by the Free Software Foundation version 2.
    2 z# n; m6 C9 Q) u8 J
  18. *6 G% M5 Z2 y6 d: Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 ?8 L4 r7 m0 y9 N( X) p
  20. * kind, whether express or implied; without even the implied warranty
    3 F$ s8 p( M( |$ F" O8 H" `8 J; Q5 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; U  a4 v7 p7 V5 ~0 |. U! D
  22. * GNU General Public License for more details., ?8 Z* s5 @8 S1 X/ i. N
  23. */
    ) M' }' x% r; q
  24. % W5 T8 C0 V4 B7 q# _
  25. #include <linux/module.h>& {/ [0 E( F, {* f# e2 |
  26. #include <linux/init.h>( d2 v# a0 U6 y* t
  27. #include <linux/errno.h>" T+ H/ _: ?8 |; x# N# n4 Z6 F
  28. #include <linux/types.h>8 ]- A/ v$ F$ `+ N2 u  V. \# h
  29. #include <linux/interrupt.h>0 J3 ?& @# f( w
  30. #include <asm/io.h>
    8 A, K2 v& |7 [$ T: W; a
  31. #include <linux/moduleparam.h>) [& r) ~: u; C/ |% _
  32. #include <linux/sysctl.h>- p( f/ e; `( {) ^
  33. #include <linux/mm.h>) ]) K4 X; P) t+ s
  34. #include <linux/dma-mapping.h>
    7 B( a$ [: L3 v3 h3 A0 J

  35. ) R/ r* f0 B! V# Y" c# _
  36. #include <mach/memory.h>- l% J/ s/ i( f3 @$ I: z+ ^+ z, I
  37. #include <mach/hardware.h>4 t+ u( D5 z6 ~! \6 g+ E: j
  38. #include <mach/irqs.h>' `3 B! `- w( b+ c  F( R
  39. #include <asm/hardware/edma.h>
    ' F) u: l" P. V9 g0 i# a  I. ]; ~

  40. * V1 `& W& A- m0 J$ P! G' U( d
  41. #undef EDMA3_DEBUG
    9 @4 M$ t7 E! D9 \9 K/ I
  42. /*#define EDMA3_DEBUG*/) r" X& g' `" w  g9 K4 u1 D

  43. 1 \" N' ]- f. ]" o: t1 H3 @
  44. #ifdef EDMA3_DEBUG
    6 E' P/ U: {& M1 i0 Q" F7 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 R9 w2 m4 q8 M# D# {9 u/ ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / K2 T0 W+ R- u1 o4 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 }3 c" I' I' Q- V) g+ L' r) a
  48. #else" `9 v& w4 K. O& W5 x6 G. m" i
  49. #define DMA_PRINTK( x... )
    ( K& Y, C1 G1 |
  50. #define DMA_FN_IN
    7 o# d8 L) f  x" i0 e/ H" Z; g
  51. #define DMA_FN_OUT7 t( v. c2 z+ d8 w
  52. #endif( {4 V7 q1 C4 L. l" L. N5 g4 B
  53. ; E" B0 G  M# b3 W' n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 h; a8 q, m) M. j
  55. #define STATIC_SHIFT                3# Q6 X2 F0 E6 a' y7 n+ o+ r' S
  56. #define TCINTEN_SHIFT               20* z0 O2 o; C3 u( L1 L
  57. #define ITCINTEN_SHIFT              21
    5 F& Z7 {0 f* ?6 ?
  58. #define TCCHEN_SHIFT                22
    8 `, o; Y0 b0 S2 p7 w
  59. #define ITCCHEN_SHIFT               23
    7 _! E/ R+ W8 B2 e0 ^7 {" ?* a+ a
  60. 9 t% P/ b; V4 v% k1 q( }6 H
  61. static volatile int irqraised1 = 0;0 l) t) _5 s3 N
  62. static volatile int irqraised2 = 0;
    # p& R5 U: i1 Q/ i, V& A: h

  63. 9 q4 C) l: i" E' s" A. O/ s& S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ]" q7 R( q2 `& {5 N8 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # ]3 L( I. ~  C/ i. _/ B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * \7 i6 ?) w. k5 j  [! E' B' [

  67. $ k+ u) ~8 G$ d
  68. dma_addr_t dmaphyssrc1 = 0;9 b9 Y/ X# ^+ x6 ]
  69. dma_addr_t dmaphyssrc2 = 0;5 b3 w0 L1 N% W) m+ N4 g; o0 }
  70. dma_addr_t dmaphysdest1 = 0;+ M$ C3 A% J2 l
  71. dma_addr_t dmaphysdest2 = 0;
    ! z+ C+ U% }6 x- E! n8 K) l! h

  72. ) `# m, Q. \+ {+ n) S
  73. char *dmabufsrc1 = NULL;
    + ]+ n; i, C& b/ N& Y( I
  74. char *dmabufsrc2 = NULL;. H" e* i9 I. a( w, M
  75. char *dmabufdest1 = NULL;' ?# b3 L4 d9 E, o; A6 j# x) U
  76. char *dmabufdest2 = NULL;
    5 ~3 n* B1 j! F$ E2 ]1 Q8 W5 U

  77. * X/ ^" X- @% R. f2 C4 B
  78. static int acnt = 512;; `5 Q8 q# o6 V9 t& O
  79. static int bcnt = 8;+ M- n2 g! j$ S1 M/ d
  80. static int ccnt = 8;! D% o9 B) ~5 ?) k. C. k1 p: R# y

  81. * V: {+ h# A. m; m
  82. module_param(acnt, int, S_IRUGO);/ F. `7 y7 P( t- \
  83. module_param(bcnt, int, S_IRUGO);, g: {+ ]* g4 T9 K3 |6 m3 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, [. b, a8 q8 V
- D+ G: d8 m' E/ F0 C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ b! r( p8 A& C4 _  o1 e: W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' f- s8 N0 j2 f5 c1 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. @' S1 t- i( l! M0 C" i  p! T+ }) r( j2 X. B: I
1 b' t8 L$ \6 o! c! L* m  ~4 e- Y6 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 13:26 , Processed in 0.040242 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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