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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, y9 [3 A! }: R6 y* r9 S4 Y
  1. [code]EDMA sample test application
    6 ~, j) S( k; Y6 \
  2. /*
    " ~; X0 T. B: M, O9 Q3 ?# [, \: k
  3. * edma_test.c
    - Y0 N8 a/ p1 O& S. Z
  4. *
    0 F8 `$ ?# a  I" _% K, `7 K
  5. * brief  EDMA3 Test Application
      |: K$ p) F( e& w( Y) p
  6. *
    ! b. W: J8 S9 D) y) u5 W: C
  7. *   This file contains EDMA3 Test code.; e( e% [) b$ o
  8. */ k- u9 L5 s# W# V2 a7 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * B1 O2 E/ H- p$ y; k. w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , D9 [' s- d! z+ N0 }4 P
  11. *         TO CHANGE.' e- Y/ q+ Z$ V6 ]7 X
  12. *5 X0 w) A6 A  n9 h& N& o5 _: d4 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 e& {% e# |7 R
  14. *+ N# U9 E% H6 }, E5 ~
  15. * This program is free software; you can redistribute it and/or
    # c  f& i$ y+ I, D# W6 K) Q4 I0 h
  16. * modify it under the terms of the GNU General Public License as) n& O" S( M6 w! p2 n/ h
  17. * published by the Free Software Foundation version 2.
    8 c6 o! j! a- l
  18. *
    * Y9 a+ P8 F# i  l$ W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( x6 j3 `4 Q" k, s( M7 a( g
  20. * kind, whether express or implied; without even the implied warranty
    ( s' R- u% \( O7 c& A; ?2 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 v! O- u8 C) l- {( m. @( E
  22. * GNU General Public License for more details.
    9 E7 w, ?0 R/ }6 u
  23. */
    , a3 T; j! {! H1 ?

  24. 6 p5 o4 M/ e  T) A0 @5 P- k
  25. #include <linux/module.h>
    , n7 k0 P+ `( |0 m  X. `
  26. #include <linux/init.h>2 Q7 s! ]* M; R. }. \' N
  27. #include <linux/errno.h>
    , L. H. e  ^; L$ E% B2 \2 `
  28. #include <linux/types.h>. w! K& D  a3 q7 |
  29. #include <linux/interrupt.h>
    / W8 k# n* y( x6 y% m) ?
  30. #include <asm/io.h>* k& R* j( U  C0 k/ c
  31. #include <linux/moduleparam.h>
    ) |+ B/ d% E8 V0 O1 n- j
  32. #include <linux/sysctl.h>& D. q) C3 i5 c) \1 p8 P
  33. #include <linux/mm.h>
    3 x; f9 h7 e5 g# R4 a
  34. #include <linux/dma-mapping.h>
    ) O5 e, D, Q4 [) O: K  b
  35. 5 a0 e$ z6 T* t( n
  36. #include <mach/memory.h>
    ( i6 R7 R! b) t; D9 _! r. O
  37. #include <mach/hardware.h>
    2 s' g7 N- y" g$ W
  38. #include <mach/irqs.h>
    ( B% W3 g, h+ a. v5 w
  39. #include <asm/hardware/edma.h>
    ! q1 H, @8 L. r8 k- d7 w) [
  40. 8 f1 u$ Y( k, \; H* N8 r2 O
  41. #undef EDMA3_DEBUG
    ' _3 |2 y, s1 y0 A6 N# l5 t0 D' ^
  42. /*#define EDMA3_DEBUG*/* u% x) u" \* `/ u( U
  43. * y6 F- L4 x  d& X
  44. #ifdef EDMA3_DEBUG
    0 K9 I/ p2 N! n' s3 |8 n5 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " y* E5 A. S9 A4 c# k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) W+ y+ D% n- T7 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! s3 v) c0 Y$ v$ z( a* r3 o. W, y9 n
  48. #else3 y3 L1 z- x* Z- K8 K! b
  49. #define DMA_PRINTK( x... )) N5 n3 P6 N$ @7 x6 F9 e: M
  50. #define DMA_FN_IN$ s: s/ N. c2 M! b$ [0 b4 j( Y5 ^
  51. #define DMA_FN_OUT/ n  E- f; W- {6 i7 @
  52. #endif
    7 Z4 B2 U: a1 S
  53. " E% h, I) i5 u! b+ T4 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ n3 B! [* H4 [9 C! I3 C
  55. #define STATIC_SHIFT                3
    4 }/ B  }. M4 e! q
  56. #define TCINTEN_SHIFT               202 G( m: _2 h" t: g$ P8 T
  57. #define ITCINTEN_SHIFT              21
    ; j: {/ D+ [$ V/ C3 R( X# N5 o
  58. #define TCCHEN_SHIFT                22* N0 t6 l9 C+ [/ b7 y/ Q1 c
  59. #define ITCCHEN_SHIFT               23
    6 A; j/ {+ b- A2 W4 u7 s. S) U1 H
  60. ) P! c" g+ W* M" y1 b5 i
  61. static volatile int irqraised1 = 0;
    ! ?. w' h5 ?; p8 o+ G
  62. static volatile int irqraised2 = 0;/ l6 k$ Q5 L0 x' a. l
  63. 1 g! {: ]* o/ e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u; o) A2 b* U$ ]& \* T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) w  I6 |( C2 @$ c1 U  L7 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' P. d, c, g6 j$ N# m$ Y

  67.   C9 h" p; y6 o/ t$ }( w
  68. dma_addr_t dmaphyssrc1 = 0;$ v( M0 Z0 n# {, }" f5 a6 E
  69. dma_addr_t dmaphyssrc2 = 0;
    0 P( Q% `7 y* Y' n, o8 E5 G
  70. dma_addr_t dmaphysdest1 = 0;! e. K, L1 z5 }6 f
  71. dma_addr_t dmaphysdest2 = 0;
    5 V3 o% G2 @8 c8 M# p

  72.   B1 `1 l1 b1 y3 Q$ E
  73. char *dmabufsrc1 = NULL;
    ( H- b6 t' ]% S6 d! U& l, |$ J
  74. char *dmabufsrc2 = NULL;) o7 R$ V8 b9 W9 h1 q
  75. char *dmabufdest1 = NULL;
    ! z' z$ V) N7 l9 G4 I. [6 o
  76. char *dmabufdest2 = NULL;8 F$ l2 v% w' S2 P
  77. ) O8 y6 a6 H* {
  78. static int acnt = 512;) k  n, b1 Z1 Q+ N' I5 z! x
  79. static int bcnt = 8;
    - U) M) F4 m* g  U9 \+ t
  80. static int ccnt = 8;
    3 F! s1 T8 a2 J5 F* A$ y5 b

  81. ' \) l/ A. n& A- J9 P, d) ?
  82. module_param(acnt, int, S_IRUGO);9 i- q2 s' h. n- I1 ]  J: `8 c
  83. module_param(bcnt, int, S_IRUGO);& q$ r+ _( _+ P/ }9 f& ^6 T, |: E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( n8 O. v/ ?, j  H

- d" H+ n2 _$ h- h5 O- a; i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ Q1 h3 ~0 y6 s/ R5 W/ ?' ~: Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" n1 n1 B7 i# v& }7 m/ I# [$ v: @$ {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 s3 V' r: U2 W; w# N9 h8 B
  v5 V6 z2 L- P3 n
% B3 x% [/ ?# }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 19:49 , Processed in 0.039623 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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