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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" O) `# L  Y3 b8 B/ _5 e+ O
  1. [code]EDMA sample test application
    2 D8 t' i6 M+ B8 ?' o' V
  2. /*
    ' h$ O1 i! N' A7 |& b
  3. * edma_test.c; L1 t/ @6 }4 w
  4. *
    , ]0 [- L! I! D: z# \. u
  5. * brief  EDMA3 Test Application
    3 b1 d9 Y  m$ Z) d' a
  6. *
    2 m% ?9 v1 k3 X& N7 B8 _7 k2 Z
  7. *   This file contains EDMA3 Test code.
    : R$ l; o2 I4 M( O9 g: d
  8. *6 _* Q* S, F$ K: E+ Z. b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # v/ N$ F0 I' l. ?( |" H8 D7 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 B2 |& \; c1 P4 C" ?9 a1 l
  11. *         TO CHANGE.
    0 N! H% G0 X7 B
  12. *
    5 X6 M/ |3 Y8 `* i, N5 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . Z/ k: b- X% \; L; T
  14. *
    , k& Z9 F$ a' `7 |6 V1 h
  15. * This program is free software; you can redistribute it and/or4 k* ^) }& D2 w- ]$ O
  16. * modify it under the terms of the GNU General Public License as
    3 z/ G* J# v( T, h6 ~
  17. * published by the Free Software Foundation version 2.
    ) h) D6 G; ]' H% s4 {0 w  p8 c
  18. *
    7 H5 l8 ?; \, `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 p7 h& d% M( c3 K/ P* ?, J" \
  20. * kind, whether express or implied; without even the implied warranty
    % H6 C9 G* l: g2 I+ X) K; S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 u( k4 u9 G" P0 E$ C+ F
  22. * GNU General Public License for more details.
    6 `3 S3 Z0 V8 t! S, r* Q( a/ Q
  23. */
    % E7 \( i% z" H

  24. 3 _$ I) u6 B0 }* f( A
  25. #include <linux/module.h>" w% [& U! I: U& |  P) m, ~+ _
  26. #include <linux/init.h>$ o% f; f+ n- @  G, X
  27. #include <linux/errno.h>4 g) n4 [$ y: o$ L) ?
  28. #include <linux/types.h>
    " ?7 m2 F$ ~* D5 h& }' S
  29. #include <linux/interrupt.h>2 T2 f1 @1 \" b) e* _% v+ S1 K6 K
  30. #include <asm/io.h>
    ' z2 }" |" c  F8 ~+ F( W7 G
  31. #include <linux/moduleparam.h># v- p. Y" S, G& w! R1 r( ]
  32. #include <linux/sysctl.h>4 e/ L) u) s& r; {
  33. #include <linux/mm.h>
      U" u8 L9 T% d4 D; q8 i& O
  34. #include <linux/dma-mapping.h>
    . F+ z3 `4 g* B8 i% G

  35. + A  T$ |1 r& a- [, {6 y
  36. #include <mach/memory.h>
    . e& H3 y3 B, Y8 o
  37. #include <mach/hardware.h>
    + w" l: U) a) r$ k2 h) c' P
  38. #include <mach/irqs.h>
    ! w, a* p8 E1 o* G- p5 n4 ]
  39. #include <asm/hardware/edma.h>
    / X5 h' w* i6 u; i! {$ Q

  40. " W+ j$ c$ d* i# g: f4 ^
  41. #undef EDMA3_DEBUG6 a# A( R3 t2 o; z$ k: [5 H5 `
  42. /*#define EDMA3_DEBUG*/
    ) o/ \( W, Y) B9 M% E
  43. * l+ t! i7 h1 }7 \
  44. #ifdef EDMA3_DEBUG
    . l- t! A8 ~- ~) |9 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ W9 \$ H/ M, ], O7 t/ |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 r9 K, {2 o% i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 `$ A; F' s* A8 {5 P* g
  48. #else7 S) X/ N5 z+ T+ |% t  C
  49. #define DMA_PRINTK( x... )
    8 n) M7 o( z5 Z' V5 `1 q
  50. #define DMA_FN_IN
    ; h1 b$ C; }3 F3 _4 J9 c4 [- I0 d
  51. #define DMA_FN_OUT
    ) G7 H- r; \! u( L, x
  52. #endif
    " T4 ]- y5 Z) U1 L) n  o

  53. 9 y: [" w' F6 Z8 \7 H/ R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! y/ |! y2 A$ P
  55. #define STATIC_SHIFT                3) H- t# n1 w: L6 I, e: h4 L
  56. #define TCINTEN_SHIFT               203 K% i1 f- [% ]+ _8 d
  57. #define ITCINTEN_SHIFT              21. D8 C# F! W  C* j6 u6 P1 h
  58. #define TCCHEN_SHIFT                22
    - ]6 X9 v0 i; E  z: t
  59. #define ITCCHEN_SHIFT               23
    5 t4 l9 [& F7 @& p% \! {
  60. / M8 {. x7 P4 e/ s, j9 \& o
  61. static volatile int irqraised1 = 0;
    2 L  s8 e! X  Z& n# a" u" C
  62. static volatile int irqraised2 = 0;
    / R  D4 N: t# _) U* n7 K' P

  63. # v6 |. b& [' ^; s; F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + W+ \, G1 V$ J8 }7 d" x6 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 v8 l- B& u6 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% }8 R+ v3 S4 T8 s  b5 f
  67. * z: ?, C: c) |7 _
  68. dma_addr_t dmaphyssrc1 = 0;
    ) K' o0 P- `: ?% J0 l4 T
  69. dma_addr_t dmaphyssrc2 = 0;& Z/ Y' _+ y5 D& l: E, A
  70. dma_addr_t dmaphysdest1 = 0;; V% e* H( O7 U
  71. dma_addr_t dmaphysdest2 = 0;$ z9 F- ^; ]: b3 U" R- s; B' _, H7 e9 E

  72. 3 @0 @9 ~( q6 w3 v( Z" A
  73. char *dmabufsrc1 = NULL;' E, ]! m$ x( w- ]1 a0 g$ Z
  74. char *dmabufsrc2 = NULL;* G- x0 i" i) L
  75. char *dmabufdest1 = NULL;
    5 z0 h6 J7 O2 X8 z( _
  76. char *dmabufdest2 = NULL;4 ?5 Z* P, |( l6 A
  77. 4 g* i+ O) W  y
  78. static int acnt = 512;
    % {: h( t: p. I$ T! D1 n
  79. static int bcnt = 8;
    4 g8 k/ c6 f" L; P4 |9 {6 X
  80. static int ccnt = 8;
    & r% u9 V; H- ]: U

  81. ; N# e6 o$ S! t5 L
  82. module_param(acnt, int, S_IRUGO);6 F+ s* @2 d: _& }
  83. module_param(bcnt, int, S_IRUGO);
    % J# a/ {/ t) ?& f+ V" j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" Y( T: L# I: H/ Y
! v* H; ~. f1 U) S+ a$ W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 O" S$ y7 \9 a" ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 T3 C7 M: N, L9 K0 R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' ?# {* x  k7 G: E
* A5 G1 j- W% i' `$ |# e& g

) p$ p( ?1 b3 V9 K0 {7 c' H! G8 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 01:26 , Processed in 0.040620 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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