OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; B- h0 p9 f/ s& I4 w% Z1 U# T( Q
  1. [code]EDMA sample test application
    % x9 a% L: U( t4 v# @9 G7 g6 k
  2. /*$ t% {" Q  f% G  G2 P
  3. * edma_test.c% p( r+ P2 C, p# T
  4. *" O& t$ x% ?* R( Q& a5 |' |8 u
  5. * brief  EDMA3 Test Application
    & W" I6 G, G" i9 i* r9 C2 P. @
  6. *2 R( \' n. a; y+ w9 Q2 j
  7. *   This file contains EDMA3 Test code.5 R+ i: [: V6 h  N0 p/ \; C
  8. *9 Y5 h5 g# \6 c) i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) h0 L) G$ d) R* e# \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' i# |" {  `' b$ T
  11. *         TO CHANGE.; W: C0 h  P0 r" I& F$ h
  12. *4 ~1 n7 d1 O3 i* m2 M5 z; i( z$ [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : H. c+ ]1 B1 M/ t: B
  14. *
    2 n3 M, Y5 v! `! H# F6 e
  15. * This program is free software; you can redistribute it and/or0 O5 E; E- j- m$ w5 {: Y
  16. * modify it under the terms of the GNU General Public License as
    ( ^3 w% [- p3 R2 Q! A
  17. * published by the Free Software Foundation version 2.  L7 F; M; B$ b" K, ^: {* ]$ J
  18. *
    8 h+ c4 T- v, `& {5 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. t( M! v2 O  b7 t9 e7 h
  20. * kind, whether express or implied; without even the implied warranty
    + G& X2 K) [& a  x0 l* C, a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' n; C# |+ l8 a. o
  22. * GNU General Public License for more details.) A* D$ N3 d( a; b8 j
  23. */  K7 \( g+ D( C7 p! r4 A

  24. - Z* m# e# ^" k# |
  25. #include <linux/module.h>
    $ P0 G+ a( g0 D3 q4 K9 H% j
  26. #include <linux/init.h>& O6 x. q3 I( F! {! O$ i+ X4 q
  27. #include <linux/errno.h>5 g" c8 W, ?# d0 z9 N0 O0 P; g+ h
  28. #include <linux/types.h>
    6 J' @, q  ^% ~, L9 d
  29. #include <linux/interrupt.h>' t8 H- n5 g  w) J# O
  30. #include <asm/io.h>
    0 U. z: D' s' \7 |; C4 o
  31. #include <linux/moduleparam.h>
    6 r9 t/ M+ s, t; g5 f1 C" S3 D
  32. #include <linux/sysctl.h>
    . O* j7 E' C0 y. |$ B
  33. #include <linux/mm.h>
    5 V) \" N0 p- q% I
  34. #include <linux/dma-mapping.h>6 V- S8 M( H1 I& `8 _/ m* }
  35. : Y) U6 H+ T/ ], ~8 H7 J
  36. #include <mach/memory.h>
    3 |9 @0 R0 G# O" t$ t5 @  y
  37. #include <mach/hardware.h>
    8 h$ ^9 K3 F1 B% T: {3 q0 m6 Q$ S1 _
  38. #include <mach/irqs.h>6 e4 O& b& U- k6 W7 K/ e6 W+ j0 h
  39. #include <asm/hardware/edma.h>" ?8 s2 `( s+ k8 s) |

  40. . n7 E' C2 l" H5 o
  41. #undef EDMA3_DEBUG
    ; U5 d4 u, F) ~+ U, E8 J1 B5 J
  42. /*#define EDMA3_DEBUG*/* u3 Z$ n$ [' S0 [

  43. $ p8 n" ^+ l8 ^9 |
  44. #ifdef EDMA3_DEBUG
    9 X+ V2 {  |. e/ A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' c! [% |4 Y% E/ K2 |; o. |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 _# U" M, y, E; A: N  {" C" |4 g/ N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / \7 i8 ~/ E6 l1 ]' \  T* r+ M
  48. #else
    / M7 c/ B- L  ^: Q! }3 o4 L" \
  49. #define DMA_PRINTK( x... )7 A$ m4 U% y9 I
  50. #define DMA_FN_IN8 e- d+ Q  g7 y# W
  51. #define DMA_FN_OUT$ m) e5 O- H; D: k
  52. #endif
    . i: P, K# h  f8 O; j* y0 ]

  53. " l  n7 m; G. t4 |# ?, v2 `0 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- Z( m+ X. [6 n& J; O. a
  55. #define STATIC_SHIFT                3
    5 ^$ b/ n) z- ]0 ^; m
  56. #define TCINTEN_SHIFT               203 ~4 ^$ d6 O; |$ u2 S
  57. #define ITCINTEN_SHIFT              21& j( j1 ?3 S0 |- M2 H" h
  58. #define TCCHEN_SHIFT                22( y6 M' V  @4 O* O9 T
  59. #define ITCCHEN_SHIFT               23
    " s6 W6 v( M3 l2 N! C) h
  60. $ \+ ~# `) B0 D  i; ]" b( `0 k9 J
  61. static volatile int irqraised1 = 0;
    $ ?9 k$ K. i8 S2 D
  62. static volatile int irqraised2 = 0;! h1 S" o; D$ @/ o+ B  l, o

  63. 7 M6 g6 I5 q, R) W5 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " o" o/ C& L2 d' z1 k( t( n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; |# t$ Y4 Z/ o. ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 Z. m( O' f# g7 m3 N  G

  67. 2 ~7 Z( K8 V* s: V, `. f3 _
  68. dma_addr_t dmaphyssrc1 = 0;; d8 y; A3 {7 j; }
  69. dma_addr_t dmaphyssrc2 = 0;
    . I6 P3 m! P! ^
  70. dma_addr_t dmaphysdest1 = 0;
    2 S5 X/ ~- o- B# a
  71. dma_addr_t dmaphysdest2 = 0;+ c+ g1 U  c/ w0 e. z

  72. 1 W3 m4 v# e+ U2 R7 D8 W1 V
  73. char *dmabufsrc1 = NULL;, u9 W. U: D+ p# I' L$ m6 n# s
  74. char *dmabufsrc2 = NULL;  O. y5 _* p+ X
  75. char *dmabufdest1 = NULL;7 B* w; m3 x% ^7 ?/ F% }
  76. char *dmabufdest2 = NULL;
    , M; G- p% L+ |; M! t! C( B

  77. * A6 b2 a$ B, ^7 b8 y, J
  78. static int acnt = 512;+ j/ |/ `7 o8 {5 J9 F2 E
  79. static int bcnt = 8;7 `+ }; X# ~" `! ^4 ^/ z/ F6 m0 w
  80. static int ccnt = 8;
    " d$ s( t, Q( M9 I# x1 ?6 z

  81. 6 m3 c2 r4 A* @. h6 b
  82. module_param(acnt, int, S_IRUGO);
    4 z5 h6 ^3 Z5 _
  83. module_param(bcnt, int, S_IRUGO);
    " [5 F4 R* B& @. b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; u# ?$ r" y4 P$ N7 C9 y+ q$ Q
) B% i3 k+ M) x8 ~' h! N; R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 O! V. H4 l2 X0 j3 W3 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 n5 g! L+ r! a5 ^2 {1 V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 U5 l: B3 _  c& X8 V2 P" ]

8 D2 L6 V0 N( C8 b- K2 x& ?* U" C" j& Z3 d( l0 o1 K* z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-12 23:22 , Processed in 0.037000 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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