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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( g: w# v& A  |/ g
  1. [code]EDMA sample test application4 D6 l$ @9 i) _( D! z
  2. /*( l; B1 c# D1 }* F) _* S
  3. * edma_test.c* S( u0 Y) m, s) o: R
  4. *
    ; h* m( p- }% m  M  Y% r
  5. * brief  EDMA3 Test Application
    9 r6 A( t: q7 v) C& I0 W
  6. *: ?2 v2 J7 b% l3 A; n& W. t! M
  7. *   This file contains EDMA3 Test code.5 p, ?: }/ P- c! }+ W* P8 U
  8. *
    " Y6 F1 n% F6 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 A4 _, B  n2 Z( b+ ?+ V: `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 X$ `9 `# ?( _  n" Z/ U: M. {
  11. *         TO CHANGE.
    5 I3 Q& t! {( x) ~& h
  12. *
      b& P6 D$ V# j: ^( R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; F; L5 T4 p& r' ?. C
  14. *
    0 Y# r  _4 [+ t3 X' M  Q
  15. * This program is free software; you can redistribute it and/or
    % @6 ?1 k$ N8 u, N
  16. * modify it under the terms of the GNU General Public License as
    4 ]* m" S1 p& ?5 ^
  17. * published by the Free Software Foundation version 2.3 j: R0 `" p7 t: y8 E* K% B
  18. *
    / \. K. I4 p- C: V9 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : |0 ]1 w& \2 j4 z2 R- ~
  20. * kind, whether express or implied; without even the implied warranty
    ) M# k0 t  C% _9 H, o9 U' `  _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ J) N; J' |4 L8 S  Q0 [4 |( g
  22. * GNU General Public License for more details.
    / W1 w& a3 E6 G. |4 p0 o" K
  23. */1 N, b+ q& V$ r# w, M

  24. + Y  \2 u7 |8 _: n  G2 Y9 L
  25. #include <linux/module.h>9 R3 [# `0 \" l  f
  26. #include <linux/init.h>: ~: c) P: V' Z- S4 K
  27. #include <linux/errno.h>
    0 g6 C. }8 s4 R' c  K2 D
  28. #include <linux/types.h>( x: L1 f# b" ~# q. v
  29. #include <linux/interrupt.h>
    8 C) x% O& F- r- q& i0 \
  30. #include <asm/io.h>! f9 _5 w8 w% }% ]. N4 I5 u3 `
  31. #include <linux/moduleparam.h>1 g# O; V7 ~' B5 F  K2 x- N8 P
  32. #include <linux/sysctl.h>
    7 }, E  z, u' K6 ~( Q6 y
  33. #include <linux/mm.h>3 p$ D% ?' K7 I5 c' T# p
  34. #include <linux/dma-mapping.h>3 K7 r5 Q5 z( g& i" Q$ a+ H" w
  35. 9 T2 r) @7 |& e/ Y; H, j3 G
  36. #include <mach/memory.h>7 {* C" E+ ~# G9 K: J; ?) R7 n
  37. #include <mach/hardware.h>' b+ F7 X& S: b0 m/ s9 o
  38. #include <mach/irqs.h>
    5 o  p0 k% o- j! O) R; i
  39. #include <asm/hardware/edma.h>/ D! O$ y2 ?3 h" j. H
  40. ' L6 X: r9 b  z
  41. #undef EDMA3_DEBUG5 W1 q' n# `( I
  42. /*#define EDMA3_DEBUG*/: F5 _2 v( v' i% V0 M

  43. 9 J8 c+ N) F+ s7 N' V4 c! U
  44. #ifdef EDMA3_DEBUG! D" ~1 |* R' E5 o" ^: r3 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 M8 v4 X! A' w1 E' F% w' [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); G$ t( Q/ [$ S7 ~8 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! M  ~6 [/ O# V% ?6 o" \
  48. #else
    7 l3 d2 L0 |, `  R6 @
  49. #define DMA_PRINTK( x... )9 H6 R' S$ [6 @) h3 k, f
  50. #define DMA_FN_IN$ V: d% S4 w* W, f% G9 N- }
  51. #define DMA_FN_OUT
    # R7 L3 @2 Q% ?2 B
  52. #endif/ V' h( }; P* ^* \1 W* y  _+ C* i

  53. . d1 G% i% ^; Y" B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 i5 f, s: r/ J; I* f) y
  55. #define STATIC_SHIFT                3" E1 ^: F9 d- C9 r
  56. #define TCINTEN_SHIFT               20* K& U( g0 h8 P" S
  57. #define ITCINTEN_SHIFT              219 _" N) c: [  R/ C" D2 u
  58. #define TCCHEN_SHIFT                225 f6 ]7 r0 J, G* v$ x+ ]4 _3 p  S
  59. #define ITCCHEN_SHIFT               238 e/ @' @/ D0 H: i+ d: n: c

  60. 7 R# _. \8 S" [- F: g% n0 i
  61. static volatile int irqraised1 = 0;9 q/ o4 j# `$ |7 |5 B0 U
  62. static volatile int irqraised2 = 0;
    $ {: C: u  P( r, ^
  63. 1 @, s2 B' p5 \& P3 P& O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! o2 R6 i( }1 N, t7 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % [: z* l$ K5 ?2 L5 A* Z, P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) {, D5 B+ c( E' A. V! m8 s) R
  67. + L, |# I/ i% Y2 [
  68. dma_addr_t dmaphyssrc1 = 0;
    3 H4 [: S1 n: [4 ]& N
  69. dma_addr_t dmaphyssrc2 = 0;
    4 {7 j  S5 t9 z1 P
  70. dma_addr_t dmaphysdest1 = 0;4 ^7 t4 N, v- s* A
  71. dma_addr_t dmaphysdest2 = 0;  z) u, g  Q( ?7 \3 z% l- A

  72. 8 T; X  `8 N# v& D" s- O- _9 n
  73. char *dmabufsrc1 = NULL;
    5 E4 j1 I+ {" [% _* l; O0 V& w( d
  74. char *dmabufsrc2 = NULL;
    # g5 R7 v& t- Y7 s
  75. char *dmabufdest1 = NULL;
    ) p. u5 s7 u- I
  76. char *dmabufdest2 = NULL;0 [% p# o) f- O- ]) O

  77. $ V" k7 w$ q* q, W/ f# i
  78. static int acnt = 512;
    / X2 ?' e, k( P( o1 y
  79. static int bcnt = 8;
    0 W& k* @9 K# |6 ^
  80. static int ccnt = 8;  r; Q' x, l4 l8 B6 e

  81.   h( k1 R+ u' H4 D& Y1 V, Y; l
  82. module_param(acnt, int, S_IRUGO);* k# X; _5 t  I. F
  83. module_param(bcnt, int, S_IRUGO);) y7 E0 p3 Q" A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& ?- _: i0 x% a! B& ~

- T4 B" K* q7 v. j$ j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  X4 K, |% u9 Y. M8 C% C! q' A/ K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& b4 Q6 N# Q1 s/ q6 M/ ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) H! G3 `) U8 Q% t
! X+ T! T. p1 j9 R. U8 @# p" P+ o1 W/ C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 20:05 , Processed in 0.041841 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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