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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 c9 M) n2 y$ Y. N
  1. [code]EDMA sample test application
    # p- d( a; H  Z5 w" v/ r) H
  2. /*
    " J1 Q( t& ?0 o5 g$ O- Y4 s  E9 A
  3. * edma_test.c
    * {% i  `0 }# Y9 N3 V" N- m
  4. *
    ) J" ~/ J9 O8 H0 F) r$ ^( i
  5. * brief  EDMA3 Test Application$ k' }) R4 R( v- B
  6. *
    4 l, o9 \. g7 r6 D1 @. R' z
  7. *   This file contains EDMA3 Test code.. O8 P2 P6 t  Z0 h/ N
  8. *
    9 ~) [, m- C( Y5 M% K4 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 a+ M3 b! X( W8 n) {% p* R" }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- Q  g( N2 c9 R
  11. *         TO CHANGE.5 j0 \' _+ f6 [. G
  12. *3 U+ r0 K, b  D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* d# l% T/ p8 Q7 |4 o
  14. *& I$ i% ?8 \* H8 S- N2 Y( z1 N7 A
  15. * This program is free software; you can redistribute it and/or! r- V  _$ x! [  A
  16. * modify it under the terms of the GNU General Public License as& O- Z/ m9 V0 V' P( C" M1 B9 p% s
  17. * published by the Free Software Foundation version 2.8 X5 s# F- D) y7 i# `
  18. *
    ( y2 L9 f& m' v- `9 Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 q, d/ U- R6 l+ ?5 E4 @
  20. * kind, whether express or implied; without even the implied warranty
    ( Y1 {' C" H! n5 D* `: M5 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& A* v/ W+ {$ |! W- @' O
  22. * GNU General Public License for more details.1 L1 B7 K+ J" F9 h+ A- m
  23. */
    9 R' F# g, M! w
  24. ! y. |. t" B* {1 d, U! V* G/ l  Z
  25. #include <linux/module.h>
    % O& U  o& y5 r; v( b
  26. #include <linux/init.h>
    " `! I3 p  \" Y5 }7 s
  27. #include <linux/errno.h>
    - a4 l' A( v. ^1 |
  28. #include <linux/types.h>
    ; z" A1 b) ]' Q3 \+ \& g1 x' p
  29. #include <linux/interrupt.h># H, _! ~8 m6 ]0 s- c
  30. #include <asm/io.h>
    # O1 k1 q# L4 r
  31. #include <linux/moduleparam.h>
    " U; U6 e9 w- Q
  32. #include <linux/sysctl.h>( Q$ O- I7 ]6 c
  33. #include <linux/mm.h>' Z# o/ K4 h* h1 @, }1 `% }
  34. #include <linux/dma-mapping.h># Z! ?0 ?0 C% X9 A

  35. 8 G  ^$ S3 C8 q. M: {% N- Z
  36. #include <mach/memory.h>
    * y) l9 K. k2 W6 K
  37. #include <mach/hardware.h>& `4 B* \1 u! c: P' E; l
  38. #include <mach/irqs.h>$ b6 x: f% f: Z; G6 U* o
  39. #include <asm/hardware/edma.h>
    9 X3 i& D/ E7 a# o- M

  40.   n! d: t0 {- S9 }% s
  41. #undef EDMA3_DEBUG8 h, H6 u, ]. I) P& i8 e7 J, ~" D
  42. /*#define EDMA3_DEBUG*/
    8 L9 i( |- @' y7 }

  43. / ?& m( D$ _& R* d9 T; D
  44. #ifdef EDMA3_DEBUG
    & S1 \0 ^! g  k  P  h. n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 v! w# x1 c; W) @  P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 H, L, I7 v& l" A& G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 t- [: i! Q# s8 }
  48. #else! f, \. x/ _& O9 a+ t
  49. #define DMA_PRINTK( x... )2 w9 |8 X' A& [2 `5 d
  50. #define DMA_FN_IN% h. @% p# A& Q
  51. #define DMA_FN_OUT0 E5 G9 b* S, x% M* I
  52. #endif, ]* a. j$ X1 w  i7 A

  53. 9 s- }& Z6 d  q6 R' {$ D6 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . S* Y$ r/ q- g: [! q; D
  55. #define STATIC_SHIFT                35 f" ^* p' h) V
  56. #define TCINTEN_SHIFT               20( b  n7 S: o* `, m9 d
  57. #define ITCINTEN_SHIFT              21
    7 A: w, A. ^. i- F$ S; z3 J% `4 Q  V
  58. #define TCCHEN_SHIFT                22+ v0 h) }% b$ i/ h0 `
  59. #define ITCCHEN_SHIFT               23* [( U3 H+ e) G; b

  60. # y  M* O6 D- A3 n, |
  61. static volatile int irqraised1 = 0;
    2 G  W9 B$ I+ J5 a
  62. static volatile int irqraised2 = 0;& t. S: H- v" b2 X$ g. @
  63. 7 x1 u" _4 k) O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( E& U# P( q/ t& W' y" y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! Q! Z! Q* E8 B; }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. l1 ]# e) J4 c

  67. ( d0 i1 s  F3 d5 ^/ t5 D- f# V
  68. dma_addr_t dmaphyssrc1 = 0;
    / H+ D) r6 y  q) Q( |
  69. dma_addr_t dmaphyssrc2 = 0;6 e1 ?1 B+ G( B& b6 u) Z4 B# i
  70. dma_addr_t dmaphysdest1 = 0;$ S3 S+ S" \; e$ f. u+ N7 \' O8 P
  71. dma_addr_t dmaphysdest2 = 0;6 W" b; o9 f! ]: f) e/ ]1 C
  72. 4 x( ]* [# D! h- E
  73. char *dmabufsrc1 = NULL;$ q2 f( c6 O+ ?! P* B
  74. char *dmabufsrc2 = NULL;
    $ V0 w0 Q  O7 i0 _
  75. char *dmabufdest1 = NULL;( J) `# u! a, n0 w) g
  76. char *dmabufdest2 = NULL;9 u: [9 F( D: s/ B
  77. 5 K8 s- g; g6 c+ v2 e- [
  78. static int acnt = 512;
    : J6 m+ ^( t- V( ?! S$ b) d
  79. static int bcnt = 8;, {* \- }( c3 m/ c; B
  80. static int ccnt = 8;/ J, V% D3 P  R3 O$ }

  81. " M( g( U0 Y' I* g8 g3 W1 l
  82. module_param(acnt, int, S_IRUGO);
    , c+ v. r% |, I
  83. module_param(bcnt, int, S_IRUGO);
    9 M, r* U, M& Z# V, I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& ]- r6 F9 A; i* j  r% C7 K' C
4 T+ V: J/ k! G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ m3 h" y  u4 \# k7 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* C4 R6 R& `& U' H) v4 t1 B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ ?* `; m- i2 V1 G4 l
# L# x, W% ^; }5 r; e$ x' a  m9 q0 P
, f/ o  `& r& }3 B8 w! A2 I% `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 09:41 , Processed in 0.037779 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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