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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 ?9 ^% o) B1 M
  1. [code]EDMA sample test application- ~4 d3 o; K) ~
  2. /*; G" o- L+ r0 e: ~
  3. * edma_test.c$ I5 H0 |# `* G0 H9 W
  4. *
    6 F3 b3 q$ y% }! }& b$ Z( g
  5. * brief  EDMA3 Test Application
    : d% _  e1 n, B
  6. *
      |' x; I3 O5 e) V+ r0 S
  7. *   This file contains EDMA3 Test code.
    3 O" D$ u) J; @
  8. *
    , N; w+ F0 ]2 l* p8 M# X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ~& {0 m+ \# }7 R/ I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' D; [- Z, U, g+ b; ]
  11. *         TO CHANGE.
    " G- N6 o* |# d1 l& a6 T4 ]) `( }
  12. ** K/ A+ @9 }' t- h; G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! w, L, j+ o0 Y
  14. *' T+ m) ^+ k2 V5 ]4 ^8 y2 T1 Y
  15. * This program is free software; you can redistribute it and/or
    4 n8 C& k" B, v5 V' x
  16. * modify it under the terms of the GNU General Public License as* x9 h# L6 v4 l4 l2 z( e* p- X4 Z( X
  17. * published by the Free Software Foundation version 2.
    6 K: L% l+ {, p3 M0 d
  18. *& C' d( y" z2 z3 h- e2 B- L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, j" x9 G# a2 u- o  [
  20. * kind, whether express or implied; without even the implied warranty2 o7 ]! H/ M% s& {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 c3 }% _) p3 h1 `6 _' b
  22. * GNU General Public License for more details.
    8 x3 l* W+ A% m+ j3 G
  23. */
    , P8 [( f( `1 `4 F
  24. " q! {0 r8 G  n& ?- ^8 `
  25. #include <linux/module.h>& g" I* b. N0 c' {1 ^$ [2 i: J/ _6 r
  26. #include <linux/init.h>
    - W. o5 I$ _* h6 t5 c1 g: i
  27. #include <linux/errno.h>% t" u3 G% E! `+ T3 V; R5 U
  28. #include <linux/types.h>
    5 f% V9 i7 t* |( {9 f5 z. t
  29. #include <linux/interrupt.h>
    + l  w% p# _+ A$ A0 x- v
  30. #include <asm/io.h>4 M# j8 e& Y2 q4 H' r6 Y3 W0 W
  31. #include <linux/moduleparam.h>. {3 y2 g1 V# N$ B7 H
  32. #include <linux/sysctl.h>
    ; d' w: T/ r5 B/ {  t& d
  33. #include <linux/mm.h>- x7 a  E/ p* X( L7 G
  34. #include <linux/dma-mapping.h>
    + H# E9 f; |4 _" A
  35. 3 v+ E1 c# ^" t- }
  36. #include <mach/memory.h>
    4 j/ D* M! ?2 \5 Z4 a, ?, d, E
  37. #include <mach/hardware.h>3 _; d& s4 o, a4 A
  38. #include <mach/irqs.h>
    5 O- f4 f4 B0 t, o; F3 h
  39. #include <asm/hardware/edma.h>
    ' J# R# Z+ p  P: a. R8 R0 V0 l+ |: p8 N

  40. 4 g* A2 Y2 W" y& b  }
  41. #undef EDMA3_DEBUG
    , O8 M1 ?8 n9 r% @
  42. /*#define EDMA3_DEBUG*/4 A. z6 p1 N4 b8 ^  P  D/ S
  43. ) r3 B$ y/ a2 X) R2 ^, {
  44. #ifdef EDMA3_DEBUG
    ) j$ l3 w" V, z" R8 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 B1 T: C, [# h: ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ?; _3 X3 ]  I7 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ L$ ]. b1 y# g  e
  48. #else4 t; H% _; y, U4 F0 {1 E5 W
  49. #define DMA_PRINTK( x... )
      j! M2 h4 Q9 V% C1 a- z" i
  50. #define DMA_FN_IN
    3 h9 K3 w6 z1 a7 R1 u
  51. #define DMA_FN_OUT* o) P4 P8 L5 r' n0 Z8 ]1 t
  52. #endif( a5 u+ d4 s& K. q/ R3 f2 U# G
  53. ) |! w' w- o; ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ R/ B) p" p3 K. h2 h) Y
  55. #define STATIC_SHIFT                3
    & `5 k; b0 A5 Q( T6 L
  56. #define TCINTEN_SHIFT               208 e$ y( f' m8 J
  57. #define ITCINTEN_SHIFT              21( r' B% O9 o5 e, }
  58. #define TCCHEN_SHIFT                22
    + P# j9 F% A4 s/ @: A
  59. #define ITCCHEN_SHIFT               23
    ( [: c; m9 t% e' h/ s8 k3 @
  60. , Z/ s$ W- |# M3 J
  61. static volatile int irqraised1 = 0;: r( L3 @0 A  T; Q
  62. static volatile int irqraised2 = 0;
    % U/ o& t+ R9 L% G5 _3 Q
  63. + y6 k" A( N; J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 H( k2 ~6 {* Y$ p- @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- l( ^4 S  k9 b2 |: U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 S' k# c3 [. T& a( u

  67. 5 V9 M2 K# y8 D3 V3 x3 O
  68. dma_addr_t dmaphyssrc1 = 0;
    / R* d# \! p6 K4 _+ V$ g4 [
  69. dma_addr_t dmaphyssrc2 = 0;
    $ l( P0 r  z2 f# @) w7 M2 ]
  70. dma_addr_t dmaphysdest1 = 0;
    & O! T: y2 j) N7 j( @
  71. dma_addr_t dmaphysdest2 = 0;/ N+ a9 T6 O! k6 ~8 }  D
  72. " w2 @# ]9 D: x
  73. char *dmabufsrc1 = NULL;
    4 m: n* T) w) b6 Z! K
  74. char *dmabufsrc2 = NULL;
    . X0 |. N) \  z7 Q6 O; `1 z$ Q3 P4 d
  75. char *dmabufdest1 = NULL;- o; P2 S- j1 b" y/ a; ]
  76. char *dmabufdest2 = NULL;
      |# {* z* ~+ t3 Z
  77. 0 ^. u( S6 \; \# T# B+ c
  78. static int acnt = 512;; ]: f/ |$ d+ L0 M' W
  79. static int bcnt = 8;
    3 C: R. O6 e- }: I
  80. static int ccnt = 8;
    % @% N/ k* h( U' |9 t

  81. 4 c3 m; O' X  k1 f4 A
  82. module_param(acnt, int, S_IRUGO);
    ) p: m: C  A  y& q3 R. t9 u) d# k6 r
  83. module_param(bcnt, int, S_IRUGO);
    , C# f: V. W% ^# K+ M8 I) \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 V  `( G# z% l1 k/ G& X% g, o# y7 _: A; F' O/ A8 v7 r8 o! H( |" K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; `/ ]* @  e+ L; w8 _$ a: F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# r8 p9 Y2 [1 R' p) r- T: @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% C: l% p8 y0 h" s( W
0 c) ~9 P$ ], Y. F) n1 S

6 S0 y; ?8 s4 K. P( B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 19:38 , Processed in 0.045409 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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