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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( [/ D) i1 k) p# q
  1. [code]EDMA sample test application: l5 O, n; Y0 `' M
  2. /*2 W. Q" {0 i. w3 f* Z: u( i
  3. * edma_test.c: b& P9 ]) {! H/ C
  4. *
    ( ?% {" |. d6 a3 i
  5. * brief  EDMA3 Test Application
    6 o+ l9 Q2 _% E, y' q4 @# k
  6. *
    : t$ Q+ H% f& e" m( I
  7. *   This file contains EDMA3 Test code.
    + m6 h" n1 Q# j/ `
  8. *  U( \  s: l6 E' d0 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 A* g6 X6 K6 ?& S0 B# f$ H( j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / u! K. J: M( }. H4 ]
  11. *         TO CHANGE.
    8 Q# ]/ @" @$ G6 n9 W& R( D
  12. *! ~" Q" z! u5 |! d' K# ~7 b# R( F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # a( W' F+ z" R. e, x
  14. *- {& u/ B  N8 O8 l
  15. * This program is free software; you can redistribute it and/or( m# U! g/ m, Q
  16. * modify it under the terms of the GNU General Public License as
    + z- I* \2 Y3 l9 c) U
  17. * published by the Free Software Foundation version 2.
    - }! e& ]% g; C
  18. *
    5 b# ~; `% I4 U4 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 G( n/ Y/ m/ u" o. }
  20. * kind, whether express or implied; without even the implied warranty
    + x  [  S! j6 g; ^& j3 i4 ^, L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 V% K+ V5 U8 \4 m0 C
  22. * GNU General Public License for more details.
    1 n' k" B2 W- }0 U/ e4 ~2 g1 Q; N
  23. */
    # m+ A! G4 R1 i6 A  v, ^( b
  24. % k0 C5 L. l3 B
  25. #include <linux/module.h>  l* J& U( y1 H! `$ ~3 z2 J, c
  26. #include <linux/init.h>
    " k4 N7 b9 N# a# r6 y. K. I! x
  27. #include <linux/errno.h>
      q  z* M" x7 c# I6 d; D
  28. #include <linux/types.h>4 z" q7 N0 X4 \! ~8 |6 E" b' R
  29. #include <linux/interrupt.h>
    9 F9 Q' u6 R) w9 A) S' Y$ k
  30. #include <asm/io.h>
    , \- _( j0 N/ Z% T
  31. #include <linux/moduleparam.h>
    3 P- I0 x) ^# H* ?- S+ N* f
  32. #include <linux/sysctl.h>
    # d  ?0 ]) W: d5 X0 F" a1 Y
  33. #include <linux/mm.h>: i% i/ Y1 B3 K
  34. #include <linux/dma-mapping.h>
    8 d; {' s7 a  F: W, |, [+ J$ ]8 K
  35. . e' p: H' u* d2 R- o
  36. #include <mach/memory.h>
    6 J( Q& b. E6 d5 R2 t0 g6 ]
  37. #include <mach/hardware.h>
    ! {0 D( S7 ~( O1 x* o! _
  38. #include <mach/irqs.h>2 p1 ]( J: T3 |/ P; ]
  39. #include <asm/hardware/edma.h>
    - K8 x" a! f! }) a$ _7 n

  40. " X: a9 T( @+ h/ L& n) _' t) Z* p
  41. #undef EDMA3_DEBUG) r; p' ^5 u6 \
  42. /*#define EDMA3_DEBUG*/2 C  o  f3 u, ]1 a; G5 B2 B

  43. ( L+ u  c* [7 v: ]# B
  44. #ifdef EDMA3_DEBUG! P9 p7 n8 p9 E( b; P' n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ W4 k7 V8 `/ \* Y( ]8 n7 |* v+ E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! K# w, V  ?  u9 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " \# V- K/ D% c( W/ z3 a
  48. #else
    / @- v# ]) z6 c6 r$ `
  49. #define DMA_PRINTK( x... )
    . p& l/ M) ~6 |% N$ Z: ]; N8 q
  50. #define DMA_FN_IN  ^, ?' A; V* L, z/ x* b* V9 j
  51. #define DMA_FN_OUT
    7 C" o4 L$ s7 t3 b5 P
  52. #endif
    : _* A6 x7 x0 u/ z. }. H
  53. 3 Z0 Z  v1 b- _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ i3 f6 ?  l/ y6 e* R
  55. #define STATIC_SHIFT                3: \/ n6 s: x0 A# `2 O1 r
  56. #define TCINTEN_SHIFT               20
    % t' s5 m/ M" ~: @, y
  57. #define ITCINTEN_SHIFT              21+ [' `9 F+ X3 q6 i1 U" G
  58. #define TCCHEN_SHIFT                22
    ) a$ c' |2 B( l6 C2 L. \
  59. #define ITCCHEN_SHIFT               23
    2 [: h  b; r! k5 [" X6 z+ S
  60.   ^# U; j+ {: T/ D6 j
  61. static volatile int irqraised1 = 0;% J, X; o/ p. [$ ?0 _" M8 b
  62. static volatile int irqraised2 = 0;$ S' {6 k% Z- Q  b8 G) R

  63. ) U8 h+ i3 M$ V; Z* q8 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 b. h+ v6 Q0 }( W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & P& _4 e# ]$ e9 J. q0 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % I8 U) V# d( D3 V, Z

  67. + o- J0 i3 V3 p+ y# A
  68. dma_addr_t dmaphyssrc1 = 0;
    ) k0 Y* |6 Y- L: `* w% ~; U  Q- _
  69. dma_addr_t dmaphyssrc2 = 0;
    $ D- i1 i9 P7 U, g! o1 p
  70. dma_addr_t dmaphysdest1 = 0;# R0 v# O" J! O4 A2 y8 W
  71. dma_addr_t dmaphysdest2 = 0;
    4 R7 t) |9 G) `! h  u: R
  72. / u! s" g2 G& A, j& e( @0 `+ n
  73. char *dmabufsrc1 = NULL;) o, M9 k8 t6 p, a$ o
  74. char *dmabufsrc2 = NULL;+ @; h$ C  L/ e3 i
  75. char *dmabufdest1 = NULL;% j3 V/ f& J2 b( U  P6 I
  76. char *dmabufdest2 = NULL;
      N- h. G$ C# u5 I4 S% w
  77. & G" Q1 o, J7 g9 i2 T
  78. static int acnt = 512;9 p( O7 T: \" a* p5 |' T, n4 ?
  79. static int bcnt = 8;& ^6 m9 W! V* }: m  t* w: F
  80. static int ccnt = 8;2 X% r4 N# A+ X- y
  81. ! l( g# w6 D+ Q- @  Y& h
  82. module_param(acnt, int, S_IRUGO);& x! {% b& }5 k8 o' a7 f
  83. module_param(bcnt, int, S_IRUGO);
    . @$ V! s1 |! W2 z4 C% k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- c: @( |6 j' E, ?
7 T1 Y7 j+ H2 d1 S( U* F- x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* ^# ^; {$ F8 jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- ?& c2 a: q! }# b  w' j! _% f' o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  i- @  s4 l  E( h

! M2 F) R( \% j1 n4 j2 q7 a9 F
/ }, p4 B3 j2 {: R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 12:36 , Processed in 0.052832 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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