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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' c. @. c0 s  g( m
  1. [code]EDMA sample test application
    1 `6 @% {2 u0 C7 w$ X8 @# f' I
  2. /*
    6 A/ h3 B) H/ h# t& i1 M3 J5 ?' C% R
  3. * edma_test.c
    6 G" k+ M8 K  t! D: E  \& Z
  4. *
    % i; Q9 Y& E* P
  5. * brief  EDMA3 Test Application3 V- E- O$ A$ T# P4 r/ r1 _
  6. *, c1 S, ?0 Z9 S0 ?% @
  7. *   This file contains EDMA3 Test code.# ^8 Z7 [2 u5 ]& V2 b6 |
  8. *& C" |8 {; _/ z* P: J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 N( c$ r1 ~: c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 E+ u8 s  q* T" h4 s
  11. *         TO CHANGE.
    4 s$ d9 H/ \1 Y+ @/ f+ n7 d! N
  12. *
    2 V, U" w  n" I/ k( z% b$ Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% E+ P5 B3 L7 p8 ?; _
  14. *
    ( }( {+ N; U7 p' c. ?2 R  f
  15. * This program is free software; you can redistribute it and/or4 G+ [; \3 p5 }' i
  16. * modify it under the terms of the GNU General Public License as
    + |; `& h, I4 H/ [: D3 B
  17. * published by the Free Software Foundation version 2.
    2 H  B; f. |0 Z3 L' C
  18. *2 \( F, O. R! ?+ I7 b2 H' P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% @  d& t% ~7 _
  20. * kind, whether express or implied; without even the implied warranty: [9 _' @7 J" ]1 q2 k! x3 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : ~* g4 u% C7 X+ W/ W( p
  22. * GNU General Public License for more details., Y; d8 F! ~+ Z; v; d
  23. */# d( E  q( w! ]& x# q- B0 T, I
  24. 2 ?8 ^* `& N2 r& q( T3 v
  25. #include <linux/module.h>
    % |  H# B" }5 J' \
  26. #include <linux/init.h>! w, i9 j% {' @- `& j  [6 \
  27. #include <linux/errno.h># H6 P! U( Z6 A5 Q9 @
  28. #include <linux/types.h>
    6 u. T& o) X. Q- c6 I) U8 ?" q
  29. #include <linux/interrupt.h>" i: _7 P2 \# k2 J( ^% m0 i7 G- S1 [
  30. #include <asm/io.h>
      v( D, w' i$ ]( i9 x: d- `& g0 f9 S! Y
  31. #include <linux/moduleparam.h>% Y5 C$ [3 [* c  R0 m, Y+ Z% G
  32. #include <linux/sysctl.h>& ^( y+ F* k# S5 R' r( @
  33. #include <linux/mm.h>7 S  O5 O8 ^: P& C/ `7 ~  x
  34. #include <linux/dma-mapping.h>
    % j5 W2 w9 f5 |. j  E) |3 P
  35. / M- D: ~& r% j  `
  36. #include <mach/memory.h>
    2 Y5 }, |/ q% y! a( o, l1 @* J
  37. #include <mach/hardware.h>" [) b  x! h9 d- a- m+ _
  38. #include <mach/irqs.h>
    5 a3 E5 K6 A. \* C  W
  39. #include <asm/hardware/edma.h>
    / K. d. z! [4 _3 P7 s) _

  40. " y3 o$ F1 T2 J& P; K
  41. #undef EDMA3_DEBUG/ e2 e& p/ c6 ]
  42. /*#define EDMA3_DEBUG*/, F2 \/ W, x) k9 O( s( @

  43. ! L) f3 E$ @& p- o/ g2 w
  44. #ifdef EDMA3_DEBUG0 Y, {  K3 ~8 D' I( m+ X$ Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ V; i' |/ o: e- |, l# F+ ]% {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ P" q& R- M0 [# [: U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): {5 k) D; B8 z) ^. L" t* L9 C# U, i
  48. #else9 o' _0 n6 l/ ?- ~3 t
  49. #define DMA_PRINTK( x... ): r/ I4 {4 d8 E4 H. G
  50. #define DMA_FN_IN
    * a  W0 y! L1 E
  51. #define DMA_FN_OUT0 R. z7 k% o' T' w; ?
  52. #endif( @2 B, a0 W% H. p( g

  53. ) n7 F$ C; A& }# R. j2 X! @* }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  h- o9 d2 L; u$ ]
  55. #define STATIC_SHIFT                3
    ' k: A9 Z, w$ \6 N
  56. #define TCINTEN_SHIFT               20
      C; w9 p1 ]9 S; I$ X* Q
  57. #define ITCINTEN_SHIFT              21; q" ?9 _8 h5 H$ \
  58. #define TCCHEN_SHIFT                224 c, [' o$ t3 C& W: W
  59. #define ITCCHEN_SHIFT               239 v9 K7 @2 g( p# B$ l) V/ o& t6 b
  60. 2 i1 J1 o% L: e/ y1 B4 S- l9 o
  61. static volatile int irqraised1 = 0;
    & ^9 u" W4 v- Z) O: D$ i
  62. static volatile int irqraised2 = 0;
    ! e* ?9 Q( n; L
  63. " k4 \, Q6 ^; }7 z# C) ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 l$ p& y( q: [; a' q2 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* @; e5 {8 z# w, l" U- b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% T) M, d1 ?6 A+ w* Z
  67. + m2 b$ L, y& C7 d
  68. dma_addr_t dmaphyssrc1 = 0;
    % L3 V. |) R( @8 s; ^$ p: A& N4 q
  69. dma_addr_t dmaphyssrc2 = 0;0 f! G7 A; j5 d. m  \# d% b9 e
  70. dma_addr_t dmaphysdest1 = 0;- C$ V. T5 e& \9 N: @
  71. dma_addr_t dmaphysdest2 = 0;( U9 d  Y. |8 x% ?

  72. " o; R' ~: r) k& d) B  T
  73. char *dmabufsrc1 = NULL;0 r+ J. ?( Y6 j5 S* y' `, K# P
  74. char *dmabufsrc2 = NULL;) Q/ y) {4 r! \
  75. char *dmabufdest1 = NULL;2 v4 y; a0 R7 h6 ]% \9 C0 r
  76. char *dmabufdest2 = NULL;) t+ ~5 E: ]- H+ c
  77. " y& t% b: v  B+ Q: K" a7 g4 o9 e  y
  78. static int acnt = 512;
    ' P4 O" v( G6 d1 [, k3 S
  79. static int bcnt = 8;) |% b6 B5 ^" b9 I& {
  80. static int ccnt = 8;8 ~7 j. }; \: W' c1 Q8 l) t2 P

  81. * A; s% I0 s" @8 o
  82. module_param(acnt, int, S_IRUGO);) Y  r% m' }+ E( _
  83. module_param(bcnt, int, S_IRUGO);
    % q, ^2 M/ [; {5 \) Y/ @- q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 A  T( Y# K' x; q: v
6 z/ |) R/ d. _3 b* o+ g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" V7 g3 w" D$ N; v- h( k1 Q9 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- Y+ f8 M( H3 w4 k1 ?; N  g. q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" e, g( b* P3 X/ `
8 v( \2 N) x6 Q6 m' v% s
, h, d3 Q# t. b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 17:29 , Processed in 0.043988 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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