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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 m% S- j. n) e
  1. [code]EDMA sample test application
    " h, s3 Q4 s3 c) K: Z( s. k. ?
  2. /*
    2 ~! I% a3 `* H  i& d- X
  3. * edma_test.c
    , g2 b$ k% L9 T3 H1 i
  4. *% o$ k, Q. g: i( M" T7 h
  5. * brief  EDMA3 Test Application7 u9 X+ g$ K5 C' d5 E
  6. *" @" @# i: F7 L
  7. *   This file contains EDMA3 Test code.
    % e7 Q4 I8 m1 W& p2 o: b# ?# r
  8. *6 s# i/ s7 O( J5 ?8 c2 K, }0 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # T/ U9 ]7 k! m( q" Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' ]; M  w! b4 T- J6 j) E
  11. *         TO CHANGE.; H1 ]0 K. @, O. q. E
  12. *2 z1 I: L0 [; Y6 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! P9 J+ l) H3 Q9 W( C5 s, i7 w# F
  14. *  m7 J# ^0 `: |
  15. * This program is free software; you can redistribute it and/or
    - I0 B. b  n& L  ^5 k
  16. * modify it under the terms of the GNU General Public License as
    ) _7 o" f$ ^% k
  17. * published by the Free Software Foundation version 2.
    + b, x- h4 T9 d7 [! B* l6 e# Z
  18. *
    , H/ c$ B# d$ r; I- K( ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) q' P% J' @5 u% }
  20. * kind, whether express or implied; without even the implied warranty
    / Q0 K5 p( L9 R$ c% e6 ~) P$ M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " v# g  w0 P, K  G& x5 f* v/ Q7 |
  22. * GNU General Public License for more details.0 ]' `" _% ^8 b9 ~, s' m$ V
  23. */1 p  s- k- J$ p$ L1 ?9 b1 ]

  24. ( M# s7 \% B4 p  a
  25. #include <linux/module.h>( N. f+ f. j5 q3 W
  26. #include <linux/init.h>! F; W: P# v. n7 o$ x
  27. #include <linux/errno.h>
    " A( B6 G3 j( T
  28. #include <linux/types.h>: q9 {( d( B2 U5 g: T
  29. #include <linux/interrupt.h>( V/ d" d7 Y& v8 q- K
  30. #include <asm/io.h>
    8 Y( E6 h( y# w% N) L: s
  31. #include <linux/moduleparam.h>: \- ^3 s  r( G4 _5 i
  32. #include <linux/sysctl.h>+ c+ f* j4 @3 R2 R+ Y9 U
  33. #include <linux/mm.h>" x& }, Q8 P$ }- p; L6 b, Y
  34. #include <linux/dma-mapping.h>
    ! E- K' k) S. w  U1 L0 C

  35. " S) u9 R, c. Z( }- [
  36. #include <mach/memory.h>
    , n) y$ `! [( i7 Q4 c9 [
  37. #include <mach/hardware.h>
    ; M+ o, [* F- K* L
  38. #include <mach/irqs.h>
    " N' f$ I& q, @  I1 ?% A
  39. #include <asm/hardware/edma.h>
    $ z6 `8 E  e+ I
  40. ' \7 M+ `% e* Y& U4 _5 W# i
  41. #undef EDMA3_DEBUG1 A" @. }" g# c+ a' F' t7 [+ i
  42. /*#define EDMA3_DEBUG*/
    8 @2 Y# J0 h2 g
  43. : j1 J4 f/ R- F& r
  44. #ifdef EDMA3_DEBUG5 d/ V' L1 l; q0 L: Y6 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 C8 c5 z) q. U3 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 w# a6 Y+ i6 m4 {7 k8 K: l' F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 b: {  h7 w! ?" {" A
  48. #else! _5 K' [3 F+ m1 d) h2 F3 A0 n/ ~
  49. #define DMA_PRINTK( x... )0 Y9 C3 X8 @! R- q
  50. #define DMA_FN_IN
    9 q  n; Q$ b( T* F' f' C3 |' q# e6 x# p
  51. #define DMA_FN_OUT
    - V  i8 b! o, T) H
  52. #endif& \" I/ p$ `* G

  53. # F* J2 X  u3 o' d; L8 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ z0 ?* H( R& t4 t  x9 i/ ]3 d  h
  55. #define STATIC_SHIFT                3, F4 @) h: g; ]" }" |! }) Y* N5 C: p
  56. #define TCINTEN_SHIFT               20/ t( m; o) g, v* C/ p/ M" s: }, I" |
  57. #define ITCINTEN_SHIFT              21
    ; O; {3 V/ M% w4 j: ~
  58. #define TCCHEN_SHIFT                22
    ) O5 C" D) x1 _! R) f" L) `0 Q
  59. #define ITCCHEN_SHIFT               23- }- e' j! h$ k# n  ~; k

  60. 7 Q5 f' S1 @8 {, s0 \
  61. static volatile int irqraised1 = 0;
    # L2 I5 h+ e. I' I7 T
  62. static volatile int irqraised2 = 0;; `# j' \' T. ~* t) k
  63. $ ?# ^' d( G( m6 u* r, y# F; ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: F; {) M  h3 R+ q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: b# D! d3 S* y" ~: ?1 c, G1 z& g2 m" O: H' l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  g  i. g& f- [
  67. 0 Q* N+ F# [2 Y7 A$ n+ [
  68. dma_addr_t dmaphyssrc1 = 0;
    ) x  @! I$ O9 C2 B
  69. dma_addr_t dmaphyssrc2 = 0;1 r: {" H4 X1 k2 C8 r# k
  70. dma_addr_t dmaphysdest1 = 0;
    " V6 g7 F- F, g
  71. dma_addr_t dmaphysdest2 = 0;+ Y$ f6 ]8 f3 q2 Q& g# d* {2 e
  72. 0 j  [* z  b% u5 `% W  g$ E3 {2 c
  73. char *dmabufsrc1 = NULL;
    " s, x0 _/ Y3 Z, R; l& @
  74. char *dmabufsrc2 = NULL;
    ) z0 G4 T, c1 r+ ?
  75. char *dmabufdest1 = NULL;- T% W9 [# m' _% U$ j
  76. char *dmabufdest2 = NULL;
    8 N' S3 l4 M; g; ]5 [; c
  77. * f4 m, K% J3 b: I' d
  78. static int acnt = 512;; I/ I/ D. w' j7 g" G
  79. static int bcnt = 8;/ U# K9 d5 n5 p4 r7 O
  80. static int ccnt = 8;/ d7 C7 V( I& a/ s" X
  81. 4 y% }2 }% U& a+ H/ q* P8 U
  82. module_param(acnt, int, S_IRUGO);
    % W9 p7 g8 v) @
  83. module_param(bcnt, int, S_IRUGO);
    $ C7 x: q, M0 y& [9 |. X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 ?) s$ \/ q/ v! W
5 \2 v/ h( Y, u$ _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 }+ @: M  ~" n3 H8 e9 l- H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# x$ |5 |! ^* Z' X% _( g' y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- Y! P- N% ?4 j. q* B8 S/ j

7 Z( B% U) ~* r
4 |( Y3 h1 c! x+ i  A" |7 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 01:09 , Processed in 0.037784 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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