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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% ^4 U* e* s6 j% h3 A5 k
  1. [code]EDMA sample test application
    " B4 D& D. I5 f/ f3 X
  2. /*# B$ A$ B3 y2 ~( [* L
  3. * edma_test.c9 v' |8 H2 Y" q( I/ y; `. F
  4. *
    : r: n6 Q- \+ }5 z; U
  5. * brief  EDMA3 Test Application
    0 k5 Q0 {$ }* [
  6. *
    . @/ H; K8 z( L) z) s
  7. *   This file contains EDMA3 Test code.
    # |  V- n5 t" u6 M3 X$ E# L
  8. *
      ]! z1 ~& Y6 G. }# @# k8 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : z3 t. R( Q; P, M" C* n& P" K& u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 F7 L  G! O4 R/ e. o; z& y* \" W% W
  11. *         TO CHANGE./ L# q/ R# r+ p9 v8 ^6 j
  12. *1 _) r' b, ~  n% Q! ?5 f! p' ^" g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ `# }$ z/ U- s6 W6 Y
  14. *
    2 s$ k# g+ N/ C% f
  15. * This program is free software; you can redistribute it and/or
    - z: v4 t3 i* O/ w
  16. * modify it under the terms of the GNU General Public License as
    ' m5 F! I( a) ?& |- J. x8 i2 a/ K* Q
  17. * published by the Free Software Foundation version 2.
    5 Y( R! g# `3 n3 V1 |1 l8 E9 N2 ~
  18. *
    2 V# c7 j7 N8 Q8 ~" w* x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 _7 M" m: x3 v! r: y: I
  20. * kind, whether express or implied; without even the implied warranty
    . E: B6 ~' l. a, N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- L# X2 E' m; \) A6 I/ x( L; ]1 ]
  22. * GNU General Public License for more details.; B* r! u$ i* a$ ]
  23. */" X1 D) R5 H* F3 m

  24. . @# ^0 k& `1 R1 ~1 h
  25. #include <linux/module.h>! R) v/ V' V7 z% ^, P5 L( r
  26. #include <linux/init.h>  q5 e* \' E/ s' o) C) [- t
  27. #include <linux/errno.h>
    ! e* y+ o$ }7 c, H* f
  28. #include <linux/types.h>- X0 J- v  ]7 c2 x0 g: P
  29. #include <linux/interrupt.h>
      D* p1 g: T% D1 u
  30. #include <asm/io.h>
    " ^9 T5 l! s) E+ O, D
  31. #include <linux/moduleparam.h>: g( u' I3 z. O5 Y. M% \' R
  32. #include <linux/sysctl.h>
    3 c9 \; R5 k% f. x( l
  33. #include <linux/mm.h>
    + b  Z( V! w6 b- ]5 ?1 U) d
  34. #include <linux/dma-mapping.h>% R7 f. D3 B& x- V4 F2 s3 v4 L
  35. ' R6 X* p# }% Z# o
  36. #include <mach/memory.h>8 A9 R7 z" J$ ], R: ~
  37. #include <mach/hardware.h>
    $ A/ S4 i4 }* w& H' J
  38. #include <mach/irqs.h>
    , d2 S. `0 F$ F' F, j+ h
  39. #include <asm/hardware/edma.h>6 L1 o7 @+ j* C$ g
  40. . D3 T9 {6 D, v% Y! R
  41. #undef EDMA3_DEBUG
    ! M) b3 Z  C; z7 w* i( T
  42. /*#define EDMA3_DEBUG*/+ R; ^, Y: R; i) [5 m% R9 `
  43. - A+ ^% [' G7 d6 [  I/ T; P
  44. #ifdef EDMA3_DEBUG
    : B" X; u, r$ S7 {+ Z2 |7 L- [) N9 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 g) G. A* i  x' u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 c# R6 S# j0 H, r$ }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 r5 N0 F; }7 u3 L* k4 D; T
  48. #else: w' d: y) z# Z7 |) k4 O: e' u
  49. #define DMA_PRINTK( x... )4 |) O  P' b& Y2 y- u( e
  50. #define DMA_FN_IN2 X7 S" B, M: u, Q7 E( a
  51. #define DMA_FN_OUT) z' L- s+ X: L% a- ~" M5 o
  52. #endif
    3 ]- [/ B8 e/ i7 K, {
  53. . v8 R" k: Z3 N5 i9 [* h+ C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 }) V: N& a! f7 }8 S. t( @
  55. #define STATIC_SHIFT                3
    % B. b) p7 B6 |! Q8 L! m; Q% n* ]
  56. #define TCINTEN_SHIFT               207 S, M" t* w. @* B
  57. #define ITCINTEN_SHIFT              21- X4 n1 v5 S1 d0 T# }! X/ T1 m' l8 g
  58. #define TCCHEN_SHIFT                22
    / g' [. L8 Z: i
  59. #define ITCCHEN_SHIFT               23
    4 {6 F5 C  k9 z" g8 {0 f6 L

  60. & R( m0 R# L% N! y0 ]
  61. static volatile int irqraised1 = 0;
    # ~0 k8 ^1 Q* v, B4 d0 b9 b/ H
  62. static volatile int irqraised2 = 0;
    2 A* v6 d/ G: u% L& j' h5 p" G

  63. ! }! y/ ~7 I/ h% H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 h7 b& ~3 Q, n( ^& U+ }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P  x3 k3 c; [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * j6 t: H9 r5 P8 i* z
  67. 4 g  R  P5 J: E7 A" x7 G7 P, P
  68. dma_addr_t dmaphyssrc1 = 0;$ M- f; q! m% {5 M0 X4 f
  69. dma_addr_t dmaphyssrc2 = 0;3 x  g" g4 Y( y4 s
  70. dma_addr_t dmaphysdest1 = 0;
    ) `! ?6 V& b. a) u0 B' B: C
  71. dma_addr_t dmaphysdest2 = 0;, ]* a* o* @; c% d$ [; a# C- p# B

  72. . Y+ e) }7 S& y# P
  73. char *dmabufsrc1 = NULL;- W3 a1 `/ O! x6 U) R
  74. char *dmabufsrc2 = NULL;( F" u) w5 H# r: ~+ W: Z
  75. char *dmabufdest1 = NULL;! e& z* N4 E$ Q7 H# q
  76. char *dmabufdest2 = NULL;! a$ A& k: t* G9 x% B

  77. 7 \: E( l; B. I5 x% C2 z# A
  78. static int acnt = 512;. [: K7 w) G  e( A  u: [
  79. static int bcnt = 8;
    0 X3 m8 T) J* f) J0 P( m, {
  80. static int ccnt = 8;" D. s# F: [4 I5 T' Z

  81. . P1 c5 {- i4 z9 s2 k
  82. module_param(acnt, int, S_IRUGO);
    8 M! I$ d8 v0 g
  83. module_param(bcnt, int, S_IRUGO);+ J2 b( _1 L( s% E/ p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 J* ~& |/ V6 _) k
) D: O  b, ~- L0 p. ?% `* q- l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& t, [# k8 [. O" P- harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, T& C" O7 q, Z- `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 e' Y% M# I1 t$ {8 @& r1 g
' ^; @- z" c/ s' z6 K' [/ ^7 x/ D* a; @8 @1 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 21:41 , Processed in 0.037096 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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