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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% o5 B$ v8 X. v7 O6 m" g
  1. [code]EDMA sample test application
    3 d1 Q: \, G, y$ Q" E$ t/ N
  2. /*, G: g+ K' [4 v$ \; M# |
  3. * edma_test.c; a0 \% e/ L* E% ^: h$ a; D
  4. *2 W4 C: Q$ D& P& V# K
  5. * brief  EDMA3 Test Application
    % |4 F7 u2 r2 N, ~) `+ w1 D
  6. *
    * `& b. w! R  m
  7. *   This file contains EDMA3 Test code.
    1 `  _7 _9 Z4 k7 h3 X
  8. *
    " r5 l0 A% W1 M. n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . z, K: z6 k9 u& u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; w' X/ z0 _) }2 E; P
  11. *         TO CHANGE.! g* A( {% M6 e$ s1 l, [
  12. ** W/ U# o/ O. Y: u! e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * x  U. L' M. E& Y' V
  14. *
    , o& f! K" d, j* T0 c
  15. * This program is free software; you can redistribute it and/or
    ' _* c1 x/ x$ B2 K+ h
  16. * modify it under the terms of the GNU General Public License as
    6 V/ u# M! `3 `7 x7 o& G# }& Y
  17. * published by the Free Software Foundation version 2.
    " U* A- _/ A% R5 B4 }) k) v
  18. *
    / i/ R# {4 }/ n! c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 J- }3 |5 v- ?) r4 n9 j
  20. * kind, whether express or implied; without even the implied warranty2 _9 [& T6 m  u4 q6 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) w% A# z2 u3 O$ B% b
  22. * GNU General Public License for more details.7 h) p- {- V- f2 {6 Z
  23. */% \3 [& [  E! L) _4 r, q

  24.   z; h4 r: d) M" {' I2 Y' g
  25. #include <linux/module.h>
    % {" c! _, ]0 _5 r. N3 \
  26. #include <linux/init.h>
    " U- p: K) J- X& q5 @! j$ Y3 a; D
  27. #include <linux/errno.h>( ]' s" ~8 O4 l9 |* ]
  28. #include <linux/types.h>
    ' V0 N- @% S' X% U, S1 b) |& a
  29. #include <linux/interrupt.h>
    9 d6 M7 r" J% T" b- c% E5 ^% J; v+ O; ]
  30. #include <asm/io.h>
    9 j+ |( f/ S" J8 M3 q  d2 F3 @) N
  31. #include <linux/moduleparam.h>
    % T9 E3 s" A" X/ M$ O& h9 _
  32. #include <linux/sysctl.h>
    8 g  r' X9 N8 m! C
  33. #include <linux/mm.h>4 q8 m+ T4 N3 ]6 m2 z1 [* \
  34. #include <linux/dma-mapping.h>
    $ r9 @' B9 m) H- h" V5 C# |
  35. ( e# E8 Y7 Z0 X  J
  36. #include <mach/memory.h>
    5 E. q5 |+ g6 G; d8 U& S- @- Y' `+ @8 x
  37. #include <mach/hardware.h>
    ; X9 {# s' c& j. R9 F% h
  38. #include <mach/irqs.h>
    ' B3 N) S0 J2 H. G% R, g7 x8 p1 Z
  39. #include <asm/hardware/edma.h>1 }2 D# U3 f# `
  40. 0 X& f. r8 p6 L2 x) F
  41. #undef EDMA3_DEBUG
    ! q% T( f- z) N
  42. /*#define EDMA3_DEBUG*/
    2 t$ H' I& g" E9 U( n

  43. 1 Y1 O1 y2 |. s) {
  44. #ifdef EDMA3_DEBUG
    5 v- O9 Z/ u! N6 q4 [: s, ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 E* v- v& j% z8 I2 f, U6 l* A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 S4 v% v7 i: l( F/ B& P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) j6 g* ?3 S  w+ ]* n
  48. #else
    0 S" Q* r. k% g- Q  Q
  49. #define DMA_PRINTK( x... )9 d6 F1 j/ K+ j9 H( v
  50. #define DMA_FN_IN3 X* ?8 x: U/ v, `) ~6 z7 B9 I" A
  51. #define DMA_FN_OUT
    $ Q0 M6 \+ }* D
  52. #endif7 P. |, \: ^5 F2 d
  53. % u. b& E; }2 O7 ?: S* K; ~3 L8 J5 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). l) K: V* s4 R4 \, u4 n
  55. #define STATIC_SHIFT                3
    # v5 B0 _8 H& z: S
  56. #define TCINTEN_SHIFT               20
    5 Z' V0 J& F0 ~- w/ ~
  57. #define ITCINTEN_SHIFT              21% c/ m( A1 t' \* O6 c
  58. #define TCCHEN_SHIFT                22
    * j* P" a. c8 A- I' Q
  59. #define ITCCHEN_SHIFT               23) `; y" |/ \' Z, E; ~* o# ~6 ]
  60. 9 L9 ?3 W9 q+ r' H4 H  q  C( Z
  61. static volatile int irqraised1 = 0;9 d, B: g+ m4 ]6 ~! Y, z. a
  62. static volatile int irqraised2 = 0;% U* P9 ^4 {( ^8 h
  63. ) g' j- C8 x8 o! v3 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 q  X, M) _) x) O* O* v" w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ K- `- U5 ]3 a7 w7 z7 a0 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& m  f) h, `; ]( H) }0 H* @/ b" n

  67. 0 z4 d& a7 w, U  o5 Y" L# I$ O2 {
  68. dma_addr_t dmaphyssrc1 = 0;1 T' o) r7 I5 Y! N$ U" `
  69. dma_addr_t dmaphyssrc2 = 0;
    0 I* t* K1 C% Z3 j1 a9 Y% q: \# J
  70. dma_addr_t dmaphysdest1 = 0;
    : A' h. Q7 u1 u) ^1 s4 B
  71. dma_addr_t dmaphysdest2 = 0;) H1 b9 f2 u, E$ t

  72. ) [/ o2 \3 f$ O) \+ Y
  73. char *dmabufsrc1 = NULL;
    " E0 P& z6 |4 Z1 |
  74. char *dmabufsrc2 = NULL;* [+ Z8 V4 j. _0 r# K* ?" t
  75. char *dmabufdest1 = NULL;# q' C. n* m9 O  Z3 f( }
  76. char *dmabufdest2 = NULL;
    0 {% Q9 ?' s' F8 A. K9 x

  77. 9 O" z0 P( k5 z6 f0 T+ n
  78. static int acnt = 512;
    * l! L; @7 i# ?6 B4 ^; i8 f
  79. static int bcnt = 8;: j, }' p9 ~& v* L2 s' P
  80. static int ccnt = 8;, V( v* R4 \4 x" y
  81. 0 X* W& y6 o  U
  82. module_param(acnt, int, S_IRUGO);
    2 u2 z' a8 U' G8 y9 z4 d
  83. module_param(bcnt, int, S_IRUGO);+ Q" w' W3 j% O* C! K, x: t& |1 Z# A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ s; J& I% m* c/ x; G) ~+ K. b1 K6 s, L0 r4 s' G; D' N; U! J# F' P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& Z5 ]6 y% }5 h8 X3 G7 E4 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 Q9 f4 e+ E. _3 S% a. D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! E  E4 A! l( s. w
- p8 s+ I* z9 l' {& a  X5 C

9 @: ^( z+ i. V9 F" R! J9 v8 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 21:52 , Processed in 0.038897 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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