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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# h0 ~. r8 s' d! K! C) L5 B0 i+ k
  1. [code]EDMA sample test application% x4 G$ g7 q/ I# r3 m1 h
  2. /*" r6 v# u' }1 v3 ~& h5 @# c
  3. * edma_test.c
    # b! ~( Y; k3 ^, r
  4. *
    ) ^8 \* S. X7 w3 c7 Z
  5. * brief  EDMA3 Test Application, _. \( j$ ]2 z) {7 d
  6. *
    ) ^8 \0 ~6 D4 h$ H4 `: S, m; }7 s
  7. *   This file contains EDMA3 Test code.' C8 l4 S( ^/ w. [/ [+ y: h
  8. *
    6 J( o1 M7 a  [" u5 a, ~* P- e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , [- I  I- k" |5 a+ T) I2 S" x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 U  P. f' j( @( J7 z
  11. *         TO CHANGE.
    1 U, o: z3 `5 j6 k
  12. *
    ; \7 E: I7 ]6 X0 L" Y* _& t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* ^) I. `3 C6 s3 h! F
  14. *, p. w+ L/ v) X2 f+ u9 N
  15. * This program is free software; you can redistribute it and/or. _. \- _0 s9 C7 R7 |1 U
  16. * modify it under the terms of the GNU General Public License as
    2 k9 z8 K$ T  S6 y, c
  17. * published by the Free Software Foundation version 2.- G$ d: f" T* `; v4 D$ j0 U
  18. *
    $ t4 ]* m; _. q, u3 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 T( a; _9 f- }5 O, d6 q2 x
  20. * kind, whether express or implied; without even the implied warranty
    / Z" r6 B. G/ A6 S, ]$ [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 ]( q; S. Q1 Y. [- K  }1 S" e
  22. * GNU General Public License for more details.. z( I  _6 B8 V3 `# H" B5 K1 }) q
  23. */% V5 A3 w: n2 m2 w
  24. ) G5 i9 Q: M, F1 A. @  b
  25. #include <linux/module.h>; f$ E  Q1 \: |' D" o
  26. #include <linux/init.h>! v+ Q. B. V! d+ e
  27. #include <linux/errno.h>" l) H" }9 _. M* t* ]/ k
  28. #include <linux/types.h>
    7 L& J# C. K5 E
  29. #include <linux/interrupt.h>
    : D- |) A' a5 x3 X
  30. #include <asm/io.h>
    ) V% F# S% w4 p) n
  31. #include <linux/moduleparam.h>
    / S9 P0 O0 w1 G. T
  32. #include <linux/sysctl.h>0 W" g5 Z4 Y# u0 Z
  33. #include <linux/mm.h>
    ! P5 F1 b* d# N0 G8 P8 A
  34. #include <linux/dma-mapping.h>
    $ A3 x& f: O. ?) _. t: t6 Y
  35. * _* y/ o( a3 l2 G4 u4 i' N
  36. #include <mach/memory.h>4 ], t- a9 `6 \  U: R' k$ }
  37. #include <mach/hardware.h>
    * m4 T. m% G: V: o; y3 E* n
  38. #include <mach/irqs.h>8 ~+ P: f, ^8 y
  39. #include <asm/hardware/edma.h>2 e' K1 Y1 |  n2 V$ q* l& b

  40. - Y& _, a4 L, E5 E6 _3 |& E0 b! z
  41. #undef EDMA3_DEBUG
    0 [- k- F" Z' U# W: A( ~: ^
  42. /*#define EDMA3_DEBUG*/; y3 o/ {; U& I  o6 r6 F0 j$ y
  43. , V5 o% v" L: g' b# E5 ~
  44. #ifdef EDMA3_DEBUG
    ! i; W9 `( @: ~" f! F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 o6 w6 J! w! F$ ~2 H- o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , i8 u5 \* I; e* c' p0 N- H# V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + `, i+ i/ N7 F( v# g
  48. #else
    $ H  R7 x1 [, z' x& q
  49. #define DMA_PRINTK( x... )
    4 U; l% U' L' H! Z4 T, ~9 s5 b
  50. #define DMA_FN_IN
    ' S1 T% W! Y7 H  }" ]1 G
  51. #define DMA_FN_OUT5 g6 z7 B+ U" m, R1 M1 z
  52. #endif- R9 N1 M$ O% m4 o4 K- U
  53. 0 P* H  @/ Y' c6 _8 K, o* I% W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), a0 \5 t* N. I0 W# y
  55. #define STATIC_SHIFT                36 Q) z' G9 _# L% w" D
  56. #define TCINTEN_SHIFT               20
    . L+ P- o! h! }1 {! y- |
  57. #define ITCINTEN_SHIFT              215 \+ D) K* w2 P9 X7 y
  58. #define TCCHEN_SHIFT                22
    4 D1 b9 B, \& O# g
  59. #define ITCCHEN_SHIFT               23
    2 ~) Y" U( W8 H. h

  60. 1 }0 E0 t6 ]  t$ d5 ~7 F. O' j
  61. static volatile int irqraised1 = 0;
    6 M6 C3 L1 j9 \3 j- k$ W; b
  62. static volatile int irqraised2 = 0;
    ; \5 d( s1 n; |9 [
  63. ; f+ B) q. n& V4 y( B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ V3 J& y+ |8 M( u+ K. [$ b8 ]" R) B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* v; k3 o! N& P& ~% F5 W3 C# b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; @0 [$ M; i. r& X

  67. ' Z7 s4 ]0 `: U
  68. dma_addr_t dmaphyssrc1 = 0;! _& L* G4 O! U1 s7 S( J
  69. dma_addr_t dmaphyssrc2 = 0;9 u* ?: D: P" Z& _, i
  70. dma_addr_t dmaphysdest1 = 0;5 a4 y/ ]" N% A5 J' v0 f4 N
  71. dma_addr_t dmaphysdest2 = 0;
    * c2 c3 i/ D; Q) t. n% s/ P: |" r$ t
  72. ; }* r; b9 g* @: V% G1 j* Q$ Y
  73. char *dmabufsrc1 = NULL;
    6 b- A$ p7 l; z, a/ Q: N
  74. char *dmabufsrc2 = NULL;
    4 v3 D* t" _( [  g" S3 V8 L
  75. char *dmabufdest1 = NULL;' d( z7 A/ |8 ]0 h8 |
  76. char *dmabufdest2 = NULL;
    + {( r# `  h, c4 P8 \4 F7 }0 i- ~
  77. " }. s- S' a7 F' p! m* X
  78. static int acnt = 512;' R* @6 S& E7 g: S$ f6 X: U+ c, k
  79. static int bcnt = 8;
    1 y6 [' v4 ]; y) k! V) L
  80. static int ccnt = 8;
    $ F* S$ X0 e4 F2 f

  81. + Z% K  ~, D2 B0 Z" R/ w, Z5 n
  82. module_param(acnt, int, S_IRUGO);
    % c7 x3 \) |3 M7 y0 Y; {1 f6 v' {
  83. module_param(bcnt, int, S_IRUGO);
    # r$ a, }2 o" z: h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. J* O$ R& ?' i2 z
9 j! p# p. N' T. M6 q  J) s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 z9 B/ S* _# e( parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! H' H( |% A+ J1 C7 s* Y( a, e; I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! L0 Z+ P: j# d% n8 Q4 d
9 d% F- m" F5 P+ R* x* N
2 \* ^& s! }" z4 X" L8 a* ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 11:06 , Processed in 0.041348 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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