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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 a# \( n" U. T
  1. [code]EDMA sample test application
    7 b7 i6 ^7 f+ H! A3 `8 J
  2. /*3 B7 |- U/ {; Q, u
  3. * edma_test.c
    ( L' y; e5 y- y# v, E
  4. *: \. ~# d- F. N/ I  K4 g
  5. * brief  EDMA3 Test Application
    / |3 K1 c& u" K* o0 d
  6. *: M6 Y! T$ [7 t
  7. *   This file contains EDMA3 Test code.- [2 A1 W5 D8 }* c
  8. *, b) r- M$ F9 R+ r9 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 x. d# B7 |% _- e6 |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & D, r. s4 S7 n2 }( \2 w" {5 [4 D
  11. *         TO CHANGE.9 Z8 g7 W, I7 t& W) z0 N1 A# p; V
  12. *
    . ^# Y5 j! o3 E" A1 X* y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % l# `+ s7 q0 o& j  f( K
  14. *
    1 J# V- N  Y. M' r
  15. * This program is free software; you can redistribute it and/or! ]( _3 e0 F. }9 w, b8 x
  16. * modify it under the terms of the GNU General Public License as$ K8 T( s! Q! ~6 }# I
  17. * published by the Free Software Foundation version 2.
    ( y  `3 m' b# f) b
  18. *2 X2 _; J4 Q; w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 |- p& g3 t/ v' a1 P3 q3 F
  20. * kind, whether express or implied; without even the implied warranty
    ' M4 h6 K; }( d3 e% i/ c6 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 k5 H, H' @& T2 ?# M: }% h
  22. * GNU General Public License for more details.
    ( d& K6 m! H" u; X4 T0 ^
  23. */* K0 y/ |% ]; n; K# e. T) W
  24. ' z9 C! o5 c+ l8 N6 Y
  25. #include <linux/module.h>7 _+ Q+ {, v. @) z4 P% I. s
  26. #include <linux/init.h>
    9 R5 F4 s) j" L/ g- i
  27. #include <linux/errno.h>; [( a9 P$ `) q, _2 C+ F0 w7 S
  28. #include <linux/types.h>& ]8 {% U" P, q
  29. #include <linux/interrupt.h>8 ]1 h4 q1 `: Y/ e0 U. J( a
  30. #include <asm/io.h>7 z4 u; @0 o& u6 k6 J: J1 P5 ?
  31. #include <linux/moduleparam.h>
    2 k$ E# k2 L* W7 I3 ^- N4 L
  32. #include <linux/sysctl.h>( q  u. W0 N3 i
  33. #include <linux/mm.h>
    8 A# d8 S: j8 `# ?
  34. #include <linux/dma-mapping.h>% i, O. _& M$ ^2 D1 ^; `2 U8 r$ Z
  35. / X, N& x" {/ S6 @' _; w
  36. #include <mach/memory.h>/ w1 J* |8 a/ }- D- J% q
  37. #include <mach/hardware.h>* A# B  D  k! G9 M  e2 s
  38. #include <mach/irqs.h>+ s2 L6 @% K% r
  39. #include <asm/hardware/edma.h>
    ' E% }5 w: l8 R" n; W! b/ T1 c  G

  40. * m" o  r! U3 [+ n: |. [. r% V
  41. #undef EDMA3_DEBUG0 F: Z% I$ x+ l' f( Y4 J
  42. /*#define EDMA3_DEBUG*/
    2 r  }' `6 ?; F. Y* E

  43. " b2 }/ j9 _  ~
  44. #ifdef EDMA3_DEBUG: v$ V- H  h4 g9 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / b) ~1 l' o7 h& E* f  w2 G; t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 S+ A# G5 p) R0 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - q: W& u0 z4 y+ m( G
  48. #else8 V  `% {2 @* `# A3 s( `
  49. #define DMA_PRINTK( x... ). ?1 K2 n. }8 |) e( T7 U( J
  50. #define DMA_FN_IN
    0 O9 R' T. U$ \$ p" P: H& {
  51. #define DMA_FN_OUT
    ; E& b& T0 y" f- }5 O7 h; u
  52. #endif
    ! X  C* n% o: B/ |) e" E

  53. 4 V) h5 T+ m: b! ?# |( `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 }0 D, c1 S7 M3 v/ j
  55. #define STATIC_SHIFT                34 i- U( l, n) n5 v
  56. #define TCINTEN_SHIFT               20
    * s& ^* J% Y' C; [7 r7 P
  57. #define ITCINTEN_SHIFT              21
    ) w4 Y" B) a  V% D/ U; ^7 U
  58. #define TCCHEN_SHIFT                22- c/ k& V7 o! @5 a  W
  59. #define ITCCHEN_SHIFT               23& q2 P7 C. |6 i7 T2 c% o

  60. ' a: B: V; A4 m4 R# Y
  61. static volatile int irqraised1 = 0;
    . C( U: D, G$ I% _. w/ V: M2 Y
  62. static volatile int irqraised2 = 0;4 Q7 o3 ~# R- D3 \1 `
  63. 5 r0 D% K5 V! n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; [# O& S  D3 X% f2 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' V" }2 ^' w$ r) u# x1 r! g% `$ G& g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 W! y  {4 {( \8 G+ Q7 U
  67. ) g. b8 W, k$ r4 b$ }4 L  _5 g
  68. dma_addr_t dmaphyssrc1 = 0;
    0 ?! z# ^5 {0 R$ H4 E5 _$ X: n
  69. dma_addr_t dmaphyssrc2 = 0;; j, }* a: y# {* {" K0 E8 P
  70. dma_addr_t dmaphysdest1 = 0;
    # G% C+ v# R+ e& C
  71. dma_addr_t dmaphysdest2 = 0;3 E5 [8 [# V: V' s, U

  72. ; Q6 d6 G7 X3 }' ?) R* b
  73. char *dmabufsrc1 = NULL;! ~7 ?* W7 s) d6 H3 K( E4 A/ `
  74. char *dmabufsrc2 = NULL;
    - K# K, i8 ^7 X
  75. char *dmabufdest1 = NULL;
    0 |1 T1 n2 f6 J( B" U  Y0 p/ t
  76. char *dmabufdest2 = NULL;
    2 Q- L  c$ E  j2 ^6 ~. H
  77. 7 V% h3 ]+ d# p! f
  78. static int acnt = 512;
    , s8 j2 A" E4 D; f: O5 J7 L5 i( F
  79. static int bcnt = 8;0 l# S% }* W% m3 X0 w& ?9 Y& x  r" {
  80. static int ccnt = 8;
    7 s1 @# [8 S% [, M3 M' K, O

  81.   ^5 n* R7 Z/ `1 y6 a
  82. module_param(acnt, int, S_IRUGO);
    3 |& D; B0 p( ~8 B/ {# G! h2 O! ^, `
  83. module_param(bcnt, int, S_IRUGO);' q  i" f% `' \- E# \- I4 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; B7 Z  i8 F6 t
3 ^, d, [7 {  _* ]$ d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# z8 W. ~! ?+ n# h' ]; Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% {% P0 n% h. S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( ?" Z3 w! p' j& W
, {  o3 P0 M5 v  c( m$ G2 W" |
9 t9 N9 N  v7 }6 y/ Y( v3 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 01:02 , Processed in 0.041753 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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