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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ }( _" i) O- z
  1. [code]EDMA sample test application
    7 K7 O. ?3 l/ @" [/ V
  2. /*
    ' t0 e0 F" L+ B. s3 @; }* @8 v
  3. * edma_test.c' f4 C5 m# [6 _' W0 B+ a
  4. *+ y6 X% R% t8 [2 p. b
  5. * brief  EDMA3 Test Application$ a' Z) _3 p8 ]% O# x
  6. ** I3 _& U; \1 `! m
  7. *   This file contains EDMA3 Test code.
    # H9 o/ v& A$ ^
  8. *' V" U2 E  Q& u( x0 O8 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, t. [- M8 |, ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & l; f2 z3 V! ~: [7 Z' e8 ~6 ^
  11. *         TO CHANGE.# O( a" Z/ H" i" [% p% e* t8 R/ k% z
  12. *$ U9 B$ m& P7 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 n7 M/ O7 I) s
  14. *
    $ }3 h: P% V* K) h. w, n
  15. * This program is free software; you can redistribute it and/or+ w+ q1 k/ H) [8 d6 H
  16. * modify it under the terms of the GNU General Public License as6 l6 X# t, ?' F" p+ a
  17. * published by the Free Software Foundation version 2.
      P! _( T2 }1 J) f& T
  18. *7 \, A- s5 Y, a* W' v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" V+ X+ |1 C3 f3 l
  20. * kind, whether express or implied; without even the implied warranty) ~. N* ^6 E  H; R5 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 {6 l* z1 K7 [1 n! G
  22. * GNU General Public License for more details.; ]: S0 b6 ]1 {( e* G/ Q% N
  23. */3 \1 g# w. \9 ?
  24. & j6 O( O1 h; l  U# B) }
  25. #include <linux/module.h>% o9 \5 m$ ]) x
  26. #include <linux/init.h>
      U$ z, z2 Q- Z: k. K* W/ s
  27. #include <linux/errno.h>
    $ L0 _1 K) K. N3 }" v# [
  28. #include <linux/types.h>
    , q. {; ?  k. ^. ~/ b
  29. #include <linux/interrupt.h>2 j* b8 ?% i( s. i
  30. #include <asm/io.h>( Z2 }# s+ A. y4 e
  31. #include <linux/moduleparam.h>
    7 V0 B6 T0 a% C: [- l+ {
  32. #include <linux/sysctl.h>
    ) |+ t6 N4 y& M2 D" \1 e7 }& {# C, C
  33. #include <linux/mm.h>
      U- l, |6 s: v1 R% d" E- f8 S
  34. #include <linux/dma-mapping.h>
    8 o2 j% @7 Y6 T
  35. ( B$ Q1 t8 J1 N# L2 a( p5 [) V5 V
  36. #include <mach/memory.h>
    + c, |0 u; t# K" Q$ W3 @
  37. #include <mach/hardware.h>
    - s' P/ C4 y; h5 ]$ o/ ?
  38. #include <mach/irqs.h>6 Z5 f; t% M+ \+ c1 x& E
  39. #include <asm/hardware/edma.h>& e  D' {4 o* x1 o/ `

  40. 2 P: [- @/ `' f3 S. S, L
  41. #undef EDMA3_DEBUG
    6 V9 C: }2 l9 }* p2 H' K6 Q
  42. /*#define EDMA3_DEBUG*/3 b9 `" k7 m2 ~* t, ]

  43. , V( O' a, `( Y
  44. #ifdef EDMA3_DEBUG( t. b% w- @( ~  e- U7 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % T& V; m0 J6 W6 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# }  g6 u" N( n1 N/ S) j6 ~6 ]" K! c4 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - V' j1 n( X# Z1 _' _
  48. #else
    1 H# F" {  M( r; d
  49. #define DMA_PRINTK( x... )5 N. b# E% M& U4 v( {$ C! u
  50. #define DMA_FN_IN
    & d& S( a1 Q* G% q
  51. #define DMA_FN_OUT6 ?) K8 y# t4 Y: d" b& j8 e2 P
  52. #endif2 _) T- D% P+ ]. v
  53. 1 p0 z( S5 a/ J, M$ T4 R4 R% Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      M* ]/ j/ \' U. w, x, @+ N$ F
  55. #define STATIC_SHIFT                3+ ?1 C& l* d) M- @' T3 w  H) K. Y3 N
  56. #define TCINTEN_SHIFT               20: c4 K# |  W5 W9 ~( n
  57. #define ITCINTEN_SHIFT              21  o( ~8 G% z; X/ j& S+ o
  58. #define TCCHEN_SHIFT                227 k1 \. E  S1 Q$ @: L! b
  59. #define ITCCHEN_SHIFT               23
    # X% q2 |7 S- B! S2 @6 k6 S' o

  60. % V9 ]) A; ^  r5 H# `
  61. static volatile int irqraised1 = 0;! k/ o- v& R, s. h, g. Y, b" t/ a
  62. static volatile int irqraised2 = 0;
    6 x2 |% \+ q6 F$ e2 s' y

  63. 7 Q1 s+ h8 Y8 J. H) Q) i  b1 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 k& J9 H( M3 j: F: C$ A% M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% W+ s9 S# L4 f0 M1 E8 l4 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 V4 i0 \6 y7 V6 q5 F" t! K

  67. . F7 A* q& U0 k, w
  68. dma_addr_t dmaphyssrc1 = 0;" Z5 F" P( _# y% x9 |  p9 ]( k
  69. dma_addr_t dmaphyssrc2 = 0;
    / g: N( D- b5 I! Y3 i0 f
  70. dma_addr_t dmaphysdest1 = 0;: |3 D) S) X& b; Y  L
  71. dma_addr_t dmaphysdest2 = 0;& q3 a' v5 v8 D0 {7 m) i

  72. 4 Y+ Z3 o) V" M$ \( Z% G
  73. char *dmabufsrc1 = NULL;! O  ^; N/ w: k. [6 t
  74. char *dmabufsrc2 = NULL;
    7 v8 Z  T2 h8 e. A1 b% U- Q
  75. char *dmabufdest1 = NULL;& M  w: w% Q! V5 \
  76. char *dmabufdest2 = NULL;
    0 o6 }  [$ z/ ~
  77. 8 `& c5 s5 m1 M+ X
  78. static int acnt = 512;
    8 D+ E* v6 [, n1 E; e
  79. static int bcnt = 8;
    4 a, M* L- [& N6 `
  80. static int ccnt = 8;
    7 A$ W. w  v( P( h, ~

  81. & j3 F# ~5 P3 ?) e- j  N( p, e4 e
  82. module_param(acnt, int, S_IRUGO);& E+ E+ I2 M0 j( y3 b; L8 B
  83. module_param(bcnt, int, S_IRUGO);8 {- J2 s0 W+ @. q, t. I  z) W7 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, O( a% U/ _1 a* {: S7 _: F1 {

2 K' p- d  C2 G, [$ H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* @$ e, c" ]6 }, narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" W0 o  b7 M7 V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 P1 S& Y6 M% {$ p# B, z2 m/ }# h
% S6 I9 t! ~8 v% F0 a1 S, F4 z" @6 H. ^" \7 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 06:34 , Processed in 0.045288 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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