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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ _" b0 A' D* c8 ~
  1. [code]EDMA sample test application& f/ W. B/ Z- r7 p4 ?9 v- Z' g' f3 b
  2. /*! g, t/ C4 ^/ `/ [
  3. * edma_test.c
    / i4 g; X; |% Z# o
  4. *
    1 E& n2 b% ^+ d& W5 l, Q6 m3 u, _8 F  K
  5. * brief  EDMA3 Test Application1 V1 l- i0 _" B
  6. *3 |4 A2 }; f/ W- d' G& @  h
  7. *   This file contains EDMA3 Test code.2 U2 k; i( l$ @; k, Q
  8. *
    ; s# l* s5 M0 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 W6 @: w3 ]' \! c; D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & M5 X" |/ g) d# q& `8 W3 M
  11. *         TO CHANGE.
    / B" r7 X; S8 M1 K
  12. *1 X: }% k5 g( ]" y! B" _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( l4 f! i3 z; Z( D" j3 o
  14. *
    % {/ j" S% O, l' s& }
  15. * This program is free software; you can redistribute it and/or* _1 o: o9 ~+ ]3 Q
  16. * modify it under the terms of the GNU General Public License as
    ! s# U$ C, v6 C5 T( k8 Z: }0 K8 r
  17. * published by the Free Software Foundation version 2.. W8 t. X* }  a( L' S- x3 m- m- Q, D
  18. *$ H' F3 b/ o( N) l% z- E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ ~8 G+ ?7 e  d* P) \; n: ]2 N7 V
  20. * kind, whether express or implied; without even the implied warranty) a; R  \! f- ]( G0 p4 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + s/ I" x# P; e$ Q
  22. * GNU General Public License for more details.
    ' O1 y  l. A7 z8 X* K
  23. */( I- l2 {2 ^: I. U; q5 `

  24. 2 t, Q4 k0 m0 \( F; B- @
  25. #include <linux/module.h>
    4 o4 Y7 V# t5 a5 b) R: m  j( _
  26. #include <linux/init.h>  J4 R& o) N' f- t3 _% p  j4 [# C
  27. #include <linux/errno.h>
    1 Q0 U- }2 A+ _- \
  28. #include <linux/types.h>
    ' Z, I3 \4 f+ K# R( R
  29. #include <linux/interrupt.h>
    + }# t' N; e9 C* j
  30. #include <asm/io.h>' }  X% q3 u3 J9 K8 b
  31. #include <linux/moduleparam.h>8 s( I; `8 I7 @  M) v* h
  32. #include <linux/sysctl.h>
    8 E, Q1 O# e+ ]7 d7 D
  33. #include <linux/mm.h>! w8 W& b0 V, C$ e/ P( j4 v
  34. #include <linux/dma-mapping.h>
    ) R' |8 h: K+ W5 W0 p

  35. $ B* \" @  s0 Y( Q# A% m! B
  36. #include <mach/memory.h>0 I! T0 J4 E) J, L7 e4 ]& n5 V
  37. #include <mach/hardware.h>
      g2 C% l( c1 c
  38. #include <mach/irqs.h>* ~2 N% ?* S4 L1 v
  39. #include <asm/hardware/edma.h>
    1 r' w. X; h+ E

  40. 9 z' S9 z5 Z7 P. u
  41. #undef EDMA3_DEBUG
    1 O- E1 g+ f. s8 C
  42. /*#define EDMA3_DEBUG*/9 P0 f2 }/ p" l. @  B+ d$ {
  43. + `- Y8 b: U! D2 `: H; j
  44. #ifdef EDMA3_DEBUG; d8 u1 g- b- Z+ f7 U+ y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      J: S; {0 P! r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 K. C# p) v, Z- R$ O! S, U6 l8 }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 d7 Y) u) Z1 V: M- @1 |
  48. #else" o$ G" |1 U* G, A7 w1 A
  49. #define DMA_PRINTK( x... )
    / z! O" w1 r, `1 o% b& U; E
  50. #define DMA_FN_IN2 L$ h" g$ }, K( g( S( w
  51. #define DMA_FN_OUT
    % Y: ?" m4 U2 }3 h6 E
  52. #endif% X! Z; Y" l, B- f1 `9 ~  I

  53. $ ?6 v. a# a) y$ [: y, O' X$ C4 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      ^! b" J/ q1 h% o
  55. #define STATIC_SHIFT                3
    8 v7 M! A: w' e! b/ H! b# v
  56. #define TCINTEN_SHIFT               20
    . V2 q( ]* C3 j0 r1 s. }
  57. #define ITCINTEN_SHIFT              212 ^# Y. ?) |4 C& v( t3 T0 l8 i0 a' Q4 B
  58. #define TCCHEN_SHIFT                22' t2 Q* N3 \6 @3 V) F2 V# y
  59. #define ITCCHEN_SHIFT               23! q, L' Q  a, R  Z8 |9 ~) \7 s
  60. 0 @1 c2 Y( j8 W
  61. static volatile int irqraised1 = 0;3 x) ?$ j% m5 G2 H  L! W# k
  62. static volatile int irqraised2 = 0;# u0 T1 T# }% K1 y9 L, e8 k1 M4 ?
  63. 1 H3 C7 m4 X9 w$ n- x2 P! F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & }: z% t3 N: e+ f; k7 N: O' B# u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l& U* F9 H& X) Y" Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 K4 _8 S5 s5 I4 w' L& r

  67. 4 t3 U- [+ n+ e( v) N* T& j1 _
  68. dma_addr_t dmaphyssrc1 = 0;- @2 ?( Y/ m, Q( \6 {9 V' i9 m+ Q+ n
  69. dma_addr_t dmaphyssrc2 = 0;, x% E, i3 V# E# x3 r* s2 {
  70. dma_addr_t dmaphysdest1 = 0;
    * y: v' Z8 [- w5 q
  71. dma_addr_t dmaphysdest2 = 0;0 |+ Y4 H% I$ p/ [
  72. 1 f0 b, {2 k/ F, I( A
  73. char *dmabufsrc1 = NULL;8 a2 w* G" L% J# [# ?& v  b
  74. char *dmabufsrc2 = NULL;
    % R& s; @. y3 z3 ?- V9 K. E9 N
  75. char *dmabufdest1 = NULL;( |; r7 v5 T1 C  Z9 u6 o- l3 e0 ?
  76. char *dmabufdest2 = NULL;
    5 @* q; ]3 C1 F6 m) i6 {6 [. C

  77. 5 V9 \. H/ R' K+ D: y- ~/ h
  78. static int acnt = 512;
    9 \& R1 `8 |* |/ i4 ^  i# w6 h
  79. static int bcnt = 8;
    8 Z$ h; g. E% ?$ A/ u1 W+ r( N2 f
  80. static int ccnt = 8;
    0 r2 v9 b# u$ M  M2 G% }* X* P
  81. . K" m  f% C; _& ]# G- P  b' B
  82. module_param(acnt, int, S_IRUGO);
    8 Q* ]" `% r8 W0 D4 w
  83. module_param(bcnt, int, S_IRUGO);
    : k1 y& q! n# z5 f5 w8 `- H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 a6 t% B% _& j3 H( R
7 f. r8 n5 L- u. z& `- C5 t8 N9 f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; ?' Y1 n/ i% D+ Y+ T2 Z% s/ \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 q- Z: `; j; c# u9 F! O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ d- n/ g) B. B# ^9 B& x3 S% r8 C6 e
/ ?) o- \/ v8 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-8 14:45 , Processed in 0.044175 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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