OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ v) c0 ~' T" V
  1. [code]EDMA sample test application5 Q; t8 j  P$ m" C
  2. /*, X$ A: e0 Z1 s% }! N5 x
  3. * edma_test.c/ E# u9 J! V9 Q( y* o) M; V, D9 I  E
  4. *6 {  ~0 }0 c, V! _' X6 }$ {
  5. * brief  EDMA3 Test Application
    / i5 X. _- A! c5 J2 H
  6. *
    ' H5 p; j. I* o. E7 ^# w
  7. *   This file contains EDMA3 Test code.( t' r6 s/ c5 b/ Q# i( r: N% t
  8. *  J$ Q+ x, i4 A+ m  g' A! u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: L2 N  _& v! v6 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / }" {% i5 Q4 }5 S
  11. *         TO CHANGE.
    7 j7 H+ B( d8 R# b/ S3 V/ J
  12. *
    ; D) U" \& N/ k/ ^4 F. P, B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : r! U: _3 |9 q7 A; p
  14. *  s# j$ @5 C* d- l
  15. * This program is free software; you can redistribute it and/or! `. y' W& Q* v4 l. C. D& A
  16. * modify it under the terms of the GNU General Public License as6 U3 e6 i5 m  C) G
  17. * published by the Free Software Foundation version 2.
    $ ?* F+ U: m7 V1 h/ A
  18. *- F3 q" u+ y& x9 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 E) h9 W, c8 E  _# H4 R
  20. * kind, whether express or implied; without even the implied warranty2 \5 w' [6 t" C+ d  t+ T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* |3 k7 u! W$ F! H4 Z
  22. * GNU General Public License for more details.
    . t2 {5 d/ F' f% P% y5 R
  23. */
    1 m" ~* I( ^0 K, X# K! d/ r( y/ E) Q

  24. % P+ F& h7 m- r( X% \: v
  25. #include <linux/module.h>
    ; S- k9 ^+ o7 |2 t
  26. #include <linux/init.h>
    - n# J/ q2 g2 T% g( P1 F
  27. #include <linux/errno.h>0 T1 }7 J6 l! B. ~5 u' J
  28. #include <linux/types.h>
    8 [+ ]+ ]4 U9 e4 s# `! y
  29. #include <linux/interrupt.h>
    - L5 f7 v+ ~( s2 m0 ^
  30. #include <asm/io.h>+ W9 q/ o) x% U/ a* w1 O, a
  31. #include <linux/moduleparam.h>
    9 h* c( Z0 p7 u
  32. #include <linux/sysctl.h>
    " ?& m  i' }9 m( b
  33. #include <linux/mm.h>/ M1 }: P9 u* e% D1 U  {
  34. #include <linux/dma-mapping.h>5 H  N: \7 W5 _* @7 u; H
  35. 6 Z! n/ U5 t5 R# h: A
  36. #include <mach/memory.h>
    * g* u% g& _2 X' c( A# o4 |
  37. #include <mach/hardware.h>& j' Q. P) s/ s7 W4 U* \
  38. #include <mach/irqs.h>, A7 A, T! B: n6 c" S
  39. #include <asm/hardware/edma.h>
    & l& P8 W$ j# P/ K

  40. . Q% L) k8 o8 b! U, U0 P9 u) D
  41. #undef EDMA3_DEBUG
    ) F# _: s' k* u4 m  F
  42. /*#define EDMA3_DEBUG*/' m' e9 i6 G( I, A
  43. 1 D* ?2 \" i; D  w9 Z6 \1 |4 k$ F. {2 u
  44. #ifdef EDMA3_DEBUG
    6 r3 j7 s0 b3 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" S4 Z1 @5 T/ j+ B0 u8 @) d% g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / f0 C+ ^. Y& Y: e" t% q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 ~9 {' E! f0 Z9 ?6 m/ Z, P4 _
  48. #else
    + _. \7 H. Y6 q9 |0 O0 g/ L& X
  49. #define DMA_PRINTK( x... )0 Q/ d3 M+ P& |/ `1 n, T8 y' Y
  50. #define DMA_FN_IN8 |2 E, j( d2 [) ^1 R( v; }
  51. #define DMA_FN_OUT
    2 p2 ?# H# B7 @, H& Z# `
  52. #endif& p" C% l$ T# [! N" q& a6 X
  53. : J3 U6 B) ]0 p# P5 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 t! C. V. s. ~6 ]# S0 C( y  Z
  55. #define STATIC_SHIFT                3
    8 `( a; z1 V1 j6 W  H. q% P
  56. #define TCINTEN_SHIFT               20
    - q' B# I0 u2 @5 e
  57. #define ITCINTEN_SHIFT              21
    ! n5 I7 p; F3 g* y' E2 @6 L/ J
  58. #define TCCHEN_SHIFT                22- ?! A0 N6 Y  ?7 Y
  59. #define ITCCHEN_SHIFT               23
    $ L; |, L' C2 }4 v8 t3 o
  60. + D4 d. _% c7 u$ b# ?9 |
  61. static volatile int irqraised1 = 0;
    + n0 y) y) X* ^8 i' F3 m
  62. static volatile int irqraised2 = 0;1 X5 f/ \  X( x- M( o
  63. / K, H2 U2 v$ j( h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' R9 E# ]3 e+ ?8 ^6 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; O# N- Q9 P5 a0 _  l4 g0 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & K1 K+ p( y  }( x! B' q, D% l
  67. 4 ^1 G& M6 N' b2 |
  68. dma_addr_t dmaphyssrc1 = 0;  Q9 ]( O9 s& }  |6 r9 ~& t
  69. dma_addr_t dmaphyssrc2 = 0;
    & G" @2 N" i/ C) V& K, s
  70. dma_addr_t dmaphysdest1 = 0;4 t" f/ Q7 q, L2 I' k% R$ E0 n
  71. dma_addr_t dmaphysdest2 = 0;+ G' O' A. W3 }1 q
  72. 9 e: o$ Z/ _- F* d, R+ }* \% z
  73. char *dmabufsrc1 = NULL;
    2 C" Q5 E: m5 H, L7 Z  C- G7 W
  74. char *dmabufsrc2 = NULL;
    % }0 v. k' w( K) G6 N! z2 y
  75. char *dmabufdest1 = NULL;
    ; {3 f2 K  ?2 X9 A1 f. m% m
  76. char *dmabufdest2 = NULL;" U8 f! Y0 n9 N. b% [$ F

  77. 4 u7 ~* {, \4 A9 W1 y* V
  78. static int acnt = 512;
    5 r; v, H2 f/ Y6 }$ F* c
  79. static int bcnt = 8;
    : D, F' i! U1 [! x- r
  80. static int ccnt = 8;
    ; V- q% ^/ i7 M: ^0 _/ C) i9 e, }

  81. 7 R& r# s4 z& {* C+ Y/ u$ s
  82. module_param(acnt, int, S_IRUGO);6 o( M$ p( f. c
  83. module_param(bcnt, int, S_IRUGO);
    + o' {4 _* }5 r( X! {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' U9 o1 E; Y7 p- d4 g3 ]
6 g3 z/ r, L( N1 N$ K  m) _$ c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 f! r/ m, I/ a$ A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ f7 S9 D& a/ a' u2 M/ ~' K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ P4 R+ x) ?; @- w) y6 L
7 _9 E4 f- G; H0 A( \: G

0 ]$ q3 A# ~# p3 I2 `& l$ M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-8 00:04 , Processed in 0.036455 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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