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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# F0 `% k3 d" O+ _0 R
  1. [code]EDMA sample test application
    . M$ u8 w9 W, e/ W0 M7 R! k
  2. /*- ?; R" [% H+ ?$ P- l
  3. * edma_test.c
    # O* r# _: X  t% p
  4. *$ E' H8 G1 F! T, a+ [! p. v
  5. * brief  EDMA3 Test Application6 m* r2 n% c9 Q& z4 @: k2 e7 T
  6. *
    * V6 h. {# c+ n0 T) |2 K$ z: T* h0 s
  7. *   This file contains EDMA3 Test code.* q* |: O# ?- u  b
  8. *- w2 o, F: }- I& M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 V* b% c+ W' K8 C  H' D  X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      A+ F5 \  h5 e$ ]9 e
  11. *         TO CHANGE.9 D% `! ]4 O( y( V) y! W+ K4 M; U
  12. *7 ?' |3 n, X5 G# O% O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* X9 [2 p- [6 {( h2 [
  14. *! V* S4 Y0 v# V8 Z  u% F
  15. * This program is free software; you can redistribute it and/or% t3 u' Y. N9 r* U1 R6 p, X# T
  16. * modify it under the terms of the GNU General Public License as0 u1 U: _7 Q) |
  17. * published by the Free Software Foundation version 2.6 E/ [9 K* X- h1 O$ v7 x* T5 X
  18. *( ]: o3 _2 w! \0 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " _0 D9 B# X2 i+ \) u4 r
  20. * kind, whether express or implied; without even the implied warranty2 y# d" M% Y: T; a* u/ Q( K5 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( H% L' X: O% w; U7 x
  22. * GNU General Public License for more details.
    1 g& Q( `/ }$ j1 j: {( a, z, y( `
  23. */
    4 b2 ^. E7 [5 Z% P

  24. % I+ i- a% ^8 z. r
  25. #include <linux/module.h>0 ^% {! v* H1 P! |, q. q
  26. #include <linux/init.h>2 _' X+ x! s8 x% k  w7 ]
  27. #include <linux/errno.h>: e5 V5 q" ]+ J1 P; |# Y
  28. #include <linux/types.h>
    / e3 @/ Y$ K  b( }0 |
  29. #include <linux/interrupt.h>9 I/ G/ N* t: u6 t6 m9 x$ o* y
  30. #include <asm/io.h>
    ; {0 D6 e. P& H( X% x) ?! w% D
  31. #include <linux/moduleparam.h>+ u% j; t/ V2 }1 U& E
  32. #include <linux/sysctl.h>, X$ m2 m5 @' V
  33. #include <linux/mm.h>
    5 a+ B. O) S' k
  34. #include <linux/dma-mapping.h>
    ) t( Q* b% H9 d/ o" ]

  35. , N. n( E7 Z" q& Z- K
  36. #include <mach/memory.h>' p2 S" D. @/ Q7 p" v
  37. #include <mach/hardware.h>
    ' N9 O2 q, W/ q  a* l. f
  38. #include <mach/irqs.h>8 M/ Q) ]  s; S; Y# P4 |
  39. #include <asm/hardware/edma.h>- G! F6 ^/ I- W* j! K* [8 x/ x- z
  40. ( @" T) v0 X7 g5 s" D+ C3 F/ W  \! S* Q
  41. #undef EDMA3_DEBUG
    5 z6 B% ?. E! S4 i5 S! C, g7 ?
  42. /*#define EDMA3_DEBUG*// J& c3 y+ w) `: B4 M

  43. , R: L& [. o: E  O" Q; A3 X) p( U
  44. #ifdef EDMA3_DEBUG
    ; O# S  _5 S- t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  A. |! x. E  [; U) N* A( Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; [0 |; e* }5 V; a7 |, N. W/ u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! ?4 s0 f6 ]7 G; `+ ^: E
  48. #else
      A( S; }* e/ K, K6 V- h0 s8 A
  49. #define DMA_PRINTK( x... )0 Z6 I' a$ e- r! q1 E
  50. #define DMA_FN_IN
    + i% z1 A( R& `. r) [2 w' B
  51. #define DMA_FN_OUT
    # m3 H  D- c+ U6 i/ l  ]5 P
  52. #endif& {! s6 j! v, Q  j
  53.   k8 J$ ]. j: X# y9 [( }7 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . G4 B8 G8 w9 h, b+ I6 {
  55. #define STATIC_SHIFT                3; K( f% T& M! Q
  56. #define TCINTEN_SHIFT               20% ~# K$ i8 G9 [, e
  57. #define ITCINTEN_SHIFT              21
    + r5 L& f* \6 i$ a4 P2 P# q
  58. #define TCCHEN_SHIFT                222 K  j: L8 V8 N+ h: t& M
  59. #define ITCCHEN_SHIFT               23
    & T' ]3 P9 L" H) S/ n

  60. ; A+ z% X" S, S+ X
  61. static volatile int irqraised1 = 0;/ k8 k0 _+ Q: |
  62. static volatile int irqraised2 = 0;
    ) C+ f+ F2 d& D

  63. % ]3 k  i. E7 g7 L( ]0 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 G3 V' z0 p6 U" C' F3 s* E* _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' N. T! p! P3 c. u0 I! T4 [8 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % z6 H, X+ [  c; x
  67. % {: M+ g" t6 P  o
  68. dma_addr_t dmaphyssrc1 = 0;2 X6 _( L; [$ a9 r, H" \
  69. dma_addr_t dmaphyssrc2 = 0;
    8 k5 v& O' I2 y/ W9 q# o$ H
  70. dma_addr_t dmaphysdest1 = 0;
    % d) p$ T: ~2 Z1 n7 s# A4 ]
  71. dma_addr_t dmaphysdest2 = 0;
    * O0 L3 K2 {1 z) n; Y) X& l
  72. 5 V9 N9 R! }0 _/ ?2 t1 M2 h
  73. char *dmabufsrc1 = NULL;
    3 A. b; d& f4 Z! y$ b
  74. char *dmabufsrc2 = NULL;
    . M+ Z5 X+ `; L. ]( _( G
  75. char *dmabufdest1 = NULL;
    2 ?- W. d- V7 K7 G* W$ a9 n
  76. char *dmabufdest2 = NULL;
    / K) G+ J) h; t9 t! B, d1 K# T
  77. 5 e3 p8 E+ d- _4 P! z7 v9 |/ ~
  78. static int acnt = 512;
    & }0 C* ^4 P6 E0 q* `, z+ S( m, [( `- \
  79. static int bcnt = 8;1 O; k7 f8 y+ R# l* G  L5 d8 B5 B6 T9 c7 W
  80. static int ccnt = 8;
    2 R- S0 P. m8 P. q! e+ |' g) F7 i
  81. # s4 x/ ?9 M4 t; i  l
  82. module_param(acnt, int, S_IRUGO);" H2 P# P3 c; L6 [+ h* Z0 @$ B- }
  83. module_param(bcnt, int, S_IRUGO);1 b  e$ A! _1 \' z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' I* E7 n! D9 o# z

6 m, @) n6 ^" U& r) e7 P4 i$ {# g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# Y7 q. F( s) g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# s2 j2 {$ d6 I2 y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 W* t9 l/ `/ H

% q* [4 N  |5 U8 D+ V5 J/ \
4 H$ `  N0 ]. y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 12:43 , Processed in 0.039955 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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