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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 y! c. ]. R" n3 c) }( [
  1. [code]EDMA sample test application
    . A3 T! I6 E+ |5 X% U" ]2 c8 _
  2. /*1 C  Y/ x" ~# t/ g( d
  3. * edma_test.c, W* r- m. \8 x4 D, f
  4. *! I9 Y( ~3 T9 i1 ?- J
  5. * brief  EDMA3 Test Application9 G7 g, o! C" P% q' ~6 `
  6. *
      V8 i8 p/ }! Q" i, ?
  7. *   This file contains EDMA3 Test code.6 o. Q7 u/ |' [
  8. *6 p  u' `$ Y( y( N2 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 y) L8 S! I/ p* L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + t9 r* q+ W5 V. }
  11. *         TO CHANGE.' v+ ^- n5 \  t6 v
  12. *5 {) M( A7 S& E: C5 v  @# K6 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 U2 r3 R, s" g
  14. *
    5 S$ b, K" k5 e& h3 x
  15. * This program is free software; you can redistribute it and/or! Y6 s9 u6 S9 j% v, h
  16. * modify it under the terms of the GNU General Public License as
    + [6 \* o3 w. C6 G7 v" w' q* _2 O& z6 V
  17. * published by the Free Software Foundation version 2.
    ! E8 U: U5 ]6 ?
  18. *
      h. B  e5 \+ ~6 |* w3 u6 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # f7 e: c7 N; I0 T5 F9 M
  20. * kind, whether express or implied; without even the implied warranty7 I( p  l6 W* H- E6 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% u4 S. a% w3 H/ Q& Q- ~2 |% l
  22. * GNU General Public License for more details.
    & d+ \2 L) ]  ?& I0 }9 {* F* _! A
  23. */+ U+ ?) N  N! q
  24. 2 c& I' V9 M7 E. ?* P- m" s
  25. #include <linux/module.h>
    9 @+ P' a4 t# W  d$ R0 s# W" i
  26. #include <linux/init.h>
    3 J7 M6 x9 G5 X6 g
  27. #include <linux/errno.h>; l5 V0 n' ?3 Y# @( a
  28. #include <linux/types.h>
    + P/ V; u2 u9 b% Z" [1 A
  29. #include <linux/interrupt.h>
    ! C7 g, _. G2 b  ]( i/ A& y' i
  30. #include <asm/io.h>0 a" I( b/ O4 T8 ~9 r9 D+ @6 F1 [9 g" L
  31. #include <linux/moduleparam.h>" c' k' {- L, A  [) K, z/ S. E
  32. #include <linux/sysctl.h>
    ) b$ b# V! z* A& v, h# L
  33. #include <linux/mm.h>
    9 h7 Z- z/ f8 {( I- o4 R
  34. #include <linux/dma-mapping.h>
    4 \, O9 F* Z- i/ D  \4 `* O

  35. # p/ \9 \/ E  r8 Z/ z( _% E+ q% m6 f
  36. #include <mach/memory.h>$ i4 I, A5 V+ m+ W
  37. #include <mach/hardware.h>" D# B$ C0 q6 Y! o, c
  38. #include <mach/irqs.h>5 y& e; n- F2 y2 z/ e9 d5 X9 `
  39. #include <asm/hardware/edma.h>
    1 w' T( @" R1 C4 t) e7 b# P4 L. r
  40. 1 h# z/ ?5 j2 }& u# p( R" M# \3 h# U
  41. #undef EDMA3_DEBUG# h5 l  U# \- Y5 v  V
  42. /*#define EDMA3_DEBUG*/
    0 o) P/ A+ z$ ^( i* s" t
  43. ! \: h8 i. O- l- [6 N1 A  z
  44. #ifdef EDMA3_DEBUG
    4 E: b: G% Q/ S' `$ h! y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 z' ]# C+ f0 E* e% n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): N9 X! X5 t+ f" _, \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ z; [, |' \% I/ j9 z
  48. #else: u$ G/ Q4 R. |
  49. #define DMA_PRINTK( x... )$ Q! S0 H; @! V* |
  50. #define DMA_FN_IN
    : z3 C7 N8 a: |7 W+ H0 T- ]
  51. #define DMA_FN_OUT, B' _- R" j1 s7 D
  52. #endif
    ' h6 R2 H/ C0 E! B# G( f

  53. 6 K3 k$ H8 H. M7 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 d# P, l* w7 F# c
  55. #define STATIC_SHIFT                3( T3 {, e( k) e5 v$ ]  l4 \
  56. #define TCINTEN_SHIFT               20
    7 t9 J0 w9 M( U/ J
  57. #define ITCINTEN_SHIFT              21" v1 p8 l2 t  |* h  Z( f
  58. #define TCCHEN_SHIFT                223 f( j* b! u' \) y" B% ?, i& M
  59. #define ITCCHEN_SHIFT               23/ y: m* k2 t& }. w

  60. 4 m& _8 N0 G& s" o1 W/ i- w: i/ f
  61. static volatile int irqraised1 = 0;
    6 q1 O/ |" j6 Q* T. p7 U
  62. static volatile int irqraised2 = 0;2 ~9 p" {$ l) T5 T1 ]7 S

  63. ! }# z7 L+ V% e, o4 L0 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 J" i& l( m' @+ h  X$ Q5 k$ h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) m1 @6 f# o* O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ r' A8 |$ H! G3 r

  67. - }; c( Z1 N- k) {- e  k/ v( Y: E
  68. dma_addr_t dmaphyssrc1 = 0;2 O1 v% {4 _" a0 ?
  69. dma_addr_t dmaphyssrc2 = 0;
    * K" U! v) L! [
  70. dma_addr_t dmaphysdest1 = 0;
    ( \. e" Q4 X7 O& x, {% F
  71. dma_addr_t dmaphysdest2 = 0;5 _; Y! g, s$ w/ F

  72. $ i7 E' B0 a" [5 U2 i
  73. char *dmabufsrc1 = NULL;, v; v! U  m0 u7 x! z: M2 `
  74. char *dmabufsrc2 = NULL;/ o9 V. P2 Q: C4 u1 `( F1 z
  75. char *dmabufdest1 = NULL;
    3 R6 C, {: A7 l9 G1 ~1 w4 c
  76. char *dmabufdest2 = NULL;2 I: \3 D2 e1 |0 Q9 l! a8 d+ o

  77. - C, x2 o# K: B  V6 S7 N7 D5 R% L
  78. static int acnt = 512;4 ^+ @" v6 p5 I; d
  79. static int bcnt = 8;. K4 b* P  R4 G7 @3 h9 G
  80. static int ccnt = 8;
    8 B3 d* I# h2 {( ]. z/ s
  81. 9 M) {* u" M( Q! a. _$ V( x
  82. module_param(acnt, int, S_IRUGO);
    ' e* ^/ p1 b9 i$ ?* g
  83. module_param(bcnt, int, S_IRUGO);
    " Q9 U2 H' N& A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" D5 e' F& y4 z: L# G/ y. \* {  v2 O; C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# t* P, q8 `6 i, oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 s3 }7 R: ^* w# l# {4 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% e2 |0 t( c8 E7 n& K

0 z8 @( [' m: W; D2 f& x
2 S1 u5 _8 B9 V$ w6 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 05:33 , Processed in 0.039673 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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