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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 C9 W4 h( n; `$ d4 P  t  Z4 d
  1. [code]EDMA sample test application
    8 Q/ P- `% a9 ^! ?- `
  2. /*
    7 i4 C' D/ {. h7 G( ~: L9 k# I
  3. * edma_test.c
    ; D' L( \$ c& q+ H
  4. *
    4 p& e2 y8 l; a3 p
  5. * brief  EDMA3 Test Application2 u( o6 j  t' c. P6 y9 \: Z
  6. *6 U. p; x: V* M4 M: \+ G6 b8 C
  7. *   This file contains EDMA3 Test code.
    ( J) ]) M: {6 e7 N0 k+ C5 r6 T
  8. *
    ) W; B5 \9 }, l  s: _/ z; A; f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 |, \0 S: W, |& `, Q2 O4 H5 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. y% r; V2 q+ V
  11. *         TO CHANGE.
    $ z- H/ Q# Q8 e" d3 Z
  12. *
    # p, ^- A7 `7 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 [9 t; X4 U; j8 ]- I3 D# V, k
  14. *5 {' U+ S7 A9 m9 D" k1 }$ e6 l
  15. * This program is free software; you can redistribute it and/or
    : c4 o/ v( w0 e6 i. q! k% e: c/ M1 l; ?# q
  16. * modify it under the terms of the GNU General Public License as2 @( e+ c) o; |0 z2 |# w) Q$ P
  17. * published by the Free Software Foundation version 2.: Q/ Z' Z! S+ j0 h
  18. *
    $ Q; x  Z+ A& Y0 f/ e% v2 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 V/ a1 `& i6 S3 ^# r8 C
  20. * kind, whether express or implied; without even the implied warranty
    1 ^. q4 e7 n- f) \% I" ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) `% f. q  j  Y& V+ {% d6 R; l
  22. * GNU General Public License for more details.
    & L7 J: W; g! I4 X9 P
  23. */. L# L5 w8 ^5 u+ m% M9 j
  24. : |  @/ R# W! M' T. x
  25. #include <linux/module.h>. }* ^& J0 b7 I6 _1 O
  26. #include <linux/init.h>! @( [4 L# K( f4 D5 w, \& X
  27. #include <linux/errno.h>) d! f# k; i+ _, K% g) k; H
  28. #include <linux/types.h>
    # C  `- O' B% p$ p- S
  29. #include <linux/interrupt.h>% @' }7 Q1 W- G) Y
  30. #include <asm/io.h>
    2 N8 {, r9 u3 w1 O8 R
  31. #include <linux/moduleparam.h>3 _0 s5 }% C! f3 m
  32. #include <linux/sysctl.h>; X; k: c5 f# }
  33. #include <linux/mm.h>% l7 D# n2 L! z  d
  34. #include <linux/dma-mapping.h>
    5 {# i' v5 h( r5 p- ?( C# l5 Q

  35. 7 N1 {$ u/ s9 G$ c: n4 d. N8 Z
  36. #include <mach/memory.h>0 n' |5 u: C( R2 |' \3 q8 ^
  37. #include <mach/hardware.h>
    " O$ R) p, N9 B- Q% a
  38. #include <mach/irqs.h>7 \7 Y1 Z% r) d
  39. #include <asm/hardware/edma.h>" i* b' L. I' W4 P  R/ o& a- O

  40. , d% w8 C  W5 A+ H2 p& v! R
  41. #undef EDMA3_DEBUG
    - A$ b- T5 U6 F$ B5 q% Q0 R% y: E
  42. /*#define EDMA3_DEBUG*/
    $ c% t$ m* \6 m% _, \, j: y
  43. 1 w; ]9 X" H1 l
  44. #ifdef EDMA3_DEBUG  u  r! E7 y: j+ G* X. E/ d4 E/ `. ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 ^( b7 |0 P+ a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ i5 J$ e9 [, C' W" O5 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 R  {9 C% |' {9 [/ Z6 N0 r5 ^: R
  48. #else' w$ x7 @. s7 G. V* a3 K( c) o
  49. #define DMA_PRINTK( x... )4 p, B5 [# o4 P4 R( J
  50. #define DMA_FN_IN
    + N8 d4 v* F# O) M2 C* n. L
  51. #define DMA_FN_OUT9 ]# S& n. @: m. y
  52. #endif: C. s: i& q- ]% I$ ^- P# B# S2 Z
  53. ( Z" U+ F( U2 V; Q, @( @! @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * M) A  P1 m, A! I2 p
  55. #define STATIC_SHIFT                3  m0 n& M+ ?" |% Q
  56. #define TCINTEN_SHIFT               20( I& a8 @1 d+ @3 C) b  a
  57. #define ITCINTEN_SHIFT              21; ?3 j9 w2 o5 C: B0 A- U
  58. #define TCCHEN_SHIFT                22
    * U) K+ T, S- H
  59. #define ITCCHEN_SHIFT               23
    & \: H/ R. O7 K" X
  60. . W3 L* e$ `* t- S
  61. static volatile int irqraised1 = 0;2 ~1 s- M) s4 p; V8 s
  62. static volatile int irqraised2 = 0;* ?$ ]- R" O) k! |4 T& t
  63. " m+ D. [# G+ N6 t! q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) }' P" `- P) K3 N6 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 @$ k6 l1 ?9 S$ M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  F$ H6 \  g7 e- r' D2 d8 x, }  b

  67. : ^4 Q9 C& v& D7 }6 L) z. z
  68. dma_addr_t dmaphyssrc1 = 0;
    . q5 w# }8 W6 c7 }3 O
  69. dma_addr_t dmaphyssrc2 = 0;% E3 H4 b& c( G7 R6 D+ j( Y
  70. dma_addr_t dmaphysdest1 = 0;' |# o# |2 N) o! h' A+ d& e' @- x
  71. dma_addr_t dmaphysdest2 = 0;1 N7 V- ?/ z9 G/ W0 l0 O

  72. & _; f+ Q/ h0 g; {
  73. char *dmabufsrc1 = NULL;/ h1 e6 h8 K3 @; w. C! ~
  74. char *dmabufsrc2 = NULL;1 a  C0 J3 s  }0 m0 u5 Q
  75. char *dmabufdest1 = NULL;! m# a. ?* \- \( V" I. G2 ?
  76. char *dmabufdest2 = NULL;
      @/ U2 J7 T6 D( z8 n
  77. 9 X$ v' v) V+ Z+ |% r$ O( _
  78. static int acnt = 512;, x' m& S: P/ }% R3 Y" g
  79. static int bcnt = 8;
    3 E- n& m0 ?* K1 e
  80. static int ccnt = 8;5 [: [$ r' |( d" l7 z
  81. $ Y* t0 @* J( u) D6 S; c; _3 O1 q
  82. module_param(acnt, int, S_IRUGO);
    + u: r! X9 P  t5 j& Z* S
  83. module_param(bcnt, int, S_IRUGO);
    / r$ \) _$ Q/ ^& i% e' F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ k, U$ g4 |* @6 V. b6 J( N9 X) m
6 a2 N4 Z# I; @  A# ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! \4 r+ Q9 ~4 g* \% Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ A+ x$ z. f* K3 V6 k0 O( [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 B! S. x1 q3 \0 z5 R
; Z% ]  I: K$ J

! \0 ^) E% L4 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 09:05 , Processed in 0.044524 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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