OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( E# ]$ s5 A3 k  T! A4 P& g7 a
  1. [code]EDMA sample test application
    % v9 ~: a5 v) ^: U6 k& U: ~
  2. /*5 a) P- [& c/ \6 v
  3. * edma_test.c6 @4 Q5 C4 X5 H6 x& \
  4. *) g/ m) |( O, w% P3 m$ y) a2 Z6 w
  5. * brief  EDMA3 Test Application
    , {" q! H9 @; N" J2 i5 Z
  6. *
    1 G7 d! ]6 Y" e$ u- [
  7. *   This file contains EDMA3 Test code.9 u6 G7 I7 M# j* x2 f9 a: J
  8. *6 U9 r9 Q- Z' P( B2 E& Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- h3 D3 p) x) g6 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ _+ W/ D7 x, P4 g! O1 n
  11. *         TO CHANGE.
    5 \- g: N% W; T. M0 V5 t+ i
  12. *: {2 x3 C) }8 O5 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( A5 }+ ^5 d) O
  14. *8 b! X7 {6 `6 W. |1 k- @" r2 H/ Q
  15. * This program is free software; you can redistribute it and/or
    & j5 @1 H: V0 N1 y
  16. * modify it under the terms of the GNU General Public License as5 ?* }) {) \/ e9 g) x# I. @# M
  17. * published by the Free Software Foundation version 2.
    ' W% o6 B% _& {  ^
  18. *" O, T  C% ]3 a- Z8 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 \0 t/ x6 L$ E
  20. * kind, whether express or implied; without even the implied warranty
    * l: F; Q. H3 I2 G* ]1 j) Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! E" E. U8 `0 g
  22. * GNU General Public License for more details.6 ~  y' b1 \! I2 e" _$ Z
  23. */
    * P/ r6 A% t' K- P$ N

  24. ! \. l# d* k, V) I: P3 T: y' X
  25. #include <linux/module.h>  D# a+ e- }) g7 M$ U) S
  26. #include <linux/init.h>% f' o& x( u/ k; u3 T
  27. #include <linux/errno.h>
    / v) f/ e+ i, L8 H/ s. }2 F; m% v
  28. #include <linux/types.h>
    1 l' u4 {+ I3 v* P8 C4 F
  29. #include <linux/interrupt.h>
    - n: Z& U1 C( O0 i) P/ I8 @+ E
  30. #include <asm/io.h>1 J* f" K3 D) \6 E
  31. #include <linux/moduleparam.h>0 \' `) s+ B, X9 L
  32. #include <linux/sysctl.h>$ B9 v9 q1 n4 e" B! n
  33. #include <linux/mm.h># j) t1 a! L* ~$ B) A% B6 J# E
  34. #include <linux/dma-mapping.h>
    : z* y9 F3 o0 @+ W5 [
  35. ) e5 D, k7 v7 I+ I
  36. #include <mach/memory.h>/ o  f3 f/ F. V9 K2 T- T9 B
  37. #include <mach/hardware.h>$ \2 z" y' m% M& T
  38. #include <mach/irqs.h>
    % f1 O1 `% U0 `: R
  39. #include <asm/hardware/edma.h>5 B$ O: e# O9 k8 E

  40. 2 [/ H( ~7 G; Q( l$ J) _1 q' E
  41. #undef EDMA3_DEBUG/ Q! E7 P0 b/ l/ J. M# o2 B# \
  42. /*#define EDMA3_DEBUG*/
      \9 B' T1 d% F- W' u# @' E

  43. * D) b+ I% Y* i9 y$ R0 n
  44. #ifdef EDMA3_DEBUG
    + R: W- m2 z( o( I  [0 n! d/ d2 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! C) _& ~, ?. X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# |5 Q+ |. c! d% \2 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( N; k5 q8 J* ~( V8 [* y$ s$ ?; a+ y
  48. #else
    & p) v  Q! L% u- u* P
  49. #define DMA_PRINTK( x... )
    6 s) E3 a. `1 ^% g$ e
  50. #define DMA_FN_IN3 c. |3 K0 F1 F8 o
  51. #define DMA_FN_OUT
    3 ]& c; J- K$ ~( R6 |
  52. #endif
    $ p6 u% Z, W4 h7 V2 F% Y8 r

  53. , t2 s6 R+ b3 m" |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # @5 `) N0 k% @+ Q) u! t1 i
  55. #define STATIC_SHIFT                3, L* P: `' a3 V: T) L* m: \9 h
  56. #define TCINTEN_SHIFT               206 n4 R+ t9 v/ ?
  57. #define ITCINTEN_SHIFT              21
    9 {8 N7 ~% W& k, V" I  ~
  58. #define TCCHEN_SHIFT                225 n/ D. v4 q5 `. M
  59. #define ITCCHEN_SHIFT               238 p8 s' W, u8 R1 x

  60. 8 ~6 ~, @; h" }! H
  61. static volatile int irqraised1 = 0;
    3 Y" l( ?. O! t2 E
  62. static volatile int irqraised2 = 0;
    ) K. s- n# ^# {6 m  O( g8 `, P
  63. $ e' t; r4 S5 h& B# ~6 h1 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + W# v0 F% @1 |; k9 d3 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 j, Q. W9 T8 ]' Y6 d! |8 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; U6 k$ M0 b/ N2 m/ N  A
  67. ; M; W8 c; ~1 z5 Y+ Z- S) g
  68. dma_addr_t dmaphyssrc1 = 0;5 }( i; z: v: w' i
  69. dma_addr_t dmaphyssrc2 = 0;& H% ^* j& `8 \2 ?" l
  70. dma_addr_t dmaphysdest1 = 0;
    ; Q; i6 v( R. H# w* A8 d8 o
  71. dma_addr_t dmaphysdest2 = 0;
    ! |7 T; t& T0 m
  72. / j: t& x# I! D5 J
  73. char *dmabufsrc1 = NULL;
    $ H% o2 `' E" S% g" s; F
  74. char *dmabufsrc2 = NULL;
    + ?, `7 c. U8 h) N$ p5 Y7 R
  75. char *dmabufdest1 = NULL;6 ^% [8 A, g) ]* U
  76. char *dmabufdest2 = NULL;
    ) S" h( L' B+ i3 l
  77. 2 U1 y/ h# c: v0 C+ o8 O: ]( S
  78. static int acnt = 512;# Q0 ~; `, i& N9 g0 \
  79. static int bcnt = 8;
    2 ]2 O# m9 e! z% A7 z( h
  80. static int ccnt = 8;* ~2 `# `( ^& w
  81. + z* V& E7 V5 R/ Q( [4 C
  82. module_param(acnt, int, S_IRUGO);" ~( f$ z# }$ F$ l% S. @% S3 H
  83. module_param(bcnt, int, S_IRUGO);
    - s- b/ }6 ~/ m2 k6 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ w; [" e4 Y4 v5 p6 l, I, D; w8 A* L0 q$ z) P. m! }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ F' F. f, ^, `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 Z. @  i5 t  t3 J, c# M4 @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  e* U, J( y( n- ~) k

3 n0 s1 x- x: w+ G4 N6 J$ ]" S; @6 Z8 l; J9 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-12 09:48 , Processed in 0.038394 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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