OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / n. m1 X  v( a) T
  1. [code]EDMA sample test application
    - H7 p0 D7 n& v4 R4 T
  2. /*
    * a# D, A1 O3 l9 A  X
  3. * edma_test.c9 V# }$ R5 V+ t& `1 M
  4. *3 T( G9 L3 i; H1 |& q' N
  5. * brief  EDMA3 Test Application/ h7 y. V( N3 L
  6. *$ k2 a+ \1 G5 ?
  7. *   This file contains EDMA3 Test code.' ^$ c& O9 F7 c
  8. *# J0 w1 l! y+ K% i/ S' b5 `) A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* Z  ]  O) j" O* f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 \8 _- l( L$ l/ m& d
  11. *         TO CHANGE.# G3 A& v, e8 {3 r* I
  12. *9 \! h, d( f. c. l* k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" ?  {5 j6 R6 f4 n- ?
  14. *  }3 U! k1 u: K  c) m+ N
  15. * This program is free software; you can redistribute it and/or
    5 K1 k) W. |9 F
  16. * modify it under the terms of the GNU General Public License as$ t* Z: C" @: T1 ^2 P: d* L( A  W
  17. * published by the Free Software Foundation version 2." `# b" c: W) B& l, f, x' ?
  18. *
    . i" K4 |" n# L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ ^+ g& p6 D7 a- p4 S/ H8 }
  20. * kind, whether express or implied; without even the implied warranty, y/ Z8 T7 P! N1 u/ o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( d$ a; P; s# R0 `9 {9 m; ]8 v
  22. * GNU General Public License for more details.
    $ B9 C1 R7 ]6 [3 O
  23. */
    3 A; c  R- A% r+ S. _  F# B. J

  24. * }5 c8 G8 N; z  E6 _
  25. #include <linux/module.h>
    6 U& a7 G" t; F3 t+ z1 m
  26. #include <linux/init.h>
    % m0 ?- Z, ^3 }+ t/ n" G( b( J' J
  27. #include <linux/errno.h>/ M: ~7 h; d# O: H
  28. #include <linux/types.h>' V# p! O( p5 E  E8 {8 f8 r
  29. #include <linux/interrupt.h>/ Q6 ~  ~; R& ^8 g: M1 T4 `' q
  30. #include <asm/io.h>
    , s( V* W% u/ U: V! {% I6 B
  31. #include <linux/moduleparam.h>
    ; h: b; `) |/ `  ~* P+ E
  32. #include <linux/sysctl.h>) X, {6 Z4 u: V2 V
  33. #include <linux/mm.h>$ a2 p& \: B1 H& e8 v, T- Q4 }! N: H/ b
  34. #include <linux/dma-mapping.h>/ \8 W+ ^5 b5 W$ C: O2 s/ `
  35.   E% e* a) L& \, y7 H5 {4 E# V+ h
  36. #include <mach/memory.h>  B% o5 c" `, y* `$ M
  37. #include <mach/hardware.h>: k7 k: k2 i7 Y& y& r  a5 d! m/ P
  38. #include <mach/irqs.h>
    2 {- t4 G: E' S! E6 j
  39. #include <asm/hardware/edma.h>
    , J# J8 B% u9 _# J( S3 C

  40. 7 P4 `$ M# K  c: g5 e' L" N3 S
  41. #undef EDMA3_DEBUG
    7 v  H: G9 V& S
  42. /*#define EDMA3_DEBUG*/" {0 ]7 z3 A* D& M
  43. 2 ?: C4 {. l( O! H% d
  44. #ifdef EDMA3_DEBUG+ Z* \' U3 n0 q+ V/ n) n/ L4 k! Y& g) X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( {: [7 M% J+ G  `/ J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) p6 H0 F5 ?0 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & J  N6 d% c- t% g$ A. R, a
  48. #else
    / [! I. S" ^+ F
  49. #define DMA_PRINTK( x... )+ r7 r, ], i4 T% b2 ^
  50. #define DMA_FN_IN2 w- K5 `7 n' N2 J3 Y5 @* @" n
  51. #define DMA_FN_OUT
    4 `$ W+ [" A5 H! O$ R$ }
  52. #endif! x2 S& U& e) P% c6 H3 ~7 s0 l
  53. + v+ J( U) z! h4 a+ F$ j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! c# T4 t+ u% l) _* X& y  n1 e
  55. #define STATIC_SHIFT                3+ `1 U; Z5 C; B- S
  56. #define TCINTEN_SHIFT               20
    9 N! v* Y2 S6 ]  s* w: P  `0 b" w2 r
  57. #define ITCINTEN_SHIFT              21
    9 @6 {. F  f, A1 v% ~
  58. #define TCCHEN_SHIFT                22
    % P5 ]7 C; R  P3 _
  59. #define ITCCHEN_SHIFT               23$ J' w* O/ N0 x$ B5 ]& R

  60. 9 ]! R0 S- X& p, i! j
  61. static volatile int irqraised1 = 0;- x. m' [, ~+ e% w% G; f# [' A
  62. static volatile int irqraised2 = 0;
    4 F7 t  N1 a5 f. ]4 W" E0 r

  63. 7 G/ h: \- g6 C! g& p" P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 Q& s2 l  V( y8 C" O" Q' p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( d6 B: T8 n( J0 \+ g. Y% v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 u+ f, I) i$ U: X( K

  67. / I3 P1 @9 Q* C9 n  t: l
  68. dma_addr_t dmaphyssrc1 = 0;! Q* H! r5 Q: J' w% x
  69. dma_addr_t dmaphyssrc2 = 0;3 o, `" q8 h4 I# h0 s3 ^: @# h
  70. dma_addr_t dmaphysdest1 = 0;
    3 s0 I7 W) z2 |. M# o
  71. dma_addr_t dmaphysdest2 = 0;
    * L$ L% j. D4 B+ D4 q& K
  72. , J; m! P, R3 h: `3 ?2 K# e
  73. char *dmabufsrc1 = NULL;# y, o  a9 U; m" H6 P* M) A
  74. char *dmabufsrc2 = NULL;" ?  P' |6 c% ^3 _) k/ x
  75. char *dmabufdest1 = NULL;
    6 g4 }1 U7 Y3 ]5 D* Q7 L
  76. char *dmabufdest2 = NULL;5 x8 X( {/ F2 p  u; ?
  77. $ U$ S1 {* g# P- F; f0 e! h
  78. static int acnt = 512;
      W6 Y+ m4 B$ R( @) u- K
  79. static int bcnt = 8;: O# d# d7 {' d0 V/ F9 }0 k$ F# t' c
  80. static int ccnt = 8;
    # `- |( t5 A- E/ j6 U3 z

  81. 7 U; r/ }+ B* W
  82. module_param(acnt, int, S_IRUGO);- s# Z7 ^) H, [: i7 _- ?2 L
  83. module_param(bcnt, int, S_IRUGO);7 h5 x' n7 y/ `3 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( d/ o6 D9 }# W; ]8 Q/ R
( p# E" x) {% V  P+ v' O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% q9 n* J+ q! t) o+ C; D) _' |7 R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# O  i, I! J$ T$ H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) W; o6 O: e2 V" ^& Q, @
; L. y3 B7 g* L0 l) `
' C& U) M# ^2 Z6 C  P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-17 13:53 , Processed in 0.042765 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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