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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 H+ R) f% \( @8 b; H) [& t
  1. [code]EDMA sample test application- H. v( u( U6 x6 x2 y# ?8 ^
  2. /*, N  E6 v+ d2 _( ^  y9 s: L; m
  3. * edma_test.c
    / U* k+ ]) w: t7 B' |% Z4 d0 z7 E0 p
  4. *
    " r6 u# s3 |1 y9 k& T3 U* @# G
  5. * brief  EDMA3 Test Application# t$ {3 |; d* f+ b
  6. */ ]* x) K% Y+ q5 ^. I; v
  7. *   This file contains EDMA3 Test code.. U" n- ~  Y" T( w# J7 q
  8. *
    * c7 U2 v: J( I0 R. }) I, h! ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* z: j# {0 `# v: E6 j& h& X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, l: x3 O6 {. t4 ^6 b
  11. *         TO CHANGE.
    2 l  h3 \: t: D( O6 m( a
  12. *6 P9 }9 x9 ^3 K' @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 V8 b9 `( x% T
  14. *
    + `9 ?3 C. g4 m0 u/ z
  15. * This program is free software; you can redistribute it and/or6 ]' H' ?# T/ R: k3 k+ ]
  16. * modify it under the terms of the GNU General Public License as' o; ~* v  X4 E6 r
  17. * published by the Free Software Foundation version 2.
    ! w3 \* T  H% ]& u$ }/ {
  18. *- T4 y# Q: y: s( H$ e. B5 ~8 Z/ Q( K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' u4 S: V! c  U. o% x: r8 Y6 ^" Q
  20. * kind, whether express or implied; without even the implied warranty# }  a# H' i( S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * E; w  t9 e0 u
  22. * GNU General Public License for more details.7 V0 ]; `( }  B8 o! R  h
  23. */  p7 k, R% \7 v9 }7 y
  24. % K  R' @# C2 K6 A
  25. #include <linux/module.h>
    2 q$ y& J  s) g* B0 t) Y
  26. #include <linux/init.h>
    ! X2 w" b, c3 [# j- Y) U/ |/ ]: {
  27. #include <linux/errno.h>. |& a( |( H! x; T& [
  28. #include <linux/types.h>
    0 _' g; I* j$ Z' U
  29. #include <linux/interrupt.h>7 W, d0 h, a4 k6 \* y! X# @0 b
  30. #include <asm/io.h>9 S6 z* J6 D8 b+ b
  31. #include <linux/moduleparam.h>
    9 c) V4 Y9 v2 R6 \
  32. #include <linux/sysctl.h>
      Y& P9 ^% W( D. r0 G  m0 w6 l
  33. #include <linux/mm.h>
    ; U: @  O, y  p9 b' \9 o3 n) A& ]
  34. #include <linux/dma-mapping.h>
    * I/ @; y  [  s( ?, i' v
  35. / X& U: u8 |0 n3 d
  36. #include <mach/memory.h>' X/ p1 P7 N8 }, V
  37. #include <mach/hardware.h>
    2 W' Q/ b* L; h- y6 [8 i5 F6 c
  38. #include <mach/irqs.h>
    % k) D4 A  L, F6 |
  39. #include <asm/hardware/edma.h>- j; E/ `; ?) |3 h: y. q: Q
  40. , j  h, s  d9 f( [6 k# H! b- J+ g
  41. #undef EDMA3_DEBUG/ F$ c! Y5 G% S' D
  42. /*#define EDMA3_DEBUG*/
      [. o& U' T! C# g

  43. . r1 D  |% Q7 D3 o0 n4 _
  44. #ifdef EDMA3_DEBUG0 @8 g( ]+ \7 ]9 S. z: m$ A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " Y- J* `9 @& Z( s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      `, s* t, Z' j* ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % U4 c% m; j8 M( J( `5 i7 ?
  48. #else
    ' ]( ^5 }3 S$ P4 \" ~5 R
  49. #define DMA_PRINTK( x... )
    . _6 ?- v2 l1 T$ k* @$ p
  50. #define DMA_FN_IN& i! M. r) H9 e8 B! o
  51. #define DMA_FN_OUT
    & U8 [) P/ V, R- H# ^
  52. #endif" L, n) h) T- l: C

  53. / P* i& M3 y  L0 ~9 `# ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 F* C/ K, k2 _2 y/ \; e6 d# n
  55. #define STATIC_SHIFT                3
    " ?) K4 y6 p  H+ R8 A+ B. l- L$ t/ L
  56. #define TCINTEN_SHIFT               20! |* v3 W' b  Z* n/ J) c# J! U
  57. #define ITCINTEN_SHIFT              21
      W' o4 m! J3 W! h, b
  58. #define TCCHEN_SHIFT                22( {" M) d: \# [* w
  59. #define ITCCHEN_SHIFT               23
    & `1 q" d3 |* a$ l. R

  60.   y) A' L. l4 H* d% M) L" P
  61. static volatile int irqraised1 = 0;( b: z: y6 V. Q2 l  v2 `
  62. static volatile int irqraised2 = 0;
    + M  j6 N: \8 k# D' {+ o+ N. v
  63. 2 p- B+ `7 S# Y0 J* ?- d& Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 B# P) m' \; H8 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% {" p1 O" X9 M2 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: u  K: A% P; ?% c1 N
  67. & @! b' W' x8 `; k) ^) L
  68. dma_addr_t dmaphyssrc1 = 0;8 |+ \# q- k& S6 Q2 |
  69. dma_addr_t dmaphyssrc2 = 0;" T5 w6 M: \6 [' o
  70. dma_addr_t dmaphysdest1 = 0;
    $ m* _) e9 k+ ~! Q) t7 |! {
  71. dma_addr_t dmaphysdest2 = 0;
    4 K, Q, H6 C. Z8 g( K# [

  72. , M: n( x5 q+ g: `
  73. char *dmabufsrc1 = NULL;
    + I' |8 T+ r! O3 d, M! M
  74. char *dmabufsrc2 = NULL;
    $ K/ A% h, Q2 _3 }
  75. char *dmabufdest1 = NULL;9 |& A5 o; o. a9 T4 t+ `
  76. char *dmabufdest2 = NULL;( p. t" _- Z7 }6 E0 r" B$ o

  77. # I2 n% m) g$ `
  78. static int acnt = 512;8 |% [  F1 a" l# N, }  }5 |# q8 w
  79. static int bcnt = 8;
    ; L6 ]( s5 n9 x3 j  f- q0 v# e
  80. static int ccnt = 8;  s( m. i5 K6 T7 r0 L

  81. 7 ~4 s; E' f* K" x; z) l/ [
  82. module_param(acnt, int, S_IRUGO);' w6 Y4 x5 r) j0 G
  83. module_param(bcnt, int, S_IRUGO);
    4 p4 `* g6 m2 |/ f( w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 |$ B) \. `% X

  b3 ~; p  ~: C! {- q3 X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) S4 y& ?0 B) m1 j3 s8 Iarm-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 g( Y+ @1 c  `+ S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 E2 o& i4 \3 i9 S: p
. K$ s, f1 W4 O6 h4 K! m+ I1 R# j' M1 e3 J: c- o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 08:33 , Processed in 0.037958 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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