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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( Z$ x* d% _' V2 I- n
  1. [code]EDMA sample test application  Y8 r6 A' X( ~4 S1 Y% O- r* K
  2. /*2 K, p$ }3 F0 {+ F4 q
  3. * edma_test.c/ _" F4 |; }# T. i* x" o
  4. *! b% G. n6 C; O
  5. * brief  EDMA3 Test Application
    2 r0 @1 N0 T3 z! T. i% }  O
  6. *. a9 H( @9 }1 E& `) L  ?0 X
  7. *   This file contains EDMA3 Test code.4 u( d+ X# w" }% \
  8. *0 l/ Z, z. n* p" ?9 h: J8 T8 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  A4 Y/ K3 o- M: p2 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + |5 K# M3 X$ D/ V
  11. *         TO CHANGE./ K; {, a" g1 S5 Y6 p  r
  12. *
    ) P8 |/ y3 i; a6 h: \$ t6 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / A4 B3 n* F5 |) G4 K/ k( k
  14. *1 ~; F; ~# k, Y3 G1 V
  15. * This program is free software; you can redistribute it and/or* a# O' L9 y  y: C6 `
  16. * modify it under the terms of the GNU General Public License as' V" q8 U% X' ^2 E. G! j- r
  17. * published by the Free Software Foundation version 2.
    ' x. w# u+ M5 f5 u( P, _( i3 h0 `
  18. *
    * d9 E) u& }' V6 O6 n  j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # U0 `+ R- o: i1 g
  20. * kind, whether express or implied; without even the implied warranty# q: ]3 h$ G' j8 b& y' M! `- o8 W1 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 U- ^1 G4 Y3 }
  22. * GNU General Public License for more details.2 H! d4 _* W: s& J- @. n2 D) K: k
  23. */# `1 X% V" s0 ~
  24. % Z$ O- B8 s3 P" w
  25. #include <linux/module.h>) m* P: v; t0 J. Z0 ]
  26. #include <linux/init.h>
    ; N1 E# E* I+ w3 l( M9 @6 w. Y
  27. #include <linux/errno.h>
    5 _$ }: k* q# c& ^
  28. #include <linux/types.h>4 Q* a* r& N' c
  29. #include <linux/interrupt.h>
      L* M: q/ o! C0 M# {
  30. #include <asm/io.h>
    ; E, R7 P2 C) d2 {0 J7 T% m; T1 s
  31. #include <linux/moduleparam.h>5 F: s' Z" F0 w3 N
  32. #include <linux/sysctl.h>
    % z1 Z% m0 x  }4 `# @/ q" z
  33. #include <linux/mm.h>& a0 t  Y# S' T) z7 N+ M
  34. #include <linux/dma-mapping.h>
    ! e# |) a# j9 g- g
  35. 6 U  z; O/ B# B5 I& l
  36. #include <mach/memory.h>. _7 t7 M# N) M: @: ^, i
  37. #include <mach/hardware.h>- F+ A, F/ l2 N9 a* D! r2 \
  38. #include <mach/irqs.h>5 j) l$ u: I3 h' g* A
  39. #include <asm/hardware/edma.h>
    # I4 v; h1 P! {$ F; v8 w* |; U
  40. - t+ Z; g. @# q+ b
  41. #undef EDMA3_DEBUG- H" Z. G- k6 A& l5 v
  42. /*#define EDMA3_DEBUG*/
    2 a/ q7 O6 ~5 r. C& ^
  43. * H$ Z& `7 S& T6 |' j; ^" H$ K" t
  44. #ifdef EDMA3_DEBUG
    : T4 ]1 t, v3 s# X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 y" ^' s, S* r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) Y) D4 A& h; X5 s5 t7 W: i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 p1 V: G0 n; W# s
  48. #else
    # P6 ]% X+ a: W! J! x* r' C- e  Z; ~
  49. #define DMA_PRINTK( x... )/ b% ~: ?# A! A5 q8 O- \
  50. #define DMA_FN_IN/ a! \6 Y6 R* c" \: j9 e  H! p
  51. #define DMA_FN_OUT0 }9 j! G4 ?. o  G& \
  52. #endif
    9 n0 J; M2 y7 F! G/ K& b$ z# c) B

  53. * r! O+ h* U. ^# \/ _1 M4 \+ K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' x6 w1 O. E9 {
  55. #define STATIC_SHIFT                35 x$ \5 t' a' l* W
  56. #define TCINTEN_SHIFT               20# E4 c, S. |. z1 u( v
  57. #define ITCINTEN_SHIFT              21  v$ h3 p0 X: ]( ^
  58. #define TCCHEN_SHIFT                22
    1 B, }9 V/ B9 R6 Z, v
  59. #define ITCCHEN_SHIFT               23
    # s6 K1 A4 x7 N4 ~: T# t2 H$ r
  60. 6 y/ w( G; [6 m$ K
  61. static volatile int irqraised1 = 0;" J0 v; q- U8 R  f* w2 q+ ^5 I0 e1 {
  62. static volatile int irqraised2 = 0;
    8 J3 c' ]. ?4 ~9 t# C: j
  63. 8 l# t: B' {3 g& L% K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 C# _! y& M* m4 c3 h, E5 g( D% I: P7 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! P5 Y2 F, X/ e) }5 `0 `3 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: A+ ?; [! `8 z
  67. 3 L2 {" e0 J: y6 E
  68. dma_addr_t dmaphyssrc1 = 0;
    0 o+ R, n& h) H' x, q1 Y& V
  69. dma_addr_t dmaphyssrc2 = 0;
    ! M- w: f8 A; ^! C8 C2 F
  70. dma_addr_t dmaphysdest1 = 0;
    . t& U; r, r" f1 n5 ]2 w
  71. dma_addr_t dmaphysdest2 = 0;
    & M/ ~* W$ P) ]" n0 f0 P, D

  72. ! h; z) O! X# p% G: U
  73. char *dmabufsrc1 = NULL;3 h% [! x8 y- V( g4 E, W
  74. char *dmabufsrc2 = NULL;
    2 `, d) q5 j0 e- N" d* C
  75. char *dmabufdest1 = NULL;
    8 f  e/ J6 D% @
  76. char *dmabufdest2 = NULL;# j) M( l1 D* v* {/ W% ?

  77. 8 N8 |- w8 q: x9 }. [5 F; q& Q
  78. static int acnt = 512;  @8 y, ]1 ]  q$ p5 Z" f8 c/ i1 X
  79. static int bcnt = 8;
    3 ^/ E- n6 T: ~! Z& k. g$ v
  80. static int ccnt = 8;9 `9 {# h0 m! x! x7 }0 p
  81. ; ?* g  E4 Y, l& r+ X: A0 F
  82. module_param(acnt, int, S_IRUGO);
    8 l0 T9 S4 X8 G6 E& J5 r* T; K
  83. module_param(bcnt, int, S_IRUGO);
    ( Y" O$ {2 P1 v" m* ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ Y$ J/ P/ F& H  t
# i& w2 ~3 ^0 j3 m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& L6 U$ \9 z+ p3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ h- Q( C% r% s4 X0 A/ K$ u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 {1 Y1 V" \  ]2 M, S$ c0 _4 D2 m4 G
& G# g, Q6 _, {7 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 22:48 , Processed in 0.043495 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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