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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* }! w% D) \" G7 U0 [& m
  1. [code]EDMA sample test application5 \% s2 ^2 J3 I& \. D$ P
  2. /*
    : _4 m' @% x& U! d4 v5 ~
  3. * edma_test.c
    # j3 ^3 v6 Y, F# i: P
  4. *
    , f8 |! ~- p, K4 R" ?
  5. * brief  EDMA3 Test Application5 |8 x. G7 i  t1 c/ |* x7 P
  6. *0 x- _& J4 c4 B! x& H3 E6 E8 I8 w9 G
  7. *   This file contains EDMA3 Test code.
    - l; ^+ B* H/ C" ~7 d# F" @9 d
  8. *
    ' s) c; Q* |- v9 p. J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # t2 E1 v4 ^  ^/ S# g8 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" L# Y; d  D5 h. W' ?
  11. *         TO CHANGE.: B9 R- L3 k0 v: s& c' O. y
  12. *
      S. p7 d# }& A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 b, h5 J7 o: p/ t
  14. *( E9 g( C' @5 C4 i$ M9 J
  15. * This program is free software; you can redistribute it and/or# C: Y+ i2 F6 ^6 N6 R
  16. * modify it under the terms of the GNU General Public License as% U( p9 H$ D8 V' p% Z6 \( W  H
  17. * published by the Free Software Foundation version 2.
    3 j& i* m% ]' c6 W
  18. *
    + `$ {& K- D( m( @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% p+ s- H  R3 q1 t2 u# _
  20. * kind, whether express or implied; without even the implied warranty9 O/ A! s' H; Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' a; S' a$ s( e& [. B, J2 N% i
  22. * GNU General Public License for more details.) c/ |7 q- ?% g
  23. */
    ) v/ Y: }, ]/ j7 B, K
  24. $ ]& \" j0 o9 f; B, v6 [9 ~
  25. #include <linux/module.h>) k2 S/ X) U# B: s: W4 |
  26. #include <linux/init.h>
    ) H& ~, C/ J8 g% O; {
  27. #include <linux/errno.h>8 D: z. E9 v8 r  y* s$ }% ~+ R
  28. #include <linux/types.h>
    5 r! e9 d8 ]; M% l+ ~/ `! ^
  29. #include <linux/interrupt.h>' w, a. j0 V0 ^1 i( i: Q6 ]
  30. #include <asm/io.h>
    9 P' Y2 F( v; ]+ b( b1 u/ z; z) l2 g
  31. #include <linux/moduleparam.h>9 O9 u# t" x9 C, I% o# H
  32. #include <linux/sysctl.h>+ r7 L: |  H1 a7 c* G% m" E# X6 I
  33. #include <linux/mm.h>
    9 o8 i! x5 c# s# |1 v4 e
  34. #include <linux/dma-mapping.h>
    8 W$ Q; w6 U# p; R, X  u
  35. 0 S, q$ B. S) l1 U. i
  36. #include <mach/memory.h>+ Y; m0 a- c( n" O* h: q
  37. #include <mach/hardware.h>
    ; I7 r5 y& {% G0 _) u
  38. #include <mach/irqs.h>  E* Z9 P( {6 c/ D
  39. #include <asm/hardware/edma.h>0 E! g% d6 _8 L" W. L

  40. " a1 H, G* A/ c
  41. #undef EDMA3_DEBUG
    % C8 k! s4 r9 T6 v
  42. /*#define EDMA3_DEBUG*/
    * T- {  g1 o  T

  43. , Q: C. h5 V" l; ^! q  G
  44. #ifdef EDMA3_DEBUG$ k% }1 y* ?- ^4 j6 S' g( [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " @; J1 l: K" E) s8 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 A$ z$ \; i: |0 L* R( l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 }% O" @# `4 `* v" b4 a* r
  48. #else
    ' F1 @0 D: V( D+ v% K
  49. #define DMA_PRINTK( x... )' `0 ^7 A$ K8 `$ O& \+ |! c* |
  50. #define DMA_FN_IN
    6 ]: l( j+ v5 G' q' J9 q( G3 n
  51. #define DMA_FN_OUT
    # W, O; @3 n2 I- W! Z- p
  52. #endif* O: I- r* S$ C4 ~  B  L: x

  53. / p0 s6 Z) ~! [! d; w# k+ T+ `7 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 ^9 e: t3 _& f5 U/ N7 L7 }
  55. #define STATIC_SHIFT                3
    7 g, r3 b/ {; u8 |3 v* i
  56. #define TCINTEN_SHIFT               20
      b! `6 p5 ?7 _& R" \; g
  57. #define ITCINTEN_SHIFT              21! s6 y. s/ v! I$ a  w$ y8 W# W/ l
  58. #define TCCHEN_SHIFT                22- A# x5 K, A! F3 b; S# v- N
  59. #define ITCCHEN_SHIFT               23) o! N  x' ?9 \

  60. ) M8 q7 f3 n/ D$ G
  61. static volatile int irqraised1 = 0;# j& ]2 {, t6 N# }3 c" I+ ]/ z
  62. static volatile int irqraised2 = 0;9 Y% e7 g! N+ p: c- L: o$ a  k
  63. 0 A/ H( w% ?) U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 |7 `" \% l9 p9 Q$ j7 W9 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 f! J# R2 U0 o2 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 h1 G7 e: I% r# p+ z

  67. 1 _1 _* O- s8 O. b1 i' p; I
  68. dma_addr_t dmaphyssrc1 = 0;$ ]+ [2 J. ]5 S- _) S# t; G& r
  69. dma_addr_t dmaphyssrc2 = 0;
    ! q& E3 j1 O, t
  70. dma_addr_t dmaphysdest1 = 0;1 q; y7 r2 ?9 Y% X' Y: k
  71. dma_addr_t dmaphysdest2 = 0;
    / k$ c+ e: t( S' }
  72. 3 L# x3 a% @7 @: \" s
  73. char *dmabufsrc1 = NULL;
    2 R4 r+ ~2 [: h$ o5 G" V2 Q
  74. char *dmabufsrc2 = NULL;
    3 Z7 a  ?# E7 j6 F8 b% |* h
  75. char *dmabufdest1 = NULL;
    3 h" V- V* [. E' r+ A0 Q
  76. char *dmabufdest2 = NULL;
    7 x% J( b% c0 T4 O, v3 D- ?0 M' \

  77. : j2 P) y. {8 B: F, a- M+ V2 t5 \
  78. static int acnt = 512;
    . z0 D. @4 Q) S; j0 j
  79. static int bcnt = 8;
    / D, z3 m, ]# J9 }$ z9 B
  80. static int ccnt = 8;
    $ D+ Q+ k  N( @+ B9 w* o
  81. . l" U* S/ ^4 L  b4 X
  82. module_param(acnt, int, S_IRUGO);
    ) i9 G8 p" P1 y; E/ u7 A
  83. module_param(bcnt, int, S_IRUGO);( E4 v! J1 e" T5 l1 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% M0 F& B9 }4 w/ o* E6 A/ m
: U2 P4 S) S; n- o& ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ g$ d9 d! m9 X% p1 s! g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- y& M2 H; W1 ^, R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- b! |5 b" A: r6 y

/ G/ l. q2 U' r* h( P( Y% a% H- _, T$ C3 Y0 M( P9 t! c* H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 21:38 , Processed in 0.038779 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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