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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 [4 F0 N/ f1 b! N4 i. Z' ^
  1. [code]EDMA sample test application4 g; ?" R& J. ]
  2. /*
    0 J$ Y8 a% k7 b1 _; s- h5 C% w' M
  3. * edma_test.c  |/ w$ c2 d5 x' v
  4. *& x( ?5 k4 s+ r; l$ C
  5. * brief  EDMA3 Test Application1 Y4 _6 r( O4 V8 W: s
  6. *
    . C; h( h8 ?' G0 [; {) K
  7. *   This file contains EDMA3 Test code.
    " h9 C5 H0 R2 j" P
  8. *
    6 \5 R! L( U' F) W" S0 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: P4 L3 D7 d8 D; [0 O8 g/ b" f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: q  h5 o9 O" i- |  Y) C
  11. *         TO CHANGE.
    ) _4 B, V  X' q1 Z) z9 a1 u
  12. *
    6 y: P: K& h1 ?  c4 M. R" }0 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! j/ k# b" T; `" c6 V0 \
  14. *# c( F& L" s. M& E4 Q: n' l' B
  15. * This program is free software; you can redistribute it and/or
    ( q, C7 O- Z6 U, ]# ]0 @9 q
  16. * modify it under the terms of the GNU General Public License as
    ) p" o. L# `* Q9 H9 ^0 s
  17. * published by the Free Software Foundation version 2.
    + O& M9 H" f/ g7 a& }2 T
  18. *
    ( t9 a7 ^4 v6 ~' U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ `$ M7 J* {- G! v) w
  20. * kind, whether express or implied; without even the implied warranty
    . Q6 G5 V) Z9 K, n" _7 J3 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / K' ^: {% x* u1 q! }3 c
  22. * GNU General Public License for more details.1 J, P/ A, Q. z+ R* G9 G
  23. */
    ' P" V$ P9 |/ g( s0 a4 ^

  24. ; H5 ^& L. L  x; W- S2 [
  25. #include <linux/module.h>
    9 ]0 J$ ^# }, M
  26. #include <linux/init.h>! _6 W1 V! g& @, ?# q
  27. #include <linux/errno.h>
    ; ~3 |9 x( g6 a9 h8 R+ J. w
  28. #include <linux/types.h>
    9 Z! O# R# R4 M" B- z' c- y
  29. #include <linux/interrupt.h>  a3 L! O) G, M
  30. #include <asm/io.h>' k* Q6 h% \. G; e. \
  31. #include <linux/moduleparam.h>
    2 H+ @& |) w9 v# A8 U7 b! f, k
  32. #include <linux/sysctl.h>; E$ G3 u* ~+ J; A1 Z: Z
  33. #include <linux/mm.h>
    ( H5 D: U' H9 n7 a& z0 W) e
  34. #include <linux/dma-mapping.h># m& q) H3 L& g. r
  35. 9 c! r: k0 u: m9 q  y+ f9 ~# K
  36. #include <mach/memory.h>: A; ]0 ]" F4 J6 f. S. y
  37. #include <mach/hardware.h>
    6 Q: V2 R% _. x4 t
  38. #include <mach/irqs.h>) M% W7 d  S9 g9 I$ f
  39. #include <asm/hardware/edma.h>6 S+ g; B( e% s! L& ~5 `' G9 h
  40. 3 [3 T4 t3 @0 t  N( ?# g
  41. #undef EDMA3_DEBUG4 u. y! L, {0 q( D# W: m* N* {
  42. /*#define EDMA3_DEBUG*/. H) n8 ^9 s; Q* v
  43. 9 Z- C3 g2 C" d! ^: C7 y
  44. #ifdef EDMA3_DEBUG
    ' ~- D4 ~: O4 |, i' R  J9 K& a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 @7 s& Q3 N- _( B; Q: k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      i/ F  R* m8 [. s7 w" W' I9 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* ~! u, D, u: G6 {, b
  48. #else  I2 d# w# |+ A3 l
  49. #define DMA_PRINTK( x... )
    9 |1 q3 t" x7 G: t2 _' O8 l
  50. #define DMA_FN_IN
    4 ^6 Q) V7 b) O# P+ t; J8 d. k
  51. #define DMA_FN_OUT2 v4 D1 ^: B+ i+ \; [7 H% T
  52. #endif
    , y6 c2 t5 h8 H* n

  53.   v# @4 b$ I2 p8 h0 w' N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  ~5 _& `+ t. n4 @7 l# m
  55. #define STATIC_SHIFT                3
    0 B( C& g7 a6 C- b1 c) f
  56. #define TCINTEN_SHIFT               20
    / O6 t/ T, S4 l9 U
  57. #define ITCINTEN_SHIFT              21
    $ j* i9 X! J* P" u! b
  58. #define TCCHEN_SHIFT                22! ?: ?8 H+ n  N- c) `# h# F
  59. #define ITCCHEN_SHIFT               235 l6 }  ]- z! X) M

  60. 0 V4 n+ G0 j# x4 O
  61. static volatile int irqraised1 = 0;) u4 ~: P) L1 Q) C) O
  62. static volatile int irqraised2 = 0;; a# E- m& U5 c+ T! m; i
  63. ) ~/ t+ ]' h! @3 p  z: M( d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) s! ^3 m+ r; g' g6 ?' }; `) H8 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' A) _; j8 u8 f0 Y: f3 P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : Y5 `# k# ?1 P& s  N

  67. % I1 }0 d0 ~) O) ~! c* Q; y0 F
  68. dma_addr_t dmaphyssrc1 = 0;
    4 Z  u# K, ^7 v' O8 S
  69. dma_addr_t dmaphyssrc2 = 0;+ o+ c. ^" f4 n$ J# z
  70. dma_addr_t dmaphysdest1 = 0;% S7 o# s- Y1 E' n- v# b/ ]
  71. dma_addr_t dmaphysdest2 = 0;/ X) e9 G# K+ W1 K# C% _+ x: e
  72. + y  K/ l, F) |9 V
  73. char *dmabufsrc1 = NULL;. b- s+ L  D9 |0 r7 ~9 G3 B
  74. char *dmabufsrc2 = NULL;8 p+ o+ {( x5 H" D, Y( V
  75. char *dmabufdest1 = NULL;7 x9 ?1 g; l+ Z+ O; S  H$ A1 k
  76. char *dmabufdest2 = NULL;
    2 C1 H# x7 A4 j8 D5 D( x; T; S
  77. 1 F  g( W1 N* l! r# e
  78. static int acnt = 512;
    1 s" f4 L" x( u6 J2 i( o9 P3 J+ X
  79. static int bcnt = 8;
    2 @% w( }4 |$ B, B. R
  80. static int ccnt = 8;9 e% o; M. W6 d. V+ v; Q

  81. : H) _0 C* V$ q3 c2 H, ^! g/ k1 ^
  82. module_param(acnt, int, S_IRUGO);4 O& v/ @$ q9 t, o4 Q4 ~
  83. module_param(bcnt, int, S_IRUGO);
    ; ~3 h2 g5 J% ~# V) u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 G7 r9 t3 t/ d/ c

+ P' D0 q7 c2 O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ u0 c0 }3 K0 o( T+ `. n5 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 `) f4 P* |1 i1 A. Z* G1 _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ I+ c  U6 @% r  z0 X* j6 W. c

3 t7 G/ a' R7 w9 r* K) a6 r* Y+ ]6 L1 V& o' Q& K0 M" a* D4 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 16:10 , Processed in 0.039300 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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