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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 v% C. X" E% K3 Y
  1. [code]EDMA sample test application
    2 {% X2 m. J6 [3 H" i9 G8 q
  2. /*: H- C# f4 e  v( B$ r
  3. * edma_test.c
    - g# }+ ^; g( v! V4 X9 q
  4. *
    % F5 W5 ?* x# u3 [6 S) E( g% p
  5. * brief  EDMA3 Test Application
    4 m3 b. n9 c$ L, g( R3 b3 L
  6. *, {/ r2 u/ Z, z
  7. *   This file contains EDMA3 Test code.' |+ U. {8 E4 o7 \
  8. *
    ) w8 u' x* g) |6 B; J" t! n* L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& ^+ G- u7 u4 h2 K/ V: `* \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" l( P, C+ g! i0 Y% R
  11. *         TO CHANGE.
    ' }& ]/ c1 k  m8 P( E1 ~
  12. *
    . a* Z( z6 j! W+ A( k( H$ ?7 T# ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// X# i' i- m; @4 J( ]' q# ^
  14. *; v7 }) \6 a5 V, F# P8 _; u: A9 F
  15. * This program is free software; you can redistribute it and/or
    + H1 V9 ^7 t5 K" Y0 W
  16. * modify it under the terms of the GNU General Public License as
    # s5 S  V( e6 N9 _" l1 E% h" Q
  17. * published by the Free Software Foundation version 2., d6 U, t( V1 I. `: L& G) L" f
  18. *0 p* ^4 L7 G2 ]5 I1 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 W/ |6 i) U% A/ V  [+ l
  20. * kind, whether express or implied; without even the implied warranty
    % }  @# c7 m/ B- Z& ?8 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" ]- I4 _( {+ o
  22. * GNU General Public License for more details.9 A0 i" i& S5 g. Y# T
  23. */% \: Q# W) a. o7 g, a
  24. 0 G7 a  @% h- a2 I
  25. #include <linux/module.h>3 u5 [: m: {# P
  26. #include <linux/init.h>
    ( p4 P2 N% ~7 a- X: U- M
  27. #include <linux/errno.h>
    / B- K& C$ P# Q+ a; y
  28. #include <linux/types.h>3 ]7 r3 f6 L0 S$ ~" c$ Z7 W$ h' h1 T
  29. #include <linux/interrupt.h>
    ; Q% t9 P5 t9 T' x
  30. #include <asm/io.h>8 R; m( b% E; Z; j) w! J. E, F
  31. #include <linux/moduleparam.h>2 C! {7 d! z5 U- ^+ ]# O2 ~" t4 t0 K
  32. #include <linux/sysctl.h>
    8 P; n  U/ K) A0 P
  33. #include <linux/mm.h>
    4 ~  u( ?7 o3 R: Y  L
  34. #include <linux/dma-mapping.h>
    ; g, n, ^' C5 N7 w8 O" r

  35. # v5 B/ N2 i- t* `
  36. #include <mach/memory.h>! K, i6 }9 T, L, @* t6 I
  37. #include <mach/hardware.h>
      K& X" y7 F) c" R) p9 k/ q! o
  38. #include <mach/irqs.h>
    ! ]: v# C2 I+ z  z* B
  39. #include <asm/hardware/edma.h>! x, {6 i! A/ v

  40. 0 A% X5 {% J" y+ Y6 X/ A  k3 N
  41. #undef EDMA3_DEBUG7 [' j7 f! b# ]" E: z  p  l% v
  42. /*#define EDMA3_DEBUG*/
      Y- f" A+ {/ Q) f+ }9 D/ C

  43. 7 l# L0 d6 q- z+ m" n) C
  44. #ifdef EDMA3_DEBUG
    3 s/ P6 j7 c& H* i( d) s: R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" d: o" S- F  A( q0 R8 `. {# |2 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( e8 f# y7 t9 {0 V* O6 R6 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  E! d7 M" I3 z& |; H! f
  48. #else2 k% Y$ k# P# O  V
  49. #define DMA_PRINTK( x... )
    / B1 S7 j4 k/ M. K- v* e' W  ?2 |
  50. #define DMA_FN_IN! H" D9 |6 D  v6 Z+ J9 f4 S$ U
  51. #define DMA_FN_OUT0 |1 X0 |3 c( E3 m$ U0 u& ?
  52. #endif& b4 b8 d# W" r9 N# V

  53. 8 {$ u- K: E7 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). i. c" @2 U; y6 [
  55. #define STATIC_SHIFT                3
    , i  R( X; x8 s, `4 E8 ]  z
  56. #define TCINTEN_SHIFT               201 Z+ r- i* @! ?5 ^
  57. #define ITCINTEN_SHIFT              21% z% U  ?. |' r  B+ ~
  58. #define TCCHEN_SHIFT                22
    7 x$ h- ^9 ~0 c& M$ `/ X/ o/ z8 @
  59. #define ITCCHEN_SHIFT               231 O1 }6 F' i& z( A

  60. 7 @' I, m" o8 v) K' l- ]+ E- B
  61. static volatile int irqraised1 = 0;9 P1 a9 V! v: P! t: H5 t
  62. static volatile int irqraised2 = 0;
    0 Q5 L  N4 t  c% P! x
  63. 1 c6 p3 y) J/ I. v0 @+ S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; F3 I& p; {& |/ B& p$ c/ _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! |( \2 G) u1 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 j2 ~% G: j2 A( ]
  67. 8 x; e# U7 L- s+ t) r# C/ V& V
  68. dma_addr_t dmaphyssrc1 = 0;1 K* D4 `2 [6 \' @/ l: R. g# x
  69. dma_addr_t dmaphyssrc2 = 0;  |4 G; M; k6 e$ ~
  70. dma_addr_t dmaphysdest1 = 0;
    . _  E: g: ~9 b7 g/ a7 S! b
  71. dma_addr_t dmaphysdest2 = 0;
    ( D! g/ f* N% ^" ]1 ?- k

  72. 4 t2 A+ L% k$ d: r2 E; A3 Z' ~, \9 H# n
  73. char *dmabufsrc1 = NULL;+ N- k2 X5 o/ x+ b3 r% F2 l
  74. char *dmabufsrc2 = NULL;
    - y6 m- s6 B: W6 y
  75. char *dmabufdest1 = NULL;; I/ `; T' I! j" r4 B- |
  76. char *dmabufdest2 = NULL;( Y$ ?' o; N4 V

  77. 8 f9 c6 g6 r4 `8 h% B
  78. static int acnt = 512;
    % d5 }9 N* I& C4 y
  79. static int bcnt = 8;
    9 }6 i& ?1 x& g
  80. static int ccnt = 8;" U! @" n6 g* T0 D5 s% _
  81. 3 m2 R& _% g- u: ?: U- f
  82. module_param(acnt, int, S_IRUGO);$ l3 Q& N8 G3 A4 \  L( C
  83. module_param(bcnt, int, S_IRUGO);
      f4 H* ]4 X- A3 h' J8 K3 l, R, t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. q" [+ L% F0 N5 E3 ]0 ]3 T3 V+ }1 m( j, n* q7 M/ e' ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 U6 Z/ n- o8 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( d& {  r+ g1 e/ _  t  ?/ D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ ?2 v$ o7 ^: A  Y

% B, W* }( T1 {$ f- c5 ^' C* J. X' L0 W9 @. i  X( p5 m6 P* y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-8 20:23 , Processed in 0.039964 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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