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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 R" C  R4 r$ H8 F! U
  1. [code]EDMA sample test application
    2 d. W1 A9 M5 t1 P7 X% t5 q
  2. /*
    ! u* H1 X0 W( s" |
  3. * edma_test.c& l, q" x- X% e, J" |
  4. *
    * m$ ]4 O% A9 Y
  5. * brief  EDMA3 Test Application
    ( a% k/ d5 w! `  v1 \1 h; w
  6. *
    " H1 s2 i4 X1 {9 p
  7. *   This file contains EDMA3 Test code.
    1 c7 A; G8 y& V. b( ~7 |9 n% [
  8. *5 ?* }1 o/ s4 h$ G7 y7 o0 a/ D, T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & [8 U, @' d9 M! \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 X% V% c, j) ?* |; r
  11. *         TO CHANGE.
    ' R+ t9 [3 k2 Q9 K
  12. *& ?- c/ x% n7 ]4 u* `( S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 Z8 o/ U, O2 i: Y4 i1 \
  14. *4 N, B5 K& d6 u8 r3 ]% N
  15. * This program is free software; you can redistribute it and/or6 d- q3 K9 f( h6 D# E8 R- ^1 x' _& Z+ l
  16. * modify it under the terms of the GNU General Public License as3 r7 U4 P/ X+ l4 c, G2 k" @5 o
  17. * published by the Free Software Foundation version 2.
    5 m8 p3 r1 y& |; d8 N- a- p* A
  18. *
    1 A7 l% j$ m3 i6 q1 \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; j8 C2 ?% _# k
  20. * kind, whether express or implied; without even the implied warranty
    % x* D$ }$ W9 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) Y- o7 s6 E/ F
  22. * GNU General Public License for more details.
    + Q$ i0 O+ g+ `$ j
  23. */
    ' e5 i# g8 r# O7 I
  24. 1 B" c3 B+ o% Y3 l  K
  25. #include <linux/module.h>
    % }, Z+ {/ U) ~. I$ x
  26. #include <linux/init.h>( }) ~! u- ^# r) o' Y
  27. #include <linux/errno.h>$ g, G8 i- y1 S1 S. x! @
  28. #include <linux/types.h>3 b2 W; u* p! u& U4 @2 C5 `
  29. #include <linux/interrupt.h>; [% Z  i. k% F' r6 x
  30. #include <asm/io.h>
    - x; E9 G" Z1 e) P$ Z5 e
  31. #include <linux/moduleparam.h>0 @% L( _5 x3 n$ n2 {( M
  32. #include <linux/sysctl.h>) E- c1 F) c# B. m6 A+ B( |) P1 C! ~
  33. #include <linux/mm.h>
    # R+ ]3 g- M# t( z
  34. #include <linux/dma-mapping.h>
    / ?- a4 r% A5 C3 X7 ~
  35. $ U4 ~  v9 U- q* I
  36. #include <mach/memory.h>
    6 H8 m! }9 w. Z4 h" j
  37. #include <mach/hardware.h>3 q( P: t7 r/ B
  38. #include <mach/irqs.h>
    0 Z7 S# E3 j: o- K3 h- L; `
  39. #include <asm/hardware/edma.h>
    5 _9 r2 G0 R+ [# X/ [( J% n+ U$ D! z4 o

  40. . D8 }: ~& `/ x1 i. a+ i# p6 t
  41. #undef EDMA3_DEBUG
    ' W1 G$ U2 r- C; W
  42. /*#define EDMA3_DEBUG*/: a: h) T$ j; y8 t0 m

  43. , `5 }8 {! Q+ L* S
  44. #ifdef EDMA3_DEBUG
    1 F0 T7 C7 O5 Q% U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' ^5 B9 r5 p5 x. s: G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ ?6 M6 n' o5 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 x# H% p4 Z6 t/ _$ s' Q
  48. #else
    , u2 ]) S8 x; u# [' a
  49. #define DMA_PRINTK( x... )
    ! F& C! D) z6 O; L+ v. z2 d5 w
  50. #define DMA_FN_IN: }$ m3 E, C: l, \+ r0 S
  51. #define DMA_FN_OUT
    5 q2 C- V2 ^& n& H
  52. #endif; U8 |& t# _2 r( N

  53. * [- A; e6 B5 _: q7 X$ j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 F0 B7 h! T7 x; P2 z0 h, L
  55. #define STATIC_SHIFT                35 m6 T4 J. u9 P: a. n: ~
  56. #define TCINTEN_SHIFT               20
    5 x. n; q) B% s; M
  57. #define ITCINTEN_SHIFT              216 J7 R0 W# g6 d6 U0 r. Y" Q
  58. #define TCCHEN_SHIFT                22
    5 r  p; @; l- N3 }! I
  59. #define ITCCHEN_SHIFT               23; l$ w/ y; {- \. X2 e; K/ ~

  60. 1 v1 }2 k& d! u, g% _
  61. static volatile int irqraised1 = 0;/ S8 n( o4 k& K5 }( W3 x( Y8 O" h
  62. static volatile int irqraised2 = 0;
    8 T! c" h2 t! f0 _9 ?  s' v4 {

  63. - l: \! N  z* t* k1 \. j! k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & d0 L, h$ P2 I1 n5 U% q. G# W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) u$ }1 R" s9 p- p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 F; ~1 ~! m' I. @& ?7 C/ a3 ?

  67. # B# i/ B1 B8 C0 ?' R* l) K* h
  68. dma_addr_t dmaphyssrc1 = 0;8 s1 d' v$ u$ ?8 @- a
  69. dma_addr_t dmaphyssrc2 = 0;! T; r% a3 g$ A) d9 w
  70. dma_addr_t dmaphysdest1 = 0;
    ) N& Y8 K. R+ ~- M+ J
  71. dma_addr_t dmaphysdest2 = 0;" j# H4 E3 b% s% m9 t( M

  72. * p/ z" A3 m3 I8 R* }/ g0 O
  73. char *dmabufsrc1 = NULL;
    ! d8 o7 F+ ~3 o' m! p& E4 H8 e0 {, @
  74. char *dmabufsrc2 = NULL;& o6 U- ?0 A" D! f6 [; w
  75. char *dmabufdest1 = NULL;
    8 G3 \4 p6 n7 z  P, }
  76. char *dmabufdest2 = NULL;
    % b! `4 j% z( S& v3 t' R+ o

  77. 8 S. @' R7 H6 v* q8 r
  78. static int acnt = 512;
    3 t6 A4 N- ]$ g6 b2 K0 ^
  79. static int bcnt = 8;, t1 q- ?0 \" I* N, X
  80. static int ccnt = 8;: h. K. g4 I) Z  s
  81. & r7 U' q5 v$ h8 j$ R( a7 j( a
  82. module_param(acnt, int, S_IRUGO);
    % k2 S$ F1 r/ D# H1 _" N' i
  83. module_param(bcnt, int, S_IRUGO);
    6 C/ G0 a$ f- b& e) O" a+ J7 f% m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! ?" |$ x: M. @5 _
  I. x7 O# Y4 b0 s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! ?$ y* H9 c# E) n, o6 y6 C# Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# z  B$ _5 k+ B  C( J& m$ X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" i0 v- O+ g! L  U$ t/ I* b
& P2 W1 x0 o) a8 F* X8 P, K, u/ `

- x4 q8 O  `" U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 10:58 , Processed in 0.047918 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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