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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . b$ n$ T# C# L& g( M+ h" P
  1. [code]EDMA sample test application
    + A. t! T' H- L& p; e* O$ h* u
  2. /*; O/ t1 m) K3 @
  3. * edma_test.c9 }3 y6 y0 M7 R9 F1 }; U9 g
  4. *: o# S9 U- E: W" K2 L
  5. * brief  EDMA3 Test Application
    : p: m( D3 r5 p# e, O' Y; Y
  6. */ d# N( o# a$ r/ `6 t4 a
  7. *   This file contains EDMA3 Test code.7 q$ v' Z7 M# ~, \$ Q* ]
  8. *
    8 k1 ^% x0 x) j9 i% t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* F6 i5 C7 Q" N4 d, W: ~. y# i; s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 R! _; z1 g( ^8 P
  11. *         TO CHANGE.5 V. o) p, t* P+ a) l
  12. *% j+ A, m% D1 z% N; ?: `2 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . v4 s2 Y  ^1 R) I
  14. *
    5 v( P7 u; [' {- `0 r- V0 v
  15. * This program is free software; you can redistribute it and/or$ N3 N( C  M. K, E! T$ e7 l& q
  16. * modify it under the terms of the GNU General Public License as
    + h/ P- L! `4 d5 S( ?. X# k
  17. * published by the Free Software Foundation version 2.% z6 y4 I) Z/ h+ z5 s. F$ f
  18. *( f! [( k7 L6 w% l9 z% D% t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 d& Q; t3 {& @; r3 W
  20. * kind, whether express or implied; without even the implied warranty0 ^9 [2 b2 M+ G1 X4 p7 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 P! V0 k4 `" G2 Q8 I: Q
  22. * GNU General Public License for more details.
    % ^) y6 G# O0 }$ h! E1 Y0 c
  23. */
    8 Y1 \5 t: Z6 \3 [% |
  24. ! E% U) W4 T. P) ~: ^
  25. #include <linux/module.h>
    5 f) p* I8 I# t2 y
  26. #include <linux/init.h>
    * h9 D; z2 S2 _3 l$ b
  27. #include <linux/errno.h>; C& r6 Y/ ~- J  i' E* W$ v
  28. #include <linux/types.h>
    8 G" w6 R6 G2 p. d- ?& F
  29. #include <linux/interrupt.h>4 ^' _- p8 d0 Z6 j# A+ j9 K8 k) Y
  30. #include <asm/io.h>
    ; d; }2 d3 M' z, N( Q! ~
  31. #include <linux/moduleparam.h>
    1 s8 B4 M0 \9 Y/ |3 J* F
  32. #include <linux/sysctl.h>, a- M& K; s# @
  33. #include <linux/mm.h>2 w8 k- |+ z0 d
  34. #include <linux/dma-mapping.h>- |8 W$ p$ K) a% x' r% }) z

  35. # K, l+ Z' Y0 `. Z# \! L. `& A
  36. #include <mach/memory.h>7 T$ ^: a2 J3 u( J% H2 ~$ P& M$ N
  37. #include <mach/hardware.h>
    / H6 a: `# H9 R
  38. #include <mach/irqs.h>. O- P0 j1 _7 P0 p; h
  39. #include <asm/hardware/edma.h>
    0 F" a. V1 [. I1 _+ s: v

  40. 9 O3 W% `( @" a7 W7 r8 I# x
  41. #undef EDMA3_DEBUG
    6 b9 {8 C3 ?. N5 H: w
  42. /*#define EDMA3_DEBUG*/& n( L) a. M4 e) ]+ N- I
  43. 1 N5 x* x8 x. w$ c* `
  44. #ifdef EDMA3_DEBUG/ b: B" |$ V7 ^. K1 M" U) e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); W9 H+ j3 I- f. ^# V6 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ f) |4 W4 [4 g9 ]$ n% _0 x. I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): |# j: _1 K% ~& B5 H: x( K- N( i
  48. #else
    # Z4 q9 J3 ^( ]1 i; f& M
  49. #define DMA_PRINTK( x... )
    0 }" K" z5 w0 W8 O8 w$ J
  50. #define DMA_FN_IN$ x1 u. e4 E8 z7 _1 v. E
  51. #define DMA_FN_OUT6 ], W7 {7 h) z! D7 [; {. R
  52. #endif
    2 U6 ?2 \( K4 ^3 r2 `: h; G2 r; y

  53. . X% }3 {" p5 Z6 e- a/ I, }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( p" ~" ~7 \1 H
  55. #define STATIC_SHIFT                31 x- M7 Z- N" A
  56. #define TCINTEN_SHIFT               20
    / j. s% y. I9 h* t, m
  57. #define ITCINTEN_SHIFT              21  y/ f# z% b$ E- a' F7 s6 k8 P
  58. #define TCCHEN_SHIFT                229 x& o; ]% D1 j3 B& `4 C
  59. #define ITCCHEN_SHIFT               23
    $ M  E* N, H2 l9 O  @

  60. % ]* v+ V2 O  v  B
  61. static volatile int irqraised1 = 0;
    5 k) A- p+ `9 f! h& h+ d4 i
  62. static volatile int irqraised2 = 0;
    ; a1 F, n9 {, Y4 j) n' \/ G

  63. , y" W: U8 U2 f, W! {% j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. \4 L( S- m+ y+ u3 l& [0 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Q1 l1 ]. e8 F4 A) v% w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + t4 U3 B* J2 i" Y- }/ E

  67. ( I5 D  Y9 u4 l, [/ [& ?
  68. dma_addr_t dmaphyssrc1 = 0;
    : v/ p& q; G: T& |" l2 C8 G! N
  69. dma_addr_t dmaphyssrc2 = 0;
    6 |9 K3 T1 B. i( f" w8 E
  70. dma_addr_t dmaphysdest1 = 0;
    * U* b4 q. z! t: m5 p
  71. dma_addr_t dmaphysdest2 = 0;2 r/ l% L( @. g' N
  72. * K7 g. M; N/ f& J/ {5 f, Q9 Y+ Q
  73. char *dmabufsrc1 = NULL;
    0 C6 n$ b9 {" d
  74. char *dmabufsrc2 = NULL;
    - S9 t9 S: s' N6 Y. H
  75. char *dmabufdest1 = NULL;
    6 U% @( L5 G. v0 L2 L% |! t) z& x
  76. char *dmabufdest2 = NULL;
    8 G+ @: b" f/ w
  77. 9 m0 E; g8 P4 |# u: U
  78. static int acnt = 512;% z1 l- j3 s& i7 f8 Y
  79. static int bcnt = 8;
    8 @! J1 ~0 f" S- T
  80. static int ccnt = 8;
    8 z9 o# F& g. r6 j
  81. 7 W- M$ J! R6 D/ A1 d; ?
  82. module_param(acnt, int, S_IRUGO);
    ; K1 L( x% x  A& z- c
  83. module_param(bcnt, int, S_IRUGO);
    & U( l9 H0 }! `: B: h: [( |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% u8 A" R: S% D" c
& @  B9 h( A7 K) M  L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 I8 G( _0 [+ i3 P* i0 S. }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: R/ N5 v, ?4 _! Y( Y; v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ b3 Y% c/ k/ r& i6 v2 A  {
) Q% N' A) l" i8 d& r+ K& P) r7 U) K3 H" X( Z: Z9 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 17:48 , Processed in 0.040227 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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