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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( _8 R% l1 A$ Z3 B  u- K
  1. [code]EDMA sample test application" {  ^! l3 Z. n+ k0 x3 a! T3 y
  2. /*
    ; Z1 j6 Q3 G1 @* d7 H5 L& o+ s3 x
  3. * edma_test.c
    ( t9 F0 e" d# e
  4. *8 M  E' n% `4 |) Y
  5. * brief  EDMA3 Test Application; z2 K* K- H; r/ E) W5 ]
  6. *
    " i/ L9 m' E+ {, A
  7. *   This file contains EDMA3 Test code.
    4 @1 v' ~* G" O( ]6 a
  8. *
    6 y" C/ g% V6 e# s4 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! b" B/ n1 N/ b$ o2 O2 d- n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* l- R* D+ G6 M( l3 k& J- P4 z, P
  11. *         TO CHANGE., L" q6 Q6 G* U* x! p, O9 O
  12. *
    1 [/ T5 y# e% k) F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 L1 i+ k  F& D: t& r3 O
  14. *. J% O1 |8 `) J* F, y: z% B
  15. * This program is free software; you can redistribute it and/or; k4 n9 w3 y6 k' a
  16. * modify it under the terms of the GNU General Public License as( a+ L% n2 G8 V& Q
  17. * published by the Free Software Foundation version 2." K9 I8 [; Y- ]: Y
  18. *
    " v* k& b  l! }5 s0 _8 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 v# K5 U7 A  U* {- C. V2 Q
  20. * kind, whether express or implied; without even the implied warranty
    7 ?( p( [5 ]- G/ m' l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " V) O. u! u3 }7 O  k
  22. * GNU General Public License for more details.  l% x3 ~; Y( w( G3 W# B* b, a4 f
  23. */
    5 B6 {  `; j, ^; Y" z0 S0 L1 W

  24. 8 |6 `) K$ Z( Z0 O+ E" K2 R, W* H8 m
  25. #include <linux/module.h>
    ) Z& {- i$ R9 x  b' e) n
  26. #include <linux/init.h>3 D7 M- _8 a1 j# v0 Y9 j
  27. #include <linux/errno.h>
    " a+ y" D/ {. s0 @- |! m9 n
  28. #include <linux/types.h>: O4 a4 k$ ?( L3 i  ^
  29. #include <linux/interrupt.h>* k$ T( s: v  z6 i* N
  30. #include <asm/io.h>" b. T' ^  e- F$ p
  31. #include <linux/moduleparam.h>) H8 q$ u2 P5 H$ [
  32. #include <linux/sysctl.h>
    1 m0 }; m: j7 D) l6 v4 m
  33. #include <linux/mm.h>
    : s1 n6 z) Y* b6 @; w+ [+ l( L
  34. #include <linux/dma-mapping.h>4 E3 V/ x, g0 T& O% i) w0 ]1 i3 i
  35. % I  V! k: l1 j5 n3 V8 m
  36. #include <mach/memory.h>$ R  A1 f) i* }& N+ ~: F- j# v) c
  37. #include <mach/hardware.h>
    / |8 J. `' Z. j4 S: N0 X' ]
  38. #include <mach/irqs.h>" e6 [; F+ |8 d' u3 ]" i  k1 q# ?
  39. #include <asm/hardware/edma.h>9 O$ r' d& f9 U# q

  40. 7 D4 f$ n* G- C
  41. #undef EDMA3_DEBUG0 d1 L% H" ]  O* w* w
  42. /*#define EDMA3_DEBUG*/; }* a3 G* o, z& O4 F

  43. . i* P$ q! W6 b2 {
  44. #ifdef EDMA3_DEBUG
    / i2 K0 r8 u7 R( f: A8 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 ~; V6 s" ~4 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 D% n$ P2 F' }4 I4 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # z, f/ s8 R9 ], ]: e3 F8 J! Q
  48. #else
    6 \) ]2 C  l2 m: \3 t( V
  49. #define DMA_PRINTK( x... )
    : k9 g4 m6 }$ l$ Q
  50. #define DMA_FN_IN
    $ Q, V/ H5 ^. U! Q  B
  51. #define DMA_FN_OUT" T  Q. O9 q% r# r% y+ L
  52. #endif
      b. I6 _' H, j  i5 N( b7 a

  53. 1 F) F, v. o# l( h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 u& M" w4 c' y7 O5 m* H
  55. #define STATIC_SHIFT                3. @/ y6 u: s+ j$ B
  56. #define TCINTEN_SHIFT               20
    : U5 _1 J2 W2 I: q7 m1 [
  57. #define ITCINTEN_SHIFT              21
    ; F) b& O6 {1 u' F0 Y
  58. #define TCCHEN_SHIFT                220 }: T* z; X& w! q# S
  59. #define ITCCHEN_SHIFT               23! \# A- T! O$ x& f
  60. & O5 f  h. A* w7 g. c4 ?8 m; I
  61. static volatile int irqraised1 = 0;
    4 s- {7 \$ t4 D, m5 y
  62. static volatile int irqraised2 = 0;
    # r5 f2 @0 \6 V8 P6 V

  63. 4 [. `  Z1 _* P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 D0 h+ L1 I$ U0 ^5 z' U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 s" \8 w/ {) K# U9 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : r# O' F8 n$ n$ y9 Z" w9 n3 M( [3 G! d
  67. % ?* |$ M  R6 J$ d
  68. dma_addr_t dmaphyssrc1 = 0;+ c6 q7 [5 }" m. K+ R" _4 t
  69. dma_addr_t dmaphyssrc2 = 0;
    7 b  t7 K2 j! K; O/ v' k: `' A0 h
  70. dma_addr_t dmaphysdest1 = 0;
    . H1 |5 Q9 H$ g4 S6 U
  71. dma_addr_t dmaphysdest2 = 0;
    ' d' x9 P) k; l5 B
  72. $ n! N9 k# ^. r
  73. char *dmabufsrc1 = NULL;) A8 }# t9 B3 S9 }% V( Z
  74. char *dmabufsrc2 = NULL;9 A0 X4 i0 D  J4 O
  75. char *dmabufdest1 = NULL;1 [! X. r/ A2 N
  76. char *dmabufdest2 = NULL;
    % _1 l4 R, X2 {# i' D5 h

  77. . r3 O6 x/ W3 M. x, k
  78. static int acnt = 512;
    ! p4 L! t$ |& Q6 b) q
  79. static int bcnt = 8;
    9 c4 h: y' J8 {5 P0 A* ^( Z: S
  80. static int ccnt = 8;" t3 i: R3 f4 }. o: V! u
  81. 7 ]- [  Z* A. R( [! z( y0 R  u
  82. module_param(acnt, int, S_IRUGO);9 Z, T' z- a2 v# \* s) T" v
  83. module_param(bcnt, int, S_IRUGO);3 m3 s2 [$ [% S6 L, H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. [  e+ R5 |1 B. f

  Z( n) K9 M7 r/ u# _6 {) X& b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' b" t% ~- v! B! varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; m$ \& g" c1 u& k) ~' Z- D+ |) c- i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- X" N" O& V& d
& K& l  C& i0 q. Z, Z
2 l& R# Y1 @! Y- w8 L9 ]. J* K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-19 17:31 , Processed in 0.035820 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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