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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% L8 L, {2 n, _4 W  s' r5 H
  1. [code]EDMA sample test application
    ) D2 ~& J4 U% L. u9 g) H2 l2 U
  2. /*
    ( I0 h  Z* e% ?" a: Y0 B
  3. * edma_test.c2 J$ O: Z4 o( W& A. b% `
  4. *
    # }! q( e+ ~8 D8 P* m' f
  5. * brief  EDMA3 Test Application
    7 P; {+ Q) A# W) T1 z
  6. *
      Z& U* I, y' g; e  f  q
  7. *   This file contains EDMA3 Test code.
    6 j$ t- C" m2 ?$ G' j
  8. *& C' k# t3 t# U# r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : B; a( k9 f. i$ ~( H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 o" L/ f$ [) ?& m' J8 I
  11. *         TO CHANGE.) k$ _. ~: h7 A6 C
  12. *
    ' D) a# J6 Z/ F' u+ [6 J/ L. D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ s$ Z  \. G/ W) q' a
  14. *
    ; L3 A1 I/ ?1 G( ]9 s$ Y, p" w
  15. * This program is free software; you can redistribute it and/or) n5 [3 n/ J" S# ^
  16. * modify it under the terms of the GNU General Public License as1 W( D8 K; Y: M, d
  17. * published by the Free Software Foundation version 2.
    1 O/ n0 T; f  U8 r' W& z+ b+ i
  18. *
    3 B7 N0 E6 r7 X' e- K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 f3 N; F5 N' c7 |; P; G
  20. * kind, whether express or implied; without even the implied warranty7 T# s$ L1 K% \' x& V9 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " [3 u7 t' t5 a. l4 T9 T
  22. * GNU General Public License for more details.( U1 [! D2 N- k3 m8 X8 Y
  23. */
    1 K/ u# j% a: \) v
  24. * l. \# C2 y4 y
  25. #include <linux/module.h>+ L4 u; Q  O+ i8 v
  26. #include <linux/init.h>5 m  U( b" I7 j2 E/ F( f% x, i
  27. #include <linux/errno.h>
    " E4 u3 K& l) U; S
  28. #include <linux/types.h>3 r% \2 ^- x7 Y2 A% L1 Z
  29. #include <linux/interrupt.h>
    + B. {7 }8 H3 B/ i
  30. #include <asm/io.h>
    6 w# X. b& D2 |' c) _
  31. #include <linux/moduleparam.h>1 h2 S+ G7 h# s+ L$ t/ @, b$ L
  32. #include <linux/sysctl.h>
    # R- a! f, e+ a( a! Y% b. O7 [3 a
  33. #include <linux/mm.h>) Z' D2 e0 `3 W$ M4 v" W" y
  34. #include <linux/dma-mapping.h>1 e! h% @' K7 u: k/ L1 S
  35. * Z3 f, X: x% Z1 o
  36. #include <mach/memory.h>
    , ]/ `7 c+ f. ~; S( T, j
  37. #include <mach/hardware.h>
    2 R+ O& i5 Q" R; Z- a; {' U
  38. #include <mach/irqs.h>, w& X0 X) y" B" {7 i; n/ N- y
  39. #include <asm/hardware/edma.h>& a+ Z, K: t2 e$ F9 o3 c- L
  40. % b$ M" q' e/ r$ Z+ P* v* F
  41. #undef EDMA3_DEBUG9 }- W4 c- N- \% D
  42. /*#define EDMA3_DEBUG*/5 K% m; b; E: q% Q
  43. 6 K! \6 ]. ^1 |- k0 _
  44. #ifdef EDMA3_DEBUG
    5 s: o: x- q7 H3 F' _: Q5 k  R; m# b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( _, K: U0 Q8 h7 j* F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , `/ J! @; E5 C# c3 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' Q& ]/ f1 Q  S( E& v
  48. #else% W' V, y& i! w7 a' b
  49. #define DMA_PRINTK( x... )
    3 Y, u3 k5 M$ k; a& e  W% b* |, D
  50. #define DMA_FN_IN
    % k/ [+ t* s4 A. Y( s
  51. #define DMA_FN_OUT
    $ g& y0 S- W6 ]0 y, V: Z
  52. #endif
      H1 C* a% _0 p' c- U  ?

  53. 6 k3 D+ ~* z# Y- [: Q- }! p" A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* ^& C. P1 y) C2 }+ w* H
  55. #define STATIC_SHIFT                39 [$ j4 m0 D" R' f! O& o  O& n
  56. #define TCINTEN_SHIFT               20
    3 U& ~3 j" ]4 T: l& k
  57. #define ITCINTEN_SHIFT              21
    , |1 }; i$ x- U4 e: C* B
  58. #define TCCHEN_SHIFT                22. ]4 x$ U6 g- Z
  59. #define ITCCHEN_SHIFT               23
    7 K. k- i4 Z* {) W% R9 V) G8 n
  60. / c: x& X" ~$ r/ X4 u
  61. static volatile int irqraised1 = 0;& n& ^0 V# L. ]$ X5 [6 D* O4 h6 y
  62. static volatile int irqraised2 = 0;
    . B- |$ N0 A0 T3 J, Y5 ]0 C
  63. 3 a: B8 u* h6 A  I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% h, F' ?  U8 ?) D! p% u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # i. [4 }: r+ O4 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 u9 |, h  v8 G# S  M
  67. * N, Z$ j( {! m) C% `
  68. dma_addr_t dmaphyssrc1 = 0;. X; j# U, J% I2 C( E
  69. dma_addr_t dmaphyssrc2 = 0;
    9 X+ S1 E* h0 `8 y8 k
  70. dma_addr_t dmaphysdest1 = 0;
    8 }( @: n7 u- d# O! n" w$ U  J' v- \
  71. dma_addr_t dmaphysdest2 = 0;
    # c3 O6 X5 W1 \# z; n

  72. , O! {: J, a& r
  73. char *dmabufsrc1 = NULL;4 m5 w! E3 i% U' y
  74. char *dmabufsrc2 = NULL;
    " k( w4 C- l' k2 R$ G* f
  75. char *dmabufdest1 = NULL;* i% ^; V6 v, R# n; p0 G0 c% R
  76. char *dmabufdest2 = NULL;2 k4 L3 t5 S2 S, P+ m

  77. 9 [' d7 _- }; {9 C) u
  78. static int acnt = 512;" ~1 U! u/ J8 A, A0 x: X
  79. static int bcnt = 8;
      S1 U7 s) A" x" j0 B
  80. static int ccnt = 8;
    0 ?  a- I7 q& O, g' R( [, r
  81. * w" g+ @: {% T, f% o0 Y! C
  82. module_param(acnt, int, S_IRUGO);4 L, N1 u- k( q7 H- ^; Y7 C6 D/ Z
  83. module_param(bcnt, int, S_IRUGO);
    6 T# B! T4 t4 S# D0 B  R4 g" p' ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# j$ h( s: F, N, v9 A5 a, o
3 M( S  |# z, _5 E* f0 B/ n  o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 ~9 m% U7 r* n6 r9 X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* |0 z. O2 @3 ~2 s* Z: U) C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 L3 K$ ?7 ^2 L) J. a: M; Q  w% u
; Q* v: T5 j% u& F3 \9 b
2 `6 ~2 h* Z$ L- |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-2 22:48 , Processed in 0.045991 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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