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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 }+ l1 S' w0 A
  1. [code]EDMA sample test application
    + W! [! ]1 k+ `/ v( i* V7 H
  2. /*( {2 L3 i5 Q" `$ V, V4 g
  3. * edma_test.c" U" l1 F1 m+ {0 a, }% e
  4. *
    3 h; U. \( @: E
  5. * brief  EDMA3 Test Application, }0 t! a# o( {& B* i4 W& O
  6. *3 e% w8 L3 p- H1 i/ X0 M" m
  7. *   This file contains EDMA3 Test code.
    / J9 w* e3 d+ G- x
  8. *6 n6 _: `' H! D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ T% E( G% |3 G& N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 ~( k  S  _5 E( \4 w, g
  11. *         TO CHANGE., A3 x: Z3 n( E2 ~9 E
  12. *% @  n3 R9 r. k$ D$ P9 }6 o  N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; m" j2 v' ?5 _- ]5 T+ t
  14. *
      e$ W3 d5 u2 u# a, \$ f! \+ D
  15. * This program is free software; you can redistribute it and/or
    - k* k- h7 V- o5 j) q" o) |
  16. * modify it under the terms of the GNU General Public License as* y# X5 i: ?# D: [
  17. * published by the Free Software Foundation version 2.2 G2 G" X" N+ T$ K0 n7 I+ ^
  18. *0 z7 D* f& v; v9 P2 k5 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; _, I1 f. O) S! E5 J& c
  20. * kind, whether express or implied; without even the implied warranty8 I( k1 S2 b  e: a+ S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, \3 Q1 V. r7 ~* q, |# t2 \
  22. * GNU General Public License for more details." x$ r8 y3 l, {1 c0 W1 W, G* d# ]
  23. */
    1 k+ \% K/ S$ e" }* h9 E

  24.   O7 \3 F- B" y3 u4 v
  25. #include <linux/module.h>
    1 T* p+ V* Z+ P8 W' x
  26. #include <linux/init.h>
    ) z0 O/ p# U3 c2 m
  27. #include <linux/errno.h>2 C& |) t: p! k: r
  28. #include <linux/types.h>
    6 g. J/ I5 U+ X& T* I, U
  29. #include <linux/interrupt.h>
      s; ~9 f" W; Y( m, p% |! T
  30. #include <asm/io.h>( Z7 G/ R+ w; U) v
  31. #include <linux/moduleparam.h>
    4 K  R4 J) z/ @$ }2 W
  32. #include <linux/sysctl.h>
    $ u7 o* o  e( ~" k
  33. #include <linux/mm.h>7 H; v1 o/ q" {6 l2 f; a% A
  34. #include <linux/dma-mapping.h>
    - O0 j4 n7 i+ q

  35. 8 F, b  ~( r4 i9 h9 u: N) u
  36. #include <mach/memory.h>
    0 s8 Y/ E- j% N
  37. #include <mach/hardware.h>
    ; V; Y4 L5 G/ X+ p6 z& A; f
  38. #include <mach/irqs.h>
    ) D/ R5 g  X! s3 T4 x
  39. #include <asm/hardware/edma.h>
      g" C3 M% |' r! N
  40. * ~( g$ ^, a+ `7 V! Z
  41. #undef EDMA3_DEBUG6 ?! M; m/ \3 T* @9 `
  42. /*#define EDMA3_DEBUG*/5 U4 R: g. T% x! Z
  43. 9 m# d  @# M# H& u& s
  44. #ifdef EDMA3_DEBUG
    % I6 k5 ]! K. M/ E# a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( m  t2 v+ N( M( U9 R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( J+ U! |. u& I- M/ y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : [1 t& M1 @' `  p% x: o+ V! |  W6 P
  48. #else1 S5 I4 L& h  h& G( g
  49. #define DMA_PRINTK( x... )
    8 N2 C, o+ s0 N
  50. #define DMA_FN_IN
    & q3 |6 G* m/ w& K( }0 t* g( F+ H
  51. #define DMA_FN_OUT5 T0 V' \6 U$ n  A: Z7 ?) d$ w/ S7 n
  52. #endif
    $ v- r0 ]3 d* P( }  @: C

  53. " I5 B! n4 f( @! b5 o5 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" P1 p: S; I# o, T9 R6 @
  55. #define STATIC_SHIFT                3+ G7 A" E" }. m3 B5 n
  56. #define TCINTEN_SHIFT               208 E. E0 r: s9 J4 k2 Y/ X
  57. #define ITCINTEN_SHIFT              212 m; Q# e5 f, j1 _0 U% E
  58. #define TCCHEN_SHIFT                224 l$ S% r  Z% W$ }
  59. #define ITCCHEN_SHIFT               236 Q4 w" Z: P0 \8 E6 z

  60. ' W; e. i- y2 A" O7 W
  61. static volatile int irqraised1 = 0;
    2 R& C, ?" j5 _* q* |# s
  62. static volatile int irqraised2 = 0;+ x% D" d/ f+ a9 z! Y# \

  63. 7 q' L( b. Q; M0 L. k1 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 z/ j7 I! ?! i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : a  J/ s. e- p) ?; A$ b# F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* E8 G# Q; v/ V4 A& G4 E

  67. ! v2 W: Q) i7 G2 Y
  68. dma_addr_t dmaphyssrc1 = 0;5 w, m6 r. i% Z3 s. i( |( i. h# g
  69. dma_addr_t dmaphyssrc2 = 0;
    $ R. ^. Z, V: W3 s
  70. dma_addr_t dmaphysdest1 = 0;
      B' k  P0 w! n- ~
  71. dma_addr_t dmaphysdest2 = 0;
    ' d% [2 w2 [- F. X$ v

  72. , |7 m9 u/ e1 r' p0 V$ C1 @5 V
  73. char *dmabufsrc1 = NULL;. A9 h6 {3 t( s* K0 Z
  74. char *dmabufsrc2 = NULL;
    0 ]; T: p" O9 R3 D
  75. char *dmabufdest1 = NULL;: W% s+ _+ L: K# x2 J1 |
  76. char *dmabufdest2 = NULL;
    " b8 K. M: P% V8 U, T$ e6 d( P

  77. 9 q9 z8 d! Q3 e! L5 I1 z5 ~
  78. static int acnt = 512;
    # P+ J4 s' s  X" ]. ?% W
  79. static int bcnt = 8;! |& x: t% i. |# ^7 i
  80. static int ccnt = 8;# W* L, r- s2 }: p2 m

  81. # V" u9 G" c  p7 A4 X
  82. module_param(acnt, int, S_IRUGO);
    1 i& r! p% h9 v6 ~
  83. module_param(bcnt, int, S_IRUGO);
    % s" v  j: W% F2 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 f3 e- t0 P$ d( M0 h! n+ \9 r
2 E  V% `6 {: K* X" w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 E# e: N/ a. }# j$ L, b' u
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  u% S. G% _8 d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# ~2 L; o9 O; h# G# E% o2 e3 T) G5 S
# o8 {# P; ^9 D; E. x2 Y
" K% S/ i: `) j7 i4 Y0 @+ [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 02:05 , Processed in 0.075319 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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