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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. n/ i8 n6 ?! d
  1. [code]EDMA sample test application5 ]. F) Q2 ^+ H- {
  2. /*
    % f' @( O. V# u) v) p
  3. * edma_test.c* \: S) C# N+ b5 s0 q( y" v( Y
  4. *$ X; j  x/ ~6 M
  5. * brief  EDMA3 Test Application- Y& r/ O- w) `
  6. *# H' O( Y0 L8 z! g
  7. *   This file contains EDMA3 Test code.
    ) m& `4 U0 o  r  r9 ?0 @; ]5 q
  8. *; k4 r% n% P0 W( a. q) l3 W  }! C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' ]2 e2 ~0 A: o6 O4 Q. [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + }8 }* E9 y0 U" M3 ]+ b
  11. *         TO CHANGE.
    + P& c5 U* G4 ?5 c
  12. *, z" {2 \5 K4 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 T; Y2 V+ `# Y, J4 `! s
  14. *- q+ z6 P/ l& m
  15. * This program is free software; you can redistribute it and/or. N. Q  t% d4 T" S2 G7 V' ]
  16. * modify it under the terms of the GNU General Public License as
    7 W/ X5 D; I  w
  17. * published by the Free Software Foundation version 2.
    / W% [8 {2 E0 C. I2 Q0 G
  18. *. ?+ @9 z6 i) u! O" v" ~4 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 A' a' K1 x: f" ~. Y
  20. * kind, whether express or implied; without even the implied warranty( N. r' x3 t# h# V% u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  a% C) r# l# @5 F2 f+ w& g
  22. * GNU General Public License for more details.5 A$ X" t7 h: o
  23. */+ R( c" ~  k- i& _
  24. , X5 L  X  [# V
  25. #include <linux/module.h>$ R9 D6 B- g% ~
  26. #include <linux/init.h>. r( ?) r( t. M! B
  27. #include <linux/errno.h>
    & ^+ J* c2 p0 V! P5 p1 H
  28. #include <linux/types.h>
    & V- y) Y( t8 m3 a( E" e5 Z
  29. #include <linux/interrupt.h>0 g9 B: H6 }2 g9 A: V8 u' t+ X) X
  30. #include <asm/io.h>1 m0 U# \5 W1 K5 `2 J
  31. #include <linux/moduleparam.h>
    " M. n! n( L& B7 y* k
  32. #include <linux/sysctl.h>
    & S2 Y  o" O" [. q5 a2 C/ u5 R
  33. #include <linux/mm.h>
    : p5 f" i7 C! m
  34. #include <linux/dma-mapping.h>7 z3 X  e- C$ E/ K& F9 u$ M

  35. % n6 Q7 c- Q$ F2 B8 K/ i, A
  36. #include <mach/memory.h>
    & z- _  t* |. T0 u) H' R- {
  37. #include <mach/hardware.h>
    0 x( V# \+ e0 x. Y3 r- R1 h
  38. #include <mach/irqs.h>0 _/ i3 U1 T, B3 ?0 A1 O/ t6 h% {
  39. #include <asm/hardware/edma.h>1 r$ L* A$ R3 r, {7 [: \& B

  40. ' G  i9 e0 w+ C! q- y
  41. #undef EDMA3_DEBUG7 {9 c& a2 `5 Q2 _- X% x- S& X
  42. /*#define EDMA3_DEBUG*/* j# h  [8 ]% d9 s

  43. " K& Q  [! t7 p& F; z2 F
  44. #ifdef EDMA3_DEBUG
    ) ~- {% G: I& A4 X; Y1 {- M5 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& j0 A2 H# }- B% |3 {% l5 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * z  m# `8 |' n' z0 r0 I. Z# M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 Q/ P& W5 G% l; G; m7 c; W; q8 m
  48. #else
    2 `' ~7 {+ q& A  d
  49. #define DMA_PRINTK( x... )
    # i) \6 _, s! a, q
  50. #define DMA_FN_IN
    / H0 f8 P& q, @+ d2 |& o, K. B
  51. #define DMA_FN_OUT
    6 L" N/ [' I7 r% H
  52. #endif
    ( m$ Z/ [$ z) u) H0 `2 k+ j  i" v
  53. 3 w) n9 Y" u& u4 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; ?' p& A( x" B' }  z, s1 q& ^9 \
  55. #define STATIC_SHIFT                3
    + A* u4 k5 B3 _0 i/ u. }
  56. #define TCINTEN_SHIFT               20
    # z* Y# G3 D( n4 a4 M
  57. #define ITCINTEN_SHIFT              21( j! J, k( g4 X* y: h+ r
  58. #define TCCHEN_SHIFT                22+ j6 W, [- K" F% b9 n* v
  59. #define ITCCHEN_SHIFT               23; s  N7 ]( \1 Q0 ~! Q6 L
  60. " A; f7 N! `+ \7 B4 \0 h3 Q
  61. static volatile int irqraised1 = 0;+ N# l$ X2 D$ s) c* w. l  L
  62. static volatile int irqraised2 = 0;5 Q! n$ M# g' t

  63. 4 W' t; k5 B5 a: ^# D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % G( x8 W% a( F. s! I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . g9 C( z$ d5 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 r9 J( _6 D9 V9 B' \, e

  67. , l. U" M) }8 ~# B' h5 k2 s
  68. dma_addr_t dmaphyssrc1 = 0;/ z  {% L9 h- @
  69. dma_addr_t dmaphyssrc2 = 0;
    , `4 t$ u% l2 U
  70. dma_addr_t dmaphysdest1 = 0;0 b7 ]6 H  Q% T
  71. dma_addr_t dmaphysdest2 = 0;0 |  C  l( o" k4 [6 ~+ ^
  72. 2 E2 A! [( C# c) U- R
  73. char *dmabufsrc1 = NULL;; `0 q" x1 Z5 j( q4 {3 B' S
  74. char *dmabufsrc2 = NULL;
    . p0 d9 |3 o3 w6 z1 @
  75. char *dmabufdest1 = NULL;( p/ [4 c+ M( o
  76. char *dmabufdest2 = NULL;0 Y+ p  k9 Q; |+ v: p8 K( c
  77. ' ?5 e. ~$ u% ?) J8 J: b( h% l
  78. static int acnt = 512;
    ) Y* \: ~5 [( e* G+ D
  79. static int bcnt = 8;) o$ k, i& x  B+ \
  80. static int ccnt = 8;
    4 R2 `) s. L' A( [. q! x

  81. # s& m6 X  D$ M; l6 T. V& Q* I
  82. module_param(acnt, int, S_IRUGO);
    ( Z" p5 T6 D  M
  83. module_param(bcnt, int, S_IRUGO);7 D; T5 E* X: G) w* H; l4 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 @* x) D% V4 S% W7 `; b  |6 a

. ^* x4 u6 B. R5 t2 M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* W2 Y3 U9 e7 K$ Y4 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 \/ @) I. h$ g" T, S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: o% T. L: N5 b( A

; w+ _9 b, v' E3 f! u& T% w; R$ B$ \: }: i, Z7 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 19:41 , Processed in 0.040892 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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