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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 e  I6 T' Z9 r5 l/ `( o1 d
  1. [code]EDMA sample test application
    5 F0 Y/ S) z3 o, }3 Q& l
  2. /*
    3 @( k/ o5 G% A" _
  3. * edma_test.c. D5 _+ f8 t  W" x6 l9 c7 R
  4. *) h& `( I) Q2 z: g
  5. * brief  EDMA3 Test Application
    3 W6 Z* A2 H2 K6 T
  6. *
    ' x  {0 [  u& S! Q
  7. *   This file contains EDMA3 Test code.
    2 D: K( O. b& q/ ^( t, C$ a
  8. *5 n4 e, h: M- s( x, J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 K- b. a7 r  p+ y7 |% X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 T% U- [  v1 J. F) _, p9 H
  11. *         TO CHANGE.  Z4 H" \# {* r$ V1 ^* E! `
  12. *
    0 C/ D8 h& C% N  H# b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , j1 W1 @' }. U4 u
  14. *
    3 I7 f5 ^8 [! k5 K+ b; B: P
  15. * This program is free software; you can redistribute it and/or3 u6 B- J0 o3 v
  16. * modify it under the terms of the GNU General Public License as+ W2 M( E( f& j& H* ?1 t
  17. * published by the Free Software Foundation version 2.2 N( }/ b% P/ U( C
  18. *# Y6 b! m3 i* d' Z, E/ R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      v* l& i% e- z" z1 E
  20. * kind, whether express or implied; without even the implied warranty/ X1 s  O; d3 Y- k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; R$ Y# c, ?& w8 W1 v" g6 r
  22. * GNU General Public License for more details.
    4 E/ @: L! l2 N/ S5 Z  t( y
  23. */
    ' w6 ~5 s6 T2 q3 e! i# N

  24. 7 I. A- V; L  p; V
  25. #include <linux/module.h>* i. c2 s$ r0 h% q7 f1 R( x6 I
  26. #include <linux/init.h>
    4 B# F* G0 i& A3 f* v# p7 f
  27. #include <linux/errno.h>: y6 G2 o; \- ?7 y
  28. #include <linux/types.h>2 k7 Q/ ]; x1 n( v) u
  29. #include <linux/interrupt.h>+ o. z! ^! h, Q1 U4 o1 T
  30. #include <asm/io.h>
    5 G2 M+ T5 P& N4 S' W" ^- x4 x
  31. #include <linux/moduleparam.h>  u" n( e, [5 H& V* s9 \
  32. #include <linux/sysctl.h>
    1 F- o! n5 ?0 O0 C7 l# ^1 v2 `
  33. #include <linux/mm.h>9 W: P6 h; a" q, A, K
  34. #include <linux/dma-mapping.h>+ }0 ~3 W9 e" `

  35. ( ^0 |+ W/ u! ]9 ]  h, v
  36. #include <mach/memory.h>- u! O4 S% o3 M0 }: p1 @& \+ _- o
  37. #include <mach/hardware.h>
    , c' n5 g9 \) x$ N- \' M
  38. #include <mach/irqs.h>- O% y8 @( E+ _% l8 r
  39. #include <asm/hardware/edma.h>
    & B! A0 `5 ?* K, l; E/ `% q

  40. ! u- f* g6 |- W
  41. #undef EDMA3_DEBUG  I, A; S- o/ v& Y
  42. /*#define EDMA3_DEBUG*/
    ( N  \5 R& u9 F4 Y4 {, u

  43. + B7 R1 x5 _! Y
  44. #ifdef EDMA3_DEBUG  m0 p' I7 k: v$ P4 ~: F3 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). Y% d# t+ l3 m. L& A, Y3 L& g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! A7 o' B0 T! E# p6 ?( t6 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 `3 @  K% f0 M) `4 _7 \! Y9 d
  48. #else0 A, _, u! s8 ?- H3 r$ g0 k6 P
  49. #define DMA_PRINTK( x... )
    ' [7 f# d7 R# w) l
  50. #define DMA_FN_IN
    ' K+ |4 J9 ^9 Q, R; g: e
  51. #define DMA_FN_OUT% |3 c+ q2 a( |+ B. s0 Q- v
  52. #endif
    + S2 e! _4 m4 T. P: A
  53. 2 e1 s: r# D( E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( @1 B, `  B* A) \  k! L: \
  55. #define STATIC_SHIFT                3
    " L; p$ Y7 \: W
  56. #define TCINTEN_SHIFT               20
    & d8 M, y1 v, g0 m8 a
  57. #define ITCINTEN_SHIFT              21* B9 I1 r0 ?  I4 i
  58. #define TCCHEN_SHIFT                22
    ( _9 ^, g' _, d( U
  59. #define ITCCHEN_SHIFT               237 H! J$ i0 Z+ e1 S6 E4 f( I& L
  60. 6 D# k1 I1 Q' \, r
  61. static volatile int irqraised1 = 0;  ]$ ?! W( {$ }) x
  62. static volatile int irqraised2 = 0;* D8 f% \; ^" B, i9 X2 X

  63. # t( b" L4 c# @5 K; L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 R$ C8 c- _, ~1 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " I! f) R" ~9 s8 n/ b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' b& r! B' ]- g& a/ k0 O

  67.   V3 p5 E; u4 P8 t, i
  68. dma_addr_t dmaphyssrc1 = 0;
      u8 i) D  L3 C
  69. dma_addr_t dmaphyssrc2 = 0;2 k9 k- S* q( K" c+ o1 m2 [: d: g; x
  70. dma_addr_t dmaphysdest1 = 0;+ A  y  f: V! S& ]0 Q" R
  71. dma_addr_t dmaphysdest2 = 0;
    . A1 ^) r& x7 Q* ~9 j$ O
  72. 0 q/ B/ I& o3 [5 d# E3 S4 M, M
  73. char *dmabufsrc1 = NULL;
    7 [: F4 j% @% }! B' C$ s0 J
  74. char *dmabufsrc2 = NULL;
    ! w+ [3 Q( o1 _' k
  75. char *dmabufdest1 = NULL;
    ! k/ O, \3 y  W1 Q, P  M* u* J
  76. char *dmabufdest2 = NULL;- I: t- k( I, J4 y

  77. + {* `" t7 Q/ j& i. E( S$ T2 \
  78. static int acnt = 512;
    - T: V9 S% e. e/ t9 ^5 Z. w: @
  79. static int bcnt = 8;
    9 n& [7 e* T3 j, W- n/ ~
  80. static int ccnt = 8;' O/ w9 r  ^) p/ c3 K# ~- [
  81. # |$ }/ u  L$ E  s: u6 r% B5 |1 R
  82. module_param(acnt, int, S_IRUGO);# Y; V) U  g8 W8 c3 S6 @
  83. module_param(bcnt, int, S_IRUGO);
    # v4 V( T2 Y9 C% r3 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* E, I3 f  u9 O( `5 M& j: C% x( ~
& E( J& o3 s- U5 Q) ]7 b# d* b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# i1 G5 T; t2 _& E4 \: J/ Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ C# i, s/ c5 E- v. C- z: J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 d8 S* z; Y$ n# ]/ U5 c: V/ g% v/ _" {/ ]0 z
& J4 U  D5 i' @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 14:15 , Processed in 0.038318 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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