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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 P$ B+ i7 T* D+ ~% o
  1. [code]EDMA sample test application
      [5 e2 U8 r; H+ ^5 {, M  S2 v+ ^
  2. /*
      O6 [9 x( M9 t' n0 p" R" {0 h7 y
  3. * edma_test.c
    & n- u% o# {9 @4 \3 N- ?
  4. *8 y0 Q% K. [4 q* h
  5. * brief  EDMA3 Test Application+ b+ {; Z+ o5 `* ?
  6. *6 @$ \6 |* ~2 Y" g" E2 s7 ?0 K
  7. *   This file contains EDMA3 Test code.; K+ K) j5 c) V+ F
  8. *
    8 u/ w. g, K9 x" k/ W! g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ c! @; p9 e+ \$ G% s* Z0 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ S) S  l9 |' s/ U1 Y6 m
  11. *         TO CHANGE.! B7 y) P) X0 h7 F" X
  12. *8 ?/ b' v+ Y: q$ K$ ]6 v5 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* Y  @/ K! A, ^/ f( @
  14. *( T' I% @4 j: Q. ]- \
  15. * This program is free software; you can redistribute it and/or
    , Q( F& R0 H$ j. o# o7 v
  16. * modify it under the terms of the GNU General Public License as
    & b% ~( m2 a- d/ J7 ?" H2 M' M
  17. * published by the Free Software Foundation version 2.0 h  w; B3 [) \
  18. *
    4 ?( ?. a" r$ O6 H. f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 \( d3 ]2 Q) L& z( k: l, p0 C
  20. * kind, whether express or implied; without even the implied warranty
    6 s0 P& w# B- l. {4 Y# k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 Y( S, |7 Z& Y9 f$ k4 p
  22. * GNU General Public License for more details.0 `* P' z/ F  G' [3 X
  23. */2 H: q; |! G5 b) P, T

  24. ; y! @6 M/ v+ M$ e' C2 o7 ?% e
  25. #include <linux/module.h>  W% T6 Y+ A( x: d: u
  26. #include <linux/init.h>8 f0 w: u# R0 J  }* ^' p
  27. #include <linux/errno.h>" ^0 @% p7 x8 M* {2 f; r/ |
  28. #include <linux/types.h>
    % p" u( ~/ F, W0 `
  29. #include <linux/interrupt.h>& K9 {6 {! N* k- q
  30. #include <asm/io.h>
    ( L; z: _# u( Z  W& X
  31. #include <linux/moduleparam.h>3 O% B# `1 B  {9 b' ]* Y$ C9 o2 j+ d' ^) l
  32. #include <linux/sysctl.h>
    ) N" K, w  B5 X6 v% M
  33. #include <linux/mm.h>
    : S, g9 \9 ]$ T/ W! K
  34. #include <linux/dma-mapping.h>
    ! \+ h5 d1 y: ]4 M% v) T
  35. 1 K9 n% Y* Y8 P
  36. #include <mach/memory.h>
    $ r& G9 s9 @0 K1 {
  37. #include <mach/hardware.h>
    ' O' I+ e  V, I
  38. #include <mach/irqs.h>
    * }7 y! m1 G# n/ Z
  39. #include <asm/hardware/edma.h>
    5 `3 t5 Z- `# u8 ~$ [

  40. - t0 I( ^. B7 n( e
  41. #undef EDMA3_DEBUG% D% b6 `9 I% D3 `8 Q% S+ w+ k3 j
  42. /*#define EDMA3_DEBUG*/, V+ @4 t* t! ^6 i$ `! ?' d
  43. . `: X. u0 I, e5 v  n/ d
  44. #ifdef EDMA3_DEBUG3 t* E8 H$ p+ a# ~3 ~! H5 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- \3 T3 N$ A8 M7 b5 D2 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ X8 ^3 i$ |, `+ f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / P! r+ K. A. `) I5 [, {
  48. #else0 {& l# l/ J# l2 _9 i% u- N
  49. #define DMA_PRINTK( x... )- S/ S0 n9 \3 R
  50. #define DMA_FN_IN8 L/ ~2 Z8 J  b# L1 r
  51. #define DMA_FN_OUT
    % h. P% E  I8 [, ?+ i# ?# g
  52. #endif
    2 n  ^+ |) X3 A7 |* _. N
  53. * j# r  W1 D8 R3 L, C7 r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # H  f" ]- N2 d" E  n% A0 n/ Q% _4 V
  55. #define STATIC_SHIFT                34 a' ^  |/ W6 R5 I. I5 {2 U6 ]% P- y
  56. #define TCINTEN_SHIFT               20
    8 Z4 D: j( w' n6 f
  57. #define ITCINTEN_SHIFT              21. a: `* X8 R% a0 r& j' ~, q( J
  58. #define TCCHEN_SHIFT                22
    4 o# m# {( P6 }: ~0 ^+ f" _% ?
  59. #define ITCCHEN_SHIFT               23% ?8 g- a5 p6 z' @
  60. 1 m* J$ y( x; g: Z
  61. static volatile int irqraised1 = 0;
    " _" x" F$ \- \$ g, G; j
  62. static volatile int irqraised2 = 0;& I5 m/ @, K' a9 P% R) R

  63. : M7 ~7 c6 F4 {5 W" y* J% E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 V4 w( g# I0 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* m8 C3 J4 \7 ~' [( f: `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ f5 r; d3 t: ?3 z( q) L
  67. . i: j9 j8 }& B% S: _: _
  68. dma_addr_t dmaphyssrc1 = 0;
    9 i0 d- c/ l* ?; U
  69. dma_addr_t dmaphyssrc2 = 0;; h9 N! o8 \" L; \3 b# g; p1 W
  70. dma_addr_t dmaphysdest1 = 0;* D& H, \2 [2 N0 j( Z5 n
  71. dma_addr_t dmaphysdest2 = 0;" R) i( ^. L2 l' Q& V+ W

  72. 3 s( o7 B/ ~! q0 ~- F# I2 U
  73. char *dmabufsrc1 = NULL;* @3 r0 l* b! p4 J( n  f0 j
  74. char *dmabufsrc2 = NULL;! t" I0 ]( T# z# d
  75. char *dmabufdest1 = NULL;
    ! |% Z& P6 l6 e( }: e
  76. char *dmabufdest2 = NULL;+ Z* U1 P- N6 {6 o- i" u, ]  r

  77. # W% i8 f& l/ k3 T4 H7 x
  78. static int acnt = 512;4 ^% j$ e9 f0 {; R( N( Y  f
  79. static int bcnt = 8;+ U7 L* y+ K% d3 @5 N  e0 k; I
  80. static int ccnt = 8;1 ]6 H- B" K; t* S
  81.   V& V- M/ ~+ a5 h- U0 i- s/ g( d
  82. module_param(acnt, int, S_IRUGO);% p: @" U* c% _3 ^. A1 D
  83. module_param(bcnt, int, S_IRUGO);8 B0 M: I! b9 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ P' c0 K* f7 w- p* }' }  a
  I0 M* o0 O( r) D+ B: X( S5 g' [1 j/ T! I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* b. x3 b& }" g# R/ Q
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 g% ~; X8 {& j4 F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. w9 ?5 |! w" Z0 x" s/ o: a

* F; R) g# ~  h' h7 w
, c4 M) `, E8 P2 x# H" R6 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 20:19 , Processed in 0.039717 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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