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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 U6 n9 \/ [4 k- Q- e  D
  1. [code]EDMA sample test application5 ~( T, ?& C% x7 w" ]+ w. F
  2. /*( L, P6 S" }# H% s, j* @* E& Q. R- U. a
  3. * edma_test.c/ ]% L" w' Z6 D1 @
  4. *9 x2 g+ h% S4 \+ \$ K1 B# j
  5. * brief  EDMA3 Test Application
    3 y% \0 l# N9 Q( h) F- T7 `- y2 ~
  6. *
    7 v& S1 i( Z2 U; d
  7. *   This file contains EDMA3 Test code.: Z# w. r' F" @1 o# H' o$ }
  8. *
    * z- h# p  Q; X9 [% w$ S/ ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 Q$ O' ^1 s; u7 ?  h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - J. m% W1 e$ {
  11. *         TO CHANGE.8 L' [' g* d5 W# N' C, J$ J+ R3 K
  12. *9 {5 n# I% l6 Q* w3 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 f/ c% @% r, l) w
  14. *7 j# j; F  V; D  U3 R
  15. * This program is free software; you can redistribute it and/or
    + R) c: @) Q9 B8 L* Y$ x' W
  16. * modify it under the terms of the GNU General Public License as
    " p5 ^* G: i9 G! g
  17. * published by the Free Software Foundation version 2.9 ]- [* u2 k) _* P: x' ^# N1 p! ]9 Z
  18. *9 h; }; t4 h5 w* M3 G4 I. B( }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) s. U) B" q& ~, w" O6 [7 V
  20. * kind, whether express or implied; without even the implied warranty
    0 r2 {* X  D, Y4 H/ T) j7 }. u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 N9 l! W% z' h# B3 f" T6 @% @
  22. * GNU General Public License for more details.
    1 Z& P& s4 Q! \9 }
  23. */) ]% G1 @$ H; F# ^1 t5 h
  24. , |5 Q( z" A8 B1 ?
  25. #include <linux/module.h>
    / f# C; F; S0 W! n
  26. #include <linux/init.h>1 Q6 T8 Y$ u% f5 c4 E' F6 o0 c6 x
  27. #include <linux/errno.h>
    8 b0 h0 _3 T4 @, t, a% X& k& _
  28. #include <linux/types.h>7 J+ E, N5 F0 f; B+ q
  29. #include <linux/interrupt.h>
    ! L6 z! |# ^4 n3 K* ^# @& M+ u
  30. #include <asm/io.h>
    $ d# T& P4 `! |9 F
  31. #include <linux/moduleparam.h>/ C8 j4 J# t% e  H6 f  s/ ?
  32. #include <linux/sysctl.h>! |7 J, D5 K# p. X2 H
  33. #include <linux/mm.h>3 y, ~# O+ W/ q8 f# H6 q
  34. #include <linux/dma-mapping.h>2 m6 A" r5 ]: _9 q% O! r

  35. / S& ]3 o4 x9 `; P
  36. #include <mach/memory.h>
    7 u/ V* v: z% ^4 @
  37. #include <mach/hardware.h>
    % n, D; c" ~. ]1 s
  38. #include <mach/irqs.h>
    ! k  d2 y% B- C
  39. #include <asm/hardware/edma.h>
    & m9 i8 ~+ a) E4 i

  40. 4 B! i* A6 b" k
  41. #undef EDMA3_DEBUG* F/ y- T, j0 h+ v, x
  42. /*#define EDMA3_DEBUG*/
    " v3 D3 E. B  C/ s3 u

  43. ( H- B, h! e7 G/ D0 ?- H
  44. #ifdef EDMA3_DEBUG" s  N! X( j: V7 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 @! Y* s4 k& v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# Y  j0 c6 L4 }2 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( d. _1 n9 o/ F
  48. #else2 N* `' U* c: `( y
  49. #define DMA_PRINTK( x... )
    . b0 n: h, }  \7 m( g1 A. i; Y5 y% w4 U' e
  50. #define DMA_FN_IN; y( {6 @! e1 Q# x2 Z* r9 H
  51. #define DMA_FN_OUT+ O/ [) t! D5 r7 y1 ^! H+ d2 _
  52. #endif2 a; e, o0 |4 F5 L# x
  53.   M2 [0 u0 R0 h& u& ]# _4 k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ b! f5 t2 T" h7 |& c- b& }9 T
  55. #define STATIC_SHIFT                3
    7 ?4 i5 r7 b4 u& S% J1 ^% f
  56. #define TCINTEN_SHIFT               20
    " r% y$ ^& |, q4 m
  57. #define ITCINTEN_SHIFT              216 T* p' t& |: j
  58. #define TCCHEN_SHIFT                22
    3 e/ Q9 k* p/ o( F, k
  59. #define ITCCHEN_SHIFT               23
    ! d% r: A) r( N: `) N  |) o
  60. : M& J. A. C. y6 h$ o
  61. static volatile int irqraised1 = 0;/ S' S) @$ B- x: c# t* j- V
  62. static volatile int irqraised2 = 0;
    : `) Z& u5 L8 H5 Y8 A
  63. 7 O8 P3 r) _7 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! F. Y5 Y$ r$ C3 Z1 b7 J$ o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( d2 W7 }2 Q7 K- s0 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 b+ m9 Q1 [5 k+ i0 X- S; s
  67. 6 O$ ^1 g- D/ N# p& C
  68. dma_addr_t dmaphyssrc1 = 0;
    $ J& A4 b9 Q4 {* e: F% j0 `( t1 \
  69. dma_addr_t dmaphyssrc2 = 0;
    6 n7 h7 H. ~# o2 u; p
  70. dma_addr_t dmaphysdest1 = 0;% S# g. z# p5 m+ ~
  71. dma_addr_t dmaphysdest2 = 0;
    ! ^3 ?( S0 ]0 ~
  72. 8 C4 E) O- D9 D  E1 ]& u1 M
  73. char *dmabufsrc1 = NULL;
    7 S. o, y3 h; v) U* C
  74. char *dmabufsrc2 = NULL;
    ) H9 c+ D3 i- W* h
  75. char *dmabufdest1 = NULL;
    & z+ N; m  T5 X9 _( N
  76. char *dmabufdest2 = NULL;$ d/ ^, u; P; c: S+ t2 a
  77. 5 V) a& s0 y6 b1 M, q/ n8 T
  78. static int acnt = 512;5 R& @0 P9 D. Y& G, `) r1 a: t( r
  79. static int bcnt = 8;
    9 Y3 w1 r& D1 @- H" v5 m, y
  80. static int ccnt = 8;
      V' y. D& P" U* f
  81. ! z; u! v) r+ {4 ^
  82. module_param(acnt, int, S_IRUGO);
    6 d+ A$ J4 ?1 |3 C* r8 p" c
  83. module_param(bcnt, int, S_IRUGO);3 m  G: k8 u/ x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ T; X# I& k# u4 o) L4 _
2 H6 A5 _4 \* H# W: `1 m+ h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 \  |! h4 |# l2 Y6 o1 g% @- l  ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ V! H5 t% j( t- m% y/ l: e. C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ L6 d7 t4 R/ Z
. j5 W% R5 b/ ~) R+ ^4 X' e
& o7 K# t6 z: e, j; C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-23 13:56 , Processed in 0.037195 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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