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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. r# X  T! |- _+ [  K7 k) G- S
  1. [code]EDMA sample test application% B0 n4 u! w3 d- j3 c
  2. /*
    + R# j0 C9 k' X. y  |* C
  3. * edma_test.c) x4 m- t8 a" D: [2 \) r
  4. *
    ' ^- T9 f! P; O) K7 [1 T0 x4 z7 U
  5. * brief  EDMA3 Test Application! j$ O6 g4 T" \; `: h
  6. *
      d. c, |, C4 }% u% W0 ~* I
  7. *   This file contains EDMA3 Test code.
    7 B0 x6 l3 G9 D* D
  8. *
    ' s$ X. G" a1 y8 f* n, ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , m% o4 |6 m5 J2 B4 D$ O; K9 K, O2 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 B# _8 m; L+ Z. Z" y0 w2 j
  11. *         TO CHANGE.+ X) g' d- g" Y) p2 a
  12. *
    6 l' A: [1 ~' f" ?$ w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( m" K' K: A0 U( n4 G0 J7 z9 J
  14. *
    1 w5 `$ G! o" k
  15. * This program is free software; you can redistribute it and/or
    + Q, Q$ z  {  [
  16. * modify it under the terms of the GNU General Public License as; j; B/ q" M* c, A8 {1 @4 E" J
  17. * published by the Free Software Foundation version 2.
    ' B! a9 b1 Z! }1 }' m5 P) i1 Z* l0 ?
  18. *# I/ A6 {. g$ K. M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* Y+ U% G& w/ P$ v
  20. * kind, whether express or implied; without even the implied warranty2 v1 L, ~/ \2 J& P- G/ M7 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; r# f7 Q& P' Z9 {. y
  22. * GNU General Public License for more details.4 O% @0 c* y% ?2 w7 t- |
  23. */: I& ^7 M% {. ^6 C3 J
  24. 6 {$ N0 |" b- o
  25. #include <linux/module.h>
    " M/ k, H# y/ m8 T7 _
  26. #include <linux/init.h>
    ( p: z% J7 P; `8 y+ ]8 C, E
  27. #include <linux/errno.h>+ g+ ^5 G% A$ E7 p" J/ k
  28. #include <linux/types.h>
    - f9 `3 d1 U6 n; L+ t% p; m
  29. #include <linux/interrupt.h>
    8 y/ L  A7 u. V8 L0 y3 `1 \
  30. #include <asm/io.h>9 V2 o  y7 P7 l% O. I/ H
  31. #include <linux/moduleparam.h>0 k0 I# A6 i, b) s2 k6 t
  32. #include <linux/sysctl.h>
    4 @, v+ _$ f% s3 h; d+ B) S4 S7 T
  33. #include <linux/mm.h>7 S$ H# a- M2 p3 c6 v+ O7 E
  34. #include <linux/dma-mapping.h>: ]* R  K, ]9 D  r
  35. % h: Q0 j6 N3 N; l  g, J; i/ ]
  36. #include <mach/memory.h>  O: ~6 h) j: R% K0 U, A
  37. #include <mach/hardware.h>+ P. G0 m' }4 ^4 c; |2 `
  38. #include <mach/irqs.h>; G% W- D3 S+ a0 _' F
  39. #include <asm/hardware/edma.h>( ^9 e; [& _6 Q3 E

  40. 9 g- S& c3 I5 f( h& u7 b5 R
  41. #undef EDMA3_DEBUG
    / w) M9 B# V. j) [; g+ |# [) T
  42. /*#define EDMA3_DEBUG*/) B: ], G5 ?# I- s7 C

  43. ! L+ `3 ^7 O# L" M1 [- m
  44. #ifdef EDMA3_DEBUG
    1 Z/ |  A6 ?: u1 W1 G/ O0 R' u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % f& l9 b1 c4 O7 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): h) ]# f: J. b" e$ {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( S$ \+ |- @& V6 R, L( T; y" |, ^
  48. #else
    : g5 p  i9 M  M' k- m1 m
  49. #define DMA_PRINTK( x... )8 \2 ?8 U% o3 ?: V9 D
  50. #define DMA_FN_IN
    7 D0 y5 y; @: c' ~/ V3 {
  51. #define DMA_FN_OUT
    . T. C0 n$ \( N7 V/ c" H
  52. #endif2 j' |* x2 g% A5 m1 t6 T% o

  53. 6 U7 M4 X, a' [  p& j8 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * E5 |8 q% h) {
  55. #define STATIC_SHIFT                3: ~6 T# f: g3 H' V
  56. #define TCINTEN_SHIFT               205 h. }: e# I) q5 k7 X( k' ]8 L
  57. #define ITCINTEN_SHIFT              21
    * h* s( ~. i. F- |1 M' p) \! }
  58. #define TCCHEN_SHIFT                22  x, Y2 R7 V2 i8 g' a
  59. #define ITCCHEN_SHIFT               23
    % b& e& L& r) g2 h: ?

  60. ! q( q, n9 n5 a
  61. static volatile int irqraised1 = 0;
    ( }6 H. T6 i4 M
  62. static volatile int irqraised2 = 0;1 M& B1 p# D( j9 d6 [( y' j

  63. : l( n+ F# k) m% x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ T- ~, \& x5 l1 }2 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: N1 y% t" i# i' {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / |0 O; m# n3 H. d3 ?

  67. - R$ L2 g9 |$ S! v* N: o
  68. dma_addr_t dmaphyssrc1 = 0;- @: ]- w* W' Q2 d
  69. dma_addr_t dmaphyssrc2 = 0;
    6 M' ^' i9 K: m- w4 I9 i1 C
  70. dma_addr_t dmaphysdest1 = 0;
    ( t, C2 y) v. j- O3 z$ ]5 q
  71. dma_addr_t dmaphysdest2 = 0;
    7 ^( j7 Y& T, z7 R8 L" U) M2 K

  72. & U2 a: ^: k* l0 e
  73. char *dmabufsrc1 = NULL;
    2 d" C' o5 r# C
  74. char *dmabufsrc2 = NULL;% ^. T* n  J. q8 z! J
  75. char *dmabufdest1 = NULL;9 V+ _' m) {" B
  76. char *dmabufdest2 = NULL;: Q) Q- g* ]! x2 X% b7 p

  77. . g1 M; b5 a3 L+ U# ^; Z! F
  78. static int acnt = 512;) q& J0 z& i" {* L
  79. static int bcnt = 8;$ a8 u+ v0 P; O2 L
  80. static int ccnt = 8;
    - C# m, u+ }! S; F( Z: `

  81. / V0 r& z0 D( }3 w
  82. module_param(acnt, int, S_IRUGO);
    % v# M1 q1 d3 g. |  R
  83. module_param(bcnt, int, S_IRUGO);* C6 T$ c, i1 A2 K" A' y" i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 X+ ]) E7 r. E+ r

( }+ S* P6 X( M+ c; L* \7 N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) b$ h! k/ c+ ]1 a; w5 j9 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" z9 w+ q* ~- Y' C) W: ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; p9 k- O& M& `: R) B  e2 C3 T. e2 t+ m1 q- o+ T. e, S

" F( F) _% ~! h6 x! N7 |, p7 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-17 19:21 , Processed in 0.040282 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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