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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 P) W1 e9 @6 `" p: e7 v
  1. [code]EDMA sample test application
    $ u: u' W2 p* G4 w) I" E9 a
  2. /*7 G' G9 W$ _( v- m# J0 Z
  3. * edma_test.c
    " B5 ~) Q# p, C; @
  4. *
    6 x5 e4 p" {: o0 [! K4 ~  {
  5. * brief  EDMA3 Test Application. n' r' m% Q9 K' y" o
  6. *
    7 [1 e# r$ L& Y5 @
  7. *   This file contains EDMA3 Test code./ Z0 B% k6 n1 J' q! ]7 Z" T$ b
  8. *
    ! b3 d( n/ X- n# s3 Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- v( |/ w) N4 v4 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # r& l, ?" y$ B9 g% M& D" k
  11. *         TO CHANGE.' }$ U$ _: I$ z% ^, Z0 M
  12. *
    6 f- `2 H8 `& j9 F! T% x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) [- i3 i  ]% o9 ~
  14. *3 ]# z2 T+ i3 S
  15. * This program is free software; you can redistribute it and/or& X9 f( C# _" z" r4 m
  16. * modify it under the terms of the GNU General Public License as
    4 l" i3 X& a4 \2 P8 A1 C& ]
  17. * published by the Free Software Foundation version 2.
    - l) Y, C9 m/ _) v5 E
  18. *' {. p- \5 J- S0 l$ s; n) A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - d* S& Z3 x! c4 e; x
  20. * kind, whether express or implied; without even the implied warranty: S- f  M+ R3 e% Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' |7 k8 R& w. W
  22. * GNU General Public License for more details.
    # r/ ^8 A! F# }  Y
  23. */
    9 Z+ m$ W1 I0 f! e+ o

  24. 1 j2 ^* q3 N% I' @
  25. #include <linux/module.h>
    ' M! I, g$ T! Y
  26. #include <linux/init.h>. a6 X6 c* }7 I- n& R
  27. #include <linux/errno.h>
    ! `2 e8 G5 j$ N# X
  28. #include <linux/types.h>2 k' u6 Q  q6 U/ U. }( [: c
  29. #include <linux/interrupt.h>& G# F2 S6 ^) D+ S) L$ [
  30. #include <asm/io.h>& y5 Q% A4 d  [. n
  31. #include <linux/moduleparam.h>
    - Z4 ~0 f: E* X7 F/ n6 ^
  32. #include <linux/sysctl.h>9 Y' E) t2 y+ K( X' D2 H& l
  33. #include <linux/mm.h>
    7 Z3 P% ~1 W' }4 ?
  34. #include <linux/dma-mapping.h>
    0 p9 V8 G8 S, P5 v  O

  35. 3 Q- Q0 ^9 ~4 R3 K$ e
  36. #include <mach/memory.h>
    3 ]9 m7 q- f% a5 F
  37. #include <mach/hardware.h>; z8 X! s/ B. |/ }( g6 H% H, i
  38. #include <mach/irqs.h>
    " x" l4 g8 i9 `5 [9 t8 O6 P
  39. #include <asm/hardware/edma.h>, s+ W( m9 V0 b, |* s* i9 ?
  40. - _8 Z- X1 z5 ~
  41. #undef EDMA3_DEBUG
    4 S! S' H! V, [/ j
  42. /*#define EDMA3_DEBUG*/
      }% R* s: D  @' V$ m( ~
  43. % q# f* c9 w  o: n. c
  44. #ifdef EDMA3_DEBUG
    % t3 _% Z/ `$ G1 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' Z" E3 m5 ^# x, O0 Y9 ]' h$ z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; b, O4 [& p0 E9 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 C; U0 K, u5 S  Q, ~$ s
  48. #else  n$ ~1 R6 x5 S- h4 N$ G9 h+ t
  49. #define DMA_PRINTK( x... )
    + G5 h; a# Q0 u9 y# s1 C
  50. #define DMA_FN_IN
    * n: L9 I/ a" l4 J5 [  }. S
  51. #define DMA_FN_OUT$ }6 e7 O% W+ b  I) v
  52. #endif
    + Q6 N! T6 g9 c! s7 C
  53. 0 P4 X7 z9 D2 N! C" A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / @3 o8 e# m9 M; c* w2 J
  55. #define STATIC_SHIFT                33 ~, C3 t& f- q" q
  56. #define TCINTEN_SHIFT               20" ^* v" N. b6 v! M/ \! G! d
  57. #define ITCINTEN_SHIFT              21
    . X% A, {! p/ ?! S, `8 b
  58. #define TCCHEN_SHIFT                22! p$ l" `* T! D* j; G
  59. #define ITCCHEN_SHIFT               23
    : x# F/ E% U! c/ j5 U; B
  60. / M% T* t" k$ G; h/ p3 l  c
  61. static volatile int irqraised1 = 0;
    6 R( b6 A4 m7 u% A; C
  62. static volatile int irqraised2 = 0;
    4 n, A8 n5 j8 o% Y

  63. & X7 m: C: I$ ?- k0 ~7 L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / J" H% m, V, C' h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 A  J9 K& L/ K' G( f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; p$ u& ^- ?" p8 L& l4 |

  67. . U3 [' m: P7 t* E/ d
  68. dma_addr_t dmaphyssrc1 = 0;5 t8 c+ e5 R, {# ?
  69. dma_addr_t dmaphyssrc2 = 0;' H/ j1 L( T5 Q! _, R& w* B& G
  70. dma_addr_t dmaphysdest1 = 0;
    0 G5 r6 v& y% m" `" |1 }) k
  71. dma_addr_t dmaphysdest2 = 0;
    8 U( x$ [5 y/ P7 Y' w
  72. & d( P" K* B: L2 T. n; c
  73. char *dmabufsrc1 = NULL;
      Y' V" F- a( c# l* A, A6 W4 G
  74. char *dmabufsrc2 = NULL;
    ; L/ g+ C6 R- x
  75. char *dmabufdest1 = NULL;0 X. R$ y1 g  X
  76. char *dmabufdest2 = NULL;9 @) Q6 |7 q& j- [! i; d. O1 c

  77. 3 I* m& a5 @0 V6 D% m' y
  78. static int acnt = 512;
    7 `; @: J0 R9 p# e/ y/ ^
  79. static int bcnt = 8;$ o1 H$ z! l$ T* ^+ w: H9 k) ^
  80. static int ccnt = 8;" X& `1 W. a# l0 q: W
  81. : b9 |3 l9 B& a9 N% R% s
  82. module_param(acnt, int, S_IRUGO);# j5 ~& J6 t& k8 I9 f+ {- l* p$ |. t
  83. module_param(bcnt, int, S_IRUGO);
    8 |& m7 k; W& L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 q) ?  c: G+ ?+ v4 F# @' y# x- D1 o1 m) ~1 h1 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 [! ?6 A2 l% A( n8 ~3 M8 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 u# N) Q; u1 g' Y$ I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ {' X( j# c& [, |" O1 k! b5 y1 n$ t7 {) C
4 I. ^" c5 ~/ q" O6 u7 f$ r" c- d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 21:41 , Processed in 0.040484 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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