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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % n& t6 j1 K  j; W
  1. [code]EDMA sample test application
    9 n7 w. [. e! \1 \+ P% a* c
  2. /*$ _& P" F7 J, [1 `9 L' l
  3. * edma_test.c. V( C1 N+ g2 N3 ~9 E, j" W' i" e
  4. *4 v- r3 F( f- z+ Q8 v5 M  n/ O
  5. * brief  EDMA3 Test Application, f  l7 [7 L! T$ d7 q: y
  6. *
    ( N" S/ @! c7 R6 m  x
  7. *   This file contains EDMA3 Test code.0 R( e8 H" z7 t* E& j& S
  8. *, G4 r$ t! J" `/ {) C1 X  S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" J3 K' x# ?' s" R2 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 i% t$ v- j0 G4 w5 p; H
  11. *         TO CHANGE.2 ^4 f* {( o$ u' ]/ G" m3 }
  12. *
    , X! r5 Q; I4 G4 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' S6 T* B! a+ c* X, X
  14. *9 V/ M2 {9 {* Y" @* D% Z" t  ?0 M
  15. * This program is free software; you can redistribute it and/or, r" F! z7 u' \; }/ L7 }
  16. * modify it under the terms of the GNU General Public License as
    2 e8 d$ v; ?1 \- G$ W9 w
  17. * published by the Free Software Foundation version 2.
    7 g3 x# @9 g- a7 ?- @
  18. *& k9 g- m* a& D. B3 Y( r# M& b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ^: o) I* }0 J0 ^* g; T
  20. * kind, whether express or implied; without even the implied warranty, @6 `$ G$ C) P8 ?" |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& f, ^) F$ K# f0 L8 H! V3 [
  22. * GNU General Public License for more details.4 F0 c, Q' a+ H4 r
  23. */
    / X7 A: F- m% Z' r! b5 i0 ]

  24. 9 [8 l3 b( O' h- D' _
  25. #include <linux/module.h>" v5 F, U. b, {6 h! k( n
  26. #include <linux/init.h>
    ( G# ?2 ?9 @( T2 |
  27. #include <linux/errno.h>  L' F, U2 X$ @( ^* M5 g
  28. #include <linux/types.h># X! @7 M+ I+ _# C! M
  29. #include <linux/interrupt.h>3 m% d' G: \2 E& L
  30. #include <asm/io.h>% n% Y4 s( H; ?3 Y  }) R
  31. #include <linux/moduleparam.h>% F$ I! Q( {# u6 w; [+ F
  32. #include <linux/sysctl.h>
    ; L; s, B8 h( E2 `$ W% {, O
  33. #include <linux/mm.h>9 E# n" R8 b2 v! b- p6 K/ ^
  34. #include <linux/dma-mapping.h>2 o- o5 l3 ]3 P6 \4 a! W
  35. ( ~" N% I! a& n+ D
  36. #include <mach/memory.h>9 T: d) \& U6 d' l: r) c
  37. #include <mach/hardware.h>
    7 o" q6 K; P4 f
  38. #include <mach/irqs.h>* A* ^7 G. r. Y. \
  39. #include <asm/hardware/edma.h>) p  y& p' o5 b: G+ M

  40. : B2 O8 l8 k. B& [/ q
  41. #undef EDMA3_DEBUG
    ) ?( ~" L. W+ t0 {5 i% T3 ]
  42. /*#define EDMA3_DEBUG*/+ E; K8 G0 B0 e' ?

  43. $ i  `1 M' A3 |4 X# t
  44. #ifdef EDMA3_DEBUG2 N* d* M8 _+ H% u$ C! ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) e* \7 q1 p5 q3 `$ H% g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' K% C; g* ~; C3 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 D( d7 o& a, D" F/ {/ T
  48. #else4 K0 J2 H$ D  V! G8 c
  49. #define DMA_PRINTK( x... )
    0 c: }# _& ]2 J" t
  50. #define DMA_FN_IN/ O0 k9 A6 B9 [: y3 [5 h1 v
  51. #define DMA_FN_OUT
    + A( K, ], o0 N# T& J
  52. #endif* h) d' B7 A; y  G/ [3 ]3 f4 [1 T
  53. ( t% O  [3 e' q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( d* N' [- Z( q/ L4 G0 @' X& G$ q) v
  55. #define STATIC_SHIFT                3
    + y3 _% L. S1 O& m) U* o  l7 t
  56. #define TCINTEN_SHIFT               20
    & n& l; A, A4 e7 Q) r
  57. #define ITCINTEN_SHIFT              21
    0 _( |" X7 J  Z- e$ X
  58. #define TCCHEN_SHIFT                22
    3 l# V+ a7 r5 E+ C* t8 s. O) O5 p$ F
  59. #define ITCCHEN_SHIFT               23" w2 X2 p) i" }& m* M7 X

  60. # v$ ^  ^' c- b( x# a! y
  61. static volatile int irqraised1 = 0;1 x0 x7 g- ?  b4 x6 d( W
  62. static volatile int irqraised2 = 0;- q$ N0 x( O; ?" o

  63. 5 F; k) M3 [# R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 I! M, I. @1 e% w, m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) U; E: p" S" Y8 x4 n1 g7 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 z/ s% F3 N! X6 M: W

  67. / q2 A5 g( Y- y1 Q5 O9 e  S
  68. dma_addr_t dmaphyssrc1 = 0;
    2 V) S4 j2 o& G# d5 k- s! X
  69. dma_addr_t dmaphyssrc2 = 0;1 s, I. D& [5 {/ D
  70. dma_addr_t dmaphysdest1 = 0;( b+ l9 }4 @. y# i: [
  71. dma_addr_t dmaphysdest2 = 0;  X& G7 Z. g- g% s
  72. 5 B5 g; @  X/ C; _/ g% n
  73. char *dmabufsrc1 = NULL;- H+ Z8 H7 `: L3 Y. g
  74. char *dmabufsrc2 = NULL;
    " y( u$ c, w* {$ Q' l; a+ B
  75. char *dmabufdest1 = NULL;; s+ }7 D% Q* W' S
  76. char *dmabufdest2 = NULL;2 r4 E) \/ Q; J1 n; j1 ~
  77. 7 w5 O: n3 N& {6 m: Q1 g
  78. static int acnt = 512;" S6 `! }, P4 r
  79. static int bcnt = 8;' U2 \( B9 f3 u- w+ K
  80. static int ccnt = 8;
    / ?! c8 m. @  K) K+ K
  81. * e& D* |5 a# y8 {" p8 ~( a& M
  82. module_param(acnt, int, S_IRUGO);
    5 ~9 `6 @$ H, e3 W" ~1 ?' n
  83. module_param(bcnt, int, S_IRUGO);& s% U5 e! @, L$ L, T0 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 F- a1 `# m' H9 Z5 g3 G, G! N! o

  ^9 |5 o3 ^" B( Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ a0 k6 @1 U; X& Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 p: j. D; @. e/ W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ g( n; c* q) H( n

) s6 {: }+ Z% ^: u1 I7 [# C! ^
" F- I# E& k* a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 12:03 , Processed in 0.036650 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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