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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 v# u" B6 d- Y
  1. [code]EDMA sample test application; {) Y2 x) f5 E6 {
  2. /*7 M8 B2 `; d" f) y% K
  3. * edma_test.c
    + N' P8 R$ V4 x/ r& H% U) v
  4. *" m, B( T5 Z5 s- V% h% O
  5. * brief  EDMA3 Test Application
    % e7 A) J( Q, g6 B! C% A% c
  6. *8 j# ]: I8 ~) H1 ~* t! `1 C6 P
  7. *   This file contains EDMA3 Test code.. O+ _) \1 t( s% p
  8. *
    # U- X( \7 u3 R( p, ^$ \# a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 g& ?; N' d: s; @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 o' X$ a9 c' W0 ^# {
  11. *         TO CHANGE.
    ( ~5 a/ l# Y6 o) M* t
  12. *
    7 {1 u7 w$ x8 Q9 A. f5 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& W9 U+ C" l; C" Q
  14. *
    ) r6 N. K; v6 a
  15. * This program is free software; you can redistribute it and/or) U+ h' c/ F4 C2 q
  16. * modify it under the terms of the GNU General Public License as
    ) g: k" Q( U3 Y8 ]% |/ }
  17. * published by the Free Software Foundation version 2.
    ! ]6 Z: u1 }6 Q: c  w
  18. *+ Q- Q, y0 l5 |, K, z! ]* D' |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 R$ b+ c5 d( K  |5 `) X
  20. * kind, whether express or implied; without even the implied warranty  A$ L' p; d8 o: D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 C- y& `0 B1 v6 e# I3 Z8 K4 G' Z
  22. * GNU General Public License for more details.
    # v% u1 D" x  a/ R( g3 D5 R" x
  23. */
    + U/ s0 L  o- \# e0 o' _+ e' O
  24. ' }1 [% C8 d0 [2 H% G+ F1 N  V
  25. #include <linux/module.h>7 s# d! o- W/ T5 D
  26. #include <linux/init.h>
    * Q4 J! A& m: s: E# Z* H/ H$ u
  27. #include <linux/errno.h>
    9 c7 `! Q  L) ~! \
  28. #include <linux/types.h>% Z. L1 t4 k; t1 h2 V" v2 v; P
  29. #include <linux/interrupt.h>+ Z2 x( _' l( Z3 ?: K( Q4 H
  30. #include <asm/io.h>+ ^- ?1 c0 ^4 g: }( w3 ?
  31. #include <linux/moduleparam.h>6 ^# q) r2 V8 T/ M$ f8 J' V
  32. #include <linux/sysctl.h>
    ' p( A7 y$ S8 G  b. }
  33. #include <linux/mm.h>+ T% p# t3 W, M) L
  34. #include <linux/dma-mapping.h>% ~& u3 f/ E7 B4 [/ m4 a
  35. 8 k) x( e8 G  a* ]: A8 ~
  36. #include <mach/memory.h>3 H/ b$ n$ J; O( P+ I: S
  37. #include <mach/hardware.h>  A4 p' @: B3 B( k9 Y) H$ S
  38. #include <mach/irqs.h>
    6 Z6 y6 h# I8 c! N' N1 p& @- U
  39. #include <asm/hardware/edma.h>5 y. p) z9 D; p7 `( o
  40. . ]/ ?% ^* q8 O& Y3 c! Z0 {
  41. #undef EDMA3_DEBUG# D$ y: V  B5 c& I! _9 J
  42. /*#define EDMA3_DEBUG*/
    ' l6 R9 S0 F4 z& C

  43. ! o5 N& z' ^9 m" d/ Q0 w
  44. #ifdef EDMA3_DEBUG6 P3 {: l* M0 ^1 @& Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" J# {1 H, ?$ L3 @  f7 R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 b9 Z9 O( S8 E7 O+ M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 O3 ?* n' X3 D4 r
  48. #else
    $ S1 Z, P  {1 p2 R
  49. #define DMA_PRINTK( x... )
    ' P( F5 Y* y" `" d7 t, `
  50. #define DMA_FN_IN
    # ^* S6 S+ Z# z$ n0 `
  51. #define DMA_FN_OUT
    ! z2 u" d8 t( ?: l( @
  52. #endif
    4 r! k- D1 ]. h5 t6 H7 {; q

  53. ! G3 e% k9 F  R! p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% t8 y$ M  V. ~
  55. #define STATIC_SHIFT                38 l! s+ V0 \! c
  56. #define TCINTEN_SHIFT               205 t4 j+ E. ^! x% ~0 G
  57. #define ITCINTEN_SHIFT              21
    ) s4 ]) U% L% t1 g' e
  58. #define TCCHEN_SHIFT                22- y! e4 T  l3 {
  59. #define ITCCHEN_SHIFT               23
    ; z$ K) e: b6 ]4 c6 W1 z

  60. " h* H+ v: [$ b" f
  61. static volatile int irqraised1 = 0;
    3 }) a8 V$ L: K% Q7 m) I# U) U4 ^2 S
  62. static volatile int irqraised2 = 0;0 b8 L5 z4 m( z6 B" L' ~7 M% q
  63. ; F4 C2 d: ?/ f/ H% r. S) m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ N3 ]: K) X" E7 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ~' E6 E& ?5 @3 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 k: P; Q, J, G" l, ?
  67. " V! [7 F2 I: q. |& O( h
  68. dma_addr_t dmaphyssrc1 = 0;9 w8 m( O4 g( r; h. d. {
  69. dma_addr_t dmaphyssrc2 = 0;. B0 ^8 f6 B/ e/ E5 v
  70. dma_addr_t dmaphysdest1 = 0;& A. c9 Y# {$ N; a/ L
  71. dma_addr_t dmaphysdest2 = 0;
    4 T! F3 A; A2 M% H( D

  72. 1 z0 ~; V! {, I1 U) g
  73. char *dmabufsrc1 = NULL;- Q: R" q3 P& h
  74. char *dmabufsrc2 = NULL;4 a. t/ X3 R" l2 e. M' Q
  75. char *dmabufdest1 = NULL;
    7 d$ c8 \  Q  _. p7 `6 ^
  76. char *dmabufdest2 = NULL;
    8 p3 w1 m- f2 n2 J. W' k3 h
  77. # H6 J  K' w/ g, Z. F2 x/ ]
  78. static int acnt = 512;
    # R: M( l; q/ O/ x1 T7 q
  79. static int bcnt = 8;) M: k8 R9 U# R6 u& ^
  80. static int ccnt = 8;5 _5 b  H, F7 a  u1 l
  81.   i. ?8 Q3 Q6 `# |( J% F1 e
  82. module_param(acnt, int, S_IRUGO);
    + _( `' B' b! E  w4 C
  83. module_param(bcnt, int, S_IRUGO);3 u( _( K- \+ m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. S3 S- U6 ]( d' S, E$ Y& M
: s% L+ r1 |) g7 O/ T  m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  g9 |' D3 K( S% y$ a& h2 f. v1 u& Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 f# W# F0 [9 V- m5 W7 L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 h; g  A* D. m+ s" {. K% f% A+ k* g' O  J' l9 y, x

- F! m9 \" B+ S2 S) |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-23 10:03 , Processed in 0.037293 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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