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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ M7 X0 U* s+ Y: p; o( Z
  1. [code]EDMA sample test application
    , T5 L) x: o! I- s
  2. /*
    7 K( b  a# b7 k
  3. * edma_test.c$ g$ Y+ t% p1 Y" c- i. V7 w
  4. *$ B2 ^, ]& Z, b: z* y
  5. * brief  EDMA3 Test Application
    / O) X- Y5 V/ b; B- F
  6. *. D% k9 n2 d+ r4 X1 Y
  7. *   This file contains EDMA3 Test code.
    + q' j% x2 [0 r. r% _
  8. *
    . R% D+ |4 l! t0 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) C6 I1 ~9 `- j0 K. I, J# F( w0 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 v; `2 n- r  ~2 m& P
  11. *         TO CHANGE.
    # e5 h' Q3 h( F
  12. *) n, }8 J7 h& u, o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 h: @! Y$ Y1 n3 v
  14. *( r0 v2 V! {# y: U. L* m
  15. * This program is free software; you can redistribute it and/or& q2 G% i+ H3 x6 M* h
  16. * modify it under the terms of the GNU General Public License as9 [  x5 U  L4 M# i* I9 d7 e# p$ b
  17. * published by the Free Software Foundation version 2.2 C- x' l1 K, T0 f" @
  18. *
    1 P4 `" r. w3 \5 l9 m6 H  I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  j% F" }$ A# B& p
  20. * kind, whether express or implied; without even the implied warranty, a0 c% k: F0 M) [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 u# w2 Y6 {3 f: @" B: ^& ~
  22. * GNU General Public License for more details.
    " A1 K* n4 e2 p9 h# @
  23. */! w& i1 ]. q3 `6 g
  24. 1 E, j. Q/ q0 Q  n! @
  25. #include <linux/module.h>
    " V2 `8 m6 ?8 B+ a! k8 w# V- o
  26. #include <linux/init.h>4 A% Y( S/ b" f$ F
  27. #include <linux/errno.h>0 d3 v! t4 V1 O" h& \
  28. #include <linux/types.h>  ~9 Q- N/ |) `2 O" p
  29. #include <linux/interrupt.h>
    & Z% n5 _6 v5 S7 \$ i2 E
  30. #include <asm/io.h>
    ' C" }9 L+ W  }
  31. #include <linux/moduleparam.h>
    $ M% t" Y! @3 a4 z" a0 X
  32. #include <linux/sysctl.h>
      I! ]9 T  L* g& O7 e  K
  33. #include <linux/mm.h>
    ' e1 @& e6 ~- E- q! ]
  34. #include <linux/dma-mapping.h>
    . ~5 B  a  }7 {1 r$ ?

  35. * D% J5 P/ {" Z
  36. #include <mach/memory.h>9 I$ A1 ?# \- R2 }& p/ W9 Y. v1 ^
  37. #include <mach/hardware.h>
    9 ?3 C2 x, q' N# D( F) [
  38. #include <mach/irqs.h>: r+ G. M* g! E7 \" w  u( V
  39. #include <asm/hardware/edma.h>8 S- r) M* X+ u8 I8 `: |8 c

  40. & E2 K$ u9 ]# z5 N( g4 Q4 J
  41. #undef EDMA3_DEBUG# {" w# G1 E! P1 H. p, \
  42. /*#define EDMA3_DEBUG*/" ^& L5 Z8 l; @1 [5 {9 i% `
  43. ) {; J* w: S2 R* ]
  44. #ifdef EDMA3_DEBUG$ c" e( |4 C6 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ j5 o# V5 ^  O3 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% W* ]% O( k8 f- @% Q* f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! [) A; S7 Z9 `* ~" v
  48. #else
    9 r! z4 L9 U/ Z3 g
  49. #define DMA_PRINTK( x... )- F5 J- I9 p2 D; G5 D& h
  50. #define DMA_FN_IN
    1 N; e5 l5 p* @
  51. #define DMA_FN_OUT' \# {' _2 ~2 Q) T
  52. #endif0 e7 c; g& _+ {6 f3 E! e  w1 A  x

  53. 4 U5 h, d; M8 o  X# e$ K! L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 m6 `; l5 v+ P; v* V
  55. #define STATIC_SHIFT                3& C) M( F) r4 c0 P& j$ X( ]
  56. #define TCINTEN_SHIFT               20( S# r/ v& V" u# `9 w
  57. #define ITCINTEN_SHIFT              21; f( p, C  e* Q- Q7 J
  58. #define TCCHEN_SHIFT                22
    ' d. n. q; ]3 [& ]
  59. #define ITCCHEN_SHIFT               23' v* M$ F" }. L6 ]! [% R" z

  60. ( _, R, Y  g% `
  61. static volatile int irqraised1 = 0;6 ]( R* y* {5 |# R: }
  62. static volatile int irqraised2 = 0;
    3 D( Y3 c7 H( @- P' ~& ^

  63. - @! }9 L- z5 u, h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. K8 d# i& F; p/ g2 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " y) K" f: E( h8 T  E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 b4 d' [& _1 @
  67. 4 N( B+ a* c/ C2 n3 r5 S# F1 K  Q
  68. dma_addr_t dmaphyssrc1 = 0;
    4 @" y+ u& `' ?! A
  69. dma_addr_t dmaphyssrc2 = 0;
    , I7 p" ?3 |: _3 ?$ u1 u
  70. dma_addr_t dmaphysdest1 = 0;& C& w" V( j5 L$ v/ b
  71. dma_addr_t dmaphysdest2 = 0;
    - |6 O  [% H( t( y+ `4 I4 b: ]

  72. - d7 S$ _! y" l' x( Q
  73. char *dmabufsrc1 = NULL;
    $ s) u. i1 L+ ~  J, S4 C' E
  74. char *dmabufsrc2 = NULL;
    ( y8 L* e; t% o' B( o7 p: M* x
  75. char *dmabufdest1 = NULL;
    6 [5 {$ V9 W& f- A8 T
  76. char *dmabufdest2 = NULL;; t3 ~% Z- }: i* i

  77. 0 ?! D' j9 s/ d! S& _
  78. static int acnt = 512;
    . D7 W8 h9 a$ j! `/ A! q
  79. static int bcnt = 8;. R0 x$ W4 x' t: E
  80. static int ccnt = 8;
    7 b$ G7 [! a5 w( i: q" J- w

  81. ; h: M$ n  @# G- Z; s6 O
  82. module_param(acnt, int, S_IRUGO);
    3 d1 `& u. O# T
  83. module_param(bcnt, int, S_IRUGO);7 M" m. Y# x. X, O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. G2 J9 Q2 q- J) v3 \
% q! p! \/ p' o# u5 }6 R; M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ \, V0 S" @. Z+ s0 }6 _" S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! d/ O9 r  z% ]. Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ I% t. b) ^4 H1 k' K: i
/ c3 f$ _, P' W& A' ~# l

7 y) D  v2 S1 c$ Z" v- w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 15:18 , Processed in 0.040807 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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