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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* Q1 W# z* p: L! Y" b
  1. [code]EDMA sample test application/ S0 m; O. k  f' C4 h) h
  2. /*
    ( Z  ^, K" g+ @
  3. * edma_test.c' R$ w: ]6 v) e. U' v5 \
  4. *
    8 g9 p9 U; s1 |- g2 p4 d+ ^
  5. * brief  EDMA3 Test Application& b7 y0 f. |6 Y. d! ?5 e! I
  6. *
    3 G: V& \8 N) Z; G% h9 V$ z$ L, K
  7. *   This file contains EDMA3 Test code.% \& [% G9 O* H% ~6 O0 y" a
  8. *
    6 D5 a* D: ^; f& b9 {/ K1 S" J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      \6 _  j8 B/ t( b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- N- E1 b% o, W0 b+ R+ @. G
  11. *         TO CHANGE.( k1 l8 e0 K$ A! G+ M) A
  12. *
    $ j  U. ?0 ~3 n" U" ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : X& [" ?! [) u0 p% g
  14. *% a& M( h8 r% s# F8 A2 n4 `
  15. * This program is free software; you can redistribute it and/or1 d. M0 j1 |9 }9 l) a( s5 ]
  16. * modify it under the terms of the GNU General Public License as
    : A7 `1 ^* `3 {3 w( S
  17. * published by the Free Software Foundation version 2.8 q5 B, E; Q. ?8 ^
  18. *
    6 H2 Z, @: v% z( u+ @  v: O+ a( n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ ~% B$ ?, i; p
  20. * kind, whether express or implied; without even the implied warranty$ g0 }9 `9 Y, F$ X/ q  n7 l( L  N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 z2 y% T* _, w/ D+ E+ Z
  22. * GNU General Public License for more details.
    0 i# ^. a  m* ~8 {4 {0 h2 H
  23. */+ {8 `/ V* F  z/ \# T6 N* R

  24. / R' d0 @% N0 d3 z5 w% ]
  25. #include <linux/module.h>& y" K' ~+ S" Y- O
  26. #include <linux/init.h>! q7 x0 ]* B6 F) P
  27. #include <linux/errno.h>+ ^5 p$ d! e* c+ @* y& ]5 F! w8 m" {
  28. #include <linux/types.h>
    5 F2 F8 u' |( k
  29. #include <linux/interrupt.h>
    4 ^2 U) V+ p4 i( k! @  Y. H
  30. #include <asm/io.h>
    : ?; ~+ U0 v- b) Q  w* B
  31. #include <linux/moduleparam.h>
    - W2 H$ _7 v# J7 y+ }
  32. #include <linux/sysctl.h># d7 s. i' `7 A8 I( M; s1 ~" u
  33. #include <linux/mm.h>
    ; A& o; h3 h( g
  34. #include <linux/dma-mapping.h># w1 L# h" @* _4 K# s- ~# T

  35. " ~/ P5 M+ v0 v8 t; {
  36. #include <mach/memory.h>
    0 b; N& Y/ Q' r" m* `+ V
  37. #include <mach/hardware.h>
    - t( C6 q, q+ G! I) ]* X5 m% J
  38. #include <mach/irqs.h>
    ! N5 Q  }- W. a3 ]$ ^
  39. #include <asm/hardware/edma.h>, j# W2 r  E4 b: }. q

  40. , S6 M! L( @) `  ^
  41. #undef EDMA3_DEBUG
    3 _/ d3 k: m! F8 C/ U: n7 u# A
  42. /*#define EDMA3_DEBUG*/: @* b1 h. c0 V, ]& L/ N% f$ S
  43. $ M3 u8 _+ O0 l( t; ]
  44. #ifdef EDMA3_DEBUG7 N/ D' X6 Y- y  _: D- l- u: q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 ]) C' M9 C7 l4 D0 L2 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 g+ e1 E" r3 v- x( N9 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # e" M- `1 ^1 y. P) c
  48. #else* H  c) j* r5 @$ q4 U) P
  49. #define DMA_PRINTK( x... )
    5 }8 o; i  r; ]( l( u
  50. #define DMA_FN_IN
    5 b) K4 K' K# j$ |- A3 o
  51. #define DMA_FN_OUT/ e8 X% ]: _: _, ?4 ^( X0 P* \
  52. #endif5 U2 h0 y  Y1 ~0 Y. t

  53. * `: [, Y7 i+ D0 l2 j/ d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , d2 p. z  T' Y0 l0 u0 S" y
  55. #define STATIC_SHIFT                36 a0 z; a; N9 f! S
  56. #define TCINTEN_SHIFT               20
    8 x8 J! G# P1 x/ }4 U: I4 L
  57. #define ITCINTEN_SHIFT              21
    ! R6 {% H0 j/ b. j4 c
  58. #define TCCHEN_SHIFT                22
    " {0 z" G) S7 a5 ?- E6 o4 G
  59. #define ITCCHEN_SHIFT               23
    2 z! I" {/ i+ q7 L1 `. v$ S- `+ p
  60. # Q2 v3 {7 d4 b7 M
  61. static volatile int irqraised1 = 0;: _1 w) b+ d: n
  62. static volatile int irqraised2 = 0;% V4 A9 C0 [4 y- g, F
  63. 8 x1 z$ U2 U5 U: v3 F! |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 C6 {/ J1 S9 E/ j  A  Z4 e5 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! {8 h) I6 n9 \' l4 y! J" P* ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  H9 m( t" |; H1 q( [; e2 E+ U

  67. + ?3 E* V5 A8 R* ~
  68. dma_addr_t dmaphyssrc1 = 0;5 ~! h$ n- y/ }( q. v
  69. dma_addr_t dmaphyssrc2 = 0;
    $ D9 L, z6 W) b& b$ K" A5 E1 u
  70. dma_addr_t dmaphysdest1 = 0;- Y  V: k: j% u- W/ ^, r  C% j
  71. dma_addr_t dmaphysdest2 = 0;7 B) a2 Z0 g5 C$ S! ?* ~2 f  i3 O

  72. 7 i  U: _6 _( }4 n' g  @. {
  73. char *dmabufsrc1 = NULL;
    ; f- w0 z# [) v# M' Q2 P1 ^* P* }
  74. char *dmabufsrc2 = NULL;
    & ^. q; m% P! C! [. e3 U
  75. char *dmabufdest1 = NULL;
    - s$ {# a. v( A. w; S- Y
  76. char *dmabufdest2 = NULL;
    % Y$ |' E% [  R; S8 O; q4 ^; L

  77. , t# ~1 N6 S' l, x
  78. static int acnt = 512;8 }  s" J. B& H
  79. static int bcnt = 8;4 j( A; B7 ?6 R9 q/ z4 H- _
  80. static int ccnt = 8;
    1 g/ h1 Q8 c) K) E+ Y8 L. ^0 I

  81. ; l- X5 t( q  `: t3 f
  82. module_param(acnt, int, S_IRUGO);/ t" I: G, x$ U" _- t
  83. module_param(bcnt, int, S_IRUGO);, g( J" |! u) ?5 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  U' s% N. m: }. l8 _, S7 v5 J
+ I4 A3 [7 N" @- C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( f5 D2 s% X3 Y2 {; d  Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% i1 O  `6 x! i, F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 a) s" K! e/ g; P& U
5 Q0 s& M& _# S9 `) {( b

7 X8 n1 K, ?; ^+ U9 L9 x( i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 03:11 , Processed in 0.039706 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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