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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 A9 n. o% `& q2 n3 b8 T3 @" I
  1. [code]EDMA sample test application% _2 i8 A( A! P
  2. /*
    6 a  N9 w3 \4 ?  U; S
  3. * edma_test.c
    , H: u5 A1 q8 A" v: F: v6 v/ L
  4. *
    * R6 |9 A9 H$ }: [* D; ^) A" c
  5. * brief  EDMA3 Test Application
    3 \& Q+ e/ t; F' @* I
  6. *0 b# a8 ^4 I2 s* I* E
  7. *   This file contains EDMA3 Test code.4 m* W1 k' }5 ]* n1 K4 h: @
  8. *& W: I" V2 Q: i3 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & L0 y$ Y1 d+ s- t0 `9 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # L1 b& W$ D# e4 U) E
  11. *         TO CHANGE.
    4 c0 D" U9 I5 \; m( [+ v
  12. *
    8 B) ^) k# B# s3 v1 Y# j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 M7 A8 l: a! t3 c+ Y' G+ |
  14. *
    ' M5 L7 p6 k  {
  15. * This program is free software; you can redistribute it and/or" j# v$ x" ?- G. g3 M
  16. * modify it under the terms of the GNU General Public License as1 }, Q% G) b5 n6 C- B
  17. * published by the Free Software Foundation version 2.! x7 y9 Z" A' p2 p# H7 J
  18. *1 B( S# C' y- |7 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 l: @" e5 x1 L" J
  20. * kind, whether express or implied; without even the implied warranty
    : f2 z3 h8 w! |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) i! O# i& f! o/ M
  22. * GNU General Public License for more details.
    , J$ M) W6 P" R7 \
  23. */3 x1 v) j( J" x1 c4 s7 M# X
  24. ' L' v" c& e  u+ |2 G1 e- h
  25. #include <linux/module.h>% A6 q7 L+ ^. T" t( [) U. W
  26. #include <linux/init.h>
      W+ O; q3 n( u7 _: n  D( z% t
  27. #include <linux/errno.h>% N, y, R' \2 T" @: d5 R. d6 F
  28. #include <linux/types.h>
    4 m3 [8 }; j3 M; F& c
  29. #include <linux/interrupt.h>- |9 B& X1 a1 P2 ^; M
  30. #include <asm/io.h>. M& i" s; P% V% m
  31. #include <linux/moduleparam.h>
    + b' S, C; G0 ]! O
  32. #include <linux/sysctl.h>7 n8 m! v8 G* Z6 M
  33. #include <linux/mm.h>3 d2 A6 v0 H' `: K, u5 ^* K1 V* `% S
  34. #include <linux/dma-mapping.h>$ |/ V/ {5 ?8 V! K5 N  ?! j# {! k

  35. ) `, S& j7 f4 [$ V2 Q
  36. #include <mach/memory.h>" G2 x8 U/ e) w: E! S$ b" O! E
  37. #include <mach/hardware.h>
    " z+ |& A) d& v& g
  38. #include <mach/irqs.h>3 H  I, [' ^  }& ?+ ]/ p) s
  39. #include <asm/hardware/edma.h>
    - p- x: q% w9 Q1 M7 C& d

  40. ( V7 [9 k# B5 T0 n
  41. #undef EDMA3_DEBUG
    1 @* ~0 s) j/ {. k
  42. /*#define EDMA3_DEBUG*/
    ) s7 p4 J3 ]1 D" U

  43. ! I- Y0 ?! |3 G* {  a! m- y
  44. #ifdef EDMA3_DEBUG
    & r/ A) _# c4 [8 V4 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): w3 ~! L9 M2 v* C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 P& ]" @! J# c/ u& `) _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  S: r/ X5 W/ R* Y+ F' V6 H$ P  X
  48. #else
    2 @% V0 \: G4 l; |. j! R( A
  49. #define DMA_PRINTK( x... )
    5 P, I$ x' ?8 T  @# I! w! I
  50. #define DMA_FN_IN
    7 p, e% J7 p% J) i& y
  51. #define DMA_FN_OUT
    * C4 a8 t# O$ ]8 v) x
  52. #endif
    6 t7 R  ]/ ?! x8 _( q, x
  53. / W" f7 ]0 r! g; z! k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! U$ J" k/ S2 t9 e2 t
  55. #define STATIC_SHIFT                39 v7 v  v: ]6 ~0 j6 X$ Q
  56. #define TCINTEN_SHIFT               20
    # t/ t& w# w/ U
  57. #define ITCINTEN_SHIFT              21
    * G0 r! C) j  n
  58. #define TCCHEN_SHIFT                22
    ( I2 |# Z# p# h& N
  59. #define ITCCHEN_SHIFT               23& X, ^( M" K) e3 r# u* A7 [/ f5 i

  60. # ]; U* s1 [' o/ ~/ g- l6 p, z* K
  61. static volatile int irqraised1 = 0;  ~6 X  `2 K; W* f5 N1 t8 }/ w
  62. static volatile int irqraised2 = 0;
    . L" e/ v+ W6 e' j: }

  63. 8 I: r; @+ m) Y4 j# C  w0 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ b6 T1 @. w( C  A+ U4 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / P# N+ F$ f/ J9 v& S; a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , z6 M% H' ~/ g, y7 ?" D

  67. / o: j4 S0 R. D0 u
  68. dma_addr_t dmaphyssrc1 = 0;
    ' G$ k5 y9 {6 A. A
  69. dma_addr_t dmaphyssrc2 = 0;0 v! N* v! D% A* ?2 T! _3 |3 T
  70. dma_addr_t dmaphysdest1 = 0;( Q. J2 w/ c" H( j/ \
  71. dma_addr_t dmaphysdest2 = 0;, Z; u, h8 x- M" i7 g/ H
  72.   _+ A/ F/ l( i5 l
  73. char *dmabufsrc1 = NULL;
    ! a4 E% l3 J# {% ]6 R2 G! P7 W3 A
  74. char *dmabufsrc2 = NULL;
    1 Y, _+ g7 B* k7 c
  75. char *dmabufdest1 = NULL;. r8 Y4 p( v1 l
  76. char *dmabufdest2 = NULL;4 z1 o2 i- F9 y2 p
  77. , i, y( h! T7 G8 r' [
  78. static int acnt = 512;
    4 d* @9 J6 g/ b+ Y* K- y& L
  79. static int bcnt = 8;# X4 p4 x) T; Z4 n2 F
  80. static int ccnt = 8;) X# v  X3 K/ z6 X: J! [

  81. 6 c  ]  B0 N/ s* O0 Z0 t
  82. module_param(acnt, int, S_IRUGO);
    3 Y# h- H8 O0 X+ P% y7 o
  83. module_param(bcnt, int, S_IRUGO);9 ?4 J0 }$ c% s- e" U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, a  o1 P/ Z  e7 M9 m; [9 ]" e( t2 d  |4 I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: L$ k/ E5 |& a. m1 {3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# z0 j* [$ S( G; r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# e9 h- U" C: t! S4 C7 P! r' o' T* ~$ s' C% i& Z

+ s/ r1 l5 o+ v  Z/ y' ]# q; _! d: S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-19 00:16 , Processed in 0.042966 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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