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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( m. b* f. K- |: x1 _- q
  1. [code]EDMA sample test application
    # d/ q  |5 s! T8 ~2 F& F( }7 V1 q
  2. /*
    # p( C! [* c/ L0 K( j2 _
  3. * edma_test.c
    1 I2 A* h4 f  u
  4. *
    + j- \& D3 h, v3 v* c5 E' o* I, b
  5. * brief  EDMA3 Test Application! d2 {, b, P" U4 Q! T2 h
  6. *
    9 o5 x! g5 _8 x8 T# L
  7. *   This file contains EDMA3 Test code.+ N% }" m) f* x! E/ B4 c7 m. [
  8. *, J* l7 v3 G  a& b6 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 m/ X3 i/ ]! s1 c0 ^7 Q% ^' m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- G4 _9 G- c# q' U- R# W
  11. *         TO CHANGE.1 t, `5 H$ f) S- r% C" B, N1 X
  12. *
    & \* C+ f7 O! }3 D4 o3 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 x: R8 u: Y6 G/ O* e! _
  14. *( E# \6 R4 |0 P  ]1 Q
  15. * This program is free software; you can redistribute it and/or% G  w: e# \5 F9 Y
  16. * modify it under the terms of the GNU General Public License as
    9 `3 L8 u( O3 V. t' Y5 s( h/ l4 x
  17. * published by the Free Software Foundation version 2.
    & N) p" _( d0 A& V1 @/ Y; R
  18. *
    ( _2 b9 d4 S: j1 \. V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 ~  ~! [6 y- m3 M
  20. * kind, whether express or implied; without even the implied warranty, }4 U4 N% u8 n+ h. @# x  D$ {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) V2 Y5 G5 n& k7 h
  22. * GNU General Public License for more details.
    9 K0 s( a9 J0 x2 m
  23. */
    , U5 }; e% i( A' h) f$ s
  24. 7 D- G$ c! \' x+ b) ]8 P& y- ?  ?8 {
  25. #include <linux/module.h>, B& C4 k: _3 J, E, z
  26. #include <linux/init.h>$ n/ d5 H3 R0 B, }9 N
  27. #include <linux/errno.h>
    4 b& o/ x0 G+ W* }0 ?3 H
  28. #include <linux/types.h>
    $ `/ Q+ \- I* P/ h* {$ {, P
  29. #include <linux/interrupt.h>8 p" x  ^, _: k# V% Q, F0 W
  30. #include <asm/io.h>& A5 U; ~/ A$ [: W" \
  31. #include <linux/moduleparam.h>; o$ @) B  u* d: f0 G; f
  32. #include <linux/sysctl.h>' @4 Y, |  X( C6 k$ F
  33. #include <linux/mm.h>
    ! i8 q) N- X# k+ |5 ]5 M
  34. #include <linux/dma-mapping.h>, N8 r3 q, f# `/ i' O- U
  35. ! R5 x; ^7 G: u% E) u
  36. #include <mach/memory.h>4 e1 T9 K' {9 ^6 h/ {
  37. #include <mach/hardware.h>. f( M; M2 x" i6 M  D
  38. #include <mach/irqs.h>
    1 Z8 `/ M' z0 j3 Q, k
  39. #include <asm/hardware/edma.h>- l! z3 Q) p0 p. \( t, a+ j) p0 m

  40. ' W& O" u; [# I5 F& e1 R
  41. #undef EDMA3_DEBUG( _- a. R) R- m  \
  42. /*#define EDMA3_DEBUG*/
    + q" V: r) y3 j0 s' ^( y8 W* Q( E

  43. 2 ]" j9 m) k. I! |
  44. #ifdef EDMA3_DEBUG4 d) W; N9 Q6 J+ _4 H, Q8 D; t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) w0 e2 |4 N9 u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) w" B7 j" ~0 c' L; I+ z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), V0 R+ k& }. `: }( k% r7 m" k
  48. #else6 n/ @! B' K% B/ ?
  49. #define DMA_PRINTK( x... ); {/ M3 m* ~3 ^. n' g2 ?' k
  50. #define DMA_FN_IN
    ; X$ K/ R! `  v1 a. U! u
  51. #define DMA_FN_OUT
    1 b; p+ [: ]. d$ F: n
  52. #endif
      `" Q% D7 C( }: ~& |( l

  53. . L1 c8 [3 L$ q1 ^  f) ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! c$ Q8 E* E# V7 q' Q
  55. #define STATIC_SHIFT                3
      ^. L" X  h/ V5 F' \) Y7 A
  56. #define TCINTEN_SHIFT               20
    # h- t/ ^: z4 r  ^
  57. #define ITCINTEN_SHIFT              21
    , L8 Z  v( a  h
  58. #define TCCHEN_SHIFT                228 F8 \) d8 w) @8 h7 G
  59. #define ITCCHEN_SHIFT               231 n9 i7 _1 H+ M0 E, N$ `
  60. / p- e4 w/ G5 s
  61. static volatile int irqraised1 = 0;' A0 O& g+ K9 N! X' l2 l
  62. static volatile int irqraised2 = 0;
    7 f/ [3 r5 y- r# n. P! I! z

  63. 6 U% x3 i- V  f, E+ _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 u* |5 ^& H7 K; r$ o7 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - f8 }6 L& }# g; k3 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 r5 ]; O, w% J8 x2 n! o9 g, t% g/ g

  67. 1 \  q: v- U. T- m
  68. dma_addr_t dmaphyssrc1 = 0;
    - x* ~0 [5 z  P" ]4 e
  69. dma_addr_t dmaphyssrc2 = 0;
    ) O( a5 V8 o  P. a, M
  70. dma_addr_t dmaphysdest1 = 0;% S3 N% E  M; C- z
  71. dma_addr_t dmaphysdest2 = 0;
    3 ]/ v$ Y0 C8 o# g

  72. 9 J$ T5 `5 ~1 I; \' \
  73. char *dmabufsrc1 = NULL;
    : T5 F& y! Q. w, o- l
  74. char *dmabufsrc2 = NULL;
    1 E$ B- Q4 W9 Y. T0 L$ U
  75. char *dmabufdest1 = NULL;
    3 {$ B. }6 E/ ?# |* q" k- U0 o
  76. char *dmabufdest2 = NULL;
    $ ^" e4 u1 `2 f9 d

  77. 3 @. Q2 A5 r; ~9 T9 J  F: D
  78. static int acnt = 512;
    ( P, r7 I/ m$ k  k( y
  79. static int bcnt = 8;
    % q. b) N! a" A; E# M' A7 E
  80. static int ccnt = 8;
    1 ^8 i  R" H8 y$ A; Q( d
  81. 0 f9 r. L" d" j2 O0 ]
  82. module_param(acnt, int, S_IRUGO);
      P+ C- n5 A2 [8 K/ t  q
  83. module_param(bcnt, int, S_IRUGO);
    % I$ \& R* {: s" d) ?, N- }$ t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ ]9 J* E) j8 j# ~: S4 S
- C1 ~% k' c, u! ^$ L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; A  V1 z! i& L
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+ C# u! \. _# `4 {3 f3 T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 j1 r. D3 D0 @& ]4 `8 C$ V; y

8 r9 e3 |* Y+ K, t5 [! g' }& B0 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 13:18 , Processed in 0.043902 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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