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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 ^& c! r, L& l. O
  1. [code]EDMA sample test application
    4 l' Z& }2 v  q# c4 N. W
  2. /*5 h8 f( p/ a& R9 I% [" j0 h( Q
  3. * edma_test.c
    7 K+ F+ H/ Z3 v6 [) F; B9 {
  4. *
    9 E* F. H  Q: q. ~, J
  5. * brief  EDMA3 Test Application
    8 [- Z  D! u5 H6 U/ E; F+ f
  6. *
    ; T! Z6 ^5 H& h8 E( ]4 l
  7. *   This file contains EDMA3 Test code.
    9 f' F9 F- M, a; R' q+ F7 h
  8. *
    4 E) k- o+ V+ o+ o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ N. G0 L0 [$ r0 k# r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( S1 L3 J" o. F. B3 ~7 U
  11. *         TO CHANGE.
    2 V, R) F  E# Q% r+ `, \2 N
  12. *8 B2 b! N! e4 E: w2 m0 G. w/ U/ Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- o  j8 n2 v+ ]  P  O
  14. *
    1 {) s0 N+ j  s$ |
  15. * This program is free software; you can redistribute it and/or, Y; w& P% f7 [# {' G, |+ J
  16. * modify it under the terms of the GNU General Public License as
    ! @8 O4 T3 U1 Z
  17. * published by the Free Software Foundation version 2.
    . f0 l9 a- p' B
  18. *
    ) b+ F. Y* P0 t; x& w; U& E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / T: p5 x5 b/ i4 `; |+ }
  20. * kind, whether express or implied; without even the implied warranty
    : [  j3 N7 f- U6 X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " o0 x) j  h1 _' I
  22. * GNU General Public License for more details.
    9 w, i6 n- i: ?1 @. @9 U
  23. */6 y- w6 Q: n8 x5 K
  24. * J3 U1 n! _; H$ M; U
  25. #include <linux/module.h>8 X0 w* C; b& }- Y( A0 h) @: h
  26. #include <linux/init.h>7 [! L3 j1 d/ ~1 E5 z6 P
  27. #include <linux/errno.h>
    8 A3 m2 C+ o0 ]+ L
  28. #include <linux/types.h>3 x3 {2 [0 x& w) N/ l& l! A
  29. #include <linux/interrupt.h>
    , F. d, A7 r8 ~; N2 g8 Z
  30. #include <asm/io.h>
    ( q! f$ g4 \  b+ t; B: a. G4 \7 Q
  31. #include <linux/moduleparam.h>; p" B3 [% {( G0 j7 Z4 N' Q
  32. #include <linux/sysctl.h>
    / G3 S& p' ^" R. B/ ?4 j7 T, P9 u! r
  33. #include <linux/mm.h>
    7 ~/ Q9 a; H1 C7 U0 j3 H$ }- i
  34. #include <linux/dma-mapping.h>
    + L+ v9 y# B0 B* B" }7 P+ p
  35. 6 c8 X( v6 L( t% _
  36. #include <mach/memory.h>
    ; y: l/ w4 H; i7 z
  37. #include <mach/hardware.h>1 Z* q' S& q6 L: Y2 ^, k
  38. #include <mach/irqs.h>/ z: v. x. Z* K, I/ f9 G
  39. #include <asm/hardware/edma.h>3 m" h1 a* Y  a2 A

  40. ; k: b, n8 k7 O! V- r2 v
  41. #undef EDMA3_DEBUG
    + P* k$ E, t, B6 ?( D
  42. /*#define EDMA3_DEBUG*/% B2 t8 x" Q- N' B7 G) |/ q
  43. ) Y& I- s- ?4 m7 s- n, a
  44. #ifdef EDMA3_DEBUG
    7 i9 A+ t; s- }: V% L) z% ]: {& A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 f  k# b4 t. r+ X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' b0 Q- Q1 j3 p. I3 C7 E1 v2 U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - S( ^. M7 k  k6 t
  48. #else) W% C1 y! k( k( }
  49. #define DMA_PRINTK( x... )5 l6 W4 V) {0 a/ v! @1 W
  50. #define DMA_FN_IN
    1 Z5 @2 ^+ E" G. u
  51. #define DMA_FN_OUT
    & l1 P7 r- A4 _* p
  52. #endif
    ' l3 m/ B- w! a& Y. P: y
  53. ' f) Z% `  u6 E, u) \6 G" P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 f5 J& G( {' S
  55. #define STATIC_SHIFT                3" B4 u( Y! e6 |+ {! R; g
  56. #define TCINTEN_SHIFT               209 Y: [7 a$ \( I: v5 }
  57. #define ITCINTEN_SHIFT              21
    / O3 {' t% J: l2 Z
  58. #define TCCHEN_SHIFT                22
    5 g' P/ ^( k" A: V3 v: ?* T
  59. #define ITCCHEN_SHIFT               23' H5 Q) q; [* w2 ?, U- x; J! L, R

  60. + Z# A* `( ]9 B! B' T9 W! y
  61. static volatile int irqraised1 = 0;! g3 ?8 Z* E2 _. q/ E1 D, ^
  62. static volatile int irqraised2 = 0;
    ( [9 {5 n) x8 i, Z$ Z8 f& o; h  p% `3 W

  63. 8 t" j  o, I" u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ?7 g% ^/ W0 @' Q* `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  D- k3 l. p( O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 f+ O$ a% [6 M3 o
  67. 6 Z, C+ ~9 ~2 k; l; K! O+ e
  68. dma_addr_t dmaphyssrc1 = 0;
    ! S! D& p, D* l* }4 l
  69. dma_addr_t dmaphyssrc2 = 0;
    + }2 K! p- \/ {4 ~) ]2 K4 k# ?$ f
  70. dma_addr_t dmaphysdest1 = 0;
    1 ]' d) [. f" F$ X0 u/ g3 l
  71. dma_addr_t dmaphysdest2 = 0;& K+ [4 e$ A) X# u2 K4 z' P

  72. " f6 A' a2 i$ ^( y4 y
  73. char *dmabufsrc1 = NULL;
    % L7 ]- ]4 b8 r  G8 b3 W' Z2 v
  74. char *dmabufsrc2 = NULL;- Y" ~  {$ }) c) ~
  75. char *dmabufdest1 = NULL;/ d' k8 q9 }( N; x) e
  76. char *dmabufdest2 = NULL;
    % w8 L) p7 N5 |+ X; O; q) p* T
  77. + |$ |' X0 X9 W/ }2 t7 Q
  78. static int acnt = 512;2 }  R' R5 e7 b* Q# J
  79. static int bcnt = 8;. y. K! |/ j6 E, F9 A2 s1 _
  80. static int ccnt = 8;
    4 B" k8 n1 S! K' E  U
  81. 1 g* ~( \' n* F, w$ @
  82. module_param(acnt, int, S_IRUGO);# _" Z, ]  z$ {% O9 \
  83. module_param(bcnt, int, S_IRUGO);
    0 ?# q: J" B# @( _1 Z7 y" @! P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; O9 e" E' [3 I8 H) Z

0 V1 w* I' c. `4 p8 y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ _5 a' I" e0 f9 h1 W: N6 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* b: Z, K! ?7 h0 ~7 w6 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 b/ Z& v7 Y1 q4 H. ?( P
4 L; |+ s/ |) D' Y0 ]' V8 u& ]9 J
/ [2 Y0 p" B' ~9 h7 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 11:06 , Processed in 0.046442 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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