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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) Y0 l( h7 o9 o) }! B* T+ B
  1. [code]EDMA sample test application
    8 r. a3 Q9 i' S; E$ w. |1 r' G* Q2 Y
  2. /*& j) J: b" n3 Q, b5 o" w+ V
  3. * edma_test.c
    ( u) U$ ^4 }4 F( J
  4. *
    ) E4 N8 o$ V7 m% P
  5. * brief  EDMA3 Test Application
    # p2 m/ ]& L/ a) k3 E4 p% r4 b
  6. *
    + P$ r  ]( ?, ]& V
  7. *   This file contains EDMA3 Test code.
    - K8 K  r) q5 {4 h3 ~- }- g) l
  8. *
    / T$ _8 M- i4 b9 N6 y% u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 R7 l+ T' {& d- y8 q- u  b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 F( ~  F8 O3 w# _' z" K9 x
  11. *         TO CHANGE.
    5 u- w" M& {  i, Q
  12. *, [, l/ ?- h- y) F+ R# e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . R6 [2 v) _  H, B* ?1 m$ s
  14. *
    8 f* ~+ s1 }, j; Z" @# v  i, u
  15. * This program is free software; you can redistribute it and/or
    / X# K  Z7 z/ i  Z7 g0 `9 S4 p) R
  16. * modify it under the terms of the GNU General Public License as
    . `5 M0 F, k/ K
  17. * published by the Free Software Foundation version 2.5 f4 [2 w+ D3 H6 _0 w0 q1 g2 l
  18. *
      R0 r' \: r5 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ D$ q# V" Q% w" \/ t$ g
  20. * kind, whether express or implied; without even the implied warranty! I1 V& g3 n; n0 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) u/ F1 Q' P  ?! J3 O: O- C, w
  22. * GNU General Public License for more details.) T/ R1 C) q  F7 r6 H- T
  23. */* n$ H9 X: q6 }0 [+ x$ y% w" s
  24. 9 Z5 h( s/ m# c, r
  25. #include <linux/module.h>
      d* z3 I/ f9 R4 A. P' N) }9 @
  26. #include <linux/init.h>; j7 U# S0 A; _, G+ C4 ?
  27. #include <linux/errno.h>+ H3 `8 x4 ]- \, x* ]' M* Q
  28. #include <linux/types.h>
    % |. t' l( r( i& z+ g. O) h  I" ?
  29. #include <linux/interrupt.h>( F6 o3 b: X9 b: K- l! _
  30. #include <asm/io.h>
    + o+ t4 j; Z  Q+ f: n! a' ~* K
  31. #include <linux/moduleparam.h>
    3 z( A8 z6 I2 V* A
  32. #include <linux/sysctl.h>* M% y: r' ]: v1 u  }3 ]% @/ f
  33. #include <linux/mm.h>5 D( {' K* v4 y. r1 b3 H4 A: s
  34. #include <linux/dma-mapping.h>
    ( ]4 |7 Q0 j; L

  35. 1 ?7 M$ z1 A2 |- T' `5 X
  36. #include <mach/memory.h># V: z6 ~. t' G6 r# q: L
  37. #include <mach/hardware.h>
    + |- I4 ?$ j3 l% e/ |! {; U
  38. #include <mach/irqs.h>
    3 v, Z, x9 t( R/ D5 z; K0 T& {
  39. #include <asm/hardware/edma.h>
    ; K' D3 B' D- X' |7 B. O" Y- I" ]

  40. ; l1 ~% L1 X2 P7 f
  41. #undef EDMA3_DEBUG
    2 N7 [: V! Q3 J% j+ S: P+ ?
  42. /*#define EDMA3_DEBUG*/* p- T: q8 d/ z, m' b

  43. . U+ t2 L" L- M1 s) e- ]9 G, K* W; P
  44. #ifdef EDMA3_DEBUG
      |' n+ j9 f8 t( F1 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( E4 |; z- D& i- o: }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" Z  k1 D5 o0 w$ n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , h! _$ _2 U' o" R* H' I
  48. #else
      l' @1 Y9 G( S6 }$ j6 _7 v2 {
  49. #define DMA_PRINTK( x... )
    ( f: F3 |, ]9 K, ~& x6 L  N% K
  50. #define DMA_FN_IN
    : I6 H% |% m9 G9 {- Y$ |: w; h1 g
  51. #define DMA_FN_OUT7 Q6 p: X& T8 v; v$ J0 B; Z
  52. #endif
    : d" e- w9 m* k  m; B0 y

  53. + Z: ?1 D" q. |! k# }3 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! ?$ T1 ]) O8 H4 |
  55. #define STATIC_SHIFT                3- K7 D8 @, R, n& p4 T6 w
  56. #define TCINTEN_SHIFT               20, j5 y7 x" k: @+ Z) v" h
  57. #define ITCINTEN_SHIFT              21
    & X/ j; @% M: }4 W  p, k) F4 @
  58. #define TCCHEN_SHIFT                22
    ! V; x+ Q4 w, j
  59. #define ITCCHEN_SHIFT               23& O: S4 X- M& N
  60. / s* k( d" u: i9 b9 u2 s
  61. static volatile int irqraised1 = 0;; |& _% Y$ X" ~: v1 w. {! {
  62. static volatile int irqraised2 = 0;
    + ~7 y* X! N7 Q0 n% ^" `7 f
  63. $ w% d! h0 i" Y/ V. f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * T( ^/ s$ J. b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" W3 [$ E. ~1 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 {0 O/ E( R# L' [0 c

  67. : V- ^+ v/ |" B- x- v/ i5 \
  68. dma_addr_t dmaphyssrc1 = 0;
    - K% e3 V' Y6 j8 b- _
  69. dma_addr_t dmaphyssrc2 = 0;, f& n9 P' K% z
  70. dma_addr_t dmaphysdest1 = 0;
    % w. U/ I  N2 z6 \
  71. dma_addr_t dmaphysdest2 = 0;  O+ a) z; D! u" N; X4 `

  72. 6 g- ~$ D& Y4 r3 G4 m( C& K
  73. char *dmabufsrc1 = NULL;& Z% v3 W0 @5 q2 `! d0 q& e7 C
  74. char *dmabufsrc2 = NULL;
    ) t8 ~( w( r- |# m, F
  75. char *dmabufdest1 = NULL;
    * I4 @( S- [: n2 d& F1 ?# y
  76. char *dmabufdest2 = NULL;: g) x2 h, g/ c7 ^; O

  77. " i8 N' ^7 ~( g+ ~
  78. static int acnt = 512;) }2 Q: x- u- Q- f2 n# B9 H# O+ ?% ~
  79. static int bcnt = 8;
    2 H, x  O( l! S; L( C5 b3 x
  80. static int ccnt = 8;' S/ _+ q3 V; y) v3 c" l
  81. 6 E; Z( j/ s3 o
  82. module_param(acnt, int, S_IRUGO);
    * H  v: R/ I8 U3 ?
  83. module_param(bcnt, int, S_IRUGO);
    . T2 |- h- w0 _# N6 d$ e2 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 n1 |) Q" Z& t) c/ M! K! G8 E
& ^3 v7 \1 X& Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 a1 J1 {4 Z6 H( d% O7 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- N+ w2 M7 E* w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 D# C2 m7 L$ {) {9 Y2 f! V8 m

" U' M& I. L; v( D: Y+ g' U. O* A& V" m2 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 01:51 , Processed in 0.040349 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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