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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% U% _* m) h% t, }3 ^3 e7 w
  1. [code]EDMA sample test application
    . N( U/ @, \; c7 z, ~! Y
  2. /*
    2 X0 ?3 X( k  r- i) B6 f- C4 M
  3. * edma_test.c  r1 Z1 C  [) t- Q2 @7 L3 S( i
  4. *# k! ?5 x, \5 Q% Y* N( O+ X. b
  5. * brief  EDMA3 Test Application
    5 l9 ~5 W4 p' n1 h$ e
  6. ** u* v- O/ }  t9 z
  7. *   This file contains EDMA3 Test code.  M* J. `4 |! m" M
  8. *! Q6 n- \" M/ u6 x( ~6 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / ]" Q" @, l0 m3 j. i, i* q' b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 b; g2 E4 ?7 G; X
  11. *         TO CHANGE.
    ! d/ c1 M9 l& I: t' Z6 h
  12. *  }" i1 H% h2 u' O# e- `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, h* ^5 K( I( H" b# O0 ~
  14. *: z6 K6 I+ y  O# l0 p2 W
  15. * This program is free software; you can redistribute it and/or0 y  @6 y1 x4 Q: g
  16. * modify it under the terms of the GNU General Public License as) Y/ U3 P3 [$ ]
  17. * published by the Free Software Foundation version 2.
    " n) ^1 \/ ?) a+ R
  18. *3 F' j, j+ i8 P( B9 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* W6 y$ b. D" ?7 K; R
  20. * kind, whether express or implied; without even the implied warranty- u8 A3 q* @. B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      R0 D% f( E$ I# m* E3 d. k- \
  22. * GNU General Public License for more details.
    9 B$ ?1 V' L4 P' h' I
  23. */
    ; A2 d5 C7 T, l0 A

  24. 9 H8 x0 O, q" }5 U
  25. #include <linux/module.h>6 p8 `2 v* R; {4 Y! e3 ^* Z8 [
  26. #include <linux/init.h>
    3 `5 ?. |& o" [4 h5 u9 A. b# M
  27. #include <linux/errno.h>
    ( K8 C+ F8 L! E- h8 d% P! i9 U
  28. #include <linux/types.h>
    # g, o4 e( C, ~0 [; |
  29. #include <linux/interrupt.h>) N! c0 m& c) F. q! e4 o/ Y! f
  30. #include <asm/io.h>, @' G# \) V* q5 D) |
  31. #include <linux/moduleparam.h>0 S2 S7 U! L/ \  m$ v
  32. #include <linux/sysctl.h>
    2 S+ D% D6 F( C# o+ S
  33. #include <linux/mm.h>
    * u7 M3 h1 z, O' m7 n
  34. #include <linux/dma-mapping.h>
    6 q* H) A% q4 f

  35. 5 l$ U6 j; X. C0 F, e/ @
  36. #include <mach/memory.h>
    6 ]- i2 f  z( H: U3 u* {4 c
  37. #include <mach/hardware.h>5 |" h, H& ]8 X+ ~3 }5 v5 l
  38. #include <mach/irqs.h>
    % t# T1 p" @+ r- k) |7 i
  39. #include <asm/hardware/edma.h>; P, e# m& M" Z% o( ?" J

  40. & B' T5 i6 G* P' D) [, e$ x2 C3 N! V
  41. #undef EDMA3_DEBUG
    4 h/ `) p+ h' u  u0 H3 z
  42. /*#define EDMA3_DEBUG*/
    8 r5 y* ]5 H+ @  v: W# c
  43. ( Y" v" A6 C* r: U% n. e& k/ Z
  44. #ifdef EDMA3_DEBUG
      P0 S3 a$ r* p1 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' X7 j" y* U5 k  i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( `8 n. x3 y' ~; I! Y# @: H$ m8 n+ S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' n3 K4 a5 G7 [3 ]
  48. #else
    , r* X$ _' h1 z) Y. N* E& y
  49. #define DMA_PRINTK( x... )2 J. F, n& g/ X! B
  50. #define DMA_FN_IN
    ( f1 \: L- q9 G/ y% Z
  51. #define DMA_FN_OUT
    " y; m( _, L3 {- f/ U) {, V
  52. #endif. X8 w, M, _1 e0 p

  53. . b9 z3 R! {/ g& C) `$ b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& g8 Y0 y- V) w
  55. #define STATIC_SHIFT                38 l3 R- m# s" ^  I, H
  56. #define TCINTEN_SHIFT               20
    $ }% V+ X$ Y2 [8 u7 _/ f" {! s+ U
  57. #define ITCINTEN_SHIFT              21& ]  s# B6 |1 v/ z
  58. #define TCCHEN_SHIFT                22. {9 f; \# g1 g$ ]& n5 z$ K  X
  59. #define ITCCHEN_SHIFT               23- c. p. r' z' v" v, A4 z, k# R
  60. - x. r! v5 b$ D% G+ O" K5 j7 _
  61. static volatile int irqraised1 = 0;
    # k! U9 @- k( ~; I3 k, v) o  v' V
  62. static volatile int irqraised2 = 0;
    ; n& D! c" S7 P4 B8 ~8 Y4 d. U
  63. ( u8 P/ }/ b* u, K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 r4 m, w/ C6 H8 x! @  y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 F7 X# `" \0 H% d4 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 B: R' J; V1 b$ c9 \4 x7 K. j( d
  67. ; @0 k7 l: K. k# A: l6 |! d$ ~
  68. dma_addr_t dmaphyssrc1 = 0;: E8 @' t' |9 x# y2 ]4 g" p
  69. dma_addr_t dmaphyssrc2 = 0;
    ' R- M# D; J$ |* C) D; Y
  70. dma_addr_t dmaphysdest1 = 0;
    ! Y) P% ?  [% ~1 t/ @% M
  71. dma_addr_t dmaphysdest2 = 0;
    ! P; ]9 v( p8 x( A
  72. : V. t3 E& m& r
  73. char *dmabufsrc1 = NULL;4 ^" ?1 s  R' f* f, `' o/ \
  74. char *dmabufsrc2 = NULL;
    3 J; W2 u' c) Y! J% o
  75. char *dmabufdest1 = NULL;- N# n  P/ _$ |% s
  76. char *dmabufdest2 = NULL;  }7 m. T7 H/ ]( n, O# w
  77. . H) g( R+ B! b8 N( x9 R
  78. static int acnt = 512;
    * D1 r1 H) I2 R
  79. static int bcnt = 8;
    ( L) s: |. Q& t: |/ `: W$ o
  80. static int ccnt = 8;
    4 i3 |) i7 E) M: n2 f  J

  81.   M% Z, k5 p: H  w
  82. module_param(acnt, int, S_IRUGO);5 Q( q! X, r8 X. z/ j; T' u& v
  83. module_param(bcnt, int, S_IRUGO);: o4 N* m8 c. M" u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, B5 b7 ^0 }4 b' f$ O# ~' l. ?6 Z9 j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 A0 o6 h8 J3 x1 t2 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 K3 L" c+ G3 l% m9 X6 l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  \4 S; f+ u" q1 B  M& U( k; V  t& w# j5 W$ Y
" X# l4 v5 J' V: |' g+ s* X/ g5 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 16:17 , Processed in 0.042416 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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