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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# Y0 J+ }" x( \9 @' ~8 h; q( r
  1. [code]EDMA sample test application# C4 @/ a, J) M
  2. /*
    * T* k4 H8 t* [: W! K. L) ]
  3. * edma_test.c
    " o; f+ p! [' A4 d  ?
  4. *+ L) u, F3 J) B5 y2 e
  5. * brief  EDMA3 Test Application' U! N1 q2 {$ f3 k$ C/ H3 u: i
  6. *
    & F; q5 p7 R- K+ t7 ]: X8 J
  7. *   This file contains EDMA3 Test code.
    6 M2 X7 |1 A/ _# t3 _
  8. *. Y9 j! f" [+ U: i2 e, g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  @3 \2 r! P- c8 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # [' l; g) V, {0 M$ N$ n2 h4 u
  11. *         TO CHANGE.3 r1 C: y. U& `7 P! W- {; ?8 G6 p3 }
  12. *7 t3 h) S) I7 [: G% f* z/ T6 w" A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, Q' N0 V' j+ z" a7 o
  14. *
    , H$ I# Y* u( L5 F. Z7 w
  15. * This program is free software; you can redistribute it and/or
    : L+ Y8 t- E; K0 A4 w" |5 ~
  16. * modify it under the terms of the GNU General Public License as
    - T# {+ _5 T4 W+ N3 b% l
  17. * published by the Free Software Foundation version 2.
    . o2 ~: B, Z( n8 h5 l/ g
  18. *5 I, Q$ }# T6 Q( ~. Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " P! l: R1 Y2 b% B0 O( T1 N
  20. * kind, whether express or implied; without even the implied warranty; t# @/ \" ^7 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ N2 z* q4 j( a; c9 W7 F/ |- e
  22. * GNU General Public License for more details.
      r; R9 I& s4 H  t
  23. */1 z- c6 ^2 u1 L+ {( c$ H% {

  24. ) f; w, o" P7 f$ I
  25. #include <linux/module.h>
    & h- N2 ^# w' d8 @1 |
  26. #include <linux/init.h>5 ?2 ?) W; o% H, c
  27. #include <linux/errno.h>
    : A) c# H& \+ G( d
  28. #include <linux/types.h>' Y: E4 o' Y( M; o: g; j0 y
  29. #include <linux/interrupt.h>
    ! a2 S" x9 N  t! Y# q
  30. #include <asm/io.h>* E0 N% C( U/ ?' }* H; m/ U; s) S2 ^
  31. #include <linux/moduleparam.h>
    2 d6 ?# D$ c$ n) V
  32. #include <linux/sysctl.h>6 Z( A: N& g  [9 V8 }9 m; w
  33. #include <linux/mm.h>2 B3 n  t: l2 p5 U/ Q4 P- P
  34. #include <linux/dma-mapping.h>
    4 G0 F" H3 P7 o; G7 y8 \- s
  35. # k' Q5 |- J) f- L' V6 P% O
  36. #include <mach/memory.h>5 g% P9 F2 w9 t) O1 ?9 i
  37. #include <mach/hardware.h>
    2 q( j% t, q7 x/ f1 \) u6 e2 ^9 e
  38. #include <mach/irqs.h>
    6 J+ f# o& D# W; M6 P
  39. #include <asm/hardware/edma.h>: o& m) G" ?0 W+ q& L2 ^2 l! W
  40. ; z" Y9 ?( B: \( E# T
  41. #undef EDMA3_DEBUG
    & O. S: @. a2 h0 W
  42. /*#define EDMA3_DEBUG*/1 o- e& e4 _3 H& |; W7 ?2 ~

  43. - v$ i# M! x' u! }. M' h
  44. #ifdef EDMA3_DEBUG, x9 J3 T9 k% O# y% I2 f8 }* U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 f5 Y' I" ~$ W/ Q' O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 S' A5 r* C# Q0 U% \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 }- a8 V( I- J. q! u# O4 E1 J( a
  48. #else6 J( @1 R/ L- r5 \/ Y# ]* T+ r5 n
  49. #define DMA_PRINTK( x... )
    $ T! C. e6 E4 n
  50. #define DMA_FN_IN
    3 i9 \' {9 q  G2 j  x) w6 B7 x
  51. #define DMA_FN_OUT/ V9 E+ N/ S+ K1 I/ r
  52. #endif
    / n9 G# [- ~) a) Z% k0 h! k

  53. 1 q) e- c0 m  R( V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 p. {) {/ I) v! W# T
  55. #define STATIC_SHIFT                3# ~5 V8 B% }) e1 }; e3 N
  56. #define TCINTEN_SHIFT               20" d. |" d0 s" {$ T) c# x
  57. #define ITCINTEN_SHIFT              215 Z8 Y$ @1 E$ C
  58. #define TCCHEN_SHIFT                223 U' A7 b! l& A0 F( p3 _" F# o. d: L
  59. #define ITCCHEN_SHIFT               23
    " z' c; R# C/ Z+ g0 ?" T9 i# S

  60. * D* u" p  z. e  }" i4 R9 V! b
  61. static volatile int irqraised1 = 0;
      @% y" K7 [! @
  62. static volatile int irqraised2 = 0;
    " V4 ^' G3 o# f( F0 Q

  63. 1 _5 k/ ]/ W( }2 i# t. L3 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" J6 @9 B1 n+ G- }" V6 Y7 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # b9 H8 V& l7 }5 H' V2 ~) h' u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 B( x  }  t( i0 M! [

  67. 3 Z* I( ~& Z3 L
  68. dma_addr_t dmaphyssrc1 = 0;3 U( N4 X) W- V. ]4 }
  69. dma_addr_t dmaphyssrc2 = 0;! E1 w9 n9 v' ^
  70. dma_addr_t dmaphysdest1 = 0;: V; m, ^  i, v: S' q+ i8 ]% D" @
  71. dma_addr_t dmaphysdest2 = 0;) q' `& ?1 a" [7 C
  72. 6 k7 W; E; l+ l; `8 {
  73. char *dmabufsrc1 = NULL;  m) ~8 b; ^. Z8 |" e
  74. char *dmabufsrc2 = NULL;
    . S6 L! L- j; s- n; B2 ~7 _6 S
  75. char *dmabufdest1 = NULL;
    0 g8 t, t+ i; s: \/ `( s  p( }2 u
  76. char *dmabufdest2 = NULL;3 X; |; `& u5 B6 Q
  77. 3 ~, f& B0 L) W& c9 C6 Y) W
  78. static int acnt = 512;
    0 C6 {) d* B. v* {2 ^
  79. static int bcnt = 8;6 r+ W/ h: X2 t3 y- N
  80. static int ccnt = 8;$ T+ \! I1 k! Y8 J, z: T0 V
  81. 9 J3 f$ t; `* r; [  K
  82. module_param(acnt, int, S_IRUGO);/ H- h( J; v& i
  83. module_param(bcnt, int, S_IRUGO);7 ]9 J  V) ]4 J$ v; \2 A5 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 E, S. h1 i8 l' C

" i: w; [. @- J2 L7 P# e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 C/ W, C* a7 I" j# {) W4 ]% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; R. M/ j+ G2 s1 M2 n+ ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 G& u- `* a, Z( F  X0 L1 Z

( \6 p: n. y& J7 \$ ~
; ~- M/ N. r2 E8 L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-14 18:24 , Processed in 0.043902 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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