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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 r/ m9 j2 M4 ^. d* Y' ^' G
  1. [code]EDMA sample test application* N+ @1 q# A; ]0 l9 L
  2. /*
    ' D+ d8 W8 u6 [* f
  3. * edma_test.c
    0 J- a; t" i" C) j" ]8 W( x
  4. *
    $ @  E( P' W& G1 d
  5. * brief  EDMA3 Test Application9 W2 U3 P9 M8 y7 L
  6. ** a/ W2 C" \7 Z- `' p3 o
  7. *   This file contains EDMA3 Test code.
    ; e' |+ l+ Z( ]1 y
  8. *
    & \/ F6 j5 _. H5 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- d7 X1 |6 V) Q4 T; a* G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 L. n0 v$ h. M2 V
  11. *         TO CHANGE.6 Q" K$ H& e) a: z3 a+ ^
  12. *7 [; [. R# ?' S" v' o+ D3 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) u( H0 m6 b, I( s
  14. *
    - X- B. `6 g( c5 J; S0 ~' v
  15. * This program is free software; you can redistribute it and/or/ U% \3 I3 L7 H2 Q8 v7 ~! k
  16. * modify it under the terms of the GNU General Public License as3 [4 d: j% h* ]/ i# K+ D2 p5 A
  17. * published by the Free Software Foundation version 2.
    6 a9 ^& G9 \2 `1 v. }
  18. *
    / p# `( f4 {% y2 o' d* C4 G6 O& \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / E, D7 y  @6 P
  20. * kind, whether express or implied; without even the implied warranty
    2 _% V3 T+ h% |1 j; [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - G+ J3 z6 F8 U  b4 a
  22. * GNU General Public License for more details.# Z2 X* U/ B3 R+ N0 \9 N0 R. K
  23. */
    : G6 w  c: ]* D2 K
  24. * j* u+ D# h2 W
  25. #include <linux/module.h>
    ' b" {# s; P1 q! m4 R" c. P
  26. #include <linux/init.h>" f* E. y9 k8 J& m+ u# X7 V
  27. #include <linux/errno.h>" C' q# _: F. f& _: B& q1 l
  28. #include <linux/types.h>; C; p: ]# W% Z+ f" h
  29. #include <linux/interrupt.h>
    ' r! ]  h3 C+ q4 s1 g  Y4 k
  30. #include <asm/io.h>
    6 q  X* F! Z. K: n
  31. #include <linux/moduleparam.h>
    3 W/ }$ C/ p; Z
  32. #include <linux/sysctl.h>  S. F$ l$ r8 {  z
  33. #include <linux/mm.h>5 D, ]* v  p, `2 S$ w" y
  34. #include <linux/dma-mapping.h>
    % W" n/ _6 a' m" ?
  35.   B7 y% k1 l' q2 V
  36. #include <mach/memory.h>
    ' R: i) @( W0 o% c; H$ s2 X) d
  37. #include <mach/hardware.h>
    & J5 `# c1 Z% p1 ?7 _( L+ y
  38. #include <mach/irqs.h>
    % B' S5 o- T* i* |2 D
  39. #include <asm/hardware/edma.h>5 b8 @8 P# E  Y. J

  40. 7 j% a2 a, H2 e+ O. _( Q
  41. #undef EDMA3_DEBUG# w4 H; s" s' A: N( n) |& s
  42. /*#define EDMA3_DEBUG*/
    9 k' Q. c- x9 g. ~% @  c
  43. 0 x5 D# N# ^5 V6 e
  44. #ifdef EDMA3_DEBUG
    5 N" Q* u* o& c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); Q4 `2 U/ k& r! s! Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 N( M6 u  B& K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! u# |8 j8 k! O; g8 D
  48. #else6 \/ S! ?$ r. d9 Z5 b! U
  49. #define DMA_PRINTK( x... )+ Z: L* r$ O, G" A/ [: h6 A
  50. #define DMA_FN_IN
    ) Z8 x# S! j6 ]6 U9 J( V
  51. #define DMA_FN_OUT
    ; p1 i( H: i, {
  52. #endif
    ) ~: s+ Y! F+ j. R( H; r  H$ F: \
  53. % Q6 q' M3 z/ _( b4 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " H6 J2 e' B* d1 Z  P
  55. #define STATIC_SHIFT                3% e4 `6 c! m$ ]" G) x  j
  56. #define TCINTEN_SHIFT               20
    2 H" ^& M' p; B; R
  57. #define ITCINTEN_SHIFT              21
    + m% @8 J8 ]0 Q) x# k8 c
  58. #define TCCHEN_SHIFT                22) a- z  G" u; d& B) ^
  59. #define ITCCHEN_SHIFT               23, U! X. @' [, \' k* A

  60. 7 Q3 n$ N$ |7 e" e6 p7 o$ a3 w
  61. static volatile int irqraised1 = 0;+ y+ n! ^% Y% F6 N& u# u5 W
  62. static volatile int irqraised2 = 0;: i6 ^/ s; K4 @& j8 A
  63. 0 l4 p  \$ N6 u; p7 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ e5 ?- t9 n# V" ~$ O  V' M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 R8 Z6 M! \. H# r& O# H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. H. d3 C9 o0 X. ^  p
  67. 9 L7 Z: Z6 s# N# u4 }2 d
  68. dma_addr_t dmaphyssrc1 = 0;8 V9 P5 L7 W, I* E$ N
  69. dma_addr_t dmaphyssrc2 = 0;8 h6 s( J( x& W
  70. dma_addr_t dmaphysdest1 = 0;# Y0 T+ I. l& {3 F( L' |( [- t
  71. dma_addr_t dmaphysdest2 = 0;
    & {; {4 I2 g7 [; Y7 q  f/ ?! i
  72. , z# r& s% q4 p# r3 b/ |: ]( c
  73. char *dmabufsrc1 = NULL;, L/ H9 f* E. u4 w- N% x/ X
  74. char *dmabufsrc2 = NULL;
    / \, s# z1 G# n  b6 H: p: A
  75. char *dmabufdest1 = NULL;: R$ x/ y( c  h' D- P7 H
  76. char *dmabufdest2 = NULL;
    7 v: V6 O; w: g! C/ R& t% K/ ?  P
  77. " C+ ]; b, g; G7 x# k) |* T. u
  78. static int acnt = 512;
    ' ?7 p' [5 B% S
  79. static int bcnt = 8;/ K7 Q9 u5 L3 f  j: ?
  80. static int ccnt = 8;
    " f( P+ X  a& e/ N/ ]+ Y
  81. % _$ |( l* \4 Y# o7 R
  82. module_param(acnt, int, S_IRUGO);  J0 j- v! q$ C( r
  83. module_param(bcnt, int, S_IRUGO);7 v* L$ O- Q* H' `  W8 g' f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' W* l- B% z/ n) K- S
* f) m# U2 J2 z4 a+ Z  |' r* ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ |2 l7 B6 j. M; X% h+ C4 x2 v; yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- {- r; E8 [! @. O! `6 }# n9 a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! o# r. Z+ }8 r" h) ^6 s2 r# M/ f
* x2 H4 y7 T) [7 q6 Y

0 p6 |- u1 u' H' P% K+ |: F0 K1 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 12:13 , Processed in 0.039564 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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