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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 F' ~2 i* M8 S( S$ R
  1. [code]EDMA sample test application
    2 j2 a& {( c+ x
  2. /*
    9 G' S0 G. t. a0 _3 C" w
  3. * edma_test.c: A" w* \+ h, H0 c  ^4 S7 f
  4. *1 `- x3 F! F6 d4 U' J2 U
  5. * brief  EDMA3 Test Application5 B- d& e3 p0 E  R, X
  6. *, G8 W/ u% f" ?+ z% @! e
  7. *   This file contains EDMA3 Test code.
    9 W9 N# r5 M( u- k" T
  8. *$ f- S9 B+ J, K6 v, M3 r6 I; C8 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : h4 c: L1 W$ I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. c' h; `+ H) I4 d5 T
  11. *         TO CHANGE.8 h" E. d$ A$ v; @  ^; r
  12. *
    # ~* e+ v- B* S, v: ~3 w) B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, H3 F3 N2 P; g. z& b7 V4 R
  14. *1 T- g+ y8 X; O  V* Y, F7 _- S
  15. * This program is free software; you can redistribute it and/or
    ) p$ O& k' B9 q, ]: U' g
  16. * modify it under the terms of the GNU General Public License as1 |9 ?" _. ~9 M1 k
  17. * published by the Free Software Foundation version 2.
    ; r( v+ m. J4 B7 U# m8 R7 w
  18. *% |: h# [" H6 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) }2 F% U( S2 n) Y$ f0 K
  20. * kind, whether express or implied; without even the implied warranty
    ) C3 \: o6 T' S  v) E& R5 r4 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 z: |+ Y) I4 s" K3 u2 w0 G6 H& y
  22. * GNU General Public License for more details.
    $ @1 g3 s# B. J
  23. */
    ! B. ?* d, N1 u7 n+ L& Y
  24. % b4 D  s% z7 [7 w' {$ @+ N
  25. #include <linux/module.h>
    ) J* Y7 V$ t9 W+ [; ]4 E
  26. #include <linux/init.h>0 s2 y+ u, H7 }3 u! J+ A
  27. #include <linux/errno.h>6 c4 w! f+ [$ M
  28. #include <linux/types.h>7 `* a5 h; U5 o8 @; O& W' ~0 K
  29. #include <linux/interrupt.h>
    ' B+ a+ b1 x; {- o0 f1 U
  30. #include <asm/io.h>: y- h  ~* K: y; W: w
  31. #include <linux/moduleparam.h>
    ) K, W( z. R5 A" Q  l+ Z7 n. S
  32. #include <linux/sysctl.h>
    3 B% H0 R- ^5 U& a1 C/ A
  33. #include <linux/mm.h>: @  y# S$ u  N0 d1 {& i( Z
  34. #include <linux/dma-mapping.h>: i7 r; e4 f! C3 s6 Q
  35. $ E) ^8 `) R- {4 _% G% x4 t2 u( i
  36. #include <mach/memory.h>( J" s* n4 x0 n8 W# A- J3 X
  37. #include <mach/hardware.h>
    - p+ c0 v" A6 t0 q5 x8 B+ ]% z
  38. #include <mach/irqs.h>  x3 L* C2 M+ f. i5 B1 |5 y' K: n
  39. #include <asm/hardware/edma.h>& F' t- ]! j& N: x$ q5 Z
  40. 7 K' p  O4 h, @0 g1 \  P
  41. #undef EDMA3_DEBUG, h% E3 ]6 N" ^: ]
  42. /*#define EDMA3_DEBUG*/6 i  G$ ?: G  E& I) H; c1 p

  43. * M, V3 ~; \* M9 Y  _
  44. #ifdef EDMA3_DEBUG
    * T3 T$ t3 J. d: }! k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; ^# ]. @5 G9 o* X1 L( x# t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 e# @  O* L8 S" b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 _5 F: D3 m; f$ M  N
  48. #else
    7 ~! `( u( M8 z
  49. #define DMA_PRINTK( x... )/ ~3 y9 z: ?& t, B/ ?8 V
  50. #define DMA_FN_IN' I  L' Y& t) ^7 L% }- T
  51. #define DMA_FN_OUT
    7 S4 K; {4 y/ E9 v( _
  52. #endif: }! ^: q4 L# B4 v* @2 M6 W% V

  53. 3 a- H6 U" L, i% o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # i. Y# \0 E! I( J, J8 o
  55. #define STATIC_SHIFT                3
    $ G( C" Z- n, I
  56. #define TCINTEN_SHIFT               207 S  O/ o3 e: M" [3 b. S
  57. #define ITCINTEN_SHIFT              211 r3 Y& W( f, v7 ~, j
  58. #define TCCHEN_SHIFT                22
    1 t+ \1 c3 Z' P1 v, q0 C
  59. #define ITCCHEN_SHIFT               23
    ! Q4 M; V9 N( a, s# u4 d

  60. & p. |3 M8 m2 f$ g2 |2 V. a) @
  61. static volatile int irqraised1 = 0;. b! m8 j9 z- s7 P" N- C( a5 k
  62. static volatile int irqraised2 = 0;9 E, T, R, c3 Q9 K6 N, y

  63. 4 A# T( |( T/ G+ [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 v  o& d- b4 m0 x% _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : L4 R* m8 k, f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ^- Y( c+ `1 h) |- F) n2 d: t
  67. + m+ ^8 X+ X, a. v2 y
  68. dma_addr_t dmaphyssrc1 = 0;! l: i( u5 k- n4 f8 r+ a8 V8 `
  69. dma_addr_t dmaphyssrc2 = 0;9 E9 G2 `' `7 ]( d1 A: I. t( o! \, o
  70. dma_addr_t dmaphysdest1 = 0;3 S. d7 r2 a# I1 G  x0 e7 W
  71. dma_addr_t dmaphysdest2 = 0;
    2 L) C4 c9 D( x
  72. " T3 T' p  o9 p. x
  73. char *dmabufsrc1 = NULL;: e+ v9 Y% z. p
  74. char *dmabufsrc2 = NULL;! ~- Y$ _: S( T1 t
  75. char *dmabufdest1 = NULL;" {" O9 [+ V; ~$ v
  76. char *dmabufdest2 = NULL;
    $ e; H$ B8 L1 E' u4 z6 s9 o
  77. , _+ @* ^" w6 j" s- v
  78. static int acnt = 512;
    ) L: @( q1 s: O9 |. W& G0 R6 {
  79. static int bcnt = 8;6 ]) D8 j# n) d) H- R! G# Z# q
  80. static int ccnt = 8;2 t, W4 k& ~# l3 ?$ o2 W; c6 g
  81. 9 w) ]$ x, U5 d4 l) ^' ?
  82. module_param(acnt, int, S_IRUGO);* A  y, S; F+ |( Q& B) E. o. l
  83. module_param(bcnt, int, S_IRUGO);2 p1 J  a+ }2 `! i5 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; b1 s- G* C! A5 ~! {' G
( F: r" H+ ^( ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: G* G: F' g  Y0 f$ m+ ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 V* x9 u5 ^8 F$ G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* w! ]  F  W% J# {

/ D$ n  e/ T, \- v6 [% X6 ?3 F- |) m& {# ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-10 19:10 , Processed in 0.038449 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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