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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; @* r! X, f$ Q4 M  t# P
  1. [code]EDMA sample test application2 k/ `8 j7 f- c& W' V& `2 {
  2. /*
    / G' Z6 C: Q$ a7 ?" E2 c0 G6 k& U
  3. * edma_test.c
    ) d6 n0 C* x  z; y: z/ ~
  4. *. Q- Q( G* V9 f8 F
  5. * brief  EDMA3 Test Application
    ' b0 e" Z! y! I& t
  6. *
    # T4 N0 {- Y7 @% l! \6 h9 [
  7. *   This file contains EDMA3 Test code.. ?) B' B% S  c  n
  8. *
    0 G9 [9 X, \) n0 ]7 _. }( ?" H. o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , r6 \; w0 @' p2 i5 I; V- K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / F! u2 w7 H8 T1 T2 f
  11. *         TO CHANGE.% _# Y, w( m. R6 m+ m
  12. *$ m" \; K( x. n/ G. B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( ^/ {- {. T% {
  14. *; k# m4 ?! U+ w" R5 W4 F+ P
  15. * This program is free software; you can redistribute it and/or- D. o5 Y! @! ?
  16. * modify it under the terms of the GNU General Public License as
    9 j8 ^5 h8 [0 x/ F
  17. * published by the Free Software Foundation version 2./ E( P1 _+ I. y- G
  18. *
    & L+ Q. {% Y6 M( L: j6 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. u; y/ V0 ]* ]" J& ?
  20. * kind, whether express or implied; without even the implied warranty: o4 L+ [: o% c6 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) Q4 Q: F# R7 M  B
  22. * GNU General Public License for more details.
    & b3 z  m% L/ R. \5 ^5 b
  23. */  K; F4 T9 x) r5 Z/ p3 u

  24. 0 M1 R1 y1 z: y' e4 Y/ Q
  25. #include <linux/module.h>; s" N* i* L9 I2 `  P: ]% A
  26. #include <linux/init.h>8 D4 i* K9 o  |
  27. #include <linux/errno.h>( ~5 @8 r- c1 Q- H* M! y% y7 R
  28. #include <linux/types.h>
    8 Y; h# a( k7 w5 }& W. g# F
  29. #include <linux/interrupt.h>
    ( w# H) p% t1 F8 T
  30. #include <asm/io.h>9 s: s5 r: U3 K9 u
  31. #include <linux/moduleparam.h>9 Q( c/ R- H# G3 b
  32. #include <linux/sysctl.h>3 [  e3 B4 v' U
  33. #include <linux/mm.h>6 \1 g; X5 l; {. H; F
  34. #include <linux/dma-mapping.h>( V0 b: q" Z- \- p  c6 ^
  35.   p) t/ z; |0 O& m8 w
  36. #include <mach/memory.h>, k2 i3 y2 C3 e& z4 q
  37. #include <mach/hardware.h>
    $ N/ c* v+ t/ P6 P
  38. #include <mach/irqs.h>
    + i8 X9 h2 k% s! e" \# c
  39. #include <asm/hardware/edma.h>! B1 s) J9 T: @* J

  40. 6 h1 X) i& }3 }' k% O8 N( M
  41. #undef EDMA3_DEBUG
    - I4 ]* o; C. T  Y+ s# y5 w+ b
  42. /*#define EDMA3_DEBUG*/+ t- `" {* N3 S# |5 T+ |% f: E7 j

  43. # v. e, R( O7 ]3 R' h# ]9 }
  44. #ifdef EDMA3_DEBUG, X3 }" q' t3 P' n  Z2 A0 n- O  K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): \8 Y$ p3 t4 p' F3 b  }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : _: a6 ]8 A1 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); r& |8 ~) u# }0 j7 O, E
  48. #else
    + |) q; {9 Z2 S7 ?; \9 T" J
  49. #define DMA_PRINTK( x... )
    , P0 ]2 A  F- s& {$ N
  50. #define DMA_FN_IN1 H- i) v7 v% E  [
  51. #define DMA_FN_OUT- J8 c4 U% S1 v7 H! X4 a9 a/ K
  52. #endif" G* \3 c4 u1 s; `; r* x3 c7 J! ]
  53. - i4 ?! S# Q- C9 C6 _2 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& B5 ^5 ^2 u1 O4 q; P7 @9 @6 i# Z
  55. #define STATIC_SHIFT                3
    8 b+ [2 L1 W* I9 `- P, v
  56. #define TCINTEN_SHIFT               206 \: x# g, H0 T  p3 @$ ?' t
  57. #define ITCINTEN_SHIFT              21- Z0 I- D1 D- |& j8 h: Y5 t
  58. #define TCCHEN_SHIFT                225 H) p0 ^9 k) d, C
  59. #define ITCCHEN_SHIFT               23
    " |; U# o2 H1 \) }
  60. $ A: L/ H2 W' q
  61. static volatile int irqraised1 = 0;
    - A1 o7 e! Z' |! q
  62. static volatile int irqraised2 = 0;7 O4 ~+ D5 s8 j+ s
  63. $ d/ u, D% [: r: h# e1 V& G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* V9 _" e/ p, k4 W3 @0 u( a3 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . }7 f6 p% y% f/ N. T/ A, ]2 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # m2 I% m% Q- w3 g% B1 Q8 t& L+ e) L
  67. # e0 s% B0 E: I
  68. dma_addr_t dmaphyssrc1 = 0;
      P3 P9 U+ Z" s% ?4 l$ x
  69. dma_addr_t dmaphyssrc2 = 0;
    % Y1 ~. i6 q5 e$ U0 _5 f% l
  70. dma_addr_t dmaphysdest1 = 0;
    $ n  V& s3 T# I1 ~8 e/ R0 F# ]
  71. dma_addr_t dmaphysdest2 = 0;
    % `+ R5 ^4 F# x: e* {. g. }7 F
  72. - `' P, [# H4 F1 V
  73. char *dmabufsrc1 = NULL;$ Z: ^5 f8 b1 h7 C
  74. char *dmabufsrc2 = NULL;
    $ x- d. e9 M* v' c3 f
  75. char *dmabufdest1 = NULL;
    4 T. E+ s& t5 o. L
  76. char *dmabufdest2 = NULL;
    $ |. d+ }7 F4 Z% D! H2 V7 J

  77. ; @/ N7 V% N$ c4 z; j; c, t
  78. static int acnt = 512;# _* g( I0 d4 Y7 R0 {5 r1 y
  79. static int bcnt = 8;
    + X: ~/ }2 E/ ?" z/ D9 S" w
  80. static int ccnt = 8;
    $ J  `1 k: @/ l% A0 ?) e# t
  81. ; A! }5 X) N7 b
  82. module_param(acnt, int, S_IRUGO);7 V* b$ y+ u! {! c5 z
  83. module_param(bcnt, int, S_IRUGO);
    7 m3 x, a1 [3 k, u+ ?( J( s+ g3 X8 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 }( M& B; C% Q9 Q( N' b( Z

$ G$ y: \" K4 S" X; @6 X6 A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! b+ @- Q# [- l8 Q4 x* d, r( Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% R: g  H- _* j2 _1 P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' K+ y/ D0 \/ k; Y0 S/ E
9 X, J* l  a0 n5 L% I; G# G
! [. ^. Y: |- O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 20:21 , Processed in 0.049682 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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