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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* u/ z: s! T$ ?' ?2 e9 h
  1. [code]EDMA sample test application: m3 c5 N& w* G7 j% x
  2. /*  b9 j' D) g* s7 ^
  3. * edma_test.c
    9 r/ w& p/ A6 ]' y: u, Y1 F. n
  4. *
    + }4 f) z& ?/ E3 @1 R- h
  5. * brief  EDMA3 Test Application
    8 x  O' o9 W1 Q6 h
  6. *
    # J6 a/ R" V9 s. t
  7. *   This file contains EDMA3 Test code.8 u: O1 ]) s- T7 E$ E) u
  8. *. d1 b6 I+ ^7 M' |. T" n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 I! m+ |7 }0 x: _  U; L5 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 X$ {' J8 H* o. Q- y& D6 S, N: u
  11. *         TO CHANGE.
    0 J$ g  |) L. ]2 y2 n# y
  12. *
    5 N! M3 @  m7 C0 P/ S+ J# e# c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , V0 w, v8 S% T' Z
  14. ** v1 J& d) h! w1 G+ E4 V2 X
  15. * This program is free software; you can redistribute it and/or& q1 Z2 e7 h8 \: k( b
  16. * modify it under the terms of the GNU General Public License as- {2 k  u8 {& C& o
  17. * published by the Free Software Foundation version 2.
    ' S; R4 j/ P& F! x4 P
  18. *
    8 Q( K" o* `4 P/ S- c+ @' A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ~9 c+ g+ c- H
  20. * kind, whether express or implied; without even the implied warranty7 S: s' G5 Z$ q1 n% v: L4 _: i2 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + u. B, S  z7 y
  22. * GNU General Public License for more details.; d' I( f6 C* P2 j% T
  23. */4 o$ \  @% v9 m) c

  24. ( l, x1 u: f* P1 y
  25. #include <linux/module.h>, O3 _8 d/ d, r, y2 Y
  26. #include <linux/init.h>! V1 C* K) l: y. w2 B& ]: G
  27. #include <linux/errno.h>3 ~" ]/ O2 _. E/ F
  28. #include <linux/types.h>
    1 h/ r5 u* |/ D+ a6 b
  29. #include <linux/interrupt.h>
    , R8 X4 n+ i9 U8 r
  30. #include <asm/io.h>' o5 e, D4 w$ Y1 |6 k& r7 @
  31. #include <linux/moduleparam.h>* ^9 D5 K+ M: j8 E3 }; s: W
  32. #include <linux/sysctl.h>, ?# b% g# `& d+ g
  33. #include <linux/mm.h>, w# N6 \& m' q1 C1 l  ~
  34. #include <linux/dma-mapping.h>
    $ w: [( T% q1 R+ H  [( r# I

  35. " E- s% ^* b- Z- {6 T# O6 e
  36. #include <mach/memory.h>$ J$ ~0 {' _. w+ L' |. a( M
  37. #include <mach/hardware.h>0 w" O+ {+ \) k' d: P4 S5 B' d
  38. #include <mach/irqs.h>. U+ K7 X. C6 b' y# r3 ~4 R' u' Y6 i
  39. #include <asm/hardware/edma.h>; {1 F' {+ Q7 @  x1 {" w8 Q% i
  40. * e# q) @% A2 g
  41. #undef EDMA3_DEBUG, a) W6 W+ T. W) X- S) }! J
  42. /*#define EDMA3_DEBUG*/
    ( \6 M9 M" g1 q. z  M8 C
  43. ' \4 e& M7 D3 r9 M1 L3 j
  44. #ifdef EDMA3_DEBUG
    : ]) Y  u  ]( L: h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( g& l- \& H, ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( i. f( s  E( U7 L0 H( k" Y) }  h2 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : T$ ]* X9 z' H
  48. #else
    * Y% \: w- a3 g2 V* E0 n+ ~9 _3 n
  49. #define DMA_PRINTK( x... )
    * `" T' m5 T! S1 f
  50. #define DMA_FN_IN, i: |" p2 ]7 [; s1 j
  51. #define DMA_FN_OUT
    8 ?. |8 X& p6 u- A% F! d
  52. #endif' E8 l+ ^6 d1 U1 s; B: R# n

  53. 6 k* J% A+ w) x  m3 [9 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 y+ N% F) F5 M
  55. #define STATIC_SHIFT                3
    - C$ }  t: d3 t6 I- _
  56. #define TCINTEN_SHIFT               20
    & I: R  t% ]5 v& ^# Y, s( F
  57. #define ITCINTEN_SHIFT              21
    1 o, Y4 p( X& A  x
  58. #define TCCHEN_SHIFT                22% a/ `5 U" K0 |+ k4 e6 u
  59. #define ITCCHEN_SHIFT               232 B* M3 |' b) w# R9 d  W7 t
  60. 0 s4 X& `  R; s
  61. static volatile int irqraised1 = 0;
    7 ~6 ]5 W  K- }% E3 m
  62. static volatile int irqraised2 = 0;
    ' D7 y' @! B/ p; G1 [4 b

  63. + S$ J5 U3 U4 c& n% o( g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " b' C8 y( ]5 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( c- ?+ J' l! p3 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 T. `) U1 A& u/ x
  67. - ]5 c$ r  T4 E8 B. i, b2 H
  68. dma_addr_t dmaphyssrc1 = 0;
    3 b5 P6 I9 U& O7 b2 t2 T
  69. dma_addr_t dmaphyssrc2 = 0;
    ) k& T9 g2 Z) t7 b
  70. dma_addr_t dmaphysdest1 = 0;, y* I+ L+ V$ y7 |# N- w* [0 Q$ S
  71. dma_addr_t dmaphysdest2 = 0;! R  y3 F7 o6 V% K! a( y
  72. + X% f# J# d+ |2 d0 M8 @3 T
  73. char *dmabufsrc1 = NULL;: Y- d: i  L/ c4 Y: i1 H
  74. char *dmabufsrc2 = NULL;
    8 U1 @" j/ l+ ]; ~3 g( x
  75. char *dmabufdest1 = NULL;
    6 E9 \& H" ~) I& [: C5 v. ~
  76. char *dmabufdest2 = NULL;
    5 z9 y* c% e% p( u; B

  77. " J9 I6 \  x0 f4 w
  78. static int acnt = 512;# m4 a; q% M9 Z
  79. static int bcnt = 8;4 C3 P! R% \2 ?0 |% r, Y, J
  80. static int ccnt = 8;
    8 k; R) S  M) W" t

  81. + S; [% f' B2 ]5 L
  82. module_param(acnt, int, S_IRUGO);. F" A# v7 F( {, J) \
  83. module_param(bcnt, int, S_IRUGO);$ Y3 e  W& P. p* I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 J% Y/ ]4 U8 p& G- h" V  Z* E# u' ~

/ e; ]7 L+ d" ~7 q0 c" t, [6 _% S+ b2 [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  G& l8 |" Z3 a* B2 C' ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  U- O. i; l- {9 `& e7 J& z0 R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. q1 w# r9 F& O0 C. V
5 W# J2 M0 N5 L; Y. L* |7 b
$ r: V( A' n, O7 e2 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 12:10 , Processed in 0.040372 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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