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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 f3 q. }& G( d
  1. [code]EDMA sample test application
    # w6 w) M) e3 @; m- ^9 x" R
  2. /*8 c" J% I  @( w
  3. * edma_test.c9 x) |: N5 K, ]- j8 I
  4. *; X) X2 B; h1 j$ N* I$ T
  5. * brief  EDMA3 Test Application
    * q1 T. U1 _6 k
  6. *
    , [8 Y6 I& e' @! W% Y& y
  7. *   This file contains EDMA3 Test code.
    & L8 z! a6 {) R! K1 U3 a
  8. *8 E% ^# J9 ]$ g0 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: x6 q( P0 F) `! ]" {) e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 x9 l! I$ y* A# N; {* x$ M
  11. *         TO CHANGE., x  X) o" L. a/ x5 I. |9 H
  12. *2 z. O: [2 d! E' i! [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # m$ c* x- o8 |% c+ t4 h
  14. *
    9 J. V/ ?' Z4 M1 `% A
  15. * This program is free software; you can redistribute it and/or
    - L$ `, ^6 D* s$ `! A+ F5 I
  16. * modify it under the terms of the GNU General Public License as
    ; I$ S& ^, I/ B, \/ _0 g- v
  17. * published by the Free Software Foundation version 2.
    $ h, _, M# R) R. R
  18. *
    : c0 K0 @! \- e/ ?$ w0 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 Y0 i, ^0 d4 w
  20. * kind, whether express or implied; without even the implied warranty6 i) G& N. Y$ x0 r/ f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 k$ c( z- Q1 [+ q, i& z7 w
  22. * GNU General Public License for more details.
    & c- R& c! f$ K% Q3 ?
  23. */
    7 s" w$ C" N  {3 z8 W' R1 M
  24. 2 P$ N3 k7 N* J" E4 E. G( U
  25. #include <linux/module.h>
    ; Z$ _8 N3 A6 p' r5 H8 N
  26. #include <linux/init.h>
      g+ ^. Q- S: _4 U$ S6 l+ O( a
  27. #include <linux/errno.h>
    5 p: A3 g0 E+ R9 X  _5 D3 R
  28. #include <linux/types.h>
    6 t" Z/ S" \, p5 @5 S# a9 W
  29. #include <linux/interrupt.h>. q1 y7 |( e2 P6 e7 [! y& G
  30. #include <asm/io.h>4 c2 u" z6 I( B5 T
  31. #include <linux/moduleparam.h>
    0 t* B1 j. U8 X3 i- J/ T( \
  32. #include <linux/sysctl.h>' Q4 q( w2 S; Q5 F
  33. #include <linux/mm.h>
    $ x7 @/ ]3 O$ r
  34. #include <linux/dma-mapping.h>
    8 h* B1 o& t! [1 M; }3 g1 c2 H
  35. # d; S4 Z& p  f. [0 _
  36. #include <mach/memory.h>  h* V- p8 V7 A  w2 P; g, U$ r
  37. #include <mach/hardware.h>. P: p1 {0 c0 r6 t% X3 `5 B
  38. #include <mach/irqs.h>
    - U; \- n  Q; R& m$ g9 a' j
  39. #include <asm/hardware/edma.h>
    ; B3 `1 s0 ]6 p3 ?% l

  40. % L4 \+ j9 L" {9 _. N
  41. #undef EDMA3_DEBUG- h. S+ c5 ~' a  ?0 Y# w& {7 a
  42. /*#define EDMA3_DEBUG*/! z8 _- T7 c# P( V* `
  43. 3 T0 i! v( M6 g2 ]& U
  44. #ifdef EDMA3_DEBUG
    + v# J* b# Y4 ], {! y9 |' s5 M# t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  t# _+ ]2 z# W, G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 Z! `; q7 O0 @, i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 y) Z5 x  C1 h: r1 M! ?
  48. #else' v9 [0 ~# t  S+ d1 V
  49. #define DMA_PRINTK( x... )
    ) c7 g2 Q) ?) j8 a* b. j  U
  50. #define DMA_FN_IN
    % F8 y5 N5 ~. h
  51. #define DMA_FN_OUT* m+ q8 P- U0 h
  52. #endif
    ! H" c$ E/ [) ^& g8 N

  53. $ _7 i: [/ ?! ]5 V* W1 W& ?0 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 l! v" g9 E6 v  E+ g
  55. #define STATIC_SHIFT                3
    ' T' _  D. I1 {0 p% ~7 K: r
  56. #define TCINTEN_SHIFT               20$ w( ~  B5 \/ g- Y- e
  57. #define ITCINTEN_SHIFT              21
    " m) ?# L* |1 [' i  I
  58. #define TCCHEN_SHIFT                22
    : e0 \4 I; E; a! a, g
  59. #define ITCCHEN_SHIFT               237 R+ K8 v& b1 Q- d

  60. ) ]8 h' Z$ H1 P( C+ d1 M$ D  P9 ~
  61. static volatile int irqraised1 = 0;
    9 }# w# u* f3 z7 ?. j9 s! H  |
  62. static volatile int irqraised2 = 0;  @7 R( p  }4 H; P
  63. + _+ F. P# I$ o  ]8 k! E. j1 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ L- X; R. |% o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + z" l1 x9 ?- F: r: D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; H4 ?% m. D0 r) D0 [

  67. ) h& t  ?. R  o& r
  68. dma_addr_t dmaphyssrc1 = 0;1 D( P4 ?, }; B1 B. c  g( m
  69. dma_addr_t dmaphyssrc2 = 0;
    $ g3 F: n& `! a% j; q6 M! `% X
  70. dma_addr_t dmaphysdest1 = 0;
    : d9 ~/ B: r1 g8 p% ?- o
  71. dma_addr_t dmaphysdest2 = 0;( Q: k/ F& }$ r4 y

  72. / g: f6 M8 L7 r5 s4 {
  73. char *dmabufsrc1 = NULL;+ X+ p4 y9 v" J' ]& d. g
  74. char *dmabufsrc2 = NULL;" B( C. N- |$ B+ l8 p; a$ v* Z
  75. char *dmabufdest1 = NULL;
    $ c5 |8 y* E) R# \& Q
  76. char *dmabufdest2 = NULL;
    * F: V5 E9 w3 g; g
  77. # W, _8 W, f  J4 x
  78. static int acnt = 512;
    " B, J6 B. @& y* `
  79. static int bcnt = 8;4 K! ^1 R, m" B+ c1 E- G; D
  80. static int ccnt = 8;3 J& o; L- I+ M5 }( J& D+ K; a/ J

  81. 3 [; s4 e1 J/ g, w( q% i* r# d% p
  82. module_param(acnt, int, S_IRUGO);* S; h; w# B  k1 H& C, q6 Q
  83. module_param(bcnt, int, S_IRUGO);
    , W) n2 R! b: d6 W2 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& n6 V; I: x2 Q. h: s  w

6 @: j' f8 [3 ~8 j6 ?+ r& b0 h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% N  D0 c4 Z( I& k1 H  Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 T; \/ p+ l2 P( Q: y3 ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% l2 i+ w& V4 d( T% r+ [( b$ |! N$ T9 `7 y

+ O4 H$ p9 x" o0 R" ^& k2 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 14:21 , Processed in 0.038135 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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