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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % R/ q% D3 ^  g7 P( q
  1. [code]EDMA sample test application
    5 x0 S2 z! k. B. e" k
  2. /*
    5 l+ a$ P5 e7 T
  3. * edma_test.c1 `! j: V, q: h1 P/ |
  4. *
    1 \& f% M. S. r8 f8 G: C
  5. * brief  EDMA3 Test Application( [2 A5 P8 p; N2 k4 h
  6. *
    " G' y& E0 Q' ?- S# I
  7. *   This file contains EDMA3 Test code.
    # `! s1 l1 R& ~
  8. *4 k) D8 F) n3 V" t7 ~+ g/ R" V) F$ K7 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 E2 z7 V0 T  j0 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( P) y8 Z  {5 s/ O
  11. *         TO CHANGE.0 }3 F1 A7 ^. D
  12. *
    0 Y/ O: J' g! C* k7 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 f! |9 Y1 X' `1 \, W- i2 \- a
  14. ** f8 R$ y5 L# X% \- z, S* y* j
  15. * This program is free software; you can redistribute it and/or7 }, N% u- {6 a' M7 F
  16. * modify it under the terms of the GNU General Public License as6 O" e7 Z, Z0 U4 G! t6 \
  17. * published by the Free Software Foundation version 2.# d# S  k; n# b. H  C' B8 d* g
  18. *4 L. f, A% A8 k  o5 K& [# @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 X6 g/ b- q. C
  20. * kind, whether express or implied; without even the implied warranty
    + N4 R1 w+ P% E" O0 a! p% k1 J$ S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* [) _* n  @6 K/ f) ^
  22. * GNU General Public License for more details.
    3 g$ H7 {) {( S  [6 S
  23. */2 n0 Z8 P& O  f0 Z0 j

  24. , ]" {  x' f. b) v; r; U3 a; U, K
  25. #include <linux/module.h>/ s: t% \7 r  W; `0 n# j9 S# @
  26. #include <linux/init.h>3 N6 o3 e$ x; R- w8 D8 @) u
  27. #include <linux/errno.h>
    8 F8 i; I0 g) U. ^
  28. #include <linux/types.h>
    7 B, s! ~; X: j/ J5 s
  29. #include <linux/interrupt.h>
    # `: @" e. J, x2 r1 o/ q( [
  30. #include <asm/io.h>
    # V  a& Y* K2 X. J0 ~4 R! |7 V. X
  31. #include <linux/moduleparam.h>
    1 F* R. E  U' m5 F7 s" R* O% }8 B
  32. #include <linux/sysctl.h>( V3 }3 J, Y- [1 M( a; h
  33. #include <linux/mm.h>( @% U; h0 p: g# G5 e$ o# z$ [% T
  34. #include <linux/dma-mapping.h>- Q( K) ~- I; g4 {  S. `6 Z0 l
  35. 0 p9 D& J- s  t4 I, c
  36. #include <mach/memory.h>% ]' R' v( A2 c& @. A" t
  37. #include <mach/hardware.h># K& T  ?" x" }  X* y) R. `! ?
  38. #include <mach/irqs.h>$ c$ i, u: J0 t
  39. #include <asm/hardware/edma.h>" U  w" m4 ~8 b7 ?

  40. 1 l1 p( [5 A' \: V3 t
  41. #undef EDMA3_DEBUG
    $ B9 y7 p- _; U* Y0 ?
  42. /*#define EDMA3_DEBUG*/
    , n1 h$ ~( U) T& S& _

  43. ( f& F4 ]* x( N. K7 B. z' b
  44. #ifdef EDMA3_DEBUG9 L2 {9 }( [" h0 n+ g3 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  K/ w7 F" S  |" M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 d2 j# }+ q/ R7 u& u% M: q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 d- ~& H# ~5 Q5 ^% t
  48. #else
    ! q. N' C2 [2 w/ ?& w* f1 E( H" d
  49. #define DMA_PRINTK( x... )1 V0 ^& V' x! B" i  R1 R$ J
  50. #define DMA_FN_IN% }( U% f( D, c) T9 j; x; ^
  51. #define DMA_FN_OUT- q  x  n* O) [; l+ B
  52. #endif
    0 ~  C' ~6 e: R9 s

  53. ' k- R# L9 ^8 N! ~7 S. k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 Q; @) p  U6 _4 g- j
  55. #define STATIC_SHIFT                3
    : N( G# Y+ j0 V% }+ W7 k  Z
  56. #define TCINTEN_SHIFT               20! |* J2 O- b4 y0 Z1 G( V: m) w. ?6 _" j
  57. #define ITCINTEN_SHIFT              21
    4 u! g; a/ a5 S" G/ x
  58. #define TCCHEN_SHIFT                22
    2 d- p- j7 V; I; h9 e2 T
  59. #define ITCCHEN_SHIFT               237 U7 I% o5 ~  \- t: h8 M3 |

  60. ) |8 o$ z+ X# e3 t$ h7 e; x7 g7 j' C
  61. static volatile int irqraised1 = 0;# N1 I2 @: y$ H! @$ B: m
  62. static volatile int irqraised2 = 0;9 G& p' ~/ d9 I  ^
  63. " j+ @! c' U$ E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* N7 {; c5 M; n; k) J- x. ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( m  ]; @3 R1 g: d6 w) e5 j7 g# N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 O9 D- S- g+ t" }5 ~

  67. " B9 C- M6 x! o0 h! T
  68. dma_addr_t dmaphyssrc1 = 0;. y, m5 J6 N% X$ F' d6 ~1 H7 _
  69. dma_addr_t dmaphyssrc2 = 0;
    2 R5 @5 t1 d$ P: [8 s7 B
  70. dma_addr_t dmaphysdest1 = 0;; V% @! D$ A3 I6 ^; }! z) n! R) R
  71. dma_addr_t dmaphysdest2 = 0;/ E1 m5 X9 d/ j; \2 W

  72. # [$ f9 R2 Q) Z' ^  Q4 e6 y
  73. char *dmabufsrc1 = NULL;% H" A1 x3 ^0 j" J
  74. char *dmabufsrc2 = NULL;7 B5 @! b% ]" Z( I: z
  75. char *dmabufdest1 = NULL;1 e, S6 E# P7 a) E. d4 C
  76. char *dmabufdest2 = NULL;9 V+ Y( v+ k6 G7 v1 H+ K' ^& ]! f
  77. 0 j) |0 C. U' w4 g
  78. static int acnt = 512;
    3 V( b0 o2 C, M" D! r
  79. static int bcnt = 8;
      D/ {0 _1 r* _; h- M! D
  80. static int ccnt = 8;
    7 E" S# O# }' B
  81. 1 \. n# q$ [7 L3 Y- s
  82. module_param(acnt, int, S_IRUGO);9 N' H7 N9 \( j" Z% O. u
  83. module_param(bcnt, int, S_IRUGO);
    . ^0 {; d4 j* r% O% x8 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; T* u& }- V& l& j: ?) f  g# O) \# d- O: C2 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! E- V$ g; e1 |8 g5 H% E: A
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, v& ~# G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 Q6 h2 B* M& ?+ a6 n; l% \, \5 w5 @7 f& O( P

% V+ h1 t- i/ b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 04:31 , Processed in 0.041316 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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