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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % w3 r" o% g4 N6 i9 D" `  w  h
  1. [code]EDMA sample test application
    9 |2 P- ~& e7 A; s2 ]' f5 ^( c
  2. /*( K: y/ z" Z6 Z6 W; u
  3. * edma_test.c# a1 k6 ~( d. f# Z; H
  4. *
    $ g( [# l6 g/ s- i; i: G# w7 N
  5. * brief  EDMA3 Test Application  {+ C7 {" e2 G4 j" M
  6. *
      e* T; \, R# X5 I1 U
  7. *   This file contains EDMA3 Test code.
    . k- ?: a4 G3 T6 z0 _. c
  8. *- M/ [- S* R& V+ c+ C- _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : f3 i; Y& g/ s+ f& z' v. a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 o/ z$ B9 k( G& Z2 t) L% @7 x
  11. *         TO CHANGE.
    # O1 K+ I# F) a$ N) h4 B
  12. *
    1 n) X, Z5 p& d7 ^% M! V( d. q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / l( _8 ]8 s# j  `! X* f( I
  14. *
      l  f% _) N; c; E2 U. e
  15. * This program is free software; you can redistribute it and/or
    4 d1 P: B6 a% v9 ~% t" b; @
  16. * modify it under the terms of the GNU General Public License as7 g1 ?3 g. f# p" K3 Y/ Y
  17. * published by the Free Software Foundation version 2.' i; y5 _# L* v; I( ]
  18. *
    ' {4 K' F1 |5 L" ]/ q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 J: T9 J- V+ ^3 t  _* e% i
  20. * kind, whether express or implied; without even the implied warranty& e" A0 E  ~* h% n5 S* v$ d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! l9 S! X5 \4 h
  22. * GNU General Public License for more details.
    2 a; |' _7 U) Z, t: z6 H: P  m: F
  23. */
      m0 J' O, d2 @6 {  B

  24. ! x1 t, p# d$ u; C7 [
  25. #include <linux/module.h>
    2 e$ |1 `6 F+ {* ~
  26. #include <linux/init.h>7 p! X; o# K+ D2 y& E& E& s
  27. #include <linux/errno.h>
    & @; M5 v/ s% E& q
  28. #include <linux/types.h>7 s- Q; e4 |# b; G9 p/ ^% g
  29. #include <linux/interrupt.h>2 {; M. N' t2 y9 w: [6 x
  30. #include <asm/io.h>& L( G3 H* A$ Y( F7 Z
  31. #include <linux/moduleparam.h>5 m6 y' y) p- @% X
  32. #include <linux/sysctl.h>
    8 F7 E3 k5 ]; R& k7 C+ p
  33. #include <linux/mm.h>1 ?/ X5 J- r, Z/ j/ X
  34. #include <linux/dma-mapping.h>/ E- H0 ~! F7 U

  35. ) h( y# G, X! g8 Z
  36. #include <mach/memory.h>  \, S7 \( ]3 |8 H
  37. #include <mach/hardware.h>
    5 x: B4 p! j; m
  38. #include <mach/irqs.h>; V% u% D9 i* n2 c
  39. #include <asm/hardware/edma.h>
    ( O5 L" C. p& F# d* C+ ]5 t
  40. / v. n  g* q2 {
  41. #undef EDMA3_DEBUG! H0 `0 q6 _- I
  42. /*#define EDMA3_DEBUG*/
    4 l0 I/ j) `* M% }0 L0 [. \

  43. ' O7 s1 `' ~3 |- p- f  O
  44. #ifdef EDMA3_DEBUG
    $ B+ Q, R1 F* P$ t' v3 _7 W$ }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 r$ U" l7 G; U3 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 d# v3 C" `, c( S3 H" N( A6 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 f% d3 q8 u3 h* v$ l5 }
  48. #else8 X8 J5 u# m) F& E$ w! E
  49. #define DMA_PRINTK( x... )
    . @2 z& p- t% u8 R' w
  50. #define DMA_FN_IN
    & V( s3 F4 P+ W
  51. #define DMA_FN_OUT+ P+ p7 o4 a: ]* s0 S  T% q, V
  52. #endif3 [' `9 K0 h3 t4 j  y

  53. 8 ?7 ^. k8 Z* r5 {6 C9 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( _, Y+ V- P. v' O" H6 S4 P/ f& o' W
  55. #define STATIC_SHIFT                3
    # B4 q0 e& X+ D( m( @5 q6 }
  56. #define TCINTEN_SHIFT               20) A" V4 Q: B3 S
  57. #define ITCINTEN_SHIFT              21
    / d. \9 ~6 J% M& ^1 r
  58. #define TCCHEN_SHIFT                221 o4 B  @: H. d/ L) Y: f& v$ q
  59. #define ITCCHEN_SHIFT               23' X) b) P+ h7 L0 x6 B8 F/ k+ _" k: \
  60. ) q' L( B1 |5 \# d/ _
  61. static volatile int irqraised1 = 0;' V; ?" G+ T# u# t7 P1 t
  62. static volatile int irqraised2 = 0;
    / @8 m9 u; ^9 U& K5 k  f

  63. $ m, P& G- g  _& H, b% a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - J- \+ u0 i, t7 K* J1 [7 ?; D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # E. d8 P6 {7 Z6 I! E) F2 q& C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 O* U& s8 I2 S$ t) G# n" m

  67. 6 s5 b) _# n3 O$ w! @) g
  68. dma_addr_t dmaphyssrc1 = 0;' s' V) b4 H& m
  69. dma_addr_t dmaphyssrc2 = 0;
    * i5 Z- H( y. L/ U3 I" F; |6 A
  70. dma_addr_t dmaphysdest1 = 0;
    3 y- `$ |) }# q, L7 c+ s6 _# H
  71. dma_addr_t dmaphysdest2 = 0;
    / g! u: R# @) j
  72. - t, R& ^8 z, U
  73. char *dmabufsrc1 = NULL;
    # \& i0 k" ?/ M1 I
  74. char *dmabufsrc2 = NULL;
    9 ]# l) X  I) o) v! W4 O( X! R8 ^
  75. char *dmabufdest1 = NULL;7 X  N3 R, u+ K; o
  76. char *dmabufdest2 = NULL;6 x5 s3 ?) q1 N; O' x. c& h
  77. # U( c+ c+ b3 n/ i
  78. static int acnt = 512;
    8 ?& @% @$ q3 L4 ^
  79. static int bcnt = 8;: L- `) [" Q, u! `5 s
  80. static int ccnt = 8;
    ' r! G% [8 h% v* L# A% w9 V& d

  81.   ~0 [* s! n  o! G
  82. module_param(acnt, int, S_IRUGO);1 e9 M/ i1 ^5 l+ _" n
  83. module_param(bcnt, int, S_IRUGO);2 J& t. ?/ Q8 Q2 |8 S. n! T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" v2 m9 o1 A' g0 h
" D" }  W! t* L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. _* O/ o& o) ?+ _: {) Y) L$ E6 Z+ warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 [  d3 i. l, c+ y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 }+ ^  [1 s! A4 L9 s0 _4 A; L0 R/ C

4 h( s. D% G$ P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 14:04 , Processed in 0.040032 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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