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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( e* |' V* t& y  m" a
  1. [code]EDMA sample test application& N" @; e! F5 T$ t) G5 K; R8 Y+ _! f
  2. /*
      u% b5 G1 ^" t3 M( _
  3. * edma_test.c1 W4 C- d$ C! L; q6 o4 M7 I
  4. *$ b" k/ Y  K" O* @' _  p6 T
  5. * brief  EDMA3 Test Application" i9 ?5 ^1 r4 ?+ d# g
  6. *
    + _' [" c8 G' a) u
  7. *   This file contains EDMA3 Test code.+ @0 N' ~! U* i) Q% {. Q+ t
  8. *; b! L! f, q) o8 l/ U2 J" C7 }  u1 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 u" J# N* X: ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! B6 F4 L7 Y: g7 P. T( _  n' p
  11. *         TO CHANGE.
    - o) P1 d2 W0 {3 n" `3 w3 \; Y& U7 {
  12. *5 \( g( \* n) G$ v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : a8 W$ c+ @8 N% a# i' Z7 n
  14. *  t! t- R- S! B$ I9 ?7 \
  15. * This program is free software; you can redistribute it and/or9 ~. F+ |' B2 d' f( T
  16. * modify it under the terms of the GNU General Public License as7 i3 m+ F* C8 a* H9 X2 P, t
  17. * published by the Free Software Foundation version 2.
    9 }8 O$ }5 p% m  I  [3 p. _: m" }
  18. *# v3 ?# B6 @% n$ y/ q  r! A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; i7 D+ m0 j( m. ?) C" y' k8 z
  20. * kind, whether express or implied; without even the implied warranty+ v* f# o) n6 G$ p7 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / ]! b& b5 i8 j+ Y  [6 o$ Z
  22. * GNU General Public License for more details.
    ) f0 R& n- X) s& U2 k  L; g6 q& W
  23. */
    . a% Y) V0 ~% }/ [* e1 l# u
  24. ) t/ s5 N& S/ c% E
  25. #include <linux/module.h>
      W! y  e3 V' u  r3 N
  26. #include <linux/init.h>
    9 x. T( b) v, c( f0 @9 w/ t' m
  27. #include <linux/errno.h>0 d! t- K! g# I8 H
  28. #include <linux/types.h>& {3 n/ g# K5 x; v9 a9 }0 g
  29. #include <linux/interrupt.h>0 Y# q! C* A5 e" ^
  30. #include <asm/io.h>! j; `: I' a! j5 E$ S0 p# i8 e
  31. #include <linux/moduleparam.h>6 _6 A* c% H, A1 Q4 e# W% p2 a
  32. #include <linux/sysctl.h>! e9 j1 I9 e) Q8 E/ `
  33. #include <linux/mm.h>* q: m+ ^; ?& A8 a8 x7 j9 b
  34. #include <linux/dma-mapping.h>- r5 ^% V0 y% T, L% m5 E! q* B

  35. 1 f7 u( |0 D% s& m1 ]2 e
  36. #include <mach/memory.h>9 I; h$ z7 y' j+ ^
  37. #include <mach/hardware.h>  s& K3 `) ~) K. l8 |
  38. #include <mach/irqs.h>
    % h3 b+ b+ {" V. x( R2 @
  39. #include <asm/hardware/edma.h>! u& I& b- L- ]2 T7 |0 I

  40. / p, y+ k) m9 V4 G, J& e
  41. #undef EDMA3_DEBUG2 w' w, \7 k' d) ~
  42. /*#define EDMA3_DEBUG*/! p3 ?9 H4 {6 U! a
  43. / Z# z, p) I1 z9 n" b7 A5 q! f) Y
  44. #ifdef EDMA3_DEBUG
    6 b( g- h( ?# d: |5 C) B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; t2 C# n5 S6 g& G% R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : W) t( n# r6 B9 m/ o: R  r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" g4 Z( p: W8 X
  48. #else0 y' R- b4 D+ p' {1 Z
  49. #define DMA_PRINTK( x... ); P3 S- Y  H4 f$ w; s
  50. #define DMA_FN_IN
    . `! k$ \6 Y# y3 L% w
  51. #define DMA_FN_OUT
    * A! n! m% O/ C. f  ^- A7 L8 h9 y
  52. #endif7 R  S3 u+ ]; l0 d3 L) K6 R7 ?

  53.   @) l) p& F6 Z5 a# `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; M5 R( X! J; W& b
  55. #define STATIC_SHIFT                30 v" R- s9 H$ Z' ]  M9 y/ _
  56. #define TCINTEN_SHIFT               20
    3 Y' m# Z& C5 s
  57. #define ITCINTEN_SHIFT              21
    $ Q4 o0 S( i* ]( U
  58. #define TCCHEN_SHIFT                22* D5 k5 m+ U; V4 f* V% h! |7 x
  59. #define ITCCHEN_SHIFT               23
    # x3 {' g8 W& {- f5 ]; T/ l- K  o( L
  60. 8 g+ C$ A2 U) ^! U# Z
  61. static volatile int irqraised1 = 0;; Z+ T1 U& O( y9 ~! c$ |% _' _
  62. static volatile int irqraised2 = 0;
    + q- t5 z- U7 O3 z' f/ B
  63. & ?& p& R. f' A$ _' {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 q) V7 l8 T. G& S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: q" U! w/ {( T9 }0 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 J, G& K! k! K7 I2 ?

  67. - F" f. J' |% w  [' [
  68. dma_addr_t dmaphyssrc1 = 0;/ E1 f5 p) E# B  B# \6 J
  69. dma_addr_t dmaphyssrc2 = 0;2 o* N4 p/ {; Y6 z3 b/ G
  70. dma_addr_t dmaphysdest1 = 0;7 S# I& }( Y0 D, S( d/ v; M
  71. dma_addr_t dmaphysdest2 = 0;
    - m( W: e& z% ]; R% D/ M- [
  72. 1 P) U! J. I; y: A
  73. char *dmabufsrc1 = NULL;2 s' [& s+ \: h* ^2 P% ?! w0 w, M
  74. char *dmabufsrc2 = NULL;# K9 }0 V8 J- N+ F* ^" P
  75. char *dmabufdest1 = NULL;
    ! D- \7 K4 _/ t: g* _' w7 e
  76. char *dmabufdest2 = NULL;
    ( o6 q  z8 g& s& Z7 X* g5 h

  77.   T( e. p$ {! g4 t
  78. static int acnt = 512;
    9 M" I/ |2 ^9 h' d
  79. static int bcnt = 8;* x' X  x% n3 l0 X  g
  80. static int ccnt = 8;- U# \# U7 R" l5 v

  81. ) x' _" r* \* B
  82. module_param(acnt, int, S_IRUGO);
    . R) s: ^5 T9 c9 {) y
  83. module_param(bcnt, int, S_IRUGO);7 O9 M: a* D! O! v8 [' E" q4 o% I. j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* K8 s1 R* U) J3 K' x
) G+ B7 o( k2 j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- r# u+ j9 _; R  T% n# n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) x: }6 L& Q4 p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- H( e$ @' B+ A$ z* W/ O: `1 \  e. n& X  |$ C
: ?' \4 G; u# F+ g% l: u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 13:29 , Processed in 0.039599 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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