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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 V! C: N9 P  u. s* k- q" g* ]6 o
  1. [code]EDMA sample test application
    2 W- A1 n7 r9 m) O& K. ?
  2. /*7 v( b1 j9 s7 T- S
  3. * edma_test.c: I8 ~$ ^' ]1 E
  4. *- i0 p$ R: E: t. b+ ^2 F4 C: I" L
  5. * brief  EDMA3 Test Application
    : R& e3 p* Z9 Z; R/ n
  6. *
    - X5 W2 h2 K& K4 s5 t' o! v& ^* G
  7. *   This file contains EDMA3 Test code.
    4 p' F8 c1 M8 o. R, t8 b
  8. *9 s1 @$ _! C! s4 u) F1 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' y" ~- }. o/ W/ I& {; K8 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 O. D9 D3 l7 ?. d
  11. *         TO CHANGE.* k2 t8 S9 u* I" O- X+ H
  12. *- E: t* [, E$ _$ ~6 c! f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// h) _# K  K! a# W  [9 v
  14. *1 j# M- v, t& K. w5 A" _9 W: r
  15. * This program is free software; you can redistribute it and/or
      r' x$ u+ O! n/ {* L
  16. * modify it under the terms of the GNU General Public License as7 h* ?/ O: E. p
  17. * published by the Free Software Foundation version 2." Y2 T8 ]  I/ ?
  18. *
    + M; T0 s: X* k3 `9 h# v' n& H. q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - a: w& l/ a4 i6 G5 N# v* i
  20. * kind, whether express or implied; without even the implied warranty/ k5 R! L% B7 ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 E6 ~! f# i* E
  22. * GNU General Public License for more details.* S' w  z7 ~. D& c9 p
  23. */
    3 g' h$ s6 [; p5 S: J
  24. : j* t6 \; y  |2 T! v* [: U
  25. #include <linux/module.h>
    3 S, J  E9 B" i1 R; y
  26. #include <linux/init.h>" g* k& t1 }' E3 c
  27. #include <linux/errno.h>7 D8 h, L" |0 q% ~
  28. #include <linux/types.h>5 L5 x2 i% {) s' X1 M. \  b
  29. #include <linux/interrupt.h>
    8 T) y- u5 n. N) D. S7 V
  30. #include <asm/io.h>
    3 F8 l) W- b0 ?& `) z0 S2 Q  f
  31. #include <linux/moduleparam.h>
    ( _0 H# s: A2 U- s
  32. #include <linux/sysctl.h>. c% F1 q' x4 m% N7 D8 C
  33. #include <linux/mm.h>* t+ f! Q1 C1 F; N5 s& ^
  34. #include <linux/dma-mapping.h>
    . A2 D2 `3 R% c% h; C
  35. 0 L7 y( _  t6 y
  36. #include <mach/memory.h>
    : r4 T" z; w6 F( p7 U
  37. #include <mach/hardware.h>
    ( B. l! G. d9 s8 G+ y- ~; c
  38. #include <mach/irqs.h>
    6 O2 N2 `. n/ u! z. x( O, \. V1 Q
  39. #include <asm/hardware/edma.h>
    $ J8 l8 }& o, Y6 b4 r% Z- o4 F$ |5 T

  40. ; [% P/ W8 T2 O" Z5 W2 J
  41. #undef EDMA3_DEBUG& j; K4 b+ `1 M* J- A
  42. /*#define EDMA3_DEBUG*/$ m( A0 ?. i- k7 N4 v

  43.   W3 ^8 \; D* {# T0 n( a- L( r- n8 c
  44. #ifdef EDMA3_DEBUG
    , @9 R# {! I' O+ X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  B4 P) Q; ^6 F3 c) i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 h& D7 G; H' F' O. c  j5 |5 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' ^- h5 }) i0 J
  48. #else
    " |9 U' z$ O  y6 G
  49. #define DMA_PRINTK( x... )* i: |" q1 m9 X" b( p/ ?5 ^
  50. #define DMA_FN_IN( E8 V( m. d& e' z9 |* J
  51. #define DMA_FN_OUT
    3 U7 q- Q; l5 _
  52. #endif
    , e+ |3 ~) o% u+ t8 `4 H
  53. ( F' \- K# D3 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - b8 D9 B4 T  Y5 E
  55. #define STATIC_SHIFT                39 Q( j! J" U, Z; `7 ]0 X% x9 Y
  56. #define TCINTEN_SHIFT               20
    ; J4 H" l2 k4 L1 ~# y  D4 L% q# L
  57. #define ITCINTEN_SHIFT              21
    3 ~  C# k$ o: f- Y
  58. #define TCCHEN_SHIFT                22
    $ q, n/ J2 D7 \/ D
  59. #define ITCCHEN_SHIFT               23
    8 n& f$ Z) e9 i' e8 g+ @( z

  60. - ?1 \7 ~7 \$ W1 O! J0 M
  61. static volatile int irqraised1 = 0;
    ( C, k) A/ {% I: F; R
  62. static volatile int irqraised2 = 0;6 h" L; T6 B+ U: p1 u* o
  63. ; T5 ^# x& c* g  k0 _+ |4 a" J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 U7 n: W1 H# j4 P$ w& M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 k+ T! e; [  ]1 F1 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; z2 C5 E. s# h2 e& V8 Z- B
  67. 1 T' B6 f- G4 m- Z( J. A5 y8 ~
  68. dma_addr_t dmaphyssrc1 = 0;
    & z; K' n7 Z! f4 r
  69. dma_addr_t dmaphyssrc2 = 0;( K! L2 m0 K0 Y' _
  70. dma_addr_t dmaphysdest1 = 0;0 A" U1 u, G/ v, F! f; x. }
  71. dma_addr_t dmaphysdest2 = 0;1 [' p" `9 [5 `% a9 \6 s% |, f& @; Q
  72. ' d. z! e" [) m( l1 ~
  73. char *dmabufsrc1 = NULL;* U( `1 D! o* e2 {5 [8 e/ Z
  74. char *dmabufsrc2 = NULL;# N6 [- n3 L1 G: h! g
  75. char *dmabufdest1 = NULL;
    4 V% n7 S6 S9 d+ K/ W9 P
  76. char *dmabufdest2 = NULL;
    ! |1 o4 a2 ~( _9 S9 s0 ?6 i9 ?4 f
  77. ) m( X* |2 H0 k3 D% Z! _6 U& F
  78. static int acnt = 512;
    / T! r$ z/ k  e1 P+ o
  79. static int bcnt = 8;2 m, w) J1 p4 k% i
  80. static int ccnt = 8;* l/ ?8 M' k! L+ R, `2 x

  81. . H2 R- G( r# E- n! l" @7 i4 _
  82. module_param(acnt, int, S_IRUGO);
    9 H  _3 T  s& z7 f4 f) |2 `' B
  83. module_param(bcnt, int, S_IRUGO);
    - P0 v0 W2 P( n9 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. f# `3 G  T. Y- e+ y+ p* a/ c- V% ~5 K* Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, c8 @; t. f$ m6 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 L+ x2 o! `! T& E% x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 e: K$ r1 w; s9 d
. D$ f0 `4 x0 J& L
" q! a: C% I8 h+ E0 Y) z2 p6 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 15:28 , Processed in 0.044166 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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