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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 ~& \$ Q. G) N- W. X( U+ b
  1. [code]EDMA sample test application
    ! }% T1 n) h6 \8 t( C! ^
  2. /*5 h! t9 ?: s6 S1 a7 V: u4 s
  3. * edma_test.c
    ; y" q2 Y9 o" {: ?9 ^( `! }# h/ |
  4. *
    8 H3 v! [0 [8 p7 h* M2 G8 E
  5. * brief  EDMA3 Test Application$ Y+ A9 U& p' Q# T9 l" L- U* d3 L
  6. *6 O$ U4 [, m1 s+ P
  7. *   This file contains EDMA3 Test code.
    $ ^# h3 O" g- R- }% S9 @" z. E$ p
  8. */ b4 n) W3 G  F  R/ Z* n) N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , n0 v- Y4 K" [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 q: E! X6 p6 T; E" G! b
  11. *         TO CHANGE.
    % o+ v9 |8 f( t6 B2 U
  12. *; c' p6 z' M+ b% g/ Z7 y" Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& g* }/ m# K# |, ?
  14. *  o" m+ `0 `" p. s& d7 ]" O
  15. * This program is free software; you can redistribute it and/or
    " B. F, m/ W& {, h
  16. * modify it under the terms of the GNU General Public License as6 E; Z8 s- w$ o" V! Z# y
  17. * published by the Free Software Foundation version 2.
    4 z+ C4 M' ?2 i( r0 Y
  18. *9 e; q: z$ f; |+ m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - I$ W- p) P7 P. o& l+ Y
  20. * kind, whether express or implied; without even the implied warranty9 A0 b6 Z+ D1 u( ^% P* Y; k  \  A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + B6 v2 {" a0 U5 m" w
  22. * GNU General Public License for more details.: F# `6 T' l1 U0 t4 N# a) r
  23. */
    2 q, ^. R5 X$ x% h6 v* f# W

  24. ( ?  |3 N. E7 R9 A4 e
  25. #include <linux/module.h># y# \. |: T7 \( N- U* O! Q
  26. #include <linux/init.h>( p) \$ @: V# _: Q& V8 e% g+ u7 Z
  27. #include <linux/errno.h>
    & c2 N9 A+ K) @# m% r
  28. #include <linux/types.h>
    9 I; T3 V  b4 H" K, }, G  S2 P
  29. #include <linux/interrupt.h>( b1 @' f) o& m4 S* w& J/ |3 Y
  30. #include <asm/io.h>
    ( e% [6 d% U. U' n% Y
  31. #include <linux/moduleparam.h>- `9 @5 N& v& \5 ?- k
  32. #include <linux/sysctl.h>
    0 r1 l8 g  ^8 }* r  T& h
  33. #include <linux/mm.h>( W3 k% _$ Y/ A# s
  34. #include <linux/dma-mapping.h>3 F5 w( a5 v* ^: y

  35. 4 x: ]8 r0 q0 G: m/ ]$ \2 i' l
  36. #include <mach/memory.h>& z; F. q/ |# I; @
  37. #include <mach/hardware.h>% z8 x, Z! ^* d2 N. J: D
  38. #include <mach/irqs.h>
    , @+ i) j- F: O4 A) A- W' U
  39. #include <asm/hardware/edma.h>
    ' D; s) m* j% f" M) R( g
  40. + p* x9 a/ M% V1 u0 u
  41. #undef EDMA3_DEBUG
    , ^1 c/ x0 O, H+ b+ D* ?
  42. /*#define EDMA3_DEBUG*/
    5 a9 e( f( {& V+ V& S( H
  43. 1 G3 h9 H( l2 J; z
  44. #ifdef EDMA3_DEBUG6 Y- i6 J8 j7 X# n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). S5 z6 w) Q0 Q, F% X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 r6 ?! \( _4 [9 U: {0 K! U/ Q- X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      t+ F& U5 V' ~, L% o2 P
  48. #else; D% K8 I, K4 g- L4 Q) ^
  49. #define DMA_PRINTK( x... )
    $ L% q8 r' L6 v, C9 y
  50. #define DMA_FN_IN
    6 G- H6 F- t' p' i0 j0 S7 `9 G! o
  51. #define DMA_FN_OUT
      W* n* i4 k& D, n0 B
  52. #endif
    5 l, \+ _0 c5 G+ {, s; N: t) g

  53. 2 l6 o3 u. ]( e6 M7 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ a7 E1 f7 I' W7 K
  55. #define STATIC_SHIFT                3% Q4 J% a6 l$ p; o
  56. #define TCINTEN_SHIFT               20
    $ A8 B. Y% i4 {) Z( ]% z3 M! I- _& ^5 [
  57. #define ITCINTEN_SHIFT              21& i  ]+ X3 t8 H5 R/ z- b
  58. #define TCCHEN_SHIFT                22
    8 g( @: M7 u9 |7 g
  59. #define ITCCHEN_SHIFT               23, D9 ~' [8 i4 _& Q, q5 H# G

  60. 3 Q+ x- L/ R) A
  61. static volatile int irqraised1 = 0;, p/ _. }! K/ e; e! `
  62. static volatile int irqraised2 = 0;
    " ~8 i+ X# G, K, H1 k* ?7 j
  63. " ]4 T* t. `) P( F" Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # s# w# P, P5 K2 m7 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 u, l. e; [* i3 T# j2 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 h1 _8 a8 l9 ]* c! ?  U

  67. # v6 i' h$ v: i9 Q0 y- @7 c6 r
  68. dma_addr_t dmaphyssrc1 = 0;9 l( x8 J, D  u: l1 F7 i
  69. dma_addr_t dmaphyssrc2 = 0;
    1 I$ c5 `5 M' M0 f1 D. G
  70. dma_addr_t dmaphysdest1 = 0;: @5 V" x7 C& F5 @9 u3 \4 P
  71. dma_addr_t dmaphysdest2 = 0;0 h$ n: e3 U# g1 ?0 X% v

  72. . A) e# ?, C' i( Q
  73. char *dmabufsrc1 = NULL;
    & s- s5 i. D( t4 l3 M
  74. char *dmabufsrc2 = NULL;
    # z$ u$ K! C$ L
  75. char *dmabufdest1 = NULL;" z0 s7 B% E$ e* \  S2 Q, x
  76. char *dmabufdest2 = NULL;
    & p! l" s8 a8 W
  77. 7 s* e! }+ P! J! h7 l
  78. static int acnt = 512;! N6 Q' z5 ]6 ?/ j& T  L$ q. {
  79. static int bcnt = 8;* c  n1 A  @9 e1 G& ?
  80. static int ccnt = 8;
    : h! S. \  G  B  {$ s
  81. % w% u) r$ v' R+ v% T9 W
  82. module_param(acnt, int, S_IRUGO);1 \0 ]& A/ m* `0 a7 J; p  w
  83. module_param(bcnt, int, S_IRUGO);
    7 W4 V+ H6 a3 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' x/ W* q1 L8 b5 ?4 A7 ?5 b" a) Q+ @

5 s4 q$ _) [9 G3 Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% K# c3 F/ O5 l$ }& _+ Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& V* [8 Q% |# A+ _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; [7 _" w$ `" }

% ^9 k1 E$ C/ d" e, m: @4 u
2 S" y  x; X+ _( q3 t. D6 z1 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 20:19 , Processed in 0.041007 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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