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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ ?7 J4 A/ x' x* ~0 r" I0 I% i( v
  1. [code]EDMA sample test application
    & f9 E# l: Z) x
  2. /*( j1 b3 J& ]9 _. m
  3. * edma_test.c
    # E# s) z5 i  b2 l5 ]3 _/ F4 }
  4. *; h* i( D( t9 f( u! T& w
  5. * brief  EDMA3 Test Application
    1 Q0 \* s) O" p/ R8 ~# V
  6. *
    ) g% y: [: P; T% g( D- L
  7. *   This file contains EDMA3 Test code.1 ~. A2 s/ m9 v9 Q% n+ _& W9 {; C5 x
  8. *
    9 b7 U) K2 H2 I; [  ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , A( l( H1 n) ]* r1 y( c# ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 u$ n8 l& a0 i8 O
  11. *         TO CHANGE.
    ' ?; y; [. X3 ^- _$ A
  12. *
    ) Y" W' {! [4 m% j' v( Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ E6 Y' k/ F# R" ~) s
  14. *( M# ?# d# M% e# u
  15. * This program is free software; you can redistribute it and/or
    ! e6 \5 K3 A1 X1 N- n" O' T
  16. * modify it under the terms of the GNU General Public License as
    ( p0 O& f: [- b# h: O( ^
  17. * published by the Free Software Foundation version 2.* x2 T7 }, m! w
  18. *1 k6 F0 Y( v% B+ b7 C0 g1 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 m6 e: G) a' L$ d5 r) l8 d
  20. * kind, whether express or implied; without even the implied warranty
    0 {) d  b! r! h- v; v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 Y4 y* c6 b6 D# ]* q) }2 G
  22. * GNU General Public License for more details.7 E. p( G7 G3 {- O4 `3 }
  23. */
    + U" ^. j' `3 \6 v
  24. 7 K" Y& ?+ x: _4 f* H% @8 _1 u6 m
  25. #include <linux/module.h>
    8 P2 a5 o1 ~8 B! o" h
  26. #include <linux/init.h>; \7 _! A% \1 ^3 o9 Y7 {& y+ m
  27. #include <linux/errno.h>+ @% m/ H+ s6 T6 @% S6 |) `
  28. #include <linux/types.h>
    6 R' Z/ a" I3 T' D( x, f0 C$ h% z
  29. #include <linux/interrupt.h>
    5 I1 u$ V7 \( \) ]
  30. #include <asm/io.h>* I7 K+ H  T8 i( y& V
  31. #include <linux/moduleparam.h>
    7 [; F# p6 F& B1 [( S
  32. #include <linux/sysctl.h>9 V7 U+ k/ P6 u& ?) {
  33. #include <linux/mm.h>
    $ F( f* p  l& ^5 M/ }
  34. #include <linux/dma-mapping.h>
    : k% l% b7 R$ `" i" O
  35. 7 G5 Y" I3 O2 g% k
  36. #include <mach/memory.h># m, K8 j" Z% b5 }% Q9 Z2 z
  37. #include <mach/hardware.h>
    - S$ }0 U" L2 _) j- u
  38. #include <mach/irqs.h>
    ( Z8 p& s/ C0 S
  39. #include <asm/hardware/edma.h>! L/ ]% R1 m4 h

  40. 0 o: Y, D% O4 V
  41. #undef EDMA3_DEBUG
    $ K0 X, W# \  ^9 z
  42. /*#define EDMA3_DEBUG*/! |0 ~2 L3 R3 J6 v1 A- @

  43. & o! b- z2 E  F4 M" s' _
  44. #ifdef EDMA3_DEBUG, \# {, d3 i( i! c2 j/ w% T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! Z* J6 }; F& E6 Q1 k$ Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! u8 k; y& \+ d2 o5 Q; \% d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 N* I3 p+ Y6 h; I
  48. #else3 g6 T/ d2 {4 n! u) }
  49. #define DMA_PRINTK( x... )8 _4 E+ x  l* o* R7 O& _
  50. #define DMA_FN_IN
    7 V: Z8 |) c. F
  51. #define DMA_FN_OUT1 Q  f8 E7 X7 i
  52. #endif) `$ u0 I, A  K: @) S
  53. . A$ D! ?3 s7 q! m+ Q+ u7 D, Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 S: y5 A+ n; N  M5 r, Q; Q
  55. #define STATIC_SHIFT                3
      O' S! ~; c8 V1 l8 B
  56. #define TCINTEN_SHIFT               208 O. M1 X. x$ o( U( i% k
  57. #define ITCINTEN_SHIFT              219 ]- E- H% z* e' e3 ?  }% Q: @
  58. #define TCCHEN_SHIFT                22) s( h8 M. i0 p8 b  j
  59. #define ITCCHEN_SHIFT               23& h' C+ F# A+ f/ P2 b* [: i0 F
  60. $ r0 m. d% _, p" V) a- A
  61. static volatile int irqraised1 = 0;# B3 N1 C% a: Y0 c
  62. static volatile int irqraised2 = 0;
    5 k7 W" H' Z  F% K8 |
  63. % ]9 T7 Y8 n. n$ L3 R; a4 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ \1 ?& ]: d% d$ ^4 n+ b. f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: k- D% t/ V4 S' p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 J" q' w% F! W3 [$ ^5 \% Z
  67. % ^9 Y% F& Z4 U+ c6 n5 @
  68. dma_addr_t dmaphyssrc1 = 0;- o2 l5 X/ ~* Q# `3 j0 b" M0 F: }
  69. dma_addr_t dmaphyssrc2 = 0;# t( P( @9 r8 q
  70. dma_addr_t dmaphysdest1 = 0;
    * k! }& O. P" b
  71. dma_addr_t dmaphysdest2 = 0;/ v8 ?$ e# H, z5 x* f
  72. ) H# d( l$ L# [" w* [
  73. char *dmabufsrc1 = NULL;8 {  n$ m( ?, ^- A8 b4 ]
  74. char *dmabufsrc2 = NULL;4 X( u% v+ k: L! {3 o
  75. char *dmabufdest1 = NULL;+ \& n4 ~; x+ p8 y
  76. char *dmabufdest2 = NULL;& Q! e2 J, S$ c. l$ [" E2 O' Y& s
  77. , ]' a, b( O1 ~- _; n% z* j; F
  78. static int acnt = 512;
    1 ^& X8 Z) D. ^. X9 }3 N1 C
  79. static int bcnt = 8;
    ' v: p5 i1 n3 @& p+ u# q
  80. static int ccnt = 8;
    , L4 M5 g7 G0 V/ d' c# u

  81. ( k! i" {  [' R4 S! W' ?4 ?
  82. module_param(acnt, int, S_IRUGO);
    : m0 H1 ?% q8 R8 D9 \+ U) J+ e8 |. w
  83. module_param(bcnt, int, S_IRUGO);8 e+ y9 `4 `/ Y$ K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. I' `/ B. D! |4 E! [3 x9 V; G4 }/ g1 c1 R' g/ @+ p2 j! H; o% O4 l) [/ F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ R/ ^- v5 g4 L- J0 W6 s4 p3 [
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( L/ K8 G4 T2 j  c( z# }; i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& c& }9 L% k1 z+ S
# D3 h3 C% |/ X
0 ]- ?1 O4 Z( ]; |8 T* ?6 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 21:29 , Processed in 0.038616 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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