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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) \2 @6 e$ s( s* X, T
  1. [code]EDMA sample test application
    " c; w( e' k5 g4 v3 b2 p$ U/ D
  2. /*- a9 [* I7 l0 s3 G; E
  3. * edma_test.c
    , I  V; h5 X; m: a
  4. *
    7 d0 M" o8 v1 M8 Z  `
  5. * brief  EDMA3 Test Application
    1 H/ T* U, }; M2 c& a" \6 ~
  6. *
    5 U; ?- X2 ~3 m8 d  T) \
  7. *   This file contains EDMA3 Test code.  a9 k/ g2 G; t# m: ~# t
  8. *
    ' I" S' m. J# g9 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" F9 D0 _/ P* U3 m% q  }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) ^! B! P0 i! ?4 q: S' x9 B; N6 @
  11. *         TO CHANGE.# d. X5 P1 z0 _* ]+ i; L
  12. *
    : C; J9 s% T2 k0 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& |: b; k, ^* E0 a* Q
  14. *
    5 c  F  b) G; S7 }# z" d4 f
  15. * This program is free software; you can redistribute it and/or! m; s1 @0 X3 F3 u& ?
  16. * modify it under the terms of the GNU General Public License as9 u" i) ~# Q& a  S1 _% f3 w
  17. * published by the Free Software Foundation version 2.8 O- z* t( G! e
  18. *3 P$ d" L* [9 Z, L* P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' k, V) e5 {" C% x) g; f' r
  20. * kind, whether express or implied; without even the implied warranty
    6 X& p9 [# n, h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 w! h% k- f4 N
  22. * GNU General Public License for more details.
    0 U# }' i- ~. J; j5 A. M# M
  23. */
    % J/ F& O5 |9 [) b# h( U
  24. * {# x# n9 h7 s, [
  25. #include <linux/module.h>" E" y, Q1 s) w
  26. #include <linux/init.h>
    & s1 |) A! T. v+ d' ]4 ]; D. `% v" `
  27. #include <linux/errno.h>
    4 I* b7 j; Q; n3 v4 G* w
  28. #include <linux/types.h>, b1 i/ G& F7 O8 E; A/ w
  29. #include <linux/interrupt.h>- i) H7 l; k: p) w
  30. #include <asm/io.h>
    6 K- h3 n* H' C9 w7 S# w' s
  31. #include <linux/moduleparam.h>% x. W% c; J% D4 G: c: f
  32. #include <linux/sysctl.h>( o" Y; s. U' ^5 W* X$ i
  33. #include <linux/mm.h>
    ; Z! h' A# r6 f9 z
  34. #include <linux/dma-mapping.h>
    & Y5 R, c1 z8 _/ s$ ?" I
  35. ) n+ n2 J5 F" b% u4 V2 R3 F
  36. #include <mach/memory.h>
    - t# [3 O: X6 V% _1 @* B& {
  37. #include <mach/hardware.h>
    4 Z  }5 Y6 y4 T3 i7 m$ x" O
  38. #include <mach/irqs.h>) k3 v# {2 W- ?& G9 R# \
  39. #include <asm/hardware/edma.h>
    * B) X+ C/ K8 W$ L' s# X

  40. / Q) e6 _& p" r! o5 G9 h
  41. #undef EDMA3_DEBUG8 c7 ^3 j) s/ a' `$ Z5 c
  42. /*#define EDMA3_DEBUG*/# ?/ d2 z& p0 }

  43. * a' u  t/ D, U) F. }
  44. #ifdef EDMA3_DEBUG6 k) o% \9 Z- N/ I) a8 y1 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ K/ e" T8 P% E' Y* i  D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), N  `' n( d; E+ Y- v6 r/ O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' c" A8 m6 I" q
  48. #else# _1 o5 X2 x8 \/ I9 i. w
  49. #define DMA_PRINTK( x... )
    1 B. O3 V) Q6 ~' h* e
  50. #define DMA_FN_IN
    ) h( E' K  b2 `1 k* @& _9 L
  51. #define DMA_FN_OUT
    - o$ l: ^% }7 f0 D2 u! I
  52. #endif( o, E( O( r! M4 @
  53. + p3 j! k$ s% F# @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 d2 ]" k% W  E' x) j
  55. #define STATIC_SHIFT                3* |" c, B# _* T1 i
  56. #define TCINTEN_SHIFT               204 @7 G; v6 a- W8 o4 Y: e$ s
  57. #define ITCINTEN_SHIFT              21; x2 ?- f( k* t( l$ ]8 _9 t
  58. #define TCCHEN_SHIFT                22
    9 A8 e! f6 A* Z) M+ \
  59. #define ITCCHEN_SHIFT               23
    % R" ]" b% S0 S; o1 }

  60. 6 t8 q2 ]1 a6 F2 }" l5 w
  61. static volatile int irqraised1 = 0;
    $ H8 W9 r" z& t7 t+ v
  62. static volatile int irqraised2 = 0;
    1 Z4 A9 i, E3 [& N, s, g# p5 J

  63. ; K  P( O9 \9 D+ P" \1 o6 B1 z) M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ^! @9 _( {5 e' u8 k% x* T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' M+ }) h# s  M& I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# F; d: l$ z1 @, C5 t

  67. * h- P( h' A$ K/ a
  68. dma_addr_t dmaphyssrc1 = 0;$ e! a& }- f/ \5 Z
  69. dma_addr_t dmaphyssrc2 = 0;
    % t2 P- M! b. }8 o1 v3 g( `
  70. dma_addr_t dmaphysdest1 = 0;
    - J/ P1 v( y. u8 p
  71. dma_addr_t dmaphysdest2 = 0;' l5 B! q# O! B. x/ O' I+ F2 X
  72. 6 u" \8 Z  U/ a* J! [6 k* C/ L
  73. char *dmabufsrc1 = NULL;; |% y4 t8 W; g6 N, D, A: u# W1 g
  74. char *dmabufsrc2 = NULL;( @+ h& h  m4 N5 y2 J$ L
  75. char *dmabufdest1 = NULL;. m. Z; {5 I1 ^+ B7 M" }7 i
  76. char *dmabufdest2 = NULL;" ~  i. x* p- V5 D

  77. - N, U9 {' @1 A) t4 K
  78. static int acnt = 512;2 F! V7 M% O: I  Z# s
  79. static int bcnt = 8;" x1 T/ C! {. D6 o1 T/ @$ s
  80. static int ccnt = 8;
    $ u6 V7 ?* N% V9 l
  81. % E6 S: N& ~- W9 J9 E: d7 c- {
  82. module_param(acnt, int, S_IRUGO);
    , w: q+ g* d) m1 u
  83. module_param(bcnt, int, S_IRUGO);( @2 c! F* |! H& Q5 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. L( ?7 K9 s6 i- c

) b7 A+ o" C7 W. K" H9 i5 C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" k# p* q) u2 J5 V3 A# Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* a7 U% R5 |# m, Y+ @% [7 ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 p" v% h, c* s/ v
" B6 p* z. K7 k" M0 k6 f" j; \0 }9 X" L% V8 b0 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-30 10:22 , Processed in 0.045233 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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