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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# C% y" o' @8 }* w
  1. [code]EDMA sample test application) G; t$ U* a% c9 p9 Z$ r# F/ y
  2. /*: T# n+ |, P$ O; f% W
  3. * edma_test.c7 u) b+ J6 n0 y" G* m: G0 E( E4 Z: e6 a
  4. *8 S- L- B0 J- P$ }  x: c  V' [4 p
  5. * brief  EDMA3 Test Application
    , D: a$ m+ }* f% H) O/ v
  6. *
    " ]- K! m; a1 w7 y
  7. *   This file contains EDMA3 Test code.
    . J" M# ]" z6 A/ _. t
  8. *
    ' \# z/ p0 D5 {; B% `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" A! l9 I! S6 d+ l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' k9 c6 V, @; U8 z' K7 i4 u) K
  11. *         TO CHANGE." x1 a* t/ Y3 E2 i$ F
  12. *$ G0 f. e& m/ T/ L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# s0 Q: n, E) ~8 o1 H
  14. *- l, i7 X8 m2 Y
  15. * This program is free software; you can redistribute it and/or2 p6 G4 L( G/ \9 {
  16. * modify it under the terms of the GNU General Public License as! E: I2 ^" O! W+ p5 r% |/ a  R
  17. * published by the Free Software Foundation version 2.
    : G8 l0 g7 E/ a5 z
  18. *: v$ a/ X0 H; R) G! `. j; l2 g5 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 `6 @) H* B. {8 l, G9 o# o
  20. * kind, whether express or implied; without even the implied warranty
    - F! ~3 v8 ]! z+ @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 N4 \" X/ l( U$ V6 ]
  22. * GNU General Public License for more details.  J# s2 V0 y: a2 ~+ B* ?* z
  23. *// s& q. s, P5 [" ]  Z) L$ `
  24. - [( K! l+ J' `- |, @9 k3 }9 n! U
  25. #include <linux/module.h>2 g* n2 B! ]- m  }4 ]! k
  26. #include <linux/init.h>
    $ X/ E- D9 E7 c: M. ]9 r* @
  27. #include <linux/errno.h>2 i( P$ g; x) ~2 D* x# W
  28. #include <linux/types.h>
    5 p! F: o* i9 N" {& N
  29. #include <linux/interrupt.h>) H. E6 o4 ~- B3 ?
  30. #include <asm/io.h>; v- @; L6 c5 R, r& `
  31. #include <linux/moduleparam.h>
    % k9 D  d, A, k7 D) a, Z
  32. #include <linux/sysctl.h>) {2 j& r( J8 |8 U* b% t
  33. #include <linux/mm.h>
      ~$ Z7 ^+ V8 Y8 e" Y/ A2 C2 [
  34. #include <linux/dma-mapping.h>0 q8 J* K- _, P

  35. : A6 t/ u& t0 J9 v' T0 q0 T
  36. #include <mach/memory.h>
    - f* W! o3 e1 A
  37. #include <mach/hardware.h>1 F& E( J, T) `3 k
  38. #include <mach/irqs.h>
    0 ?4 L/ U+ G5 h. I1 |
  39. #include <asm/hardware/edma.h>
    4 ~  f/ j1 r( P4 v  A2 v

  40. ( W7 G1 Q. ?8 t. R' N
  41. #undef EDMA3_DEBUG9 O: D4 I3 W7 q9 \
  42. /*#define EDMA3_DEBUG*/
    5 s% @. Y: `/ _- u+ }3 P4 c; x
  43. $ X$ a5 L$ g: H" E0 o# X+ [6 Q
  44. #ifdef EDMA3_DEBUG5 K3 W& l6 U6 C$ h( j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! A# g- S/ N. q, h' x$ D# r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- K" d6 L/ B3 f0 R1 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ l6 D; q0 d; D! K8 B3 ?+ b
  48. #else
    / w. a( e/ r2 W0 S- n
  49. #define DMA_PRINTK( x... )! V9 G, m8 {9 w+ [4 k/ s) `' |
  50. #define DMA_FN_IN/ V9 C- U% \- c: Z
  51. #define DMA_FN_OUT
    2 V! F& s9 w! \& y( M& }3 W
  52. #endif, O9 p1 K, ^4 Z( A( o8 K/ z
  53. + ~, k+ Q2 h5 i0 E. t( N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * ]9 S; a+ V6 B7 S% M
  55. #define STATIC_SHIFT                3
      E% R7 C) G4 ]' m7 L+ U
  56. #define TCINTEN_SHIFT               20& R) m9 ]' C. P% e3 W
  57. #define ITCINTEN_SHIFT              21! C+ |3 r- s* p5 _! a6 w
  58. #define TCCHEN_SHIFT                22
    + O. P8 Y- f- u3 k
  59. #define ITCCHEN_SHIFT               23
    ( m1 e9 N, R0 r9 L3 v; @- }

  60. 5 A8 N2 Q. ?+ p
  61. static volatile int irqraised1 = 0;$ c0 K$ x- Y0 T8 [) Y6 ^, X. \$ ^
  62. static volatile int irqraised2 = 0;
    4 @5 K8 M6 m% [* v6 N- u) N
  63. : V  e8 {( o8 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ W8 v# A3 H& P, k. D! [: i+ L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 L0 J2 U" g  R/ g% S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 h/ s3 b+ ^% F( H% U; V- A

  67. ( I" G- W& p8 S) k
  68. dma_addr_t dmaphyssrc1 = 0;
    - {  _- l3 L; h  J
  69. dma_addr_t dmaphyssrc2 = 0;
    5 D  ]. C1 \: w; b/ x  P+ F: ?
  70. dma_addr_t dmaphysdest1 = 0;
    % ]# e4 @. x4 Q7 S: ]# c" [% L7 ?
  71. dma_addr_t dmaphysdest2 = 0;
    7 ^2 v1 Q- Y6 g; ?
  72. , C9 m" e* q" ]9 ^0 F( G; S9 M4 J
  73. char *dmabufsrc1 = NULL;
    ' I- z  r  f4 Y) `8 M( ]
  74. char *dmabufsrc2 = NULL;
    . C# t$ j$ b! n( l3 }8 ]% Z; U
  75. char *dmabufdest1 = NULL;8 ]$ r# g- B$ J4 U7 g, E
  76. char *dmabufdest2 = NULL;" o7 T7 M3 C- \1 s( f

  77. 9 T# D2 p4 C. M; F9 A2 ~6 p
  78. static int acnt = 512;
    / _0 }* x0 z$ F2 J4 ?
  79. static int bcnt = 8;: d9 o- D6 _. ?% t% \
  80. static int ccnt = 8;
    : J) l) G6 I. \& ~' z# S8 ~
  81.   N! F$ S$ b# c; N8 G3 n4 a
  82. module_param(acnt, int, S_IRUGO);! ?+ e6 C) ]4 t9 b1 O# _: }. {, \
  83. module_param(bcnt, int, S_IRUGO);, M3 e1 a' j+ q9 t2 K. z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 k% _8 b- H. {
' _- K4 ]$ b7 V# C( g2 j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 ?. k( |# e& g8 Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; j8 _$ q9 D! o0 ?; _% @6 w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ [" c( h! L: W& ?$ M8 ~
" _( Y( {) N8 g, O

; T! n! V6 X! {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 12:05 , Processed in 0.039467 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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