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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 r" k9 l! E- z$ F
  1. [code]EDMA sample test application
    ; h! I/ z, V9 M9 P( [9 w0 J
  2. /*3 k' V$ H6 C" b! {$ h  f, j$ w+ Q
  3. * edma_test.c
    . R% D. G2 [& s
  4. *
    : G2 D9 u+ ~% D" _
  5. * brief  EDMA3 Test Application
    * x5 y& |5 {" G# K' W3 z
  6. *7 `5 L# M( S6 v( Q
  7. *   This file contains EDMA3 Test code.
    * L4 y# @; e$ ?4 ?( \4 u3 A
  8. *  a1 N. Z! Y9 |1 s2 B+ N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : a( n& _  p* f  H! _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ g3 j- k$ S" T( j, D+ q/ x- {
  11. *         TO CHANGE.
    + z6 \) ?9 e& `0 l$ i% g* l* W
  12. *
    . p3 t! m; y* r# I& l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ e0 d- B' M% x' |+ c
  14. *
      l+ s# L5 O1 L- I& r  t6 u0 U
  15. * This program is free software; you can redistribute it and/or9 U! s) i1 v  c' L  R, _
  16. * modify it under the terms of the GNU General Public License as
    5 x0 Z" V7 Q5 `$ h
  17. * published by the Free Software Foundation version 2.
    % S, L6 j5 i0 S
  18. *+ \' q) ^; {$ C% u0 R4 y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . \+ N  X. q" P) B6 w) [( r" W
  20. * kind, whether express or implied; without even the implied warranty
    4 u7 U2 U* L+ |2 r! ^! V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 b; i+ ]; e' \- s9 T5 D& l
  22. * GNU General Public License for more details.( K5 N3 B- [7 e
  23. */+ s" A2 P# z9 h  b) ~( z$ f3 B4 j

  24. 0 f0 B% s% Y1 Q* U7 h. s
  25. #include <linux/module.h>/ Q  L3 t! x8 _# L2 D! o, i6 p
  26. #include <linux/init.h>% y: h9 j- C: O+ c6 D7 D
  27. #include <linux/errno.h>
    7 S3 q# |, P4 K- m/ e% ]
  28. #include <linux/types.h>
    3 s1 o2 c& g% l, q
  29. #include <linux/interrupt.h>
    $ p8 A3 l4 w- [7 a1 k1 c
  30. #include <asm/io.h>
    . v1 E1 e2 `( \# \8 x0 c! y+ e0 T
  31. #include <linux/moduleparam.h>/ L; ]* P8 B& V. L; V8 q! Z0 _
  32. #include <linux/sysctl.h>$ N; {3 @5 b; E* i  P# [
  33. #include <linux/mm.h>
    * L7 [/ p( Q8 a/ X+ K
  34. #include <linux/dma-mapping.h>
    ' k! x5 \( ^1 P8 N7 b' A

  35. + v  l) ^2 B5 Z0 s# U0 t* W8 p
  36. #include <mach/memory.h>
    1 D. s& e: l! ~& ^4 E2 H+ V4 F+ `# J
  37. #include <mach/hardware.h>! C4 Z  C: ~. @8 c+ o( {7 n
  38. #include <mach/irqs.h>8 o0 G- p; N) X. I, i
  39. #include <asm/hardware/edma.h>
    / @& V. Y# G8 V! l2 @7 n9 f9 }

  40. 7 `1 C/ ^5 l9 z) i2 }% [7 s
  41. #undef EDMA3_DEBUG/ f# e: A& s3 h8 r+ ^9 k& o9 w
  42. /*#define EDMA3_DEBUG*/
    , q9 I( f( \: j6 p! V: F0 g, t* O
  43. 3 p4 ]0 ?; T2 m$ ?
  44. #ifdef EDMA3_DEBUG; X) O4 I/ ?5 D, o2 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 ?  g) M+ R. Q$ R: S0 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % o* I0 X6 ^# {; Z$ K# |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 T) C5 A; i' F
  48. #else
    ; N' f" B* i" s8 D# i" W
  49. #define DMA_PRINTK( x... )
    & ~5 b5 k! P; Q, {/ c! M
  50. #define DMA_FN_IN
    9 Z; O8 f+ s: L; s9 g
  51. #define DMA_FN_OUT! V( `5 q  A5 s& q7 `/ f: t$ W
  52. #endif% ]3 Q/ W6 y& X" I' M* i/ J
  53. - u2 s8 x& Q+ Y5 w2 F( m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( `+ h) I% K! t# M6 o
  55. #define STATIC_SHIFT                3
    + A2 k+ {- ?) [. p
  56. #define TCINTEN_SHIFT               20+ U" E! a  V  j. u
  57. #define ITCINTEN_SHIFT              21
    * S6 k; I' u4 D' I' z5 H
  58. #define TCCHEN_SHIFT                22* F5 P7 t2 z: s
  59. #define ITCCHEN_SHIFT               234 x  ?( C7 o! J2 t" f

  60. - f2 B8 v1 F" m& p: Z4 R
  61. static volatile int irqraised1 = 0;6 e' t5 @2 v' {, {' H( X
  62. static volatile int irqraised2 = 0;
    3 m$ e  f7 N0 ?% q" s# u' p* h6 ]$ r

  63. / q4 l2 ]8 e5 M* ~7 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 T) p4 q, Z/ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ], i- L( G) b+ K1 F' _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( `# v, ?% r! J, u3 a/ f
  67. & \, ^5 R+ g- c8 F0 z' O
  68. dma_addr_t dmaphyssrc1 = 0;
    % r" t$ V; d8 |/ o
  69. dma_addr_t dmaphyssrc2 = 0;+ F4 z6 N) M( o8 M+ ?; a& `/ |: H
  70. dma_addr_t dmaphysdest1 = 0;
    , |/ L5 O% T' F7 ]- O  {6 m0 g
  71. dma_addr_t dmaphysdest2 = 0;
    $ V. k1 W/ R: }9 y: e3 [- g+ c

  72. , y0 a' y9 v5 T( ^% E2 v5 p
  73. char *dmabufsrc1 = NULL;0 d4 g  l$ a  Z
  74. char *dmabufsrc2 = NULL;
    ; j- H0 q5 R- ^2 x
  75. char *dmabufdest1 = NULL;9 w0 G& e( C' v
  76. char *dmabufdest2 = NULL;  d+ d- C+ a  s, i+ d6 ]+ {

  77. ' T2 O$ R0 V! }6 B
  78. static int acnt = 512;
    9 m' n8 f  |) {+ a+ ?  P
  79. static int bcnt = 8;
    * L& E% R7 D% ^# v  x
  80. static int ccnt = 8;" p, g: V% d2 @' [& S3 |1 N
  81. 1 P% j& R& m+ M
  82. module_param(acnt, int, S_IRUGO);5 u$ V% x0 J% k. J$ D" F$ L5 o
  83. module_param(bcnt, int, S_IRUGO);( [  i9 j, e9 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, |. h+ c4 z( g7 ?, v8 M1 _) [, H. q% A4 h- Q* h( X6 A0 T- S2 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  B2 O4 d0 I* O! [( I/ ?2 z) Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 v) u4 E, ?4 S7 C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) I& c2 b- ]5 R& y0 `
+ Z' ?  J# k  T0 s- a: \+ c  H; ]7 h# b% d) R$ [% a4 R( o1 {% b! V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 22:58 , Processed in 0.045440 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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