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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , N% R: q0 a5 K& A  [: A3 Z5 W  u
  1. [code]EDMA sample test application* g& T6 R4 ~/ y# T! ~# R  x
  2. /*  L( Z: l! K6 e- _8 ~7 t& `# Y
  3. * edma_test.c2 q5 D5 y0 _% T) J
  4. *  R/ [0 U1 p) j' B, k
  5. * brief  EDMA3 Test Application
    $ V" {' m/ i7 E: S9 ]" S
  6. *& u. G2 T6 z4 t
  7. *   This file contains EDMA3 Test code.
    ! c: D$ M+ ?5 r8 _
  8. */ @! O! x- l- w4 j* l5 _/ a$ y4 o0 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 C0 a: L2 i2 {# q3 Y$ h7 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + A7 C# }( L7 l% \
  11. *         TO CHANGE.
    : O  E' m( |  ^9 b
  12. *4 x5 r9 G: S8 b& r: @: p( K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 D+ P$ W: r: H3 O7 b
  14. *: ^$ ~8 x2 B, T, b7 A) J. h
  15. * This program is free software; you can redistribute it and/or# ]% v. Z+ w) x+ Z) V
  16. * modify it under the terms of the GNU General Public License as
    * O  \9 R' M) c+ t) J; g
  17. * published by the Free Software Foundation version 2.* d9 v: f* s' w  Z# n' e9 n
  18. *
    8 j$ w' o4 a) K( ?3 V% m& R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: Z4 u% o3 t$ D  W8 E
  20. * kind, whether express or implied; without even the implied warranty
    - z7 h2 W( ?" W( R- K+ p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * V9 l; o; B" k9 h2 R/ c$ t- q+ i0 A
  22. * GNU General Public License for more details./ V3 H/ u  n% D/ f  s
  23. */
    ( e# f) i1 A5 W( s/ z
  24. + I+ i) F; r4 a$ c; |0 |, p- G$ m
  25. #include <linux/module.h>5 y( W3 q! m% @
  26. #include <linux/init.h>7 i% ^/ Z3 ~8 u, c. k2 w% W
  27. #include <linux/errno.h>" r0 @. A3 m) M$ _4 P& \
  28. #include <linux/types.h>$ J: B9 {2 f; ]/ \9 I( `( r  |
  29. #include <linux/interrupt.h>
    2 q/ h: R5 \3 F4 G7 z% q- k3 Q( l, ]
  30. #include <asm/io.h>
    5 c  O3 F$ o( e
  31. #include <linux/moduleparam.h>
    * C/ A+ y! `9 _0 U$ f1 w
  32. #include <linux/sysctl.h>
    . P6 g3 o* V0 e) x' U( L
  33. #include <linux/mm.h>
    # y/ R1 l! a  F3 ?
  34. #include <linux/dma-mapping.h>6 c# P* O* i2 @$ J( k! T
  35. 7 j. L2 n9 ^# M9 n, O
  36. #include <mach/memory.h>% L' D- ]/ J% o' b: E
  37. #include <mach/hardware.h>, U, o% k9 i! ~4 ^7 e( A
  38. #include <mach/irqs.h>
    3 G9 }4 Y, Z6 v8 e/ P4 }; x
  39. #include <asm/hardware/edma.h>
    8 x/ z" f8 V. W0 D2 t6 ?

  40. 2 y! Q1 G! z6 r8 Q; ^
  41. #undef EDMA3_DEBUG4 ~6 b. R7 @6 _8 e7 Q- M
  42. /*#define EDMA3_DEBUG*/  r+ p+ @  R# @2 r

  43. 7 Q) r; i! s7 W) U
  44. #ifdef EDMA3_DEBUG
    ) J' I, G8 U* v; `4 Q; ?. s4 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , F$ H. X: C+ s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 x' E' x9 {, c* o1 b4 n$ ]. `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - M$ P1 T1 Z4 w7 ?" y5 l$ ^
  48. #else
    0 [0 Y4 `6 q9 E, p, r* ~
  49. #define DMA_PRINTK( x... )1 _# ]% Y; U, d/ A3 i- Q
  50. #define DMA_FN_IN
    3 _: W; s6 s0 }0 f. \! d1 M/ x. E0 }
  51. #define DMA_FN_OUT
    1 s% ^1 O4 H. v$ w) O- T  v
  52. #endif; y7 f4 u# _3 [% [* k: ^3 {" h
  53. ( V* e. @% Y  z  I& Z7 ?' A9 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 ?, _0 r$ S4 T( S: z) ?9 B
  55. #define STATIC_SHIFT                3* H2 L! ~( P, l
  56. #define TCINTEN_SHIFT               20, X6 X) [( t; p$ ?) x/ s& x
  57. #define ITCINTEN_SHIFT              21
    $ m/ r8 C& L0 k1 K& b
  58. #define TCCHEN_SHIFT                224 M* A' N$ C8 Q1 A) k
  59. #define ITCCHEN_SHIFT               23  b: N) {9 A: w4 I- j1 f

  60. 7 g) T9 F8 H  s( [  _% q
  61. static volatile int irqraised1 = 0;; M2 _! a, j1 z- x- b
  62. static volatile int irqraised2 = 0;# [1 M( m5 d7 f: L+ t; L
  63. 1 r9 }& V/ n" R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% g& v; B! J, [: o4 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ?# y. p# }, |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & E" J) H) ?, u8 Y% T7 a

  67. ) s  w3 L( @2 q6 O; m
  68. dma_addr_t dmaphyssrc1 = 0;
    ! L- o7 j6 x  h# Y: y* i; B
  69. dma_addr_t dmaphyssrc2 = 0;
    4 l% R9 l4 u. h6 H
  70. dma_addr_t dmaphysdest1 = 0;, t: R$ |/ G5 C  L
  71. dma_addr_t dmaphysdest2 = 0;
    5 ^: S, s; X9 h! _- K3 h
  72. ; J( b1 J0 ?  x5 |3 @' _5 H
  73. char *dmabufsrc1 = NULL;* d# C5 S) S9 ]) a9 S& |
  74. char *dmabufsrc2 = NULL;; i) x9 k" Z; }' l
  75. char *dmabufdest1 = NULL;
    : \% j# Q! {; ?
  76. char *dmabufdest2 = NULL;$ J2 s: x1 @- d" b
  77. ; r! O! b9 z8 M! [( }8 a+ J) o) c
  78. static int acnt = 512;
    : q: y, |9 P3 I1 ~% e, P+ h; d
  79. static int bcnt = 8;. n. T$ b0 l. n4 @( L* b
  80. static int ccnt = 8;
    . ]; L+ w/ m9 k  j( ^2 `
  81. 0 y# y, _/ t: {8 n6 t) b, q; j' ?
  82. module_param(acnt, int, S_IRUGO);& H! {* F4 a. o5 }. w/ \) p. _0 A
  83. module_param(bcnt, int, S_IRUGO);; M4 |% k; r! X9 ^3 k) ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! P/ l) {6 N8 I8 @  J

  G% K2 k! S$ |- t6 L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: u$ x! C/ C2 e- S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ w! F7 A6 Z0 K# X: H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 x* d! d! E4 e& P8 W3 z1 q# F; t

( R/ r" l# B& Z2 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

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

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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