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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % p; }& u! ~$ J5 {
  1. [code]EDMA sample test application
    # y* H# G" w5 R! y! g( n- z% O
  2. /*1 E1 G8 x8 I) L7 C
  3. * edma_test.c
    " y( d% O0 ~7 z1 t% M' N: h9 I
  4. *- F/ {5 I# H- `" C3 I4 S2 N% v2 ~
  5. * brief  EDMA3 Test Application
      _4 r7 ?7 E( }1 J& p+ |1 `
  6. *. \8 C0 I* r8 v) x1 U
  7. *   This file contains EDMA3 Test code.6 R$ I% a: l3 l& f% k* y
  8. *$ _5 Y# k% p' ^8 }  U! f) Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " M! M7 Q! C. c: r2 B* n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 Q) P0 m5 I' \( [) d) M8 H/ `
  11. *         TO CHANGE.
    5 ^; r' r( h& X! e( N  \! @. \
  12. *
    7 Q, d) E. r2 n3 q% a# I4 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( r# M+ ^% W2 n3 U" X: M3 v
  14. *
    ) [% m0 b6 w% J& J
  15. * This program is free software; you can redistribute it and/or2 l: R1 G3 H- u3 a7 T3 ?3 W9 i4 h, ?
  16. * modify it under the terms of the GNU General Public License as
    # w, ~8 W2 I  c) e6 F
  17. * published by the Free Software Foundation version 2.
    & v( m# I' U5 A: L+ x
  18. *
    ' l4 `$ F" \4 C6 t3 Y+ t3 i" |* Q6 g! E+ f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! n# l( R" O* q4 e) D* x8 `, c
  20. * kind, whether express or implied; without even the implied warranty
    : l+ o  G/ z9 G, z8 G7 ]4 U6 C1 q0 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 b" Q. y+ A& K, I+ H
  22. * GNU General Public License for more details.& o- U+ I/ ?' Q. `/ h& L, t* F
  23. */" v7 h7 g, w/ e. {( m
  24. + p7 ^" ?# X. ~0 U% O( u! x8 s
  25. #include <linux/module.h>, ?3 Q9 s2 X7 _( L
  26. #include <linux/init.h>  ?3 Z- t# N9 n( l
  27. #include <linux/errno.h>
    , M7 B  |$ u( t
  28. #include <linux/types.h>
    * j( H# N1 ]) F' I* q
  29. #include <linux/interrupt.h>9 Q" m- g1 Y7 T' |
  30. #include <asm/io.h>
    - g8 G& r  X2 a& U$ P% p" M( i8 N- J$ y
  31. #include <linux/moduleparam.h>8 \) b" V  ]  j) L
  32. #include <linux/sysctl.h>
    1 A0 P% J5 I6 X6 P/ a
  33. #include <linux/mm.h>
    5 g/ Q" O  `- y! i4 q' ~# C0 _
  34. #include <linux/dma-mapping.h>
    $ {9 P# A, k5 y/ f0 l

  35. . m7 F: J# n1 a/ a5 A
  36. #include <mach/memory.h>5 t% R: F! e( T2 d
  37. #include <mach/hardware.h>+ M% c* x: w' z) |% F
  38. #include <mach/irqs.h>
    + K( f9 q+ |$ ?
  39. #include <asm/hardware/edma.h>2 ~! q0 @! B3 Q0 y+ p
  40. / D* H5 }: U; C( V
  41. #undef EDMA3_DEBUG) W* f; T" F. ^3 g4 W0 L
  42. /*#define EDMA3_DEBUG*/
    $ F( m7 D/ g  u3 L' b. [( O' K
  43. " H1 [  [. E# k) K- W
  44. #ifdef EDMA3_DEBUG0 ^. ?8 n7 t1 \' k5 Q* K; q7 Q8 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 J% }3 J( ]! l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ t# o% {; L  r: L1 C( p8 u$ {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & E; }3 ~& L+ P" j
  48. #else
      H! u0 r: h0 F+ j! Y, e
  49. #define DMA_PRINTK( x... )3 p; \8 w# U$ {! B
  50. #define DMA_FN_IN! ?9 O' K* D% a( c* B  s
  51. #define DMA_FN_OUT
    3 U& L- w7 i/ }2 H& n. y  z) o
  52. #endif. @/ j4 K& J" l7 Z% z) Y
  53. / p7 v; C$ i3 C- G; E% q  M5 b' N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# G% A, z5 i* R5 A
  55. #define STATIC_SHIFT                3! g. ~# v+ i0 Y) Z/ |! z  G
  56. #define TCINTEN_SHIFT               20
    9 o' u& z0 \9 H- J
  57. #define ITCINTEN_SHIFT              21( R2 _9 u' k% C& s
  58. #define TCCHEN_SHIFT                228 x" W( A( e) b& C- _- ?3 J  T
  59. #define ITCCHEN_SHIFT               23! ?  y7 K& y* A, i$ B

  60. / `0 d  O' N' Y) C, g1 y
  61. static volatile int irqraised1 = 0;. f$ B; g, O3 h. L/ v9 c! ~8 N
  62. static volatile int irqraised2 = 0;, o: W, n5 J; ]9 o" P0 ^- B, v* E8 x
  63. 9 R& f% P/ n  r% F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 w" V- j$ p; v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 y& K5 K2 ~+ [  j1 [# Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 x5 E, I" ^1 n( e) ~  v

  67.   J$ D1 K  ^# ~/ q, w1 W
  68. dma_addr_t dmaphyssrc1 = 0;
    $ s- P  I4 p, D1 t- O/ q
  69. dma_addr_t dmaphyssrc2 = 0;6 L8 C: S6 ]# k+ S8 c
  70. dma_addr_t dmaphysdest1 = 0;3 C# Y$ l1 S/ w& o. j6 w9 ]
  71. dma_addr_t dmaphysdest2 = 0;& N) S# x, W) O
  72. 2 `( |4 @" D# E- k6 [+ h
  73. char *dmabufsrc1 = NULL;
    ; T/ w. g9 Q, t; g
  74. char *dmabufsrc2 = NULL;
      K" M& i, M1 N9 w
  75. char *dmabufdest1 = NULL;
    : B9 H: R0 j' {
  76. char *dmabufdest2 = NULL;
    5 @8 a) c2 b0 Z+ g3 S; j

  77. ( X9 [# N: y: m/ U7 S9 ]
  78. static int acnt = 512;; ]6 K' M' u* a1 w  a" G
  79. static int bcnt = 8;
    $ t+ [2 @+ J5 H$ b$ n% Z- \0 D
  80. static int ccnt = 8;
    4 u4 Q% r5 ^5 v* B8 D4 Q1 w

  81. ( w$ n! M& P9 ]8 ]; {; y
  82. module_param(acnt, int, S_IRUGO);/ n2 T5 j% k% H4 t2 p
  83. module_param(bcnt, int, S_IRUGO);) n. |. T" @0 X9 H: [  u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 L/ J5 P9 {8 E& @& e) H1 B& r
8 ~* W3 o3 F- I6 i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 h( H: r' T: h% V9 i/ darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 ]7 m. ^& T$ m. ~* r/ S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( N# |/ a5 p& B& f; m% M, ]" x
. I/ }+ A# @5 W) |4 s% Y* b1 \+ P: k4 g) W4 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 22:05 , Processed in 0.037461 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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