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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) A# y' W  x/ B
  1. [code]EDMA sample test application( Q  M1 Z. j7 r7 {) I
  2. /*& l- G% r7 b! Q* p. `# a
  3. * edma_test.c+ [* w3 \& F' u0 K' ]- y- K; ~
  4. *2 Z/ H3 V$ n$ A- M, ~" W  W
  5. * brief  EDMA3 Test Application
    2 ^* k! Y- c: S" P; }! u# W8 y
  6. *
    / D. s* m* e( t* h3 g3 X
  7. *   This file contains EDMA3 Test code.
    . ^; |* X8 i1 V; e, J# Z& a0 Y
  8. *. N" q! w6 v) f; ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 F; m) X) e9 J% L( ^4 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; v3 G' p9 ]1 E, L( G5 [) o! S
  11. *         TO CHANGE.; V# z; ~0 Z8 r# K( H
  12. *3 T' @! U, z  {1 d( C, d$ V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ b' K/ I6 U3 t5 G' Q
  14. *0 D9 L" ~9 J. V$ `4 y5 d0 k: |
  15. * This program is free software; you can redistribute it and/or/ k, S* F% _% f* W
  16. * modify it under the terms of the GNU General Public License as& j+ Z6 u% p: H$ c6 B! S- F/ Y
  17. * published by the Free Software Foundation version 2.
    5 s7 J9 t9 O( u- K0 i
  18. *2 o2 d$ b9 u) C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % a5 Z. `0 r9 X0 ?8 E
  20. * kind, whether express or implied; without even the implied warranty
    % R8 F+ @6 b! L; J% ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, r+ T) M, A" V7 x) r
  22. * GNU General Public License for more details.
      [9 B- l2 i" G% |4 g6 W: G% x
  23. */: n) U$ Z* B& J1 k

  24. 3 X% C# Q  Y/ u. n( f
  25. #include <linux/module.h>5 |1 G* Z8 H/ u4 l6 {' j
  26. #include <linux/init.h>. q' r+ S4 B7 y4 M6 z7 _
  27. #include <linux/errno.h>4 A- C5 Y* L* t$ A; [
  28. #include <linux/types.h>
    2 o7 P- f1 Y  b! q! c. K) B
  29. #include <linux/interrupt.h>) r. W/ Z0 X4 W. G3 c
  30. #include <asm/io.h>
    " `, e2 F" `# x9 g+ d, k4 s# r, q
  31. #include <linux/moduleparam.h>
    8 G4 D$ l# x: L2 W5 s
  32. #include <linux/sysctl.h>% Y( u8 W- _% `" N
  33. #include <linux/mm.h>
    - o% l- i7 s7 B
  34. #include <linux/dma-mapping.h>
    # u8 m8 H8 Y. z& x. p6 n

  35. $ N" ?5 ]$ Y- w6 N. [. _4 \+ ]# k
  36. #include <mach/memory.h>
    - `- s, |2 r% W* `
  37. #include <mach/hardware.h>9 {5 _3 a  Z6 Z% d# h' W! a' m; K. e
  38. #include <mach/irqs.h>2 N2 I. p" Q, U/ T7 @3 ^' K3 w
  39. #include <asm/hardware/edma.h>& j7 N$ W8 U. Q/ g! M

  40. 5 U' ^' T4 y& @$ }" p
  41. #undef EDMA3_DEBUG
    ! v) F; O2 d1 F! E
  42. /*#define EDMA3_DEBUG*/
      X  N- r" k- d4 k6 `/ A3 V
  43. / _8 ~  t4 X4 c; }+ c* v7 k
  44. #ifdef EDMA3_DEBUG" F: @$ B* P& u- X+ `; Z1 b3 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * \- h3 U# a! [- D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 A) j* `' a/ B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ y. _4 ]; T8 P, b4 C* E  F; ?
  48. #else
    3 ^' c/ Y8 d$ \. Q8 L" W
  49. #define DMA_PRINTK( x... )+ s9 [6 p0 a$ l7 _% X
  50. #define DMA_FN_IN
    ' \0 t1 u; n2 A1 L( t
  51. #define DMA_FN_OUT4 D/ c$ h+ I: V$ P/ w# U
  52. #endif8 G( _. O9 \1 b+ k( V2 i+ U  J) o
  53. 7 ?: h( C2 D+ @. F, C5 S: q% n# e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ E) F( M/ {! r& G9 w
  55. #define STATIC_SHIFT                3
    % o+ o& w$ {. O; c0 @* n
  56. #define TCINTEN_SHIFT               20) v. X2 m# t; X3 o/ s4 ?
  57. #define ITCINTEN_SHIFT              21
    6 a5 B* ]5 ^& s. Z; H/ P* ~
  58. #define TCCHEN_SHIFT                22
    , u3 D; f0 V) g3 f+ N
  59. #define ITCCHEN_SHIFT               23
    6 E+ g3 j, c6 U3 r
  60. . W+ n: T. s8 ~9 l  Z/ u
  61. static volatile int irqraised1 = 0;( C1 J' [0 g0 k- f! I
  62. static volatile int irqraised2 = 0;/ I' Z) e/ c# B. y% G
  63. 1 K! |# A( y2 D1 [7 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  e% i) j+ K. \, e7 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( J0 |9 L9 f! T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( Y+ P% K3 C- u/ Y3 y0 U

  67. 6 |: X+ B9 C, t& S. U
  68. dma_addr_t dmaphyssrc1 = 0;
    + o0 }7 P9 |7 a# Q" T6 h; V
  69. dma_addr_t dmaphyssrc2 = 0;
    : y) G( s" u3 r
  70. dma_addr_t dmaphysdest1 = 0;
    + A$ h2 n) d) T
  71. dma_addr_t dmaphysdest2 = 0;. r# K. L" u" N; ~

  72. " z. V4 F0 f$ U" I. q8 B
  73. char *dmabufsrc1 = NULL;
    1 o8 Y+ n% p' L" G$ g  e# J; l
  74. char *dmabufsrc2 = NULL;; e- T: _' G( z0 T
  75. char *dmabufdest1 = NULL;; t# F1 `) p0 C5 z+ [
  76. char *dmabufdest2 = NULL;
    ( f3 _% U: Z, C) o2 l& E
  77. ; Q4 ^* G# \% N% l/ c, |- s. I
  78. static int acnt = 512;9 r8 t. [( N$ K# P& Z
  79. static int bcnt = 8;5 Z7 b- n0 }( o" Q" I: p1 f
  80. static int ccnt = 8;& f$ N/ i7 V) l( Z& f4 [' S, x7 _

  81. 5 I4 s  K% J  Y7 l8 v9 q
  82. module_param(acnt, int, S_IRUGO);
    * t! g6 ?8 Z( E% ^7 E* i$ y1 M6 d  H
  83. module_param(bcnt, int, S_IRUGO);
    8 v3 a9 H: G, m! w4 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. ]5 i, b. c- @
" a: i* G4 @3 l8 ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ D; i, M/ N+ q( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 ~7 p. b4 P% P  h$ B/ `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( q* c5 H/ Z' Y- L( R) w7 t
2 @) t0 \- w' y7 G
- A  L( E4 I# U' H+ }6 N1 ^( {1 Q  J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 02:38 , Processed in 0.058705 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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