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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! m" {- [$ K! B) D. b  F- C0 r3 J
  1. [code]EDMA sample test application! t1 z/ h, o& S% W! X3 F; g# l
  2. /*
    . I! R6 j2 t& U8 S/ ^* y
  3. * edma_test.c; a+ S0 f2 d4 ]8 O- D4 n
  4. *0 O6 D" T+ d- j7 L3 \# A
  5. * brief  EDMA3 Test Application
    ( s3 M- y  Z9 v2 f1 `' P
  6. *
    9 c4 R* j+ T4 h1 L6 l, E
  7. *   This file contains EDMA3 Test code.+ H8 t2 Q* ]( z/ E8 W+ i$ a' m
  8. *
    * \$ I# d  w$ {6 [, U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 A' F' I" X4 J1 _/ F1 @# P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  e: s6 k0 j& m8 D: K2 m
  11. *         TO CHANGE.
    : Q: ~# Q9 \& C/ [0 F1 J) p& [
  12. *
    0 j1 W# ]% m1 x5 e' t; Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 P0 h/ e% o+ c% w
  14. *9 p" t7 C8 c5 r' [. P8 f
  15. * This program is free software; you can redistribute it and/or+ b! j* N7 @1 W! G# j7 o
  16. * modify it under the terms of the GNU General Public License as7 S' d! }  @3 J2 ?& L4 B
  17. * published by the Free Software Foundation version 2.
    # w4 e, B: d  e- Q
  18. *
    % }3 E( R. U+ H* `  W6 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! q) `7 e, d0 k% a; Z9 q% j  r
  20. * kind, whether express or implied; without even the implied warranty' s* n. L% f( J9 X$ ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 |- H. [: Z6 _2 v2 |
  22. * GNU General Public License for more details.
    1 A' b; V" o7 c# [# A; x5 U
  23. */
    / p: R9 U% L- M0 w; B
  24. + O' P5 `  \# v  K+ s& U9 L
  25. #include <linux/module.h>
    - u* x2 E# [) k  o* B+ d, K
  26. #include <linux/init.h>7 k! A! J7 e% {; h% T# e" a
  27. #include <linux/errno.h>) b1 ]3 a, R6 I& M2 r  r( X. G9 }
  28. #include <linux/types.h>
    ' \! h" a. N/ f+ ~" n; a
  29. #include <linux/interrupt.h>
    8 U2 V7 t8 E1 e- J. ^# A8 f3 s
  30. #include <asm/io.h>
    2 h8 U/ D# p# l' H: P5 @' m7 A# S
  31. #include <linux/moduleparam.h>9 z4 d- E6 @8 e0 _
  32. #include <linux/sysctl.h>2 M* N) L9 V% k* G
  33. #include <linux/mm.h>/ c- I# A9 I$ z+ l5 v
  34. #include <linux/dma-mapping.h>/ W% N1 C5 a  j4 H3 c
  35. + Z  S% J! C. }) {4 }
  36. #include <mach/memory.h>
    . L  A5 Q% D" C
  37. #include <mach/hardware.h>
    2 h  m: R$ @5 K/ X( h2 a( U
  38. #include <mach/irqs.h>6 S9 O( Z1 X5 v. F; ^3 y; n/ o" l
  39. #include <asm/hardware/edma.h>) h8 }4 H( _  ^- ~9 y! d8 F
  40. 6 z. O3 E% o8 }+ ^7 l- c
  41. #undef EDMA3_DEBUG
    4 g5 j1 y* D3 I: x# Z0 q4 Q3 f
  42. /*#define EDMA3_DEBUG*/
    - k) O7 h# x- K1 b3 e3 z

  43. " c1 W7 Y5 Q6 q! s6 p
  44. #ifdef EDMA3_DEBUG
    ) B+ M( ]* G- \# \6 N1 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( R% e4 `) ?3 v  q7 g% `; b" G2 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 @; `0 }, ^1 \% b" ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . k. |! v6 C/ D. r  U1 `+ A
  48. #else
    : ]7 g, O$ F3 P( G0 I/ v
  49. #define DMA_PRINTK( x... )2 }; K5 T8 P1 h8 r) q
  50. #define DMA_FN_IN
    & |  Z  G8 H* {' J
  51. #define DMA_FN_OUT
    - K7 M6 L; E% a: u% T  q2 |" T
  52. #endif  x  c" o" x- S7 w4 P) }
  53. ( p5 @9 L5 o; a; D, I! k4 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ m4 o, f0 T) j
  55. #define STATIC_SHIFT                3
    / f5 r/ C. d+ h3 L
  56. #define TCINTEN_SHIFT               20# Z6 t( Z. \! s
  57. #define ITCINTEN_SHIFT              21  Q7 y) k/ A/ y* P7 ^9 m' d+ }6 i: \
  58. #define TCCHEN_SHIFT                221 d4 Y) q' J3 z8 B. t! ^0 O
  59. #define ITCCHEN_SHIFT               23/ W1 I4 D# m0 w! Z9 Z% [

  60. + X6 i8 y# V- ^  T4 N7 |: G, Z
  61. static volatile int irqraised1 = 0;! \0 d6 C9 w# o& v  ^, J/ ]
  62. static volatile int irqraised2 = 0;
    ; [' P# E/ K3 [. O5 ?9 S$ Y

  63. 9 ~" X' ~) }! |# L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 m- L9 I! A" W1 M( ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- d3 Y3 [! S% s8 G- u! H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 t( J* i9 u1 X& d" e9 L

  67. : D: g1 K! G5 R$ Z. {6 d9 K$ I0 Y
  68. dma_addr_t dmaphyssrc1 = 0;
    ; O9 q* y) n: |4 g7 C! ^2 \2 k& X: s
  69. dma_addr_t dmaphyssrc2 = 0;% S6 f0 Y% w  Q
  70. dma_addr_t dmaphysdest1 = 0;
    $ p& M* h  A, ]+ t$ T
  71. dma_addr_t dmaphysdest2 = 0;
    5 [. X0 b4 P: R0 A# z
  72. ; V. w6 q# X* y
  73. char *dmabufsrc1 = NULL;
    8 [0 O) L' B1 o) o# W, m
  74. char *dmabufsrc2 = NULL;  \% v: L# P2 r0 c* Q) l. @; F3 E
  75. char *dmabufdest1 = NULL;9 ?. U. D5 ?* @. I8 D) \
  76. char *dmabufdest2 = NULL;5 K. N7 K; e  g% ^. Z

  77. . w: a  S( x8 C7 R- W
  78. static int acnt = 512;7 b5 O4 V  h4 P+ m2 U6 x
  79. static int bcnt = 8;& P; q9 u. Z. Y# k5 L
  80. static int ccnt = 8;
    - y$ x: g( b! O1 V5 {

  81. / E! F$ Z4 V6 N* u
  82. module_param(acnt, int, S_IRUGO);5 s; J/ y4 t# d0 {* B0 u+ V7 |' }
  83. module_param(bcnt, int, S_IRUGO);
    ' d+ b. }6 f: S! [3 H" |. F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! A$ y& r5 o$ ?3 @8 O, t+ g& j. k
/ S% ?7 `9 n# ~2 B+ V8 k  w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 h- h* ~* c/ d# |1 V1 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! i2 u+ v) d7 B: s$ f& ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 o: b: U- t* @
7 t+ B; @( D, R$ h, m0 s8 z3 H6 N% c; V. g3 y! Q( o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 22:01 , Processed in 0.044003 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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