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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " q" U& x8 R+ \/ K! r3 o5 y0 Q
  1. [code]EDMA sample test application
    & c# s2 q: h+ j8 l; f% [" f+ z/ H
  2. /** |! G1 F9 \# R, J: k6 k. D7 R
  3. * edma_test.c
    & A4 M& R7 k) q, L9 d! R9 ^
  4. *
    - Z7 ^0 ~2 `0 y
  5. * brief  EDMA3 Test Application
    + u& ~# X4 U* Y/ @/ [, A' B! |+ {
  6. *1 t9 J* z5 M* y, H6 U$ h/ U- S6 M
  7. *   This file contains EDMA3 Test code.$ H: k, z) T1 p
  8. *! Y* f# Z2 [0 n" }/ i; L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " r! p+ [8 `& k; V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 O7 z$ T0 ~4 P
  11. *         TO CHANGE.- p. t9 g/ S; \) e/ g
  12. *" |7 i, Q5 e7 o- d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; u9 z$ w! b9 o6 d! S4 E9 m5 v) ?2 F
  14. ** r+ y9 \6 s0 V4 t$ T/ b, ]4 v
  15. * This program is free software; you can redistribute it and/or
    9 j4 ?+ U1 a3 y! Z) k8 U" t% `
  16. * modify it under the terms of the GNU General Public License as+ D  A" t  L4 s& H+ Z4 M) s' \
  17. * published by the Free Software Foundation version 2.
    / O+ b& C  e3 j. ?1 r
  18. *
    * T) {8 I6 ^# V" K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ `, m& |/ h3 q$ u) \
  20. * kind, whether express or implied; without even the implied warranty
    7 W+ T) S1 k5 a: {! Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 H& X  J/ y% t% U5 N6 q
  22. * GNU General Public License for more details.
    ' ^- m* L) t6 H; l& W( F/ P
  23. */
    5 }8 ]( K, h  P3 ]9 `" v
  24.   \0 B4 c2 j* d) h# c6 G: I
  25. #include <linux/module.h>
    7 j0 x5 L- [' K0 t, c1 [$ d
  26. #include <linux/init.h>
    3 \5 @, X& ]& t9 D
  27. #include <linux/errno.h>
    8 G& g7 b, ~3 {- C
  28. #include <linux/types.h>( e: S& D5 U/ t+ F# B5 w0 T
  29. #include <linux/interrupt.h>
    9 u4 A7 w- S8 W/ |7 p: p9 \: U; u
  30. #include <asm/io.h>9 @6 d) N: A# ~7 F2 v8 w6 |! t
  31. #include <linux/moduleparam.h>9 |7 Q- x, d) Q* C0 i& i
  32. #include <linux/sysctl.h>
    ; g! V9 o# a+ M: t
  33. #include <linux/mm.h>- w) E( A" P- o/ A8 h
  34. #include <linux/dma-mapping.h>
    . u: }  D  S5 j  ?8 M% x1 |- z
  35. * L5 w5 ]% C3 P
  36. #include <mach/memory.h>3 y$ l$ o  J; _; Q- O, a7 z# l
  37. #include <mach/hardware.h>
    5 F7 S% W+ X2 H. l, y) r
  38. #include <mach/irqs.h>
    ( L5 {+ E  E. h/ _
  39. #include <asm/hardware/edma.h>2 i/ n0 V5 p, O6 G, J  W
  40. 2 v% [4 }7 ]7 ~$ Z) D
  41. #undef EDMA3_DEBUG/ o5 D1 m4 G( a, M/ P+ ^: y- k
  42. /*#define EDMA3_DEBUG*/
    - z9 |1 ?) l5 J( u0 `) @3 B

  43. 2 R/ \$ |: ~9 H8 r; L* l
  44. #ifdef EDMA3_DEBUG
      ?* i; f6 ]- G2 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % t" A3 J! s$ {/ N8 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) V( I7 x, v' k+ ?: Y8 ~* Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 e% z' M6 T0 ?3 U& D5 O6 ?
  48. #else
    ! ~* G: \% B9 |
  49. #define DMA_PRINTK( x... )
    3 a7 P2 E, F" X# p. m, R
  50. #define DMA_FN_IN
    3 v% [+ y1 ^' c9 L5 Q9 W9 o( i7 A
  51. #define DMA_FN_OUT
    5 E; x, \! v1 b( S
  52. #endif  S+ k% E: |* G: u3 D( S+ ^" I
  53. 2 q! H7 j- _, s: N* d# W8 L8 d7 ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) w6 y3 N4 r. H/ e, q$ t$ F! R" F$ m
  55. #define STATIC_SHIFT                3
    0 S+ j9 V& V3 F( f$ b1 F
  56. #define TCINTEN_SHIFT               20; |1 V5 s! w4 C* G, E
  57. #define ITCINTEN_SHIFT              21
    ; }/ y$ Z- z# R  C6 _3 h
  58. #define TCCHEN_SHIFT                22
    % }2 g0 h' c, }. i! ~9 M/ _
  59. #define ITCCHEN_SHIFT               23
    8 d) O. A0 H: p) `& O# E8 a0 s+ d
  60. ) _* ]$ x- f. b+ |' S0 f5 O& Q
  61. static volatile int irqraised1 = 0;
    , L  E+ j7 u0 ]* p# D( X
  62. static volatile int irqraised2 = 0;
    5 c% @0 k" |. {" u( B0 a& z8 T, h& n

  63. % H1 Z% g1 b( [* q7 _& s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 m) M9 Y: p0 }' D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # D1 t, w0 O: @& \) ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! I; Z! ?6 X& D& m8 n0 y/ l7 Z) O- a
  67. 9 ^: _% g. C% p' `5 E* m" @1 a
  68. dma_addr_t dmaphyssrc1 = 0;6 `( H3 q' L- y9 m( {7 t
  69. dma_addr_t dmaphyssrc2 = 0;( k) |0 P' i  L+ A: _
  70. dma_addr_t dmaphysdest1 = 0;
    3 E5 M+ u" ]9 Y  G
  71. dma_addr_t dmaphysdest2 = 0;/ Q$ o( o, s7 y
  72. 7 j3 s6 a+ T7 e6 b+ F0 g$ K% q
  73. char *dmabufsrc1 = NULL;: u9 N% |5 ~9 i4 X1 \
  74. char *dmabufsrc2 = NULL;
    ' _- z1 [& c& H& K
  75. char *dmabufdest1 = NULL;
    $ W/ C5 z' U/ W
  76. char *dmabufdest2 = NULL;
    - D' L, O4 \% G8 [# K. y6 h

  77. 7 c0 r3 l0 E: k+ q
  78. static int acnt = 512;4 Y6 o& y: w4 ~( j
  79. static int bcnt = 8;
    3 P+ _/ i+ ?! ~9 X8 L) u
  80. static int ccnt = 8;( g' Q! r, C# i8 ^- H" Z& e0 T

  81. 7 [' [( }: Q+ C- X: Y
  82. module_param(acnt, int, S_IRUGO);
    $ R8 P  d- J+ h6 k* q1 n0 X
  83. module_param(bcnt, int, S_IRUGO);
    ) {9 `) x( w' r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; n9 ]$ I, n  W1 r
+ Q& U2 O  w" J* ^* d& Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# e" K8 K3 a4 N8 _; @4 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 s* k9 W+ k0 D: L' Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  c- w. z6 \7 w
" E1 o  Z+ E0 J# E
3 X* C  W  x  j0 w, h$ A& R% \, c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 11:57 , Processed in 0.041807 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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