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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 k. j' X0 S7 u* q3 n7 g% m
  1. [code]EDMA sample test application/ G3 o! k' Z# D3 {, N) X9 W: f
  2. /*
    + D5 z# z0 n# w
  3. * edma_test.c& a) j! C4 A- j3 I2 A2 q2 t" t- T4 @
  4. *3 ^9 A% h  e& u
  5. * brief  EDMA3 Test Application9 k* p" D! Y! H( I1 G4 R( W2 B( ]
  6. *
    $ B# r& K' ~( E5 g* D7 Q
  7. *   This file contains EDMA3 Test code.! {$ O$ ~; K) U1 T9 K+ X- z( ?( V
  8. *& M! R- l* V  z8 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; p- t" W' q: Y( G. m0 G1 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 ]$ O$ Q# P2 }3 N. G
  11. *         TO CHANGE.$ P8 L% ?4 V% V  h6 W& c. I+ g
  12. *
      w4 b( p! a! B6 w4 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 h5 x$ C9 W- w
  14. *) O+ Q- {0 H" x5 F+ |6 m
  15. * This program is free software; you can redistribute it and/or
    / }# \4 U, Q# P( y+ F
  16. * modify it under the terms of the GNU General Public License as
    - B/ R/ p! }/ O" N
  17. * published by the Free Software Foundation version 2.. f& Z" h$ g; b) _
  18. *# Z8 W1 i, D; }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 a% \8 {6 J' R5 w9 y
  20. * kind, whether express or implied; without even the implied warranty  n8 ?& w. ^* N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, }7 a  N9 O- F& @5 i
  22. * GNU General Public License for more details.0 M) T+ E' C+ C0 B- h
  23. */
    5 Y& H" q6 H2 J. a6 |2 _

  24. + v5 E% C4 w, q' T5 A9 w* o6 J
  25. #include <linux/module.h>6 J4 u# m9 ~$ X! r1 H: H. ?
  26. #include <linux/init.h>2 [) Y2 w: H6 o
  27. #include <linux/errno.h>+ j5 G2 d0 x; F3 L: T! k& `
  28. #include <linux/types.h>& `' Z  h; p8 ~# P5 A% g
  29. #include <linux/interrupt.h>
    * h6 q3 D3 [) s
  30. #include <asm/io.h>) Y4 D9 j, X; t0 t
  31. #include <linux/moduleparam.h>$ t- d( B; z8 J8 F7 o% y
  32. #include <linux/sysctl.h>" g$ }5 K, ]( R) O# X  M8 i
  33. #include <linux/mm.h>+ [* x7 d3 q/ V  |
  34. #include <linux/dma-mapping.h>& d# ^/ ]5 P( E" R7 E
  35. / T) M1 N* p' G& u4 H# f9 U
  36. #include <mach/memory.h>
    ) v: y* ?* Y' A
  37. #include <mach/hardware.h>% B4 l  n9 y* D: F+ D4 S+ O- j
  38. #include <mach/irqs.h>
    + L6 `3 J0 _! h
  39. #include <asm/hardware/edma.h>
    , {. U1 \% y4 \  f- p

  40. , G4 D- L& w  u7 p
  41. #undef EDMA3_DEBUG
    . Y* `3 L# x7 P0 S* t4 C
  42. /*#define EDMA3_DEBUG*/
    ' A$ \0 j1 u4 ~& ~2 @6 G

  43. 3 J* c$ w! `& {3 t
  44. #ifdef EDMA3_DEBUG
    : \8 l: `3 O' c/ K% x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . q- S+ l( c" r. ]2 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 f- \) M1 i0 d) W& `. P# r* u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % q. t/ D" _6 W) M: P
  48. #else& y: }, e0 B7 S
  49. #define DMA_PRINTK( x... )
    3 F3 G, w2 |% z; a
  50. #define DMA_FN_IN) T3 J+ L# n" s; |3 J
  51. #define DMA_FN_OUT7 H* _9 N0 o' O2 }3 H
  52. #endif
    6 j4 A( @9 C/ ?. Y
  53.   o8 T. I( {$ Q/ w9 D6 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 g8 Q+ b; W; Q/ N. t# `6 R
  55. #define STATIC_SHIFT                37 L& V- x, m3 p0 m' ]' G% K% M, D6 E
  56. #define TCINTEN_SHIFT               201 M/ T6 z  {2 @  m8 ?$ J
  57. #define ITCINTEN_SHIFT              21
    ; U. D2 W: w: w0 v9 D7 v% _$ ]
  58. #define TCCHEN_SHIFT                22
      G. o, A+ q& L. W6 n: l. p
  59. #define ITCCHEN_SHIFT               236 z) U5 `+ S4 l- r$ G" K( K, z

  60. / _% u8 d0 p) O6 B2 o
  61. static volatile int irqraised1 = 0;
    8 m5 t$ h- o, ~+ Z& H2 @
  62. static volatile int irqraised2 = 0;
    : o5 u+ D) [; N/ J- y; O0 U& Z6 [% Z8 ]

  63. ! ?4 @# p* w8 ^- y( M# z8 W; O" l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : R% l% v) }9 Z/ f/ ~9 ?% h9 P" {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( l1 v6 ?. S) i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % p7 Z" a: u9 y2 E: b

  67. / q1 H% {9 r" N* d& a: a
  68. dma_addr_t dmaphyssrc1 = 0;
    6 J) p' ^0 D* m8 j$ r
  69. dma_addr_t dmaphyssrc2 = 0;
    7 q+ ]; O: _7 P4 W
  70. dma_addr_t dmaphysdest1 = 0;
    4 j: U9 t4 D0 w+ Q( L& T
  71. dma_addr_t dmaphysdest2 = 0;
    5 K0 V) r: m3 J
  72. 6 M- X  o6 v  h- ]: B8 L7 J- H  U/ r
  73. char *dmabufsrc1 = NULL;7 R5 N6 I1 d* ]$ H/ n
  74. char *dmabufsrc2 = NULL;
    / Q! T/ g1 m0 p9 ~  {
  75. char *dmabufdest1 = NULL;
    " W; i1 t, h  x! s$ H- e2 f
  76. char *dmabufdest2 = NULL;
    $ H- w0 T9 Z/ N* X
  77. + J7 f/ a8 H" t: Y+ ?9 \$ [
  78. static int acnt = 512;+ p' g: {4 X* i/ c, w
  79. static int bcnt = 8;! d: W- [  t% v  Z4 q" h! L
  80. static int ccnt = 8;
    / d$ @1 s7 e) X$ m

  81. ! h$ P/ Y9 y6 f) V  b+ A! F0 _
  82. module_param(acnt, int, S_IRUGO);( H, Y7 C8 j; _7 [/ e2 H# D5 Z+ {$ v
  83. module_param(bcnt, int, S_IRUGO);
    ; p3 u4 f$ G2 V8 [% A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 F4 O  r; P' N" E6 n
$ Y) t; y. c1 ^- |0 c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* h3 V/ Q( n1 |0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' v! v* E- `. ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 k3 M6 G" @1 f% c0 l. ^+ m6 ]2 ]1 N# Y
4 e% R4 E+ ^3 G9 f) p6 ~( j3 L" S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 09:41 , Processed in 0.040000 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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