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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 o+ J" p' y' ?. ^4 v
  1. [code]EDMA sample test application
    + N" n7 ]) {- E6 G
  2. /*5 f5 X1 h! M$ v' {" z9 K6 z
  3. * edma_test.c: `) _" Z) Q  D5 {' Q  P4 A
  4. *" u$ \; x. g9 D  v2 g
  5. * brief  EDMA3 Test Application
    * s5 q' c+ Z# Z1 x- p
  6. *5 f* j  a$ }, I/ ^9 G% M; @4 c6 k8 [- j
  7. *   This file contains EDMA3 Test code.  i8 A" S* n3 A- x$ R
  8. *
    7 X* @' i3 a5 j' Y- c+ E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 U) y! R* w% r- r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - N: U8 f  J& K$ F; i' B
  11. *         TO CHANGE.
    # r5 K5 }+ r; B" D! U
  12. *
    $ y' ?1 b# C$ [. o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 H& ~- p6 q! E
  14. */ @$ l4 A( e, r2 f
  15. * This program is free software; you can redistribute it and/or1 h' _* \* ~+ p
  16. * modify it under the terms of the GNU General Public License as4 |: g+ b9 r1 n$ ?, I5 A
  17. * published by the Free Software Foundation version 2.* K4 y6 y4 b; W) I/ }: k
  18. *" ~7 v, {+ E5 \4 E- `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" W: L# m; r; \5 U) U
  20. * kind, whether express or implied; without even the implied warranty
    % j" `3 [- n. Q" q+ X+ \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- p5 D( h2 O- G  ~" s
  22. * GNU General Public License for more details.. }' |% E* w' R0 F, b* W8 s& x# _
  23. */& H! P4 |2 }' E! }
  24. 4 M8 Q$ L7 O! o* m/ r  Q0 P( [
  25. #include <linux/module.h>
    ) _4 H* @8 A" O' Y+ p9 l
  26. #include <linux/init.h>8 Q: i% K/ X: c9 g( P
  27. #include <linux/errno.h>' j6 i0 A1 |! G
  28. #include <linux/types.h>
    ; [- E( n" c2 Z7 l, w
  29. #include <linux/interrupt.h>
    9 X. P+ V$ S, y6 ^" u6 U
  30. #include <asm/io.h>
      t# Q; X4 `1 ^" o& ?6 j
  31. #include <linux/moduleparam.h>
    $ [% y$ ?6 r' c& E& F  z
  32. #include <linux/sysctl.h>& C& X% q/ c$ o6 x: o1 h
  33. #include <linux/mm.h>* r# r* t2 }6 l# R  Z: I! e
  34. #include <linux/dma-mapping.h>
    / f# ~# e: l& b: M* o) r# ]
  35. 9 i+ e' H! I0 f! _
  36. #include <mach/memory.h>% ~& f6 Z! C! v' [3 v  n5 G* x; z
  37. #include <mach/hardware.h>4 G0 b' g- H6 }% {" d
  38. #include <mach/irqs.h>, q6 a+ d/ _5 P
  39. #include <asm/hardware/edma.h>
    0 W) G& {3 n) P9 c6 }

  40. 9 O9 U  o+ y- Q, A) F  r+ ?
  41. #undef EDMA3_DEBUG
    8 I9 I  s2 |  U8 j
  42. /*#define EDMA3_DEBUG*/
    " M7 I- O1 M2 x% ]' n. `5 Y
  43. 5 g5 E' g7 q: Z2 q: K3 p3 J
  44. #ifdef EDMA3_DEBUG% c5 Z0 ]; e& M' W& w! F2 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 j; K+ K3 k* f+ [. i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- G9 b, h0 Q  o. D- G+ u. @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' E8 s& w5 F. Q; N& h
  48. #else, V. w% L; k' h6 ~" }6 _) x
  49. #define DMA_PRINTK( x... )
    / @; U; ^6 C8 @$ n; h3 y
  50. #define DMA_FN_IN
    # N$ r! W" S0 ?, R) t5 A: V0 }
  51. #define DMA_FN_OUT
    $ @0 }" V  `" u5 P) s9 r5 f0 y9 G
  52. #endif
    7 X. f9 a8 ?/ _, h3 P% H
  53.   ?/ K4 s; s4 G) ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), D) T" y/ ]; W5 m; {
  55. #define STATIC_SHIFT                3( M7 ~. g# D! v( J
  56. #define TCINTEN_SHIFT               20
    8 r& w; g1 G2 y! P. o1 e
  57. #define ITCINTEN_SHIFT              213 q: J% A1 c; v; \$ Z
  58. #define TCCHEN_SHIFT                22
    . `5 c  }* s, m# v4 y
  59. #define ITCCHEN_SHIFT               23
    / K) |/ d/ {* I+ B" u
  60. 9 B7 o+ z6 ]0 P5 U/ n
  61. static volatile int irqraised1 = 0;
    . z  V' u6 B  P" ]% {! ~
  62. static volatile int irqraised2 = 0;
    ! H1 o' m6 N6 ?2 k) Z. q
  63. 0 p. V- d9 R( b; c: r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Q0 |  P3 }8 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# a* ^1 {6 i" P  U$ {$ h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, M" {9 c* {) ~3 A
  67. $ U3 k' ?# R+ Z% Q$ y7 _
  68. dma_addr_t dmaphyssrc1 = 0;
    3 x) g1 i/ y  y2 ]( p9 A. C
  69. dma_addr_t dmaphyssrc2 = 0;
    6 N) s- M$ z& f6 _5 b: K7 n
  70. dma_addr_t dmaphysdest1 = 0;& K! U$ o, V' u$ v
  71. dma_addr_t dmaphysdest2 = 0;; k: S. ~- W, `7 \

  72. : c& d( q# P2 J" M
  73. char *dmabufsrc1 = NULL;5 x; B+ n6 I  u
  74. char *dmabufsrc2 = NULL;
    " ~. h5 `  d9 O" u1 k
  75. char *dmabufdest1 = NULL;
      o9 k8 c* r  A( z2 q+ K
  76. char *dmabufdest2 = NULL;" n8 w# O' ^2 o; Q: o

  77. + d; C5 ?; m+ Y0 }3 v& i
  78. static int acnt = 512;
    " F8 |- T+ u/ l. j. u, |) l
  79. static int bcnt = 8;
    3 D9 ?# y  [$ B' w( D
  80. static int ccnt = 8;
    ) V- ^, U8 E2 f5 R7 V) V0 k
  81. 4 C) S2 `( K' m! Q- b* [
  82. module_param(acnt, int, S_IRUGO);7 \7 }* ^) k+ O+ `! }3 e6 V
  83. module_param(bcnt, int, S_IRUGO);
    5 g1 [* j( j9 H2 I( S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 y+ i7 x5 Q$ c6 |: C3 k$ g. g: `+ v9 I$ m3 P4 j0 P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 t6 N. {. }+ C9 }. t$ U; u$ F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- r5 @3 G" N1 o0 M) q+ n$ m: Q0 x; K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  U7 j% v; I. a* X4 Y- t5 S- v! D* n
( \1 {$ H" j7 k0 Y. s3 v6 B

* }5 o" E  S+ s/ @$ W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 08:43 , Processed in 0.040639 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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