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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 a9 z& H5 C* F  E' K1 C! k. G
  1. [code]EDMA sample test application
    . A- \! q/ C) r$ N
  2. /*
    9 {' L8 W) T  P$ ?* X
  3. * edma_test.c- t- i% J8 [; n% A' }# D# v( u
  4. *
    3 J6 y5 u. p  Q- @- m- B) ^* L7 w
  5. * brief  EDMA3 Test Application% t; l1 C1 ]+ ^: v5 W& w- K
  6. *
    * \2 V5 t3 H0 o- ~
  7. *   This file contains EDMA3 Test code.5 Q8 ~5 T+ d; v. k3 E' O% R( z
  8. *
    8 X) j/ Y- X% ?; N8 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! Y6 M! g5 \$ L+ f; L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 Q( D5 O$ k8 Y6 [
  11. *         TO CHANGE.+ O) q! u+ s9 I9 g+ F- @  ^
  12. *
    8 y, b# ]' j9 g3 _! F* ?% n+ A2 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 L) g9 \8 `( i, @. x$ j
  14. *, B* ]6 T9 Q9 Q
  15. * This program is free software; you can redistribute it and/or% w9 ]1 c0 b; Z% M; ], B
  16. * modify it under the terms of the GNU General Public License as4 ?6 G! Z# @+ x6 [# L+ o
  17. * published by the Free Software Foundation version 2., O. H* b- L6 J3 I3 o% R3 s
  18. *
    + U: k4 t5 f6 x4 d. Q, U' Y6 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , c6 x, G- N/ U) q
  20. * kind, whether express or implied; without even the implied warranty
    5 r" k% j: z0 C$ j9 Z' M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# f$ Y, [* W3 o  N" b' _2 K
  22. * GNU General Public License for more details.
    " C, t$ S2 H; s( b4 N
  23. */
    - Z9 d# j/ j7 y9 T# c9 S( s6 e
  24. * s" `1 A1 w! m; n( `0 ~
  25. #include <linux/module.h>
    ( X1 D. h8 M- O# H/ Q/ q  _
  26. #include <linux/init.h>
    6 ^0 O5 }9 O7 t, [$ U' [& i  g4 K* I
  27. #include <linux/errno.h>" [9 [2 V! I9 `9 s
  28. #include <linux/types.h>
    ' \* w7 U6 B% D- s( ?" X
  29. #include <linux/interrupt.h>
    9 ~; s/ x: ?2 {& `( K
  30. #include <asm/io.h># B% @, w2 h9 x8 T& P1 `# ]! q) K1 f
  31. #include <linux/moduleparam.h>- F4 J- A4 ]3 p) b% K4 w; d3 ]& i
  32. #include <linux/sysctl.h>
    ( I4 l& f0 ?  |$ E8 v7 Y$ A* u& R  \
  33. #include <linux/mm.h>
    ! t7 n  U$ e3 ?: A. B! T- w
  34. #include <linux/dma-mapping.h>
    3 ]" F; H  z1 O) [+ Q

  35. $ m  l/ a1 B9 P: p4 S  E& {
  36. #include <mach/memory.h>
    ) @# I2 \4 f# I+ T, N- Y/ h: u
  37. #include <mach/hardware.h>
    - W. [7 @; r. B9 y) k2 O& W5 q
  38. #include <mach/irqs.h>3 W# s4 F0 o1 O& k3 P2 O: I" }* Y
  39. #include <asm/hardware/edma.h>- B$ v! b8 J; K5 J- ]9 t6 m4 x9 P, F
  40. 6 e) K: p* Z  ^5 T9 Y
  41. #undef EDMA3_DEBUG
    ; V5 V3 l" A! e( Z- R' h4 C
  42. /*#define EDMA3_DEBUG*/6 ^: h6 `4 m( U& ~7 }8 A4 |$ S

  43. , ]7 g1 a- H! n$ R; p( g- D! U
  44. #ifdef EDMA3_DEBUG
    " v9 ?/ A; R" T6 _/ ?5 S. s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % P( |; i$ u1 b. Q* `8 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' A5 {, {' b/ A6 i% E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 G% P. n) T! z% b% f
  48. #else: _2 [( p+ V; C1 \$ b9 `: ~
  49. #define DMA_PRINTK( x... )
    . d5 I6 D* ~  ~" }& T; |8 B
  50. #define DMA_FN_IN
    9 ^3 \/ k0 G6 X9 i& e. T
  51. #define DMA_FN_OUT6 a  J" T2 h7 M) i* l9 H3 w( P
  52. #endif" g2 V* e) [! a

  53. - B+ h- N% k7 z2 a( @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # |: y: r  L/ f, |! y% f5 x& |5 T
  55. #define STATIC_SHIFT                3
    : p5 N; R2 ]5 J+ J3 a! I
  56. #define TCINTEN_SHIFT               20" _; W* Y  c6 V1 K/ U
  57. #define ITCINTEN_SHIFT              21* Y6 Q5 E, B3 x1 Y
  58. #define TCCHEN_SHIFT                22
    " g) j9 [( V* N8 u, ?5 `' }
  59. #define ITCCHEN_SHIFT               235 ~: i8 G) y8 o4 t# U- q
  60. + x7 B3 ?9 p% g! J
  61. static volatile int irqraised1 = 0;
    . `; \% I6 L+ h( _
  62. static volatile int irqraised2 = 0;
    ( r5 N+ A! @; T0 L$ }5 c: R7 {: g
  63. ) `6 k$ B8 h# q) Z9 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ h" R8 U' d7 e; x( G8 O  ]& k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & v; @& s- n" ~- D! o, l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 @7 d2 t5 E/ E, z
  67. 9 t- L. p& g2 N" Y/ W+ J1 G+ c
  68. dma_addr_t dmaphyssrc1 = 0;
    - {2 C5 N! b, ]
  69. dma_addr_t dmaphyssrc2 = 0;
    9 F# n( L1 d' S9 V& t5 J+ P9 l8 @9 Y  I5 L
  70. dma_addr_t dmaphysdest1 = 0;
    8 ~: v4 X  ~0 l6 D# f$ ?
  71. dma_addr_t dmaphysdest2 = 0;
    6 K! p+ c  n# d0 h
  72. 6 J* y5 p8 @$ `
  73. char *dmabufsrc1 = NULL;
    ; _! |& w, T! c+ A' G4 [! V$ s
  74. char *dmabufsrc2 = NULL;
    8 N3 W. K/ n9 A9 {: A
  75. char *dmabufdest1 = NULL;0 l3 i8 R# G' x  {6 g5 F7 q  s
  76. char *dmabufdest2 = NULL;
    4 Y- U5 E# g/ A6 o: l

  77. 0 b6 o5 J" B  u0 f' L( _, X
  78. static int acnt = 512;
    0 P' Z; p& A  r) u2 @1 i
  79. static int bcnt = 8;
    ( u4 e9 {+ S) R/ t
  80. static int ccnt = 8;
    3 c* _9 P1 X( i2 h8 ~% d0 b6 T
  81. 0 R" r% t$ }% ]4 \" \/ r- k- r2 w
  82. module_param(acnt, int, S_IRUGO);
    ) L& M- E1 m1 A' m3 b$ s# s" O4 l
  83. module_param(bcnt, int, S_IRUGO);
    # [: c1 X& D' T$ i9 `% m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 y- ~5 _0 I9 C  {' j- [- [% o

4 q7 x0 }3 ]1 P" \5 B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ B# F5 N7 V! {( [" |- qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ X( o* c7 I. o; G' F: y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: S9 }; B2 e& h/ o/ W$ ~- A. a5 ]) C

( t9 H/ v+ |% Y' \# @) q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 05:57 , Processed in 0.038926 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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