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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # d: o9 Q' T/ R7 s9 o
  1. [code]EDMA sample test application
    # Z+ ?0 Q" e  T9 S7 V) n
  2. /*0 p! o" J5 m5 y0 a# X
  3. * edma_test.c
    & j5 P; n9 _; n, P: E
  4. *3 x6 _' g! u& Q
  5. * brief  EDMA3 Test Application
    ; I1 }- }6 v, O+ V
  6. *. a, }* z' R9 C5 q8 W9 X3 u# [
  7. *   This file contains EDMA3 Test code./ R# n+ _: W6 X, V) r
  8. *
    % Y. Q9 h1 k- n: _$ O. N8 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* V! d' ?0 Y) l% d" V8 ?: N' F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( j7 X: X/ s2 R1 g4 w
  11. *         TO CHANGE.# \  y* M7 c* H! Z- _8 r# D
  12. *
    : G$ D' R! V+ |+ F9 C, }4 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # B% B+ N3 M9 i  d
  14. *0 E9 A: V! |; Q" [5 Y1 X- [4 B3 s
  15. * This program is free software; you can redistribute it and/or5 Y3 @$ i& I' _; k, t
  16. * modify it under the terms of the GNU General Public License as
    ) K8 m5 X5 g4 ]7 G* c
  17. * published by the Free Software Foundation version 2.
    3 Z* o$ @; ~' A/ l
  18. *
    1 d' V& x8 n( Z7 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 A( y) g6 G$ P
  20. * kind, whether express or implied; without even the implied warranty
    5 k6 _: @/ \. ]/ {+ Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 C$ M2 z$ M( C# K( f
  22. * GNU General Public License for more details.
    , j* ]( N% E( ^8 f, z/ P
  23. */+ o5 E* k7 {* p( k  _/ J. d
  24. 6 c* ~* x8 t1 r3 G
  25. #include <linux/module.h>5 R, g6 o6 V- ?6 Z7 P$ G/ x
  26. #include <linux/init.h>
      f8 G8 h9 t% l- n0 P
  27. #include <linux/errno.h>7 i: W8 k6 R* o6 L0 f; Z0 ~* D
  28. #include <linux/types.h>
    - i5 Y& L  W' L, e+ @
  29. #include <linux/interrupt.h>9 x, K* L7 C" [& t  ?8 L- M! X
  30. #include <asm/io.h>
    # v/ o- z( v$ z# r
  31. #include <linux/moduleparam.h>* v8 z2 d1 Y" d& Q
  32. #include <linux/sysctl.h># L& l& Q. K; U, _& P! p
  33. #include <linux/mm.h>- L: m) u% g5 L; x: L8 t( }
  34. #include <linux/dma-mapping.h>
    " I1 c* R" E8 q' r' ]

  35. # J9 s! q: K2 a' ~
  36. #include <mach/memory.h>
    , e1 H' g: h% V- F' R5 a
  37. #include <mach/hardware.h>1 N+ T0 ^* h; w* U+ g5 D
  38. #include <mach/irqs.h>9 x% z  ]" W' j9 J; |7 S! w1 Y
  39. #include <asm/hardware/edma.h>
    7 w* M! I+ N% R" n7 Q7 c% ~* S
  40. ) A( [9 b% E1 l+ s9 G
  41. #undef EDMA3_DEBUG
    - f4 F$ V* A4 ]' j# i# V
  42. /*#define EDMA3_DEBUG*/
    ; N& q, K8 Y  P) H8 l

  43. / F7 N" f( r- m
  44. #ifdef EDMA3_DEBUG
    ; \' C8 V3 |$ q+ I6 ]$ t# i1 ^# |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- J) n; k% g1 @5 F+ p1 ~& S) D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ T0 c" r5 V  K4 b; Q$ B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & J7 W- M! |. D/ p: h7 j
  48. #else# b' B4 w3 q1 J9 I- C
  49. #define DMA_PRINTK( x... )
    ( z2 O1 y1 b3 n  c
  50. #define DMA_FN_IN) v- V( m2 j# z2 k5 Q% \7 R8 I* z" i
  51. #define DMA_FN_OUT
    : V0 b0 s* r9 w. K
  52. #endif
    8 r, M- W+ F3 n9 p
  53. 2 i+ E  r# t7 c% q7 s, K) z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* L: i6 p/ ~" V  I% ]: \5 `+ z/ E
  55. #define STATIC_SHIFT                3
    7 q; j1 y7 L) ]' w2 Q
  56. #define TCINTEN_SHIFT               20. u) E' ~; }" J
  57. #define ITCINTEN_SHIFT              215 Q! Z& F: s/ W* V% l; ~+ o
  58. #define TCCHEN_SHIFT                225 s4 [( [" h/ m2 f" w4 s
  59. #define ITCCHEN_SHIFT               23  O# |: t! F& N# U

  60. , e5 C, ^- e* g7 d
  61. static volatile int irqraised1 = 0;1 J1 l7 s; |4 C' b' Q
  62. static volatile int irqraised2 = 0;
    : Y3 d; M& \% h/ e

  63. 3 F# T8 x) `' w/ p6 q8 `* q+ ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) k* T0 P- C" T4 v) Z2 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 B9 L- r1 m- T; I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ D2 F4 L' _! z1 Q9 E& o

  67. " M+ k  {5 k" T6 e
  68. dma_addr_t dmaphyssrc1 = 0;
    & }/ ]3 N7 ^3 ^* a$ t6 j6 \
  69. dma_addr_t dmaphyssrc2 = 0;
    . u  _+ I: J+ [
  70. dma_addr_t dmaphysdest1 = 0;
    3 [- s5 {4 Z% |- @& O3 G. ?5 H5 Y
  71. dma_addr_t dmaphysdest2 = 0;
    + z! j; H" E9 O7 [, X4 T0 u4 Z8 j

  72. 2 [8 D; m" L0 J# V
  73. char *dmabufsrc1 = NULL;! g  Z2 Z. g0 P7 a" p
  74. char *dmabufsrc2 = NULL;, J4 x: c9 D% R' R+ s3 p% f
  75. char *dmabufdest1 = NULL;
    $ X* r! T9 |$ y5 N+ |3 ~$ c
  76. char *dmabufdest2 = NULL;
      w: D, Y. |: Z7 D- \/ e7 g
  77. 5 w8 }0 N& t5 y  ]. t2 j3 h
  78. static int acnt = 512;
    % ~  e. J" u. a/ n+ b% ^
  79. static int bcnt = 8;
    ; t* L7 ]6 z0 x( U( P) r" i
  80. static int ccnt = 8;3 B8 B! l) y# V7 U& ]5 x! r
  81. 4 u. M  t, }6 E1 P, f* F( S6 m9 ^- Z
  82. module_param(acnt, int, S_IRUGO);
    ' q. B# o9 {+ P# E1 H
  83. module_param(bcnt, int, S_IRUGO);8 k  |; Z8 B# q& u0 |* p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; q; R0 R/ c8 Z2 k( |8 Q; c# ]% d5 O8 m

1 t+ w/ a( n; w- [  \. y; v4 J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 [* P1 q. `9 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 @" m0 j" Y3 \0 I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 z- x5 W  m3 p0 {  g
3 p1 A2 @6 {6 b, Z8 N' k
; [4 i( o" s) \) G7 k/ ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 04:42 , Processed in 0.039091 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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