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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# O  E# P+ u- M( p) n9 n
  1. [code]EDMA sample test application/ V& h: W$ T( v6 J
  2. /*
    # f5 m( h. ~( [: z. _: w7 ]
  3. * edma_test.c# a8 u$ W  A+ m# }8 i$ X7 C5 i
  4. *
    * b8 k7 G8 L/ t+ b. F
  5. * brief  EDMA3 Test Application( C' S, Z+ }/ q2 V% H. C5 ]8 B( c
  6. *# u# m) W9 _% z. U. p+ W2 |! K
  7. *   This file contains EDMA3 Test code.; m/ u0 z: l# |0 w3 u; K$ H) g, n5 I
  8. *6 ?/ o* I* }6 k) \" w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " Y0 I* X$ }$ k; o9 L$ k1 L1 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , g' O7 H% g$ ?7 c6 V
  11. *         TO CHANGE.
    3 Q# @, A( b* p4 n, j$ k7 e
  12. *: a% Q7 I# |# ^' f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ K% u. S/ Y9 t
  14. *$ B6 q$ ?. K+ V7 Y4 b
  15. * This program is free software; you can redistribute it and/or
    2 B. I" z; L+ G  a, G
  16. * modify it under the terms of the GNU General Public License as
    % {. N* C3 Q3 t+ V: Q
  17. * published by the Free Software Foundation version 2.
    " E& x' ]" ^9 X2 u8 m
  18. *& O% |) S! S- e" D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  ?1 a1 U  K' s2 B- b6 S* L3 |
  20. * kind, whether express or implied; without even the implied warranty
    4 ~. j8 L5 g# t, G3 v& }: x# [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      E1 U  a! O. I/ p! l8 m
  22. * GNU General Public License for more details.
    6 h" o4 r% o9 h+ X" ?) |+ B
  23. */
    1 s" P) U7 P. r8 f# c& \, I* a
  24. ; W4 G& y' f6 Z9 E# w) K- q. {
  25. #include <linux/module.h>/ u8 t) |' t2 c" k
  26. #include <linux/init.h>
    ( K* q8 }# C# s1 b* w8 c5 w. U
  27. #include <linux/errno.h>
    $ c- X, i* a# J2 {& I4 L
  28. #include <linux/types.h>6 Q4 e3 Q1 p8 u
  29. #include <linux/interrupt.h>
    - B# e" L* i2 R6 o6 a
  30. #include <asm/io.h>( u+ _' ]& {- q; W! p7 P. H
  31. #include <linux/moduleparam.h>6 G  u8 N( U0 }0 r
  32. #include <linux/sysctl.h>
    ! v4 u) n8 L1 y6 N* h
  33. #include <linux/mm.h>1 X5 K( R) @3 h0 C1 r, w/ q
  34. #include <linux/dma-mapping.h>: z, p. t. R- l2 ?

  35. . u7 q& S& n  |; c
  36. #include <mach/memory.h>
    + \: p3 h* N4 f1 {
  37. #include <mach/hardware.h>
    , Q( s2 d' n6 p
  38. #include <mach/irqs.h>
    1 W9 z. C; ^- x: S% [$ k$ j0 B/ g
  39. #include <asm/hardware/edma.h>
    9 f% y# x1 W1 Q! Z
  40. ; I9 P/ p2 s4 A6 ~6 U' H, c0 r
  41. #undef EDMA3_DEBUG/ `7 @& g7 y6 U7 h' R
  42. /*#define EDMA3_DEBUG*/
    4 S& E9 C' ^( K& Z/ C6 }
  43. ; x4 Z1 ?3 H9 z* y: y* e; z
  44. #ifdef EDMA3_DEBUG3 F, A7 {# f9 d5 k  y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), q5 G/ V+ J: C- E) V. r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ M, \6 ]9 Q6 i4 \$ G7 U( M* A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . w$ Y# u4 }4 I% _
  48. #else
    & S7 F4 }3 z' C5 N' R5 r
  49. #define DMA_PRINTK( x... )
    $ x8 G* s9 y* g8 B
  50. #define DMA_FN_IN
    0 y0 \0 O: ^" c! M/ [7 q
  51. #define DMA_FN_OUT, B# T7 U4 E$ u/ i1 [% K& U* f& c
  52. #endif- w/ S) p; N: E8 }, B, Y1 b
  53. 4 Z8 W7 d+ O3 Z; }7 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- x3 V2 f" g! G1 L; g7 W
  55. #define STATIC_SHIFT                3, u* Y3 ]6 Y" a! B( V
  56. #define TCINTEN_SHIFT               20
    2 w* q  _+ T! p- ]. y5 w
  57. #define ITCINTEN_SHIFT              21. @  u4 K' C% [' S6 @
  58. #define TCCHEN_SHIFT                222 f0 b; ?# Z7 S  y* R
  59. #define ITCCHEN_SHIFT               23
    0 f0 ^6 N6 W/ |4 j$ K8 r

  60. ! J; T% e" k6 T! j
  61. static volatile int irqraised1 = 0;
    ) X0 B- S) Z# M, q& Q9 j# K) h
  62. static volatile int irqraised2 = 0;
    & P2 Q4 l4 M" P2 \9 S/ w3 H

  63. + b1 f4 ~9 |+ N5 N7 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 F" I6 {* J. E1 ~# {8 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! T2 N) J/ R" h, J4 ^1 r7 O* G: ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( d+ J1 `* ~0 c  u' i2 _

  67. 2 o' }. i5 E2 b( \
  68. dma_addr_t dmaphyssrc1 = 0;
    4 {7 j" p$ I  C( j* z
  69. dma_addr_t dmaphyssrc2 = 0;
    , Z% E7 t' B& C) G; T8 r
  70. dma_addr_t dmaphysdest1 = 0;' s7 ]3 P9 n3 G% s" ]
  71. dma_addr_t dmaphysdest2 = 0;
    7 \' W, A5 q/ L9 S4 X* E/ j

  72. % P- N6 f% p3 q  ~/ ?( E1 K
  73. char *dmabufsrc1 = NULL;1 v4 z: O9 M) b! C0 f
  74. char *dmabufsrc2 = NULL;, G2 O% e/ s1 W' ?
  75. char *dmabufdest1 = NULL;; F- Q3 X6 ?" q! t
  76. char *dmabufdest2 = NULL;
    # z" M! }& n8 d3 k

  77. 9 W" g+ x+ D' R9 Y2 @
  78. static int acnt = 512;
    ( K6 Z7 @4 V; v- R
  79. static int bcnt = 8;
    % H7 r4 x: |) l( p0 s0 p
  80. static int ccnt = 8;7 \7 Y8 N$ m3 B  u

  81. # G% y$ o. K7 d0 w: q
  82. module_param(acnt, int, S_IRUGO);
    * f7 L8 W$ C/ e: J" ?8 }
  83. module_param(bcnt, int, S_IRUGO);
    6 f0 g* }" _" T9 T8 }' y' G9 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 s) L: `) z" t8 ^; K6 F3 M) d* d$ h3 E/ U; f0 z9 A; d+ Q2 y4 \, A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 s, |. E  U: ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) x: N2 G; B" k/ s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 u/ ?) Q8 ~2 ^
! n5 q$ X) |9 b8 Y$ H
6 M) [' n/ x8 h" S$ O# }1 |# {3 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-17 07:58 , Processed in 0.037050 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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