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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : N7 \  H7 \8 m2 @
  1. [code]EDMA sample test application( t4 X7 O# \7 a; Q* o" S
  2. /*! F2 G# W* S8 s+ q" M* T
  3. * edma_test.c. Q+ i0 ~. y( `4 m
  4. *
    ! y7 N# ?0 f  L# D
  5. * brief  EDMA3 Test Application
    " v! g  V3 B, n% e5 N' z/ k
  6. *3 }% @3 V; [- h. h. {
  7. *   This file contains EDMA3 Test code.
    # s* ?' e0 D2 E, n! n  |# N1 f
  8. *
    1 c8 k1 P; o* j# m5 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 Q' {6 B7 L- P& F$ @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( v$ F! w* K' s: u' v' z% }
  11. *         TO CHANGE.
    . W& D$ y+ [$ {. [& ~
  12. *8 P8 @" U" h4 O0 u: c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! t+ j3 e+ ~1 U; M4 @6 M: B0 [  z8 F
  14. *$ E( O/ \5 {1 ]+ r, R* H# N$ P
  15. * This program is free software; you can redistribute it and/or( R$ K$ k5 U( [7 S& X; ^
  16. * modify it under the terms of the GNU General Public License as5 q; A# L. D$ L! U+ z
  17. * published by the Free Software Foundation version 2.
    ) _/ V; h# ~6 v) s* j2 b  w6 L
  18. *3 i/ W( k+ |+ u. P0 v8 f2 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 O: w4 b/ b$ c
  20. * kind, whether express or implied; without even the implied warranty
    ! T5 H1 M* j; O) l: F& h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ k( W: V/ o1 c
  22. * GNU General Public License for more details.) E$ R5 ^1 c* D& t5 [# o
  23. */
    ' R3 D% N4 T8 b* M) F

  24. 6 f' t  o5 }0 E! F) q# W* D: J8 U
  25. #include <linux/module.h>% n+ v, F1 \5 a& O6 }) N
  26. #include <linux/init.h>& X! C" R% j) Y3 _
  27. #include <linux/errno.h>  ^8 L$ \9 q- t3 h4 x' z3 x
  28. #include <linux/types.h>
    2 c% ~8 J/ P1 R- p; A' n7 _
  29. #include <linux/interrupt.h>% v6 z5 o# v9 E  l8 g- ]
  30. #include <asm/io.h>
    ' H  t+ `# k0 W" R& M" o
  31. #include <linux/moduleparam.h>
    # l, U' K8 g& \* B
  32. #include <linux/sysctl.h>
    7 Y7 \, O) n3 b, a
  33. #include <linux/mm.h>
    + O7 H9 n( \" o1 Y- ]9 O
  34. #include <linux/dma-mapping.h>0 u4 V' o7 O3 w* q) Q: U
  35. 9 P5 L6 C0 g" a+ ]$ \2 B
  36. #include <mach/memory.h>
    ) a0 C# Z5 h% k8 {# t$ V
  37. #include <mach/hardware.h>
    8 T1 _. t2 j5 ^1 }3 R) l
  38. #include <mach/irqs.h>
    6 Y& f# o  G  |2 _; l; Y
  39. #include <asm/hardware/edma.h>
    5 m: E$ S; S) L$ O

  40. # C8 Z) b1 Q& d; Z4 Q7 S$ J2 G* V
  41. #undef EDMA3_DEBUG8 u/ ~* I& Z9 Z- {
  42. /*#define EDMA3_DEBUG*/  J  ~" T/ t. ^) A
  43. ; ^( i" [! H# Y0 u/ s
  44. #ifdef EDMA3_DEBUG
    ' `* \3 b1 o2 p' T# ~1 s/ p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % L" k9 [% x8 p  [9 {$ u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 Q- A& T$ A9 w( I% \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , ^2 T# O& x/ U
  48. #else
    / |3 i9 h6 G: y/ ?
  49. #define DMA_PRINTK( x... )
    7 a& Y' r# [* I* n6 H
  50. #define DMA_FN_IN% P0 ^, d* ]0 @; b4 d! V
  51. #define DMA_FN_OUT: ~; H3 q) }7 z
  52. #endif. y! T* C$ ?: Y( j& \. D9 c
  53. 6 G3 m  ]; V- t2 F. N6 E. Y8 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 Y1 |" y) w5 g& w" p% Z- n4 N
  55. #define STATIC_SHIFT                3
    . ?, u& A) V% ?3 `9 W5 k9 Y
  56. #define TCINTEN_SHIFT               20' Z& G$ y; b: f) R0 h
  57. #define ITCINTEN_SHIFT              219 t# T5 g2 @; z3 c8 P
  58. #define TCCHEN_SHIFT                22
    6 V, U' ]6 n( [' V" L3 I
  59. #define ITCCHEN_SHIFT               23! K7 _6 |1 o4 U6 m  \
  60. 3 R2 k. P' e, W% D3 X- v
  61. static volatile int irqraised1 = 0;- P# h% {1 @( p; j, q
  62. static volatile int irqraised2 = 0;
      g+ g) X4 Q1 I

  63. ' h( ?; v0 Y+ _9 [0 C1 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Q& }/ v9 P9 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( p* P( n1 B/ ^* I4 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N) Y, Y3 X4 b% c" ~
  67. % x: d( m0 N0 r( g. F! z. N
  68. dma_addr_t dmaphyssrc1 = 0;. o4 ?& k3 D% J* S% h* m  J' \; F
  69. dma_addr_t dmaphyssrc2 = 0;6 w. {- P; J8 T3 j% y
  70. dma_addr_t dmaphysdest1 = 0;( z) b9 k0 p/ |6 ^1 J0 H
  71. dma_addr_t dmaphysdest2 = 0;4 J# ^+ R9 o. i2 B+ T" J$ Z

  72.   t1 x! H  H: P: s& l' V6 u$ u
  73. char *dmabufsrc1 = NULL;
    8 z7 i7 y: S. G+ c* M
  74. char *dmabufsrc2 = NULL;
    6 v/ H# T0 {8 Y7 ^# v9 J& K4 X
  75. char *dmabufdest1 = NULL;
    ; l! ]- \. F  i0 k7 U- D
  76. char *dmabufdest2 = NULL;
    ' {5 H8 J& V/ `# Z2 T

  77. 5 {3 A# |' u2 c4 e2 Q9 |
  78. static int acnt = 512;
    " r, r0 m2 H. \3 v4 L1 m
  79. static int bcnt = 8;
    ( j0 ^; O$ C! ^5 Z; v( m' S0 x
  80. static int ccnt = 8;, c# W3 ~- B5 B! [& f

  81. + u1 @: s# R& U! z  }
  82. module_param(acnt, int, S_IRUGO);
    1 ^% b/ O! A1 j% W0 I1 h: e
  83. module_param(bcnt, int, S_IRUGO);
    / {* X' C8 ^/ ^9 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. S$ b+ Q( a3 T; `4 y; h; L

6 f; J# D: [: e8 L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 J& z9 E0 Z- J; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; a0 H% X1 W+ i, Z. |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: }6 m% r7 q  G! y, X  w5 F+ C% |" f+ g* M4 U9 Q7 s

& G9 O  ~* N. I+ c0 ?( S- s0 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 05:43 , Processed in 0.040941 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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