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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' g& g- v% k& |1 J) J* n  O
  1. [code]EDMA sample test application$ t* d$ V4 x; ]
  2. /*: M7 {, P1 v3 \" O
  3. * edma_test.c8 V- t0 a* C  r' P) P; H
  4. *
    * J  u1 V* Q5 Z1 h3 _
  5. * brief  EDMA3 Test Application, {  q+ U; ~. m9 W
  6. */ C0 V, B  {$ e; J9 l3 n$ l
  7. *   This file contains EDMA3 Test code.
    , m' J' U# x9 p5 F2 k
  8. *2 J. A' `" F5 ?( A$ M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; r3 ^! H$ T+ F0 M1 m) x: q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! C' G/ ]$ j4 b4 c* j% c. s
  11. *         TO CHANGE.4 X- ^. S. j  Q9 F" M
  12. *
    ) U5 O0 @, u% B6 x8 k( E8 D& }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( s* w. p. c+ ~# W3 O# c
  14. *7 l4 k9 D) L" ]. R$ k
  15. * This program is free software; you can redistribute it and/or
    6 t: |8 _' W9 h
  16. * modify it under the terms of the GNU General Public License as* A  U  ^- Y  u4 ~/ ]& z. s6 G# S
  17. * published by the Free Software Foundation version 2.& x4 f% }& T  k. S( s  L
  18. *
    4 r7 @" y3 \. G: i4 q3 ~8 y, m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( \! g* ^2 b5 F! i- t8 ^9 k# c
  20. * kind, whether express or implied; without even the implied warranty. M/ l; C/ X* \8 B' [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * r$ O( c7 A: u. c
  22. * GNU General Public License for more details.
    / B6 }3 ^6 \) W2 ~. |  i
  23. */  r7 v. ~5 S" w" p" R7 W7 N

  24. 3 m& P+ Y! ~9 W" ~) ?
  25. #include <linux/module.h>+ D' j3 B. k3 u4 p/ r  l6 m( f
  26. #include <linux/init.h>+ b* o8 s; L3 P8 P
  27. #include <linux/errno.h>1 I0 t9 ?6 `9 i. C* x
  28. #include <linux/types.h>! p5 ~. S/ k" b" t* r  b. |" I1 G% P
  29. #include <linux/interrupt.h>/ \0 M4 l, t$ M9 N: }4 J
  30. #include <asm/io.h>
    " K2 X' }( d# B" A( ]5 b4 m0 y3 |
  31. #include <linux/moduleparam.h>
    + v9 Q3 B0 Z0 l
  32. #include <linux/sysctl.h>* s. U) ]- k0 z2 C
  33. #include <linux/mm.h>
      B. o- o' Y, _
  34. #include <linux/dma-mapping.h>1 C9 }1 y, m* J  u0 c( }

  35. % g- b0 k2 F- r
  36. #include <mach/memory.h>
    4 f! r& x* O0 f5 _8 ^* W8 l
  37. #include <mach/hardware.h>
    . s$ R8 ^6 i, f& _  [6 K' t( ]) m- C. B" u
  38. #include <mach/irqs.h>- G! g8 `; R& |2 \  R* ^
  39. #include <asm/hardware/edma.h>
    . j/ h, g* \7 O# R4 {2 P( T) w  F

  40. ; p1 V& {+ t9 T
  41. #undef EDMA3_DEBUG5 K9 c- G" F- K# Y3 A* Z
  42. /*#define EDMA3_DEBUG*/
    " t5 ^! j8 A5 F4 @  U6 A6 `1 A

  43. 2 y3 ~2 @8 G# X" Y( `. K
  44. #ifdef EDMA3_DEBUG
    2 ?. Q) u) m' L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( D0 I0 A2 x$ \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 A; g  [# T& T1 w- l$ c0 g# W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 q9 r( o: E# Y( ^, h) {
  48. #else
    * H2 X1 f. g) F1 }* `1 m
  49. #define DMA_PRINTK( x... )3 m4 p0 X$ G+ A
  50. #define DMA_FN_IN' _8 i* B$ b* O! e7 S3 b2 G# D5 ^1 o; U
  51. #define DMA_FN_OUT
    0 v- Q3 q/ e- U, p$ `. E
  52. #endif
    0 D. u, z- u0 {! R$ I. ^( h3 s" }

  53. 2 k: Z6 ]' E5 p, h$ L2 ]) |- t# d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 ?* E- A/ J9 P% I
  55. #define STATIC_SHIFT                3
    & s4 X6 V  M. u5 i8 K  _4 D
  56. #define TCINTEN_SHIFT               200 f) ]1 w4 ?- V, k, Z+ X
  57. #define ITCINTEN_SHIFT              21
    * L; d) R, L; W( s$ L
  58. #define TCCHEN_SHIFT                22* O  L1 @: A9 y) d- f" g4 d) L
  59. #define ITCCHEN_SHIFT               23# s! s0 r+ R! z/ |0 y4 r% H2 ]

  60. + @  q) D. X+ _& k. N) y- J
  61. static volatile int irqraised1 = 0;, m1 g2 f9 P* G2 A) ]
  62. static volatile int irqraised2 = 0;* [5 ^0 X4 ?) A* O8 {$ ~, M
  63. 3 {7 K2 k$ T" y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 n* V7 l6 A8 {7 i+ I# m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 X' \  G) o9 O7 e1 Y4 Z: [3 f6 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 e8 j- d9 q: R  s4 F. H) u  T; i

  67. 0 j: V+ l+ u$ `9 `" Z8 P; e+ s- v
  68. dma_addr_t dmaphyssrc1 = 0;
    ' ~$ z4 S$ P1 m3 Q2 o8 ], }
  69. dma_addr_t dmaphyssrc2 = 0;% p' S4 O+ j) y* r
  70. dma_addr_t dmaphysdest1 = 0;) j1 d' f: s% G, X- _$ g# s1 r
  71. dma_addr_t dmaphysdest2 = 0;+ ]" F! O/ S# w% o

  72. 8 Z7 U  Z- A3 g$ }$ M
  73. char *dmabufsrc1 = NULL;
    " o+ Q; ?9 Q& C( [" ^, e; G
  74. char *dmabufsrc2 = NULL;' x5 B+ d8 ?. b
  75. char *dmabufdest1 = NULL;
    + M8 a# P- d4 D- ~6 [9 i" D8 W+ R
  76. char *dmabufdest2 = NULL;
    7 c- Q: E  \7 s, p% M7 ]

  77. ! L; D: d! {7 K7 H
  78. static int acnt = 512;' L/ [& p, S& B4 I
  79. static int bcnt = 8;6 q7 g+ `6 \, d# F
  80. static int ccnt = 8;3 |) {2 s! i: F$ k+ B6 q
  81. 7 o5 d; t5 C$ _6 x
  82. module_param(acnt, int, S_IRUGO);7 B9 H1 s' x. `' D
  83. module_param(bcnt, int, S_IRUGO);7 L" s# H+ W. v% }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 W. `$ f, v/ @+ \+ G) h
& X  ?( e9 R5 n/ A. i, K( h/ k& N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- b5 x& [- b  _0 y7 h  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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ y* y) s- x3 d  t; H! f- g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  a, n* o, v4 V' D' D7 Y9 `/ @2 z
- s( b4 a& L! t8 E  T- A# O; \+ P6 P8 `% v$ n( A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-29 19:51 , Processed in 0.045727 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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