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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & W1 V& N3 q0 U. {/ F
  1. [code]EDMA sample test application
    3 F, t7 s" W8 i; S+ l5 n
  2. /*
    ' ~- ]( v" C4 i$ n$ e
  3. * edma_test.c9 c; ?: w7 n3 O
  4. *
    # ?! h! X# _& s6 v- D3 `, C
  5. * brief  EDMA3 Test Application
    $ `  C# B  |% x
  6. *( Y* }0 K$ M( @5 \0 y3 O0 [) S
  7. *   This file contains EDMA3 Test code.
    9 j8 K4 L( }( s6 C6 c
  8. *( Z( o" C2 b6 x  W# ~( K. Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" X7 I/ {0 x2 H. x4 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / B6 n7 ~2 R! L3 w( J5 Q8 d
  11. *         TO CHANGE.+ ~6 S3 F# u  Y
  12. *
    ! i- n$ T% \) n% ]6 i7 h  I& }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 n5 Z9 B0 D2 H3 ], Z: T( h
  14. *
    % `3 F. {. u/ E- Q+ K
  15. * This program is free software; you can redistribute it and/or7 O5 d- J6 n- {2 K! i) o
  16. * modify it under the terms of the GNU General Public License as; d$ k2 o4 }' G" I0 |. v- v% r0 R
  17. * published by the Free Software Foundation version 2.
    8 v, S7 W2 N& Y
  18. *
    $ s; V2 X* |4 ?3 L" O) c& {; ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * E# |# G1 K+ V
  20. * kind, whether express or implied; without even the implied warranty
    - y' Q& U" i" K/ g- p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 O! s0 V) X% g$ q
  22. * GNU General Public License for more details.
    ) J( c, R3 j0 w4 q# W9 f
  23. */$ O# v* o$ T; {( ~) M
  24. $ u# ~1 o/ w+ l/ Z7 X+ {* }
  25. #include <linux/module.h>  f8 [0 W; }6 I( Q- j# B
  26. #include <linux/init.h>
    : @# ]7 g- R3 S% C! i
  27. #include <linux/errno.h>0 U) u7 d/ F+ u7 p* c* B# c
  28. #include <linux/types.h>
    : s- P, |, L* O3 Z
  29. #include <linux/interrupt.h>
    . B* W5 P$ F3 r$ {
  30. #include <asm/io.h>- P0 q' \( F. j5 `6 X
  31. #include <linux/moduleparam.h>4 o: o& Q9 s: i/ _" E: B
  32. #include <linux/sysctl.h>9 P. N& B5 I# e* C4 d& a
  33. #include <linux/mm.h>
    : n: u8 ^" V! X
  34. #include <linux/dma-mapping.h>5 b5 ?4 U7 i5 H4 U' U

  35. 5 ?6 @* F! r# t& T
  36. #include <mach/memory.h># S6 ~! h6 ]( a6 }' {
  37. #include <mach/hardware.h>2 v/ t/ s7 o& ~: h; |6 G- t
  38. #include <mach/irqs.h>8 B# `. X1 Z% X
  39. #include <asm/hardware/edma.h>
    0 v' X4 o! N) Q# |' [! l( A
  40. 1 F7 i, K) v! h, \9 N. ?0 ?8 q
  41. #undef EDMA3_DEBUG
    , ~1 p; u" o' q$ R" c
  42. /*#define EDMA3_DEBUG*/
    1 w9 h7 z% X, {0 ^

  43. 7 F6 m# J2 O1 m8 a) l' a
  44. #ifdef EDMA3_DEBUG
    8 T' e  N5 Y) I3 ^4 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 ~! }# D" R, @( B' ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 K3 D0 Z, y4 T& R7 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ ~2 V( ^  {3 ~
  48. #else
    - |" T* u5 ~  ~9 y
  49. #define DMA_PRINTK( x... )
    " I* X0 R2 n0 F3 ?
  50. #define DMA_FN_IN
    ( N4 V' n$ p& V% `, U: _
  51. #define DMA_FN_OUT
    : r% i  Y: V9 U1 t3 m
  52. #endif, Z  g( H, x- x) s; x4 T, o

  53. ) C& A1 e" Q$ D/ j8 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 y! e4 _( P8 F) O( j
  55. #define STATIC_SHIFT                33 ?  x3 {9 ]' V* g
  56. #define TCINTEN_SHIFT               20
    , ?1 ^" G% m( c9 @9 I4 C& a, P
  57. #define ITCINTEN_SHIFT              21; B" u* b' f6 r9 D
  58. #define TCCHEN_SHIFT                22
    9 V7 b/ ?/ p- _0 w) D
  59. #define ITCCHEN_SHIFT               23
    4 U- w5 Q* N2 S0 I# X) [- p

  60. : F3 s$ j) E2 ]. O3 k
  61. static volatile int irqraised1 = 0;# `0 d# O) U/ G6 ]) }" o- @2 o
  62. static volatile int irqraised2 = 0;+ a; n; [* s* r! m

  63. 8 Z) f$ W# d! L  R3 R5 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 e; w" l8 `2 P8 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 F2 R) C3 {9 ~2 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  a7 o! H2 }$ V6 H! B4 b6 q

  67. 1 l- P6 L% V- ]
  68. dma_addr_t dmaphyssrc1 = 0;
    3 ]1 w8 T6 c" ^) E% `: N
  69. dma_addr_t dmaphyssrc2 = 0;" j, O; A$ X' O' o2 I
  70. dma_addr_t dmaphysdest1 = 0;0 g/ m, ^3 q9 J0 ?  Y( p
  71. dma_addr_t dmaphysdest2 = 0;
    4 E4 [. q. D! y3 N9 k

  72. $ d+ A! K0 n5 X% M& {  F+ o
  73. char *dmabufsrc1 = NULL;% |2 H$ v& Y  W9 c* t" |. M, ?
  74. char *dmabufsrc2 = NULL;4 ]5 Q. S( b+ x$ x
  75. char *dmabufdest1 = NULL;
    , q# A% x: S; P7 A
  76. char *dmabufdest2 = NULL;
    % ~2 J+ n* @$ v& Q
  77. 6 o% `, v' L7 b6 N: g( b, S5 D
  78. static int acnt = 512;
    9 ^7 d  @" k  }) l' X1 K& x
  79. static int bcnt = 8;5 l; r4 U8 }* F4 y, N
  80. static int ccnt = 8;
    & o+ {6 K; Z" u, l# Z& N9 M. N6 T

  81. 1 k! F5 `( F; L
  82. module_param(acnt, int, S_IRUGO);# L' y+ Q: N3 d; G3 K
  83. module_param(bcnt, int, S_IRUGO);
    & Y9 L- e! F3 b" i& w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) j7 s, y( n; x& J- W# L, F8 k4 x: t" C& a$ H# x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 l  G: b( u8 C  y6 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 S  ~% @3 \' a7 R/ ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) N  C" d, ?: I4 Z4 {+ t: o% ?9 d
9 A- X5 z* z# v4 q3 Q* l0 Y! V5 Q% L! z4 @& v! a, W7 P) h9 v4 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-24 13:39 , Processed in 0.045392 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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