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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 R% Y5 y/ T7 ]$ l9 ]
  1. [code]EDMA sample test application. g5 E9 Q- L& }5 v
  2. /*
    8 [3 C" Y; ^' H6 }) j" b
  3. * edma_test.c
    - Q& I/ z7 v. x8 \  v
  4. *
    # C  t- b& H! C; m& X; v
  5. * brief  EDMA3 Test Application
    , J, e$ _  c1 d4 E/ P
  6. *0 {3 W4 g+ N( _4 d
  7. *   This file contains EDMA3 Test code.
    5 s* e1 `8 l$ @* [0 S
  8. *
    ( X9 @! x( b+ S  s6 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 |5 J' L+ C  O! ~& u( u1 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 O/ }  T6 Q0 _4 s' x
  11. *         TO CHANGE.
    ( F5 u  T# i3 N( y" g! J% T, ^
  12. *
    : c  w3 g' c" t4 x& t( R8 G% [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " B  N9 y0 d' r! L9 L- e, N
  14. *
    - v& t/ Z  R  t  y! e! U; r1 ^
  15. * This program is free software; you can redistribute it and/or$ m+ n# _- k; I3 t4 E) B! ?' O8 O
  16. * modify it under the terms of the GNU General Public License as
    1 [. l: v. r5 h2 A
  17. * published by the Free Software Foundation version 2.
    0 y; U( T& j3 N& J$ o5 F
  18. *% ^% R2 z% a  i- m) \$ r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & h3 B9 _0 k6 y: W$ i$ p0 x9 W; M0 }
  20. * kind, whether express or implied; without even the implied warranty9 A# {: r  q0 J# R7 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! c6 r8 P/ R- ~, n, }( \  P
  22. * GNU General Public License for more details.; g4 o0 t9 i- Y  P1 k
  23. */
    % g. y9 m* j. x5 y: h
  24. * o6 b( r8 P8 ^9 |
  25. #include <linux/module.h>
    8 j$ l  N8 v$ Z5 q
  26. #include <linux/init.h>
    - \, K! Y! X3 r( ?
  27. #include <linux/errno.h>
    - t5 t3 j, u) o8 G" y0 F- [8 P
  28. #include <linux/types.h>8 J* `( _+ p5 i! e1 N+ _- B
  29. #include <linux/interrupt.h>
    : y$ J3 U8 I5 U) F7 D) A6 r
  30. #include <asm/io.h>* r; _  g  v- T) f8 e$ }" B5 G
  31. #include <linux/moduleparam.h>
    9 q- X% j/ a! f$ s9 t7 I7 h0 x
  32. #include <linux/sysctl.h>
    % p% m# s& B/ F( d8 S0 ?  @$ W! Q
  33. #include <linux/mm.h>  M# q, G6 X$ j$ g
  34. #include <linux/dma-mapping.h>5 q% c/ b" a, k7 i) b1 X- t
  35. 4 b4 I: y% z8 ?1 a7 Q( D: ]' H
  36. #include <mach/memory.h>
    7 S9 t) M" h0 a6 h1 O
  37. #include <mach/hardware.h>2 A& h$ E' `, ^4 Q$ x" R
  38. #include <mach/irqs.h>
    . ?, `& ]1 ?  V" ]
  39. #include <asm/hardware/edma.h># @5 o# B( n  F: p) k0 [; W

  40.   j+ m- Z" D) s, K. H+ G6 j1 L
  41. #undef EDMA3_DEBUG# X- w2 i( u7 J1 b: ~3 ^9 ]) y
  42. /*#define EDMA3_DEBUG*/4 C3 y" E1 h6 q8 k, H

  43. 2 |0 q, J" C5 I' g- C+ A! ~
  44. #ifdef EDMA3_DEBUG
    & l: Z& N8 X; B0 g/ H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) h+ Z# h( L5 ^& i. h4 X+ t) N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 j/ V1 u; E1 ^2 B' T! {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ M, J; C: }. G- ]6 j
  48. #else
    2 I3 r  Q# z3 `! m/ U8 O
  49. #define DMA_PRINTK( x... ): M" N% i; _0 V2 u
  50. #define DMA_FN_IN
    " z. B" q5 Z( S
  51. #define DMA_FN_OUT
    3 ?9 ]" S; P% y1 P/ C) S/ i5 _4 `
  52. #endif
    5 P8 l# x) |/ C/ R
  53. ' ^" j* P* G7 P) a, r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 g7 j8 ?2 P4 C) b
  55. #define STATIC_SHIFT                3
    " L: z5 T2 a( G( s6 c+ n) t" u! o+ ]
  56. #define TCINTEN_SHIFT               204 g5 y7 P8 O; {$ z" U4 P" Z
  57. #define ITCINTEN_SHIFT              21
    + @7 q: m( O) u9 Y2 m
  58. #define TCCHEN_SHIFT                22
    4 D: L4 ?) G- S5 c$ W# |
  59. #define ITCCHEN_SHIFT               23; C; y  N" k) \( k

  60. & ?4 ~. s2 T7 w! j. q3 A5 x
  61. static volatile int irqraised1 = 0;9 E! V9 a' t$ d3 N& I
  62. static volatile int irqraised2 = 0;
    " Z5 h; o& U- B+ F* Z
  63.   T7 Z; x* v8 ]+ _. L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; o' A& f: X  u5 F' ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% F& {  {9 e1 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( G$ R* i& C! ?8 }2 l0 u

  67. " d2 z  f+ W5 n4 }' s. T
  68. dma_addr_t dmaphyssrc1 = 0;& M" ?4 k* u; S7 G, p$ C4 j3 z
  69. dma_addr_t dmaphyssrc2 = 0;  t7 c( B. V7 |! V& L" Q
  70. dma_addr_t dmaphysdest1 = 0;
    : O, U& v) j) y8 ^7 N* W& d
  71. dma_addr_t dmaphysdest2 = 0;8 I) `* W3 [4 E
  72. : ]; E5 V" l& {/ B7 v
  73. char *dmabufsrc1 = NULL;  L  s$ C4 Y6 r2 C* L8 ^. }
  74. char *dmabufsrc2 = NULL;
    ; C$ y+ K. _9 h/ ?, J
  75. char *dmabufdest1 = NULL;
    / R0 t' V6 @+ F2 P* k
  76. char *dmabufdest2 = NULL;
    * L" |) k# l6 ]2 s

  77. , F/ e3 ^; v& t/ M" X4 h7 p
  78. static int acnt = 512;* ^" c5 `$ q6 ]' X5 H
  79. static int bcnt = 8;
    . d  _" w9 B' |& r) Y5 k1 }
  80. static int ccnt = 8;+ P% Y; i% k: t/ ~2 t! U* E/ P) _
  81. 1 F" h( I* I) Z' r. L  i7 n
  82. module_param(acnt, int, S_IRUGO);
    $ B/ q2 ]4 ^. G. O0 X& _7 Z
  83. module_param(bcnt, int, S_IRUGO);8 k9 R" c2 Z5 M) u# l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 }2 N9 y% p* S
0 c5 s; s8 m) T+ W+ ~9 c6 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. V5 [! q4 J( |9 u! ], garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 U1 c6 c2 j! [  b  h- q, O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& R* m! h+ [1 Y, V! e0 |) H( _8 p* Y8 U* S

2 n7 ]" P1 Z% F' x4 W! x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 00:01 , Processed in 0.039574 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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