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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 @+ C, Z+ ~! Y8 Q$ z9 k$ k6 u
  1. [code]EDMA sample test application- c" Y6 y" Y; B& l9 Q* P
  2. /*) L# Z& s" x' A! h5 }
  3. * edma_test.c3 W- @# t" B# }5 \; E' Q
  4. *
    & b7 M+ X7 Q7 J% ?3 z7 F
  5. * brief  EDMA3 Test Application/ @& J# k1 C; v8 }  l5 I
  6. *3 m8 _. c! b1 ~# A; k* q! O
  7. *   This file contains EDMA3 Test code.
    % v6 m, t4 B- U7 B9 G1 ]9 E
  8. *
    $ q* F% Q* i% V/ ]( U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- t; A$ x$ T7 p9 N* A6 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % K( G# D- W# R" E  T) s) A( w
  11. *         TO CHANGE.
    8 D! Q  h( H3 a9 C/ C# X) y5 _* s
  12. *
    % _/ M8 a+ [. K$ d9 ~, d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ F6 V6 B  U$ |
  14. *
    - P* Z* R# G+ R$ r
  15. * This program is free software; you can redistribute it and/or
    7 D' u' J3 G! \7 H+ N, k7 W
  16. * modify it under the terms of the GNU General Public License as4 D% {+ R+ _, l. W+ e, H; w: P
  17. * published by the Free Software Foundation version 2.* |1 a+ d- O) X: }* r2 E  `
  18. *
    8 _* u* `* f3 y! u9 @% _( {! U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 K6 l* b! ~' V0 K* ?
  20. * kind, whether express or implied; without even the implied warranty' b1 x4 {0 C6 F2 f  W4 y1 r1 o1 P% E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( r3 K$ i7 r# r+ n2 y
  22. * GNU General Public License for more details.# H+ c2 ^; `# E
  23. */3 _+ g4 d1 q1 }) N0 g: K
  24. ! K$ O; y; D: G5 V
  25. #include <linux/module.h>/ ~8 h7 |+ |! j4 q' o& y  s1 w
  26. #include <linux/init.h># _. ]/ ~& T+ T8 G$ j
  27. #include <linux/errno.h>9 ?0 R) {1 Y9 W5 e7 V& y1 H+ f$ `
  28. #include <linux/types.h>8 h! m6 ~) h1 d
  29. #include <linux/interrupt.h>1 N( z2 K' R4 e2 }( u4 l. i! S
  30. #include <asm/io.h>% d/ Y8 A- U, s- g
  31. #include <linux/moduleparam.h>9 ^' v4 e9 C2 e$ f4 w: e% z6 w  \' `
  32. #include <linux/sysctl.h>4 ^9 ^- [* J! R* x  _0 V. P+ f
  33. #include <linux/mm.h>. z  ?; r/ a( ~4 L1 R: B. r& d. k- S
  34. #include <linux/dma-mapping.h>+ m0 K; m5 S. q) i  b

  35. 8 a: E  a. {) N$ V6 W5 U; u
  36. #include <mach/memory.h>; P' I( M' l; W" u* J7 q2 [8 t2 @
  37. #include <mach/hardware.h>: _1 r) p9 L1 }- {$ H+ h
  38. #include <mach/irqs.h>! _" j! U4 p9 h/ N& l6 z
  39. #include <asm/hardware/edma.h>
    ; i" h: j& v8 l

  40. + x0 ~% r4 w, ~) ~) A1 b8 l2 {
  41. #undef EDMA3_DEBUG
    9 t* v; s' I& N' V1 o2 S+ \7 x
  42. /*#define EDMA3_DEBUG*/5 L2 g) _) J4 F
  43. ; I6 R( @+ g+ x' x0 z
  44. #ifdef EDMA3_DEBUG
    " }) W% J6 j" o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) n5 H( Z7 x# h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  y! E0 _  h/ [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( \7 S2 X% L! n% [. m
  48. #else
    " n9 X& M. V9 N
  49. #define DMA_PRINTK( x... )
    % z/ S! k, H: P# X# J1 \$ A$ ^- G
  50. #define DMA_FN_IN2 B4 V* M: O  ?6 {$ E+ f7 H& `, u- t, b
  51. #define DMA_FN_OUT
    ) a! L: S" S5 [( G$ t% I
  52. #endif/ A" r2 A, L: ~) X, _0 n2 C

  53. * J# n0 U3 e2 L! T- g! w  x" K0 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 c3 t$ ]7 q: M
  55. #define STATIC_SHIFT                3" ]9 r2 @8 t, s! u% l7 n- z
  56. #define TCINTEN_SHIFT               20, D: E& ^; g# T' P. B6 ^% j
  57. #define ITCINTEN_SHIFT              21
    $ L) N' j8 W  N; l3 A4 D
  58. #define TCCHEN_SHIFT                22
    2 x$ {4 I8 @6 ]0 W. H$ c" j
  59. #define ITCCHEN_SHIFT               23" ~2 A/ |8 X" K+ ^

  60. " L- p; ^: Z; R/ w8 E
  61. static volatile int irqraised1 = 0;$ h5 H6 R! n; G4 X9 X" {
  62. static volatile int irqraised2 = 0;
    % V. n  n& z* u4 o: z

  63. ( w1 ~3 {+ c# i8 i7 o; Y1 i* p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 I' d% S% I" S+ n/ o# ^- C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 r) L  k0 p" X8 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 x2 n  v" n( l* q
  67.   ~' u0 \- ]9 O9 j) w$ k& ?( b3 E
  68. dma_addr_t dmaphyssrc1 = 0;
    0 [# ~- L# F& j6 Q7 n5 m
  69. dma_addr_t dmaphyssrc2 = 0;5 x( q, q  c: a# Z+ A4 g
  70. dma_addr_t dmaphysdest1 = 0;2 Z" b6 g* g1 \$ F' k* t1 F2 k' G% N
  71. dma_addr_t dmaphysdest2 = 0;
    1 b: A( I! H* m3 C

  72. 3 ~5 Z* Q6 F" j' w8 i+ r4 x9 M5 J
  73. char *dmabufsrc1 = NULL;
    ) |" H/ a" R3 q( F
  74. char *dmabufsrc2 = NULL;
    - r) t6 _9 c9 @0 X' n7 X
  75. char *dmabufdest1 = NULL;& l# G/ t2 ?' O' o7 f! T8 [& X
  76. char *dmabufdest2 = NULL;
    / V( J5 q% n% ?3 w, B2 C

  77. 9 T" Q2 @, F7 {: b2 Q
  78. static int acnt = 512;
    ( L6 {& K4 [8 |6 B# \. l' |
  79. static int bcnt = 8;
    6 b6 s8 v6 a/ j) H. W
  80. static int ccnt = 8;4 Y+ P% [" N7 m9 m0 `& @
  81. ) [8 s/ ?3 J1 i: D, p: e6 d
  82. module_param(acnt, int, S_IRUGO);
    & ]# v# b  v! N5 B
  83. module_param(bcnt, int, S_IRUGO);
    ) p/ ]1 Z  r3 f( `5 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 ?  Z6 J: l# y6 [# L) B; K5 _8 f1 w, |/ d) L* ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* g0 V$ X' @8 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: O0 Z: N. z3 r5 C& R+ W; X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% Z. c) b* n" z& a3 W
0 S, i4 U1 n7 V( ^( {% H. d
6 @( O1 g$ |3 z" p( k, Q2 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 05:45 , Processed in 0.039723 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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