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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. P3 N3 l; \2 E7 ^+ j! c
  1. [code]EDMA sample test application) s6 F% g- }9 R
  2. /*
    , {8 A) M. V% N, X7 Q' v$ q4 X
  3. * edma_test.c
    # s) Z# u2 q# d1 h0 O+ a3 W- c$ N
  4. *) L- z, g! d1 D* f& B: Q& C# ~
  5. * brief  EDMA3 Test Application
    5 O9 y$ Y/ ]2 R/ V
  6. ** I" f8 r( c. f8 b9 u
  7. *   This file contains EDMA3 Test code.
    5 }7 ^$ D4 j- ^2 S5 w' t1 k+ e  t
  8. *
    * n/ t: U! p" E* J3 _8 e' |9 P+ T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% l9 [: w  U9 f  U6 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( y0 t& k: e3 _
  11. *         TO CHANGE.# C1 S, g/ I  q" m! _
  12. *
    ) j5 O" x1 V" ~2 a8 Q, ]- P! X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 a2 K4 ?$ }6 j- }) u, E
  14. *
    / q- R2 d# D. e- X
  15. * This program is free software; you can redistribute it and/or, {, \/ c  i  V, w5 O6 ?& _8 o$ S
  16. * modify it under the terms of the GNU General Public License as' {4 N  |9 _' s9 M+ D
  17. * published by the Free Software Foundation version 2.1 s+ e/ U$ {( g/ y3 k
  18. *1 Z1 Q( K1 \1 K" t- s5 t% v/ A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # K' p/ V* O5 N5 _! J
  20. * kind, whether express or implied; without even the implied warranty
    + ]% P2 K/ c+ Y$ g1 s. S2 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 \7 U7 g) _# A- ^7 `0 S/ i1 z' k
  22. * GNU General Public License for more details.
    8 N& _5 Y; i9 ]' _
  23. */
    # e2 D0 x7 N. v. V! m
  24. , b& X$ A! L( }
  25. #include <linux/module.h>$ |2 R( _# y% D, G. ~
  26. #include <linux/init.h>8 |, v. \4 I0 D3 d2 b; s+ `( x  i0 h
  27. #include <linux/errno.h>
    * P* p% }( ]$ d) l! o4 v0 X( A' B# g
  28. #include <linux/types.h>8 M5 T: A" Z% T( n2 `4 t
  29. #include <linux/interrupt.h>& M; ]% p( u4 k/ ]
  30. #include <asm/io.h>. ]  }' `! A9 m
  31. #include <linux/moduleparam.h>
    ' g! r. G" Z+ E& n
  32. #include <linux/sysctl.h>+ M- s' ~! @; i; a
  33. #include <linux/mm.h>
    $ j0 P( p: Z" o3 T
  34. #include <linux/dma-mapping.h>! |* {, N2 x0 c

  35. + a' ~/ m* A- f( y# }
  36. #include <mach/memory.h>/ l6 u3 f7 P) f/ w4 y
  37. #include <mach/hardware.h>
    ! p$ K7 {( h6 t) A3 H/ F2 l
  38. #include <mach/irqs.h>) @0 }* S0 W" d# k  O4 B& y# ?
  39. #include <asm/hardware/edma.h>
    1 l0 n6 F! K8 m0 N) X2 Q

  40. * Z3 b7 Y! n  r3 ?/ g; `: |
  41. #undef EDMA3_DEBUG1 k0 Q. A; |" E3 J- m, T* y8 r
  42. /*#define EDMA3_DEBUG*/' F, a* y: _/ g' J: ]1 }
  43. : p$ q7 L  x) _9 e  t2 d) a
  44. #ifdef EDMA3_DEBUG$ x; ^; o" a. A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* U) f$ i( ?& {' N- B; }" Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' b! L8 S+ d7 [/ @& `+ Q( T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ w5 }5 I: B" p4 M7 W
  48. #else  B! `8 ~/ ?" R+ p
  49. #define DMA_PRINTK( x... )$ Q2 d7 X$ D6 J6 e
  50. #define DMA_FN_IN/ F  p; g$ h& N" z9 \; d( \% D  G
  51. #define DMA_FN_OUT5 T$ _: e' n" i8 |, B( y6 w# J
  52. #endif
    # @* B+ Q+ ?0 x. S. y% k/ J2 e- V+ }
  53. . Q$ ^8 q5 y, }. y- t& A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 w# u' z; j) L9 w( a3 N; {
  55. #define STATIC_SHIFT                3
    * [3 @- H; Y7 i" k, V5 ^
  56. #define TCINTEN_SHIFT               20
    7 A$ f1 b) P6 N3 W; X
  57. #define ITCINTEN_SHIFT              21- g, [# i0 u5 [, Z& M0 O% w
  58. #define TCCHEN_SHIFT                22
    : r+ B* o7 a/ A2 `# k! |& Y, S, w5 L
  59. #define ITCCHEN_SHIFT               236 X2 }: o; j* g& G) f2 t- a0 ?( [; t

  60. 4 Y) k  Z) S4 S( w
  61. static volatile int irqraised1 = 0;$ m9 o: n" }  P% N
  62. static volatile int irqraised2 = 0;
    8 U5 v9 k+ G( I0 O  w5 F8 z" k

  63. : i# q# d' c% w2 p$ M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% b& Q8 C2 B( x$ s/ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 W: X9 I3 O+ k- _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # j/ Y# u' y9 Q4 R

  67. ; L' [% c+ n  K3 @3 t6 ]
  68. dma_addr_t dmaphyssrc1 = 0;* f4 C) j( ^0 L$ t: u$ H
  69. dma_addr_t dmaphyssrc2 = 0;% ~5 D9 W+ U1 [; q9 X4 F. U! Q5 C
  70. dma_addr_t dmaphysdest1 = 0;
    + h2 V! ]9 R5 R' w
  71. dma_addr_t dmaphysdest2 = 0;
    ( w2 A! B- g0 a4 O

  72. 6 J8 f& m3 D0 r( M3 u
  73. char *dmabufsrc1 = NULL;
    ' J$ h, t0 V; A2 ]5 M" F/ I
  74. char *dmabufsrc2 = NULL;$ V; _1 D$ \- c
  75. char *dmabufdest1 = NULL;
    6 u* W9 {- w4 d. K9 W! N
  76. char *dmabufdest2 = NULL;
    $ Z7 ]  w2 {- C; z& c/ S

  77. + G6 i. {6 S5 u9 ]9 z& w3 c& X8 C2 u
  78. static int acnt = 512;
    5 u; Q7 o" k/ B  L( r4 i' L
  79. static int bcnt = 8;; x# |0 @& o% C$ C1 ^9 S: E
  80. static int ccnt = 8;
    " `$ a! G. c& b9 j$ h
  81. 4 J/ r% O; O. G% s; D! ?
  82. module_param(acnt, int, S_IRUGO);
    4 I: h& R- ]5 _) ]. A8 ]* i
  83. module_param(bcnt, int, S_IRUGO);9 d7 ~# S: S4 U' J% N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 d7 w" j8 o. q# v/ z; l% u2 C6 G  R3 r. W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 w. s4 w1 V6 F- c! ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) v: V* q* Y5 }  @, o' {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ w# U0 O" R; ?+ B2 m5 B5 }
) b* o* s. z, B  ]# ^

$ E- `: T  C) l8 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 22:21 , Processed in 0.039728 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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