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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 P8 a: G9 _, f
  1. [code]EDMA sample test application
    : d+ n2 W# C2 V
  2. /*
    1 ^& {  L/ A5 y3 _5 R
  3. * edma_test.c
    . C8 J+ b% e( B4 C* u
  4. *3 ]/ d6 i; y0 x* q4 d, \
  5. * brief  EDMA3 Test Application
    1 g9 t5 H, i3 p1 t& K+ m
  6. *
    8 G* U4 J) f7 \$ K
  7. *   This file contains EDMA3 Test code.
      Q' O# R$ R1 P" f: m* R+ @9 z/ d
  8. *
    ! N# Y- \' G4 i: t! Y/ @7 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; n6 N- H6 M3 V# H; @4 u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: v' p' q& h* f2 p
  11. *         TO CHANGE.6 I- R  b8 c/ g& B8 F( y
  12. *' ?# R# c" Y1 q9 {! }  U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  l( q; u0 H( U- d0 O! s
  14. *
    0 o$ }4 @2 g0 a# R2 d3 H
  15. * This program is free software; you can redistribute it and/or
    ) n- \# @1 C9 T. [+ F
  16. * modify it under the terms of the GNU General Public License as
    # f0 d* _. Y3 W3 i9 ~
  17. * published by the Free Software Foundation version 2.
    : k3 Q" n/ c7 ?6 y+ q
  18. *7 p* C( l3 l& T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 f- H# t4 {! s, O+ ?
  20. * kind, whether express or implied; without even the implied warranty, E7 W8 u- N2 p5 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ J- I- n# V6 t4 f8 x2 n
  22. * GNU General Public License for more details.% J% o7 I; n& [: a! c5 A! b
  23. */* R9 L  A8 W2 ?* {% X' P

  24. $ f( [: B- @$ R1 f: a4 Y
  25. #include <linux/module.h>
    $ d0 s3 t* b; |7 A
  26. #include <linux/init.h>5 b2 |9 K4 ?/ b" A# y! X
  27. #include <linux/errno.h>8 {# k# Y) O1 Q2 \2 y: L& r4 c
  28. #include <linux/types.h>9 D; f; T+ [; _3 L, b  e& Z
  29. #include <linux/interrupt.h>
    5 _$ I4 B" D, B$ `9 `5 W- K
  30. #include <asm/io.h>
    ! ]! G$ w% L4 Q* O* D0 x5 b( @  O
  31. #include <linux/moduleparam.h>
    1 O7 `  Z# {( X% `# ?
  32. #include <linux/sysctl.h>6 ?" g+ U, V# c+ e8 m
  33. #include <linux/mm.h>
    / _3 K, N! h) p1 B9 e; h$ `# a# I% G- \
  34. #include <linux/dma-mapping.h>+ K6 G9 l; N# B! K; |
  35. " q& q- l# O, m, f
  36. #include <mach/memory.h>& F  n1 `+ T" \. Z9 p( w. o$ l
  37. #include <mach/hardware.h>
      [* c5 o$ m! v7 E& Y
  38. #include <mach/irqs.h>
    3 ^" `+ I: {/ `& w
  39. #include <asm/hardware/edma.h>0 ~: a- ~, n' V+ k" f

  40. , H; T0 v; Y8 u7 j2 Z6 ]
  41. #undef EDMA3_DEBUG
    1 X3 W7 L/ V; z
  42. /*#define EDMA3_DEBUG*/
    ( v( t, u. M: I$ k
  43. 4 L7 _' @% ]: r- A) j$ K
  44. #ifdef EDMA3_DEBUG
    ; f: x/ |/ w# i) N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 v: P5 I  |, |- w1 q3 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / ^) t5 a$ b; Y: A. r+ O9 T2 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% O9 B7 m! m% f, N" e
  48. #else, v' o+ a% u8 y( y* Y0 B8 d. ]" B
  49. #define DMA_PRINTK( x... ), \# m( x+ p' b8 n
  50. #define DMA_FN_IN# a9 R& ?+ Y& C% x5 Q3 V8 }
  51. #define DMA_FN_OUT
    ) h5 @' j4 U4 k# M+ D
  52. #endif
    + O- m' q5 A5 O) K" l5 O4 S" G

  53.   ]1 c7 s" e: l) o# p9 j7 Y" X5 D3 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 T5 i& l- z* Y8 [
  55. #define STATIC_SHIFT                3
    0 l4 ]4 M; H- f2 H. J! e
  56. #define TCINTEN_SHIFT               20
    # r; A& s) ^- n5 b( C8 w7 ^1 F9 S
  57. #define ITCINTEN_SHIFT              21
    6 w- `& Q8 x; S* S! a' [
  58. #define TCCHEN_SHIFT                22
    % q2 i0 Q* S! {8 o* Y7 O: H
  59. #define ITCCHEN_SHIFT               23
    - z. c5 e( M% U7 w' ?

  60. / P* B3 g. y# f9 C
  61. static volatile int irqraised1 = 0;
    8 ~8 Y" o; N2 `0 e1 ~( V7 T
  62. static volatile int irqraised2 = 0;! L- j  V# K6 b

  63. . Q# ?7 d2 r1 X" n4 N* M, T% q" ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ `. @* A, A8 l  h& A4 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( ^% X2 i; J( M  i# h; ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 T- |/ B; m( s0 {4 _. [) d

  67. ! g% u0 Q* C: R" |# ]0 G5 u' f
  68. dma_addr_t dmaphyssrc1 = 0;) m+ ^* Y2 f# E' F' P2 c8 f& Z( G
  69. dma_addr_t dmaphyssrc2 = 0;
    : l- t6 u$ J4 f
  70. dma_addr_t dmaphysdest1 = 0;9 G3 U2 p- j3 T, e* H/ J; b
  71. dma_addr_t dmaphysdest2 = 0;& X; d+ e0 b# }+ j: o! l6 O
  72. / M  h: U9 ?% s6 g
  73. char *dmabufsrc1 = NULL;
    0 j0 Z+ f$ ?! X, ^
  74. char *dmabufsrc2 = NULL;
    2 |- n0 [# Z) f% }. ?+ G8 V+ K! y
  75. char *dmabufdest1 = NULL;
    ( Z/ N" b' X" {& c9 a$ U: V
  76. char *dmabufdest2 = NULL;& Y9 O) `  g  C- f" \' p8 ]

  77. , Q& P$ ]5 w( U; Y( D& M
  78. static int acnt = 512;
    ! V( C; f# n' Y- r! R9 |/ c
  79. static int bcnt = 8;* s& @* x2 g+ r& f, r
  80. static int ccnt = 8;
    0 Z! |% Y: q) F2 X. Q8 R; X
  81. " \! r% F1 ?  g4 t: @5 u0 ^
  82. module_param(acnt, int, S_IRUGO);
    ; |2 f4 @9 k7 L6 ?: D$ G
  83. module_param(bcnt, int, S_IRUGO);( l8 m( C* [% Q0 t5 T0 B& n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) s" W4 Z0 n( h  X$ ?
. y: X( D  O+ Y- t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% n1 v- X( m7 Y7 L$ Z. X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ I" `- ?8 P2 y8 h4 y" O# V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  U0 q6 V  z+ a9 ~0 q, U  _! |
' N5 B7 p5 S& V

. U* g% }4 g6 q6 U3 O3 R  e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 00:17 , Processed in 0.044940 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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