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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" h5 g+ w8 W) G' H1 J' V5 ^% u
  1. [code]EDMA sample test application. \. x5 k0 W4 q4 t5 U8 i$ |, h/ |, f
  2. /*) Q$ `! @# D, Z  U2 m. O
  3. * edma_test.c
    5 H! Z$ J; }. u2 x
  4. *8 Y- O$ P: h6 w9 ^
  5. * brief  EDMA3 Test Application
    * _+ f( N* Y+ D; c6 K
  6. *
    4 ~4 p6 |" v) i; a  A
  7. *   This file contains EDMA3 Test code.1 ~* B& j1 |0 X) Z7 `9 V
  8. *: @, l$ x/ n3 p; {! f3 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  O: ~+ N, e$ t8 F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : S. m% L( f' L, `) Q# ]
  11. *         TO CHANGE.3 g6 x" `7 t* r+ m
  12. *. r! v, m, o( H, L. d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 F) C$ U: A0 y
  14. *. k/ x+ g( S3 n- m
  15. * This program is free software; you can redistribute it and/or
    4 _) _0 a7 E( D$ {/ \
  16. * modify it under the terms of the GNU General Public License as% R; s3 f2 D7 v7 e
  17. * published by the Free Software Foundation version 2.
    5 y% D$ a8 o$ ~! k* t
  18. *
    & p  F8 K$ L! z1 i6 Y! u) Z4 \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. P, `( k6 c0 i2 V& P9 |9 k0 I' ~! H: g
  20. * kind, whether express or implied; without even the implied warranty+ }/ k7 G0 w/ Q0 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! C! c( V( r9 a4 L$ d6 `) {' Y; s
  22. * GNU General Public License for more details.- f+ K6 H8 U+ r; O3 Y* d
  23. */. w5 G, H0 Z. m9 G! c, k+ G
  24. # Y8 ?5 ]0 ^+ N8 b1 p0 c9 M6 J
  25. #include <linux/module.h>4 Z) Y$ E" a3 L9 I* P
  26. #include <linux/init.h>! E7 m% u. d7 X4 M
  27. #include <linux/errno.h>1 U1 Q) u, s- a
  28. #include <linux/types.h>, t; r# G/ d" b3 T) K' M& [0 t/ k
  29. #include <linux/interrupt.h>
    6 r( a0 s! @8 N9 y8 D0 O
  30. #include <asm/io.h>; o7 m* e( ]& t) C+ @$ }
  31. #include <linux/moduleparam.h>! z& H( I: [. N6 n* y
  32. #include <linux/sysctl.h>
    & {$ R) w- B% U8 J/ F6 q
  33. #include <linux/mm.h>- w- ~/ Z* j: h
  34. #include <linux/dma-mapping.h>
    ) }4 j( G2 V4 M3 E. e
  35. * z8 [* L7 D" j, @# a/ p0 n0 \
  36. #include <mach/memory.h>
    $ t8 F" _( i# {* d. ^% g4 c3 k
  37. #include <mach/hardware.h>
    ) J& R$ k7 i+ a# N- I* a, r
  38. #include <mach/irqs.h>3 s! E; F; u) V
  39. #include <asm/hardware/edma.h>
    & X% ]' C1 Z# ~! \2 A8 h
  40. 3 P2 N; [/ `6 ?/ h. F- k
  41. #undef EDMA3_DEBUG5 T$ p4 v. q- V8 P
  42. /*#define EDMA3_DEBUG*/: H+ D  T0 b3 @- U( o

  43. % G. m9 b; \, h7 E  {
  44. #ifdef EDMA3_DEBUG
    ; p4 p  n' z* C6 c$ v; K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' `9 z9 ^5 T0 b% y" X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 X3 f3 x; ^4 k$ F: Z( w& {! l1 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 B! v2 y& I% d5 Y
  48. #else
    4 R# a2 F( Y" S8 c, @9 w0 d
  49. #define DMA_PRINTK( x... )
    3 h& \; _1 ?  C2 f6 q! ]$ a
  50. #define DMA_FN_IN
    * e0 H3 `- Y# M3 W$ n
  51. #define DMA_FN_OUT4 ~8 t8 U. n/ `$ O
  52. #endif
    $ i2 ^# U, |- R0 `$ t

  53. ! U* t( n8 j1 s2 d/ R: g( S, q  ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), s' l  g% u. v
  55. #define STATIC_SHIFT                3- n0 n2 ^9 \# I
  56. #define TCINTEN_SHIFT               20
    0 C% V2 r0 l9 r" B
  57. #define ITCINTEN_SHIFT              21
    ; a, S; L! ?+ g8 |
  58. #define TCCHEN_SHIFT                22
    , G: T' `& D7 H8 e3 u0 X/ A  w
  59. #define ITCCHEN_SHIFT               23# y9 t1 K! a: B7 @4 N

  60. / \$ A/ j& N. z3 s- c
  61. static volatile int irqraised1 = 0;+ H- n" Y6 Q* w" q
  62. static volatile int irqraised2 = 0;# X0 I$ s) z0 n( l
  63. 5 L; L* s+ b/ ]! ]. q% m) J' |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 x8 e; B* }' y. Z  J3 i0 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ V6 t* ~3 V8 B* I3 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # `) X1 i2 z% [3 K& L8 Y0 ~

  67. / a' t1 [, U: z2 C# m/ u2 T/ P, a
  68. dma_addr_t dmaphyssrc1 = 0;
    / ]2 ?3 q, w$ Q0 W  q" B/ L6 k
  69. dma_addr_t dmaphyssrc2 = 0;! l& m6 B/ @7 u
  70. dma_addr_t dmaphysdest1 = 0;
    ( x! m5 B3 o% C' a3 K- Q! m
  71. dma_addr_t dmaphysdest2 = 0;
    5 R2 {1 j# @  o; a; X+ _7 t; O& ^

  72. % R4 n2 d0 I, t9 h* S
  73. char *dmabufsrc1 = NULL;, G& v" z9 _0 X& {. y
  74. char *dmabufsrc2 = NULL;2 `, D; M/ x& ]/ p; `- w
  75. char *dmabufdest1 = NULL;$ N4 `3 N2 L; u3 \1 `/ S
  76. char *dmabufdest2 = NULL;4 s- H, m' |, z1 u3 h! J
  77. 9 x  m/ m. H# \1 f- Q: q7 L9 {9 t
  78. static int acnt = 512;
    7 l6 R% H7 k5 Z2 \
  79. static int bcnt = 8;2 _3 ~+ ]! w4 g% n- r3 a+ i
  80. static int ccnt = 8;
      [# m' F4 q( k- L9 S/ A: F% Y
  81. 1 e1 \% v$ `7 j
  82. module_param(acnt, int, S_IRUGO);
    ! P* p; P/ n- r  M9 y! @, z' |3 v. f, Z
  83. module_param(bcnt, int, S_IRUGO);
    # ^* C" H7 [- Z! e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 O1 x6 P; `- x4 @- C- _. T& t: C: x
2 v2 g1 A" l9 M/ U! l, w$ b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, X: W+ a! K% X+ t8 Q8 W5 Z, v; n' |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ P  F" o/ R5 E$ l$ U2 }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 W$ T. w% S7 U! q9 T' [5 U

" b% k( M/ w0 H5 N; \8 ?0 z3 X" U: h8 b
6 T# s- Y$ f7 z; R; ]$ M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-18 11:08 , Processed in 0.043921 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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