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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! r9 H# ~2 \+ `7 M) z0 P1 _2 F
  1. [code]EDMA sample test application) F- P- {/ S. s/ \6 x6 M: p
  2. /*# ~6 H, e. A( `
  3. * edma_test.c% ~$ C/ O0 B3 p- z8 R
  4. *
    . v0 p6 |: ^7 w
  5. * brief  EDMA3 Test Application6 I- G- R  s% f9 h% P0 {3 f
  6. *
    8 {) c4 Y0 }. ^0 H+ T1 D& G
  7. *   This file contains EDMA3 Test code.
    0 S4 E* g/ L! y; z, L* v
  8. *
    . B& U2 C4 e! r/ v! B) y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & t/ M4 R% P/ v) r$ K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , T" K# _* a2 n9 @& w0 W5 G8 i! o1 j
  11. *         TO CHANGE.0 t. ?% f( }! K3 ?+ Z+ j& z) r
  12. *
    ( R: d( |6 `* _8 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 p! K  {8 p% n, Q
  14. *
    - f* R( y  X0 _  H2 }0 T( G! U  {; R+ ?
  15. * This program is free software; you can redistribute it and/or  T* j5 q( y+ H/ G' H4 t
  16. * modify it under the terms of the GNU General Public License as" K: S: w( v! @0 A6 c
  17. * published by the Free Software Foundation version 2./ w& d- r6 @2 D/ W' y
  18. *) ~. U* X& G# A: l, q. l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: I+ \4 F# ?+ d: R" `3 f3 ?
  20. * kind, whether express or implied; without even the implied warranty" v( c+ R! l. `+ P4 K) j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  a9 T. d1 ~9 `  ^+ p0 m( g
  22. * GNU General Public License for more details.& \6 o" U1 a8 m7 P+ \% D
  23. */: G/ a/ g; q3 h9 k
  24. ) w. P% c0 D/ P7 r
  25. #include <linux/module.h>( ~1 b% M; ~& d2 v: W1 x
  26. #include <linux/init.h>
    + i1 H# _9 r* C5 n  G% ?
  27. #include <linux/errno.h>
    0 k/ P9 T1 s5 O
  28. #include <linux/types.h>
    9 Y; D+ o/ f6 U# Z6 s
  29. #include <linux/interrupt.h>2 ]; o# W5 U  T* X6 A8 a3 i
  30. #include <asm/io.h>
    : u, f8 _2 Z; F2 G& s4 B7 _& N6 O
  31. #include <linux/moduleparam.h>  I( s# Q- j. h5 Z% v, F
  32. #include <linux/sysctl.h>' g0 g+ |& _8 t: q& [$ Z% H5 n
  33. #include <linux/mm.h>: o6 q/ ^; q/ N/ ?, S, }! E
  34. #include <linux/dma-mapping.h>& c: c8 N# |3 m$ @4 \: F
  35. ' ^/ B& `2 @! G& s  ~8 i# e' m
  36. #include <mach/memory.h>
    * |; L" q) j: M' Y
  37. #include <mach/hardware.h>
    ! o9 l) g4 P1 V/ s3 [
  38. #include <mach/irqs.h>5 d# q; Y* D% G* x
  39. #include <asm/hardware/edma.h>
    ; H4 D/ E$ p2 p! J, u

  40. ) a  M8 [2 T4 j) d: U' U
  41. #undef EDMA3_DEBUG
    ' |$ @+ s0 ]+ \3 J0 ?
  42. /*#define EDMA3_DEBUG*/
    1 a3 M. n0 u( d
  43. & n2 L1 |0 F, _) H8 x
  44. #ifdef EDMA3_DEBUG
    5 R4 B0 L  Z% n! l) `0 `* W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), t. x# q) K1 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), f" r( I; L5 y' k2 `4 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  ^: T% w) R* ?2 P$ |
  48. #else
    ' Q/ N3 z6 E+ [3 }/ B' s1 W4 f
  49. #define DMA_PRINTK( x... )
    2 B0 j  D; Y9 v
  50. #define DMA_FN_IN6 f$ a6 M1 p4 X/ l: |# w' C: _8 w
  51. #define DMA_FN_OUT- D% u/ H: U2 }  r$ K( j) H- Q
  52. #endif7 ~3 D! p$ m1 _5 G4 c

  53. 6 h! m( }) d# k  @% U. s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , C5 y/ l5 X0 j6 m+ O
  55. #define STATIC_SHIFT                3, E+ r: X8 p1 H- q3 o: [8 b! _2 I
  56. #define TCINTEN_SHIFT               20
    - f3 H$ r- N9 x7 d. b
  57. #define ITCINTEN_SHIFT              215 K' K! `9 d  G! Z
  58. #define TCCHEN_SHIFT                22
    2 t2 F/ Y$ L; r& A
  59. #define ITCCHEN_SHIFT               23
    ) a% m  N# n  U5 l

  60. , w( j: q/ F3 v% L6 k! H
  61. static volatile int irqraised1 = 0;
    ( s, x& `" j, ]6 ^0 t' q
  62. static volatile int irqraised2 = 0;7 p& D, E) `& C" o# ^
  63. 8 x. r5 y/ _7 b9 [0 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& w/ C7 M) o+ K# j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ^0 t$ |0 P) |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 k; v) b% ]( a  x$ D+ v$ r5 m
  67. $ ^) L2 D) X: B: q( O2 C0 _
  68. dma_addr_t dmaphyssrc1 = 0;; L6 f/ O) W( n: e6 ^
  69. dma_addr_t dmaphyssrc2 = 0;
    ' [3 j3 _+ _9 f& t& L% K6 z
  70. dma_addr_t dmaphysdest1 = 0;
    ! e! ]2 L- p8 e8 O
  71. dma_addr_t dmaphysdest2 = 0;
    2 n  M' e8 j; P8 z

  72. ; c! e" E( X# G1 M/ o! |, n
  73. char *dmabufsrc1 = NULL;, f( z5 o* Q8 n( `" F# j6 p, B
  74. char *dmabufsrc2 = NULL;0 n8 U+ X' P$ j" t# m* C
  75. char *dmabufdest1 = NULL;
    # P& m9 J0 L* Q" T- X
  76. char *dmabufdest2 = NULL;* t* [4 j) _  m
  77. : W* v- U6 M* N
  78. static int acnt = 512;
    % O$ L. c: A$ _
  79. static int bcnt = 8;
    " E0 x0 E  O6 Q! U8 f
  80. static int ccnt = 8;
    : a9 q7 p/ l% K- \

  81. # }+ B- z2 l* g8 F7 s( z' L
  82. module_param(acnt, int, S_IRUGO);" u% u$ o& o2 l* e2 H5 y; X
  83. module_param(bcnt, int, S_IRUGO);# @% z$ `$ j& [; M- W- u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 E4 E  l8 ^. z/ i! w& N
8 i' \- s# q8 i: Y- J# u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; }8 u& a4 Q) f0 x/ \+ |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 l! m4 i/ `5 w& b& j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( D; Z0 r- W: y, i4 `
( J5 e" k/ k' p* a1 Q6 J
: g8 f* V# Z9 M3 e* \6 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 06:03 , Processed in 0.039887 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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