OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 f' l  s/ K. r2 M; j" Q
  1. [code]EDMA sample test application& ?3 p, v" a" `6 M
  2. /*) ?8 Q% S! J. G; Z, h! `& G* t3 g
  3. * edma_test.c8 \; b- \9 Q4 w- u; o' n  }
  4. *! r3 d2 _+ U& [, F, G3 U
  5. * brief  EDMA3 Test Application0 Y% ?% o. q4 O# A* ^" l
  6. *& H+ E  g) r6 J
  7. *   This file contains EDMA3 Test code.
    1 |! X; ~) }3 M6 V1 o6 b5 ^' A
  8. *# A/ I7 E6 A# q  g* R5 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 `8 K* ^. E1 `8 u/ S' N( \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( Z- ~# ]& o9 g! F) @
  11. *         TO CHANGE.
    6 L# [& Q! G( t% e. k* R9 {
  12. *: Z5 [* J' ^$ ?( {# |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 A  O% m) m5 O1 r* i  t! X1 l+ m
  14. *
    ' Z; ~* r5 C7 [" X
  15. * This program is free software; you can redistribute it and/or
    , w: ?3 G" w- ^% b% L) J% B1 ]$ t
  16. * modify it under the terms of the GNU General Public License as
      _+ Z* W5 @9 B3 C- J( q- M
  17. * published by the Free Software Foundation version 2., O& I- s/ ^6 ?- w
  18. *9 t! K9 _+ S' I, d! V* _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 @+ Q0 c5 I$ o5 i8 x" J! N* E- u
  20. * kind, whether express or implied; without even the implied warranty
    5 y% v  V. J8 R: ?8 z% L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 U) T0 @+ D" {
  22. * GNU General Public License for more details.
    + E2 n2 A7 c5 _; C9 Q
  23. */
    5 f/ r: e: Y" i! y; u% F  \

  24. 7 \9 f# k5 n* s
  25. #include <linux/module.h>
    ' P6 e7 q. T/ ^) x$ R$ v
  26. #include <linux/init.h>
      _, G# e, g6 |8 |; z# J! g
  27. #include <linux/errno.h>
    ; h8 E% e3 `7 r2 Z  I
  28. #include <linux/types.h>
    1 L/ Z/ W  ?7 |
  29. #include <linux/interrupt.h>
    + {5 q. I2 d. A/ f- s3 P$ u: ]
  30. #include <asm/io.h># |- h9 ?& `( y# q6 U  T
  31. #include <linux/moduleparam.h>! X, P' }( X* [# ]. E+ C
  32. #include <linux/sysctl.h>4 s! e& P8 j5 r% S5 a" T. _
  33. #include <linux/mm.h>
    ( @, t" T% u8 y+ g8 d) N
  34. #include <linux/dma-mapping.h>
    . [& l  y- Y$ v6 G+ K9 ^
  35. 2 `# ^6 M7 G  m" s. v$ x
  36. #include <mach/memory.h>
    $ N9 y' d7 x& F0 f) C+ `
  37. #include <mach/hardware.h>
    ; Q) T! D0 h+ H( b' _, J5 g- _, j
  38. #include <mach/irqs.h>2 \  A$ E- Y2 ?6 }
  39. #include <asm/hardware/edma.h>
    , L+ u) m, J2 u! Y: P* ~% j& g
  40. - a; M0 m$ b5 @9 Z" i* t
  41. #undef EDMA3_DEBUG6 m+ W% ]: b  w: H! I2 f! X, k- f' f
  42. /*#define EDMA3_DEBUG*/
    8 R3 ?. e6 b! \' m4 m
  43. ; x* e" z0 j8 B
  44. #ifdef EDMA3_DEBUG
    ' E+ g- x: x* b$ {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - ]6 T0 E* `$ ^. @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): m9 \, c% `: J9 a- `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 K2 X3 e1 f+ W2 d
  48. #else$ t7 T+ j3 C2 u
  49. #define DMA_PRINTK( x... )
    9 A/ Z# K! K9 a6 a3 ^: z
  50. #define DMA_FN_IN
    6 D2 V7 Y5 I8 N+ w9 c
  51. #define DMA_FN_OUT- V; C( C) k! O3 E( _
  52. #endif
    , m) B4 F6 S( I; l
  53. 4 }" u7 S) V& w' e) V! u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 G9 A) S& r9 B* n5 T% J
  55. #define STATIC_SHIFT                3
    ! B* Y' i5 R; I' G( {
  56. #define TCINTEN_SHIFT               201 u6 U3 N* E  a( D! [
  57. #define ITCINTEN_SHIFT              216 f) n# h" `$ p7 P; p
  58. #define TCCHEN_SHIFT                22! H# I/ t( j! U* b% v7 ^2 U# q! G
  59. #define ITCCHEN_SHIFT               23
    ; e# s5 d. ?7 S; W/ A
  60. / d, j2 m! O7 ?: g  }! k
  61. static volatile int irqraised1 = 0;
    8 P# {9 p; y- Z- ^  h+ d$ `
  62. static volatile int irqraised2 = 0;
    , ]2 Z& t. U6 e4 [/ }

  63. " ]: w! u$ Y  u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% @- o9 i: p; N  ^: f0 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: v( l* C: ]# V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, m& H9 A6 ?  S( }* ]

  67. 0 M/ r+ @  [. k6 T6 K$ h
  68. dma_addr_t dmaphyssrc1 = 0;* |1 ^, @3 i5 I0 s3 c$ q
  69. dma_addr_t dmaphyssrc2 = 0;
    % X2 X) Z# l9 o: d( R7 C+ c
  70. dma_addr_t dmaphysdest1 = 0;
    1 a2 N6 ?* q9 x+ R1 L' H. p# l
  71. dma_addr_t dmaphysdest2 = 0;
    " L$ x3 @' v  Y& ]% r( J2 l/ S
  72. + A' v  ?7 N* Q, u
  73. char *dmabufsrc1 = NULL;
    ) L! x: b& L) d6 `
  74. char *dmabufsrc2 = NULL;  r4 Y8 {/ a) y) o
  75. char *dmabufdest1 = NULL;
    7 f# J' d/ Z2 r2 M% [% Z4 r
  76. char *dmabufdest2 = NULL;$ v, X3 e" T* Q- ?2 e# b
  77. ; m' L* ^; }  d/ l& G
  78. static int acnt = 512;! U1 Y, B9 |0 f4 i" e
  79. static int bcnt = 8;
    + Q; I! R9 f, q" H: \/ I+ ^
  80. static int ccnt = 8;
    & T/ p3 M1 O, `  [: d# S" d

  81. 2 a3 b2 W. {3 E! [
  82. module_param(acnt, int, S_IRUGO);( j5 K2 S2 ]1 t# r* [4 E: o: L4 l
  83. module_param(bcnt, int, S_IRUGO);! K( `3 M( C+ L3 X0 e) Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 L/ X: ?( K8 U8 h* i$ \4 t  l
& Z  s+ }! @3 F# n: q7 w* l: R0 m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' Z5 F; Z' F  h/ }; C" V. barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ `8 p) Q8 x9 Z. G+ q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, T0 P$ O- D7 m' i6 y1 w" @0 C
9 F" ?3 V/ q! K7 b2 Z9 s! C' V2 ]# K1 i* y. J  R$ W9 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-24 06:05 , Processed in 0.043329 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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