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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - u# ~0 V; E! T% I/ V
  1. [code]EDMA sample test application  }, o* B( Y0 v* g* T
  2. /*
    + ~- v7 {$ o3 o8 |$ V1 Z
  3. * edma_test.c
    1 h. ~! D+ K1 a5 I+ F
  4. *
    * b* E) L2 k- V9 r7 y/ \
  5. * brief  EDMA3 Test Application
    * W1 w, y" e2 v; J; k; v0 b- \8 U
  6. *
    4 X2 e* R2 X5 j3 C" ]0 J. p
  7. *   This file contains EDMA3 Test code.
    ' y3 n+ V  b  B# n7 A' U
  8. *) l/ B$ r; [1 W% S3 A" l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 {3 h/ B( _2 R& w9 s; p1 E' [* X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 P- k2 }5 w' I* z% t8 G
  11. *         TO CHANGE.
    $ ^& R/ @" o0 p/ b& K* [
  12. */ P/ c2 d* O3 T8 f& _9 u) E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 j0 A4 S. |# T4 v( _3 `
  14. *
    & ~6 d' |% V; Z% {
  15. * This program is free software; you can redistribute it and/or/ }8 c6 ?$ l" o
  16. * modify it under the terms of the GNU General Public License as
    - U5 c+ Q4 x! G" x/ a" Y
  17. * published by the Free Software Foundation version 2.7 U& E) h* N0 L' E
  18. *
    $ M3 D' p6 W  i* p, I" e/ p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) m# H! j* L6 o3 s. z4 R2 g
  20. * kind, whether express or implied; without even the implied warranty' `0 j7 o3 k4 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 L+ s- v7 w1 {; Y; }; I
  22. * GNU General Public License for more details.! v( u- {" p# `8 r; R
  23. */
    # ~. S; D: E7 l8 Q' _) g$ ]1 {
  24. : ~8 X& ]- r4 G( ?) L
  25. #include <linux/module.h>% J1 k* F# s) ]5 u  t
  26. #include <linux/init.h>
    ! g' N4 r( l" t
  27. #include <linux/errno.h>
    # I0 r( w" |/ S, E- _: y; N: n
  28. #include <linux/types.h>
    + y. U. J& ^5 X0 J: Y% R" B, e6 y
  29. #include <linux/interrupt.h>
    + j5 W! v/ A1 G) Y& C- e  u, l5 M# Y3 o( m
  30. #include <asm/io.h>  c$ R# c' {& I
  31. #include <linux/moduleparam.h>! w% r& q& o+ c1 r2 o+ ^
  32. #include <linux/sysctl.h>
    6 Q; ^4 H* E& M! V# N- S
  33. #include <linux/mm.h>, |" f5 d$ d$ c8 `% U
  34. #include <linux/dma-mapping.h>
    * Z& k! x) E2 w& k
  35. + Z- }/ Q8 o0 z+ }) G
  36. #include <mach/memory.h>
    % @. `/ [8 I% Y
  37. #include <mach/hardware.h>
    . ?3 S; p$ m1 L, b
  38. #include <mach/irqs.h>
    2 C- ~4 q" `, A' O" G' y
  39. #include <asm/hardware/edma.h>
    $ \- l$ |* T" j( P  e5 K) B
  40. ; Z( N0 n' Y8 l, |$ r+ v
  41. #undef EDMA3_DEBUG
    - C# N$ @: L. c% M4 w  c
  42. /*#define EDMA3_DEBUG*/0 M* M: s- T0 r  u  Z

  43. : a! n9 g, F, E! o, ?: m
  44. #ifdef EDMA3_DEBUG+ |  t, N: ~; P9 J1 }* K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 H' T- Y7 D( `( O: L) b( J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : E8 j, j+ M/ ^$ j  D4 B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : c* Y2 R0 m: R$ o" U6 {7 Z! m. @
  48. #else
    $ U7 y2 L' x. O; O2 ~7 E* U
  49. #define DMA_PRINTK( x... )
    2 M( n& @% X9 q# F4 J1 ^0 r
  50. #define DMA_FN_IN
    . E" O- c- x$ P2 n
  51. #define DMA_FN_OUT( e8 q2 k( q- |3 [
  52. #endif! {5 [3 @$ l( b& K

  53. 6 q; ^# F7 H  x& b" N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 c/ e5 E- d( I$ [; @1 \9 D
  55. #define STATIC_SHIFT                3
    9 Y% }2 y* m, @) S/ y/ T
  56. #define TCINTEN_SHIFT               202 J% W* W% E) J* a' C) `
  57. #define ITCINTEN_SHIFT              21/ o$ o1 b/ D. Q0 l. c
  58. #define TCCHEN_SHIFT                22% g* A# r* X, S& M0 B. T
  59. #define ITCCHEN_SHIFT               23. E- n5 e* }" N( I* |* H

  60. + C9 V6 Q8 g: ~) N$ q  \8 v
  61. static volatile int irqraised1 = 0;
    6 g5 Q3 N2 a/ b1 Y. Q
  62. static volatile int irqraised2 = 0;
    ( y# V" e9 k# Q, D
  63. 1 \6 [3 n' m' ]9 u, W3 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * U- l! q$ l7 J: |3 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 r* |3 E) J# G. u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 d6 I$ F- d: E7 D' h

  67. 3 r: U) z7 I, G' i2 R
  68. dma_addr_t dmaphyssrc1 = 0;
    1 t/ P3 }9 q7 a6 j) u' p& q5 I( c
  69. dma_addr_t dmaphyssrc2 = 0;7 z) r  o! ]% ~: q' @# s
  70. dma_addr_t dmaphysdest1 = 0;
    9 v; H) O) g- K6 S* ~
  71. dma_addr_t dmaphysdest2 = 0;
    ( }) X% i' Q( }  I! K% l+ P& E. e+ h

  72. * G/ D  c' Y0 ?; a
  73. char *dmabufsrc1 = NULL;- u' q- `7 }$ V8 t% ]+ T" |$ O
  74. char *dmabufsrc2 = NULL;
    2 z) [' L, y" o: X9 Z
  75. char *dmabufdest1 = NULL;! j/ H! O( E9 R5 X  S! u9 O8 v
  76. char *dmabufdest2 = NULL;" p. s9 P) x$ c( w5 T+ c

  77. 2 X  @7 s- [2 V! I9 j& H0 J
  78. static int acnt = 512;7 k" r- L; y1 R3 j, P
  79. static int bcnt = 8;4 f$ F9 ^  ^# ^) j; E$ j' W
  80. static int ccnt = 8;# f. A* s# k) p/ w, A( W! o

  81. 0 G8 F6 ?/ A- Y1 Q/ P/ K' b* {) u6 k9 U5 ]
  82. module_param(acnt, int, S_IRUGO);
    $ P4 Y! y) z" f0 \# b$ j) }% Q
  83. module_param(bcnt, int, S_IRUGO);  C! ~8 ^! C1 f4 Y7 @5 c! G$ b, n6 |; F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' [8 c6 N. M0 B& d2 i) P; N
9 @5 Y6 p. _( _3 U! r8 k$ S: T8 _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 c  n' }1 N# l2 ?5 b% a  q% garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 r: ^" k; e. N. k% h+ [2 T9 M6 f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. ^; E, W9 S. s7 U! X* B' _' f9 I( K, {  o
  p3 j. G9 A0 [( [1 g% J, a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 12:45 , Processed in 0.038820 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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