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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, k) H& O7 a! A* J9 _% a! d0 F4 H- T
  1. [code]EDMA sample test application6 y9 Q; w2 N5 f0 x1 i, v
  2. /** @. E; B! N! a' J% o
  3. * edma_test.c
    ( S% Q: ~! I& [( t+ G1 d) ?
  4. *
    5 y. v5 s) @2 o/ E
  5. * brief  EDMA3 Test Application
    7 ^9 x( e) y2 P2 {" F
  6. *+ `: R3 `+ B) K0 m0 n
  7. *   This file contains EDMA3 Test code." P, w- E- J; T  W' \' [$ e  {- {. \- b
  8. *
    6 |& ]- M( a) m3 R/ D. q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 M$ A- l4 X6 o/ T/ K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 z/ `6 K& X  Q
  11. *         TO CHANGE.0 d4 s0 y) P8 \. c
  12. *( D/ r& @) x9 y3 {* w3 V$ H+ J# J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# m+ G4 D8 v; Z/ E& N0 k' u
  14. *
    8 b+ \! f) W  R% y9 v5 V, L- C
  15. * This program is free software; you can redistribute it and/or' g) q) Z% ^3 ?" w! ~/ I
  16. * modify it under the terms of the GNU General Public License as
    ) O9 b# n4 T) `8 f
  17. * published by the Free Software Foundation version 2.
    4 E8 x* g6 w0 h' q* x6 n
  18. *
    8 j. t! \; e9 U% o2 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 b9 U/ U. @( u/ \  G: d. X: g
  20. * kind, whether express or implied; without even the implied warranty( U0 ?5 a0 ]2 T) U' L6 O* d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 ]# I3 ]; @. ^# L
  22. * GNU General Public License for more details.
    3 m) @/ @  }, R- k* w0 V
  23. */4 B8 ^! _6 P( y9 ?
  24. & R# p) Y- |. C+ {2 C, T; ~( s
  25. #include <linux/module.h>
    " B' m8 u0 e! c( P
  26. #include <linux/init.h>
    $ i3 @; d$ b6 K& O
  27. #include <linux/errno.h>
    ( N) i* z- U( @  w, F1 e; W$ ]! k
  28. #include <linux/types.h>4 u9 `$ Z7 q$ Y( ^) V
  29. #include <linux/interrupt.h>
    , k; ^$ a" L9 V& B0 I+ n1 j* J
  30. #include <asm/io.h>0 E7 G# h$ V* `6 b5 O
  31. #include <linux/moduleparam.h>% A! A. b% _/ t1 j1 P- u4 I
  32. #include <linux/sysctl.h>% `: z, D) T; ]- n' x& B' H
  33. #include <linux/mm.h>" [0 ^- z& H2 J; z& Y" i% l
  34. #include <linux/dma-mapping.h># B* G0 S, ?7 i$ b9 d* W# Q

  35. ' O6 S# P7 ^. q2 T+ V( W6 Z5 _
  36. #include <mach/memory.h>
    2 N8 h1 L$ Q* ]7 U7 {- \( n- W
  37. #include <mach/hardware.h>" T; G9 q& T! C
  38. #include <mach/irqs.h>
    ' {& M9 {- G  N( v8 m
  39. #include <asm/hardware/edma.h>0 a& t0 [9 u2 Y% {7 E

  40. + c% B! o: w5 E# Z, }7 `
  41. #undef EDMA3_DEBUG
    2 d8 B! |% C5 o
  42. /*#define EDMA3_DEBUG*/
    ; A4 X' K2 L+ W5 P

  43. , V# ]7 v4 a9 E+ ?* q
  44. #ifdef EDMA3_DEBUG! @# n  B& _, z4 }' q( h  u1 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 a) U1 V8 O7 K, k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & ]% I! T. X: V# A) I6 W4 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 u+ b/ j7 |% `6 [8 X
  48. #else. R# }) E( z  O% N& K
  49. #define DMA_PRINTK( x... )& l# U% X0 n1 _# R- y
  50. #define DMA_FN_IN
    4 u0 B: ^1 t3 S/ w- S) C
  51. #define DMA_FN_OUT
    - y7 `" K; J- V# W% u0 e
  52. #endif5 ]/ p* d4 T( B7 \& Q
  53. 8 O, l4 v5 B% P0 t% b! ^2 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      Q4 k3 G# @8 \% y9 ?
  55. #define STATIC_SHIFT                35 y( |% n% X: G. O
  56. #define TCINTEN_SHIFT               20
    7 }0 t# G+ u8 U% b4 a: `: v
  57. #define ITCINTEN_SHIFT              21
    " I* L% G8 G) i
  58. #define TCCHEN_SHIFT                22
    5 ]" Q. u. h$ |% h' ~! z9 x; W
  59. #define ITCCHEN_SHIFT               23
    ( v0 o: L  f% _& `- D1 {" f

  60. 2 x( n8 a  b* O8 o
  61. static volatile int irqraised1 = 0;
    $ X6 }7 v$ }9 q
  62. static volatile int irqraised2 = 0;
    ; a  h* N( ^; c6 b  `9 b& v6 @0 n
  63. ) k# X" x) t: W# ?$ z  f! {* ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 d  x2 a) c: i' i* N0 H6 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 h- n+ `+ t# G  F, a3 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 |7 ~& F7 k4 |' n8 }+ H1 P1 E/ n
  67. + e, C! {1 }2 F  ?- w' e/ L
  68. dma_addr_t dmaphyssrc1 = 0;  x2 U" C& W" O6 u3 P) q4 u6 R* l
  69. dma_addr_t dmaphyssrc2 = 0;
    ' A/ W, Z# z+ s6 F5 q' h0 Y% D
  70. dma_addr_t dmaphysdest1 = 0;
    $ ~% u3 X, C. \  r. K
  71. dma_addr_t dmaphysdest2 = 0;
    : w  j$ Z$ H7 T# p+ V' }; Y% X

  72. 8 D  v- ^) O* A& h
  73. char *dmabufsrc1 = NULL;  }, a6 `; B4 B) u5 ~
  74. char *dmabufsrc2 = NULL;
    # i3 ?, s2 G* }6 n. p
  75. char *dmabufdest1 = NULL;
    + l! Z6 J0 C4 f
  76. char *dmabufdest2 = NULL;8 `2 n% a% [/ Z2 c; Q

  77. % h, c& u" M: i8 f+ P  g8 l% l7 u
  78. static int acnt = 512;
    6 S; _6 ?1 ]6 O* e6 g, J
  79. static int bcnt = 8;
    2 Z7 a, |6 D1 I: h
  80. static int ccnt = 8;: E% J) N9 c, ?2 [5 ^2 g% ^

  81. - ~+ E, X( P. @# v
  82. module_param(acnt, int, S_IRUGO);
    4 h, E  J/ h+ F4 L3 h5 \
  83. module_param(bcnt, int, S_IRUGO);! x7 x' L2 P7 G' X& w, ]5 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 {# z( ?+ M  I7 b, ~& ]' y% V% G

" l0 o9 T* g; \. c3 a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 R; R4 {" ~5 s& _, A# M. [$ {. narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 d: d; D% A9 b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- B, V6 E$ z9 R7 C& R
; i, B# U# v* N( ?6 c
; N, P( m; z, @3 x+ V+ X8 @. z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 17:40 , Processed in 0.039762 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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