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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % F7 G. a: Y* t# j' v  m
  1. [code]EDMA sample test application
    ( R- G0 g, p5 n1 z
  2. /*# K8 O* {4 q) w# {9 x( y( t+ K
  3. * edma_test.c( U. \' O! a* r7 I# L
  4. *# {. G1 j* l& U8 O& X$ a9 E  y- i4 c
  5. * brief  EDMA3 Test Application
    $ c7 i, D6 s2 T2 G: g" X
  6. *% X: e6 e7 X9 Z! G2 G# \9 o
  7. *   This file contains EDMA3 Test code.
    7 i1 J9 X3 p' F) k" u
  8. *% [  J( D7 K* r2 K4 S  y+ ~! g( l5 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& T2 |# [# d7 @& h- x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : `* `) p% \, B. k' g
  11. *         TO CHANGE.! J0 n: j, s/ D
  12. *, h8 b( B9 ?  H( C- j$ t$ h9 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 y2 v3 i( D: l0 z0 T
  14. *3 J2 ?6 z) M' G$ u' o3 \9 Z
  15. * This program is free software; you can redistribute it and/or1 t5 L" i% U3 \! p
  16. * modify it under the terms of the GNU General Public License as& J" Q8 ?; U! X9 b5 F* E
  17. * published by the Free Software Foundation version 2.
    3 a0 R5 G7 L$ U7 i( z0 I3 a
  18. *
    & M4 D. {! V0 q, R- G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ _" I+ S, N/ G; Z- Y0 m
  20. * kind, whether express or implied; without even the implied warranty) n6 U$ P" v. |5 A; A: r+ P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 W* p" @7 C7 N) S7 n
  22. * GNU General Public License for more details.
    ( |8 V" S+ e- M. k8 T" Q: w
  23. */  K( z5 M- G& L# q% u( v) f: M

  24. + D2 r/ e$ \; B( p& C" ]" n
  25. #include <linux/module.h>8 ~% ?. B3 W$ b9 n9 V% O9 q. T, K7 H1 Z
  26. #include <linux/init.h>  A! F( R  e+ P/ f9 r4 c
  27. #include <linux/errno.h>8 k; Q) E7 Q$ N( W( V& T. h3 [1 Y
  28. #include <linux/types.h>
    7 v3 P7 z5 i3 _7 L, b
  29. #include <linux/interrupt.h>
    ' f% L% C; I- G; R: d1 k0 `
  30. #include <asm/io.h>' R/ W- A4 s/ u5 P
  31. #include <linux/moduleparam.h>" Y! W* G7 c0 y) b! `. z
  32. #include <linux/sysctl.h>
    ! n. g6 M0 H" L
  33. #include <linux/mm.h>" u! A* T2 m. G' r$ z
  34. #include <linux/dma-mapping.h>
    & I  {/ Q) ^9 y
  35. 7 B4 \  i; ?; T
  36. #include <mach/memory.h>! |& t( F- s4 Q# i: t8 ^
  37. #include <mach/hardware.h>" c) I; e$ u/ R* H" V# `
  38. #include <mach/irqs.h>% _/ n. G. M* c0 v5 J8 }: i
  39. #include <asm/hardware/edma.h>
    6 [- C4 a6 F1 }# d# {) ?: x  a

  40. 3 j8 o8 Q( F+ N! a
  41. #undef EDMA3_DEBUG
    2 A6 }, {# r0 Y: ]- W
  42. /*#define EDMA3_DEBUG*/
    + C% |- n* ?: A& o1 Q& u: q

  43. ' Z# ^4 w/ l/ i8 V
  44. #ifdef EDMA3_DEBUG$ W$ Z2 Q+ J' K( K- t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ U0 P. C  D1 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% Q. P8 s4 S! t" t, H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 Y9 J1 a& n/ [+ S. ]0 o
  48. #else9 N  X8 W) Z# @! a) R4 s8 B# t
  49. #define DMA_PRINTK( x... )
    . ]0 A( m/ s7 x6 P0 a
  50. #define DMA_FN_IN
    ; C" z) n1 l# c: f4 K$ s! S
  51. #define DMA_FN_OUT1 n* z5 _$ E! P" B" h8 \
  52. #endif
    9 J& c  P* ^( @1 C

  53. : u! e# `# f, z; b  Y. p& t  I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 I5 U6 w  z# Q. u0 e3 ]
  55. #define STATIC_SHIFT                36 t. m8 u$ r5 F$ }5 a
  56. #define TCINTEN_SHIFT               20
    ( S. q) X) f8 S3 z; V/ [6 i3 J
  57. #define ITCINTEN_SHIFT              21
    / m3 X" S3 Z( F! S$ W! Y
  58. #define TCCHEN_SHIFT                22- P+ V7 ^# H/ y" \0 h$ T) E  R' W, @
  59. #define ITCCHEN_SHIFT               23
    * f- [# x+ u* ^# a1 K* [3 V, [( g
  60. * ^* s$ }4 j, T% w% p
  61. static volatile int irqraised1 = 0;
    9 T' m: T- E: g5 c; R
  62. static volatile int irqraised2 = 0;: m6 E0 h/ Z/ I

  63. - j7 M' P4 `! t' [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ o9 X* G& s/ m, H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" _4 I/ e. ^3 o8 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 G3 r2 {, q: b) W
  67. 4 c* f  ~# c2 Y; \9 f+ p  R
  68. dma_addr_t dmaphyssrc1 = 0;) V* N; w# a/ \7 `
  69. dma_addr_t dmaphyssrc2 = 0;
    $ k+ N/ p1 d$ M$ w9 y
  70. dma_addr_t dmaphysdest1 = 0;
    , L' W0 K% K4 z2 q# \
  71. dma_addr_t dmaphysdest2 = 0;. M8 E/ }! V# X' B% |  n) o
  72. ' N8 m6 [8 `8 ?
  73. char *dmabufsrc1 = NULL;2 R9 L3 e* u5 v; x4 ?3 l
  74. char *dmabufsrc2 = NULL;: J! D1 Q3 A6 T$ P1 X' A+ F
  75. char *dmabufdest1 = NULL;
    9 [" l8 H( S# u4 {
  76. char *dmabufdest2 = NULL;
    , g- ]/ @- ?- I8 [- ^+ N( C: g

  77. ' Z1 a7 u8 v* \$ S" ]0 q6 z
  78. static int acnt = 512;6 l% |8 u4 Z0 U. R
  79. static int bcnt = 8;$ @$ a- N( Z" x1 }* n& C* b
  80. static int ccnt = 8;3 j1 @+ E- X( {$ [% f* A5 l

  81. ( H& M0 k  }! W2 }  q  q; \
  82. module_param(acnt, int, S_IRUGO);
    + k: c  T$ n6 o$ ?6 r" p
  83. module_param(bcnt, int, S_IRUGO);
    ' A* t2 D) Q$ z0 X- H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 N0 S  D0 y: j4 H/ Q
9 t0 G& u1 Q: b7 i6 U7 L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ h: }1 N; p- c. p3 D7 N2 o; V% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) l, t1 o7 M  E5 Y- @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 E) Y! r5 b& {! b+ {) y$ T! R& z( A0 }0 t  {0 q8 ?. \! H: N+ R

* }6 L6 g) b8 Z8 f# R7 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-19 18:41 , Processed in 0.041976 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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