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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! R! p6 l9 K. i6 V5 m) s8 |) [. D$ Z3 Q+ r
  1. [code]EDMA sample test application( [8 ~5 H, }. j6 v- u. Z+ r
  2. /*
    , F# H1 M0 {$ f/ l# V  }: f  g
  3. * edma_test.c
    ! q9 D( L5 |% R7 W* G
  4. *5 M- e' J+ {6 k9 k, z
  5. * brief  EDMA3 Test Application5 K: h) t; `5 ~- F3 i) _/ |
  6. *
    1 @+ }9 ?# E3 f7 Q7 X) O9 ~. ~: t
  7. *   This file contains EDMA3 Test code.( f  m2 R- p/ I& ~& k2 M
  8. *
    ! d- I3 v- p% K1 V# Q) w8 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, \/ t) M: e( g6 F3 p; v, g/ k! z! u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. m$ D. [, F# x! v" x  B& n
  11. *         TO CHANGE.
    ( e( H. u  V1 n; C1 I1 t2 \$ Z' N
  12. *
    ; O5 }* w( V, ?) ?$ @4 G9 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 l* v6 h7 Y! ~) G( N- X3 S5 y. p
  14. *" z8 |& ~$ K9 R* R
  15. * This program is free software; you can redistribute it and/or5 a$ @3 j$ I* _7 X* V4 N/ H
  16. * modify it under the terms of the GNU General Public License as" @" i- g* D5 {  R
  17. * published by the Free Software Foundation version 2.
    7 c1 X0 d2 i8 V9 c3 ^0 V
  18. *
      O5 M) \# S" g! k3 S' w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 g8 j) K2 h3 e3 G9 v& [* ?
  20. * kind, whether express or implied; without even the implied warranty
    $ X4 m1 n" ?4 ^7 ^9 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 h8 ~6 t2 ?# j9 `3 [& `, U7 r
  22. * GNU General Public License for more details.. |0 M! ^2 V) |3 P0 Y- P
  23. */
    : E0 W% d4 l1 x

  24. $ P0 Y: q) I* F0 k
  25. #include <linux/module.h>6 f3 j  F+ L$ f$ Z! T5 a
  26. #include <linux/init.h>, Q1 N# W7 [) b! M3 I! l
  27. #include <linux/errno.h>+ k& L0 W% |+ c) M" z! r( N
  28. #include <linux/types.h>
    # a: x2 }; ?, e  d& \; b3 G9 Y
  29. #include <linux/interrupt.h>9 W) X' f, r. D/ d* w
  30. #include <asm/io.h>
    ( F! f, P; ^7 G4 [5 E/ o
  31. #include <linux/moduleparam.h>
    # K2 K1 c0 j% z$ {" ~' x& a' g  H
  32. #include <linux/sysctl.h>
    3 f( i% G# a) |4 Z* i/ v5 |5 t
  33. #include <linux/mm.h>+ v& O" F9 H* Q2 a) E& k
  34. #include <linux/dma-mapping.h>/ r0 k; f1 O$ ?  J5 i

  35. ' J9 M0 G9 A$ p4 }4 y7 J: P
  36. #include <mach/memory.h>
    1 s/ I- K/ L$ p% l1 S# s
  37. #include <mach/hardware.h>+ u9 v) ^! \1 |) P
  38. #include <mach/irqs.h>
    : w  X  p6 a& B* {
  39. #include <asm/hardware/edma.h>, D/ V0 k: m: }& v. A! ^  T* C
  40. - V8 M# A. Y6 l( \
  41. #undef EDMA3_DEBUG
    ( y  S' i7 a* E; B- l1 P8 ^& ?6 @
  42. /*#define EDMA3_DEBUG*/
    ( O+ Y' R; p* \' n

  43. * o" ?5 s5 p( G. l5 P
  44. #ifdef EDMA3_DEBUG  a- |2 v; \* J/ G: K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      q) a3 e- {8 ^" h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' q/ y% V- J" D9 J, k6 l5 [# ~( |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 s- B9 h% E5 v2 @& @
  48. #else
    ; q( C1 e7 z4 J4 W# b. w
  49. #define DMA_PRINTK( x... )
    / ^6 c/ n7 k: |
  50. #define DMA_FN_IN! a# r5 G; [/ A+ p0 b: Q
  51. #define DMA_FN_OUT
    3 v" P/ F3 [0 g6 {
  52. #endif, B/ z0 d( |. X: u- E5 B1 n
  53. 0 v/ C! f% g" B9 j( r4 g8 g7 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 P) m$ G9 o) i, g7 @: c
  55. #define STATIC_SHIFT                3
    ( |9 _" n0 h- r6 b4 S+ ^
  56. #define TCINTEN_SHIFT               20& x' ?& o! b" f# N& c  m0 n
  57. #define ITCINTEN_SHIFT              21
    2 \# R7 D# u! E" |2 B
  58. #define TCCHEN_SHIFT                22
    / X; F- p: }& o  q
  59. #define ITCCHEN_SHIFT               23, D* G: X& c- v# \$ B% U! k
  60. ) M# _$ J: X) t7 E4 _2 r
  61. static volatile int irqraised1 = 0;; u6 ^  ?- }" r0 _9 p
  62. static volatile int irqraised2 = 0;& _, g1 ~+ q" \/ O! v
  63. : J/ x; z. K7 Q3 e, V0 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Z4 _( v  D" j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( x% l3 u3 M& U0 {3 s1 U$ q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 I* Z! t, ^' h7 E* _
  67. # a5 r4 Y4 X# {3 o0 h
  68. dma_addr_t dmaphyssrc1 = 0;
    1 j' O1 G) Z4 I
  69. dma_addr_t dmaphyssrc2 = 0;
    ' ~5 X( N; k- N
  70. dma_addr_t dmaphysdest1 = 0;
    * n6 i. @" e9 R: ~3 A
  71. dma_addr_t dmaphysdest2 = 0;( U) q' w- z1 H9 g5 m
  72. . w- J0 h0 z  y4 d( @1 M' O* _
  73. char *dmabufsrc1 = NULL;3 p3 ]1 v. F: ^. F- a
  74. char *dmabufsrc2 = NULL;9 c% {. r) ?; w( S. l
  75. char *dmabufdest1 = NULL;' Q0 O0 i" E! ~( d2 w
  76. char *dmabufdest2 = NULL;" b7 D4 L5 Z0 Y! s' g4 e- J
  77. , x- E0 G2 K5 Y
  78. static int acnt = 512;
    / y# [( x8 G/ ^# H* }
  79. static int bcnt = 8;
    4 X& ~# ^! J  N9 t& `
  80. static int ccnt = 8;8 [' g1 C' k1 j

  81. / ]- u  ?$ U+ `
  82. module_param(acnt, int, S_IRUGO);2 {+ j' V% T( W% c
  83. module_param(bcnt, int, S_IRUGO);
    2 U, h1 k6 n6 c0 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 L. ?( [+ E8 J7 ]
  t! i# W& x4 S0 C/ t& {) J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. ?; F. u+ ~2 J( T- d4 `3 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) K9 O& f. _# z3 R  a- D1 o7 ~. f7 E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 b# j6 l/ n1 S, R$ ]6 e
5 V! d7 r& g* Z, h  Q: n& `" U2 B) k9 h
) e; O$ ]/ I: B$ y* l: A6 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 16:20 , Processed in 0.037950 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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