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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. e0 N8 A- F* i/ N7 Z, N1 r
  1. [code]EDMA sample test application0 Q9 [$ r, E' P6 @4 R
  2. /*
    4 v7 x: N# N. w& n- V! V+ x0 w
  3. * edma_test.c
    + T1 k/ n: w5 @" I9 F7 l' s' o3 I
  4. *
    : U+ w6 ?" Q* U( L) ]3 O8 R- Z
  5. * brief  EDMA3 Test Application
    8 E. T# o* d5 q, f
  6. *: T, i: }3 G3 i
  7. *   This file contains EDMA3 Test code.
    9 l( V7 t, _& i2 _- J1 W1 n# _
  8. *
    0 ~, d  Q0 X( t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# E8 G% w5 \% M& s$ D# {* z5 D$ m* r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 W, h( c, Y& N* R% t5 V1 ]5 {
  11. *         TO CHANGE.
    . ?( {% L& f: [1 ?; Q5 g
  12. *% f5 s- N- s" L4 i5 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' W' H4 S( G6 o/ R
  14. *8 w4 ^7 h: [1 W% [( w
  15. * This program is free software; you can redistribute it and/or
    + K" y5 b3 @) y1 a
  16. * modify it under the terms of the GNU General Public License as0 p7 g4 i* U0 z% t5 l5 u$ r  _5 i
  17. * published by the Free Software Foundation version 2.; j  ^# s9 j- y5 X  v
  18. *
    3 v% }& G! C0 d+ p/ X) P7 e; M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" `" n* K3 S# @- M% {" k
  20. * kind, whether express or implied; without even the implied warranty8 N1 ^' m6 B' ^# M2 t) G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 d, @  e+ u* Y* A. l) M9 n
  22. * GNU General Public License for more details.
    # E/ t) X5 b8 R6 O( r
  23. */
    7 y4 T# N! {- w& h  ^! S

  24. - {7 p1 I! {* P/ r6 R# ~
  25. #include <linux/module.h>+ {0 @7 g0 V6 d+ C9 S# i: {
  26. #include <linux/init.h>
    3 ?7 b$ K( ~1 R9 P2 u
  27. #include <linux/errno.h>+ S7 @3 u8 M' Q# r  G' j
  28. #include <linux/types.h>: L0 K" U7 {3 r+ {4 L/ ]
  29. #include <linux/interrupt.h>3 Z4 Y: y# z* I0 U, {
  30. #include <asm/io.h>
    8 e/ p, V, ]6 F* O7 ?$ H  [  p! N1 _
  31. #include <linux/moduleparam.h>
    * R1 _- W: |' r( r" y( {" U+ `
  32. #include <linux/sysctl.h># G3 s, X6 @5 K2 R1 m( [3 l
  33. #include <linux/mm.h>8 n; u% }$ A4 c  t' T/ d
  34. #include <linux/dma-mapping.h>
      g9 N6 t, \7 R" Q- V; t

  35. & M! d7 r. f1 u/ E% n1 B) V; T& p
  36. #include <mach/memory.h>$ D2 M3 H* r) A: q; t6 q
  37. #include <mach/hardware.h>* j2 e4 \+ _' r& [  ~
  38. #include <mach/irqs.h>9 L) h1 Y, W5 ?* v. ?
  39. #include <asm/hardware/edma.h>
    6 D! m; t" E' B' x; a) \
  40. % N- F8 z1 s3 B9 E" g# i
  41. #undef EDMA3_DEBUG
    3 }/ ?' G0 C, L- l
  42. /*#define EDMA3_DEBUG*/
    , t  W- r' H+ G, I

  43.   P, s1 k& g' a- O" i
  44. #ifdef EDMA3_DEBUG
    / h" E! |. N' I) P) j0 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 r* c0 x5 w" d% ^& f8 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 |8 l" t% A+ W- p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 \: u9 [9 F" K3 W, U
  48. #else' J  |% S$ ?5 `( r( C/ _  ?
  49. #define DMA_PRINTK( x... )9 t3 h/ U: E2 ^" E  E
  50. #define DMA_FN_IN
    + E: \9 I4 s& K& i/ Z
  51. #define DMA_FN_OUT
    0 t- s$ [4 q6 F1 X! Y+ E
  52. #endif
    . p$ s% H9 {6 z& p( g; ?( f

  53. 8 K! L: T5 I; x. w7 i7 v5 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* B) C1 D# m# X. W
  55. #define STATIC_SHIFT                3' \! h$ p& q! |: P6 }& `
  56. #define TCINTEN_SHIFT               20
    , V8 B( ^1 r1 ?( T- H+ M* u
  57. #define ITCINTEN_SHIFT              218 V8 o7 K5 C1 x& _- n4 U8 N' ?
  58. #define TCCHEN_SHIFT                22$ ?( s  \' A, X8 p9 r& A
  59. #define ITCCHEN_SHIFT               23
    & d% C* G" S8 Y+ O. }1 n. z
  60. 9 q5 T+ g% H" o, \6 _0 j
  61. static volatile int irqraised1 = 0;
    $ P# ~  T* R$ ~5 P9 E
  62. static volatile int irqraised2 = 0;
    * H$ o' B. D; P$ D4 q# {4 r: {

  63. ; u, M  s# }* C, j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ T* ]" d; [) R; `" C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) @2 g9 T1 z/ V, Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . i) O" J, A9 O9 J4 ~8 q  y# J  T

  67. 3 ~  M* r1 \* s  _( o% A3 E1 l
  68. dma_addr_t dmaphyssrc1 = 0;
    2 B7 @' V. D0 d; w  F
  69. dma_addr_t dmaphyssrc2 = 0;
    0 |# r7 \2 y: c5 e7 r( T
  70. dma_addr_t dmaphysdest1 = 0;$ n: V; D* d+ j" v8 w! |
  71. dma_addr_t dmaphysdest2 = 0;
    ' ?2 P+ \# c% G& d2 j0 }" d# i( b4 \7 @

  72. 5 X$ c( @6 q/ [  x$ }+ f
  73. char *dmabufsrc1 = NULL;; n: T/ c9 P- ?  `$ N
  74. char *dmabufsrc2 = NULL;( r/ e: b8 \' @9 D- U, f5 S
  75. char *dmabufdest1 = NULL;
    8 Z. o& k" h4 n: N
  76. char *dmabufdest2 = NULL;: b* c$ S0 F! n8 t% Q- N
  77. , u% m7 j# x$ s  d- F. `. B1 `- e, m$ |
  78. static int acnt = 512;
    ( J6 Y. e% T1 V; X( f+ m
  79. static int bcnt = 8;$ ]  v1 e3 d4 M# y, f
  80. static int ccnt = 8;9 y2 S9 f/ `# g1 P4 e) K# Q; _! _
  81.   X7 e) Z: N3 b4 W7 ]
  82. module_param(acnt, int, S_IRUGO);
    ! o8 z' a# C! n+ A( Y& Z0 @
  83. module_param(bcnt, int, S_IRUGO);" D) D8 Z* m8 s  o  U' ]9 x; F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ ~" l8 _2 k, R. m# a% P: f, }* M9 f6 r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 r8 |- q7 z( M& karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, H* ^. u) d! J; g, R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! _7 x' E8 o- L  r4 r' t+ _9 [$ [, ^9 L% n% J3 c- e

- R' p- X' O- w5 b8 }2 O; ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 07:57 , Processed in 0.040224 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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