OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; `' i, p0 Q* d) L% v
  1. [code]EDMA sample test application9 i. P$ @! T: c/ H
  2. /*/ |. H, [: Y: j: c, Q# Q
  3. * edma_test.c
    8 b3 |, u+ j* I  t3 z. A3 O
  4. *
    ) z: [+ d! I2 V" e6 {: s
  5. * brief  EDMA3 Test Application
    ! p3 _; i  @, e9 O
  6. *
    / z6 G6 W* e) V7 v
  7. *   This file contains EDMA3 Test code.
    4 x0 u& W* M% L. F7 T2 @
  8. *
    ' o$ d" L0 ~/ F: ~( j! d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 x. z  D* r! q" p  D' Z: x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 c! k8 k& g8 I( I( W9 B
  11. *         TO CHANGE.
    " i4 |8 d7 M7 ^/ x# Q  P
  12. *
    0 M# Z! V9 D  U+ ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % m5 R" A% s5 |" o, B( a
  14. *
    ( V3 D. V  U+ i1 w6 E) k1 R( S- J
  15. * This program is free software; you can redistribute it and/or
    4 L7 R. U' k( I" h! V
  16. * modify it under the terms of the GNU General Public License as7 e3 n" N* V6 E: w9 x4 j3 P3 H) f
  17. * published by the Free Software Foundation version 2.
    6 I; l. M! _2 g
  18. */ Q3 b5 d2 u6 L/ C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ @& w) N7 g* r" I/ n+ W
  20. * kind, whether express or implied; without even the implied warranty' @" Y; {, o$ I' U/ k6 m2 K5 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  P( \2 o* W1 M) t: `( B
  22. * GNU General Public License for more details.+ e# f7 l3 F4 ~7 z* i  z5 I
  23. */
    & N- s' {4 S, {; Z% S* k

  24. 0 @: \3 R( o/ l
  25. #include <linux/module.h>
    / ]" E( }$ y/ a
  26. #include <linux/init.h>
    5 F/ {5 ?9 Y$ t# }8 v
  27. #include <linux/errno.h>& v: }. Q% x4 L0 Y! L: w
  28. #include <linux/types.h>
    5 z4 T# x0 ~+ h* @
  29. #include <linux/interrupt.h>- P5 ^, [- i) x2 v3 j
  30. #include <asm/io.h>
    ; ~# p7 U7 ^8 D0 A/ F6 l
  31. #include <linux/moduleparam.h>
    3 N0 G% _* C" M4 L
  32. #include <linux/sysctl.h>
    # K- a0 O+ ^, v5 ^
  33. #include <linux/mm.h>9 i  m6 v8 B  C9 p
  34. #include <linux/dma-mapping.h>6 |! L, B8 B) ~3 N! s* u

  35. 2 \8 l. s* Y1 K$ e2 R, j5 U$ n. E
  36. #include <mach/memory.h>
    6 B7 G; M+ D$ x2 I2 X
  37. #include <mach/hardware.h>
    ' C7 Z/ F4 }; D' G2 |- G! @. T
  38. #include <mach/irqs.h>: F( r1 s$ |; k, x: W
  39. #include <asm/hardware/edma.h>5 v2 k" U1 Y- t1 l
  40. . `/ Y. V! M) a1 g3 b# g
  41. #undef EDMA3_DEBUG8 A1 I- m- v# L+ o
  42. /*#define EDMA3_DEBUG*/, G- ~  Y& N! N2 V1 ^6 x6 X+ q' c
  43. ; q( R( a: K# i) g& T- P2 X
  44. #ifdef EDMA3_DEBUG2 ^: T& n& I- c/ |7 c. w4 U5 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; _: h% T7 A; w. w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): d; N1 t* U. r2 q) V4 b+ n. L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) }' F4 M" ^" B" w& x
  48. #else1 R8 q$ L( u7 V8 M8 S
  49. #define DMA_PRINTK( x... )
    - T9 q! R3 I- }! R3 I3 v
  50. #define DMA_FN_IN
    3 Z4 b! j2 |0 L" A
  51. #define DMA_FN_OUT! j; |0 s* O. M  J  P
  52. #endif6 L7 e2 Y2 E& B, S9 j8 @$ r; @' Y( H
  53. 5 F- V0 O; n5 m. C! Z# L- ?, Q; F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 ~; k5 g1 t$ Y$ c$ H
  55. #define STATIC_SHIFT                3
    4 e$ w6 k$ ]+ d9 y
  56. #define TCINTEN_SHIFT               20
    2 v8 Q; ?+ @. e4 \
  57. #define ITCINTEN_SHIFT              21
    9 u, q* K! g6 o& C# \$ K. a
  58. #define TCCHEN_SHIFT                228 g2 o' J8 W7 X
  59. #define ITCCHEN_SHIFT               23
    2 ^/ T  C8 S+ R, T$ r0 L8 _% c

  60. 1 H* M% N9 F8 |5 T; y! ]
  61. static volatile int irqraised1 = 0;, q/ E/ H" D0 \7 R2 `6 t, V
  62. static volatile int irqraised2 = 0;
    0 z1 A8 G! {5 p; P  _+ u# p5 T5 l
  63. 7 G& X0 s/ P1 z" J$ E6 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + `( |  I: g) V4 ?0 ?3 p+ u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. T: k7 X2 @0 t6 a# Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* a/ d, K! F+ y  L+ b0 \- r
  67. ! m; w2 `. T: m+ j' l
  68. dma_addr_t dmaphyssrc1 = 0;! k. Y3 U8 i6 m
  69. dma_addr_t dmaphyssrc2 = 0;
    # h* S' k' ~0 W. \8 }  \
  70. dma_addr_t dmaphysdest1 = 0;
    + C' q$ l1 O9 F, g9 z" \
  71. dma_addr_t dmaphysdest2 = 0;. |: k  H' H# ~0 u  g' d

  72. ' I1 a! ^4 L4 }* J. u2 L1 A; Q
  73. char *dmabufsrc1 = NULL;" {, z3 e/ O  V  N, V
  74. char *dmabufsrc2 = NULL;
    7 Y. ~# L/ q# @
  75. char *dmabufdest1 = NULL;
    ; i5 T" B" v- G& }4 ~% v( w
  76. char *dmabufdest2 = NULL;7 Q4 A' o/ Y# m; S: h

  77. 1 N4 ~9 U' S4 ?4 Y) ~& K$ X
  78. static int acnt = 512;
    # ?/ t/ f3 U" @
  79. static int bcnt = 8;. P) ~" J, H7 m& j- y2 l
  80. static int ccnt = 8;
    5 ?6 [. }/ X: |( {1 m
  81. 2 t1 K, u2 b7 z$ K  C
  82. module_param(acnt, int, S_IRUGO);% o( a# {$ {5 j& i& o' b! P( R
  83. module_param(bcnt, int, S_IRUGO);0 w: d$ G7 ]  r9 X- F5 N- O; p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) B+ z  P( N' A$ w4 J$ z

: c# L6 ?, i; ~3 E2 s: x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 \- J! O; _6 q; I; s$ T2 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 v3 m; f1 Z& [' e; r1 X1 A  a3 v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& b/ Q! |& }% [7 t- ], Q. v
; f* g) A7 K/ [" @  b* G
4 q4 r8 F! |1 B+ v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 12:31 , Processed in 0.039471 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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