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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; G; J( E' l1 W+ |* x4 Y/ q$ Y
  1. [code]EDMA sample test application+ i, j* u4 Z2 Z$ V9 V
  2. /*
      y" z# a  F# V0 Z) V
  3. * edma_test.c
    2 C/ J* g/ Q; ], |3 {8 r  p8 a
  4. *, N3 h+ r) d( u. i3 _* b% n
  5. * brief  EDMA3 Test Application
    # ^$ _" r  I- @& ^
  6. *
    2 Z1 d3 Q. P# ^! c2 K- f
  7. *   This file contains EDMA3 Test code.
    9 v- M% }+ v4 J
  8. *
    5 b8 Z( l+ S1 F0 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + s) G* Y/ L% `4 ~, b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 G6 d: n6 Q! H2 {
  11. *         TO CHANGE.
    2 U5 a3 H+ w  O
  12. *+ ~0 i. m  S1 k- F' ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' M* G9 V  h6 _. S
  14. */ y# g1 y  h  R& p  |, Q
  15. * This program is free software; you can redistribute it and/or
    6 z; q! x% H- U
  16. * modify it under the terms of the GNU General Public License as* o3 S9 b* R: Z$ u% p7 o
  17. * published by the Free Software Foundation version 2./ G1 {3 |; z. x3 }5 X
  18. *& V$ b) h- X4 N0 @- A1 D1 f4 u( \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 u( u5 ?: D# U2 l
  20. * kind, whether express or implied; without even the implied warranty
    6 s: K/ j& n! L$ k9 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % J  @5 I, C. q
  22. * GNU General Public License for more details.
    $ I, F5 V4 q! F3 s6 V
  23. */7 s# ^' H) E' V: o" p6 D) l1 b, @' S6 Q
  24. + y$ D( f/ v* X
  25. #include <linux/module.h>; r2 U- {( ^2 g$ I& y( `+ l0 ^
  26. #include <linux/init.h>3 s  }" l' B5 \+ q8 a; E4 `
  27. #include <linux/errno.h>" o0 |6 @1 U' r' f
  28. #include <linux/types.h>
    ' ]3 T! x8 `1 E
  29. #include <linux/interrupt.h>" p8 C8 |4 F9 Y
  30. #include <asm/io.h>
    - i1 A0 x; ~( E: D0 v$ T1 L
  31. #include <linux/moduleparam.h>
    , t  V; _5 J- B+ Q  P9 b
  32. #include <linux/sysctl.h>$ @; N4 l8 h% h. G% T6 I6 q% j! i9 _
  33. #include <linux/mm.h>
    7 ?/ e; C+ b' N" S2 @, ~3 r
  34. #include <linux/dma-mapping.h>
    4 D- a! N+ ?5 e( ]% f4 [
  35. ' J3 [- I1 Q+ c/ A
  36. #include <mach/memory.h>" [3 \& }- o! P. A. q. ]
  37. #include <mach/hardware.h>( e9 _' `5 V% A) E3 E$ b
  38. #include <mach/irqs.h>$ L* M  M2 k$ x" _1 Q
  39. #include <asm/hardware/edma.h>6 ?* D$ n- H& W. P+ `

  40. : M( R! V9 h9 }0 ^4 K- D; S0 ~
  41. #undef EDMA3_DEBUG4 W3 c# K" @# n
  42. /*#define EDMA3_DEBUG*/' ~& A% C8 ?! a
  43. / L# b2 z" Z- r7 Q* a/ ?
  44. #ifdef EDMA3_DEBUG
    4 s5 X# _9 ^$ u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% c% W  R4 p: k% d, t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / V& p' \3 E+ N9 g- q$ o: G9 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# j* g3 e8 R& J7 z
  48. #else
    & g" H; W+ G$ q9 |1 N0 q
  49. #define DMA_PRINTK( x... )
    % R1 x' [9 i& k8 i9 U/ F+ P
  50. #define DMA_FN_IN
    - F+ i, h) R  z5 j  b
  51. #define DMA_FN_OUT
    / G4 X* _' z/ p, B6 ^
  52. #endif+ V8 l. O' ]" b8 W# H

  53. * F! p# K! E$ P, A7 d& c# m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * m6 Z- K& x# m. u" X& e
  55. #define STATIC_SHIFT                3
    3 V) T! T, Q9 z
  56. #define TCINTEN_SHIFT               20' k  @4 m$ l+ r1 @3 l
  57. #define ITCINTEN_SHIFT              216 f- M" [& L2 X
  58. #define TCCHEN_SHIFT                22
    7 v% [/ w! M( m- d
  59. #define ITCCHEN_SHIFT               23$ p0 }$ B0 R5 {7 S4 D3 X
  60. 2 i! @5 T: d! m3 [# f3 d2 B( C
  61. static volatile int irqraised1 = 0;
    , ]5 E1 b8 B& D3 E! d( q, k
  62. static volatile int irqraised2 = 0;0 u0 ?4 O5 l1 R

  63. $ d( N9 A; R1 ~% t8 I; _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 m, Y8 E- V  [- U- r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & p2 I4 |) z* z. I3 F6 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Q7 E* Z3 Q% U$ d8 j0 x8 W
  67. * ^0 D6 Q$ |9 Q& [4 M! N
  68. dma_addr_t dmaphyssrc1 = 0;: p4 v9 t9 B$ P- o
  69. dma_addr_t dmaphyssrc2 = 0;
    . q* `7 q( C: H) p! B
  70. dma_addr_t dmaphysdest1 = 0;
    ( T" l4 A5 Q$ M  P' t) J
  71. dma_addr_t dmaphysdest2 = 0;9 j: ~# b1 j0 M" D2 f# w

  72. - {9 G) c3 z5 d: Y# }" \
  73. char *dmabufsrc1 = NULL;
    $ A& U  d: g8 W) g& F: Q
  74. char *dmabufsrc2 = NULL;8 I" X7 c4 ^  Z) [3 ?5 A
  75. char *dmabufdest1 = NULL;
    ! M* G& r3 L' ?8 U/ c4 ^9 ~
  76. char *dmabufdest2 = NULL;
    0 Y# B. C2 l% c6 c; t3 S
  77. . c2 \4 \9 e& w! [
  78. static int acnt = 512;3 [6 P' q- u7 V- k3 e5 {' v
  79. static int bcnt = 8;* ~3 U, D4 o+ w7 A7 k# Y. e8 T: F
  80. static int ccnt = 8;
    8 _$ ]5 p$ a! N/ W. S

  81. ; i, h5 o, \0 p: T+ \& v7 S
  82. module_param(acnt, int, S_IRUGO);: C8 E+ I* {# ^, n$ c( j
  83. module_param(bcnt, int, S_IRUGO);
    % g# O7 s! S; U5 O. Z& }+ i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% v# E- i# O! W+ |4 L
( j7 K, t! e) N4 x* I* B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# @" H8 s6 w! j4 X) J" Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" _/ E! y6 j: C4 j$ N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 Y) _$ ^3 ?5 Z% b% q" t& l+ @% j, N  p1 ^

$ ]8 h- V9 \8 Z/ P# L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 09:59 , Processed in 0.040006 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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