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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 x/ y7 V8 I: ]( y. [6 z8 a0 B2 C
  1. [code]EDMA sample test application; b5 {2 z% i4 {+ m
  2. /*# b2 a+ C$ f$ t; X9 E: @
  3. * edma_test.c
    - u, ?% i% R' C! v/ U( X, S( P
  4. *
    2 S7 Q, a2 D; U3 u; }
  5. * brief  EDMA3 Test Application+ d: m7 s$ ^% O) x/ X
  6. *2 h7 \2 p! `) @$ x, q3 Q! V; z$ Z
  7. *   This file contains EDMA3 Test code.7 P0 w$ L6 x, J- o8 Z/ v8 L
  8. *
    5 `% u5 w% g8 I" q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& I* m; h+ X5 H! B! o2 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! g& i/ \! f4 G. k# [3 y% x4 g" {% W
  11. *         TO CHANGE.: I/ J6 N: Z. e1 H1 c+ k+ P( d
  12. *. H5 E0 f4 u4 Y9 T! ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 w- }; G6 W6 U8 r
  14. *
    - D( a# R8 N. @3 @0 Z* N4 ~
  15. * This program is free software; you can redistribute it and/or
    - k) Z9 h' V$ I8 d2 F  ?  {
  16. * modify it under the terms of the GNU General Public License as( K. ?/ E2 ?+ c6 p0 a
  17. * published by the Free Software Foundation version 2.
    " M; ^) k2 C, x5 v' ~3 h
  18. *
      I" S" w/ F- o4 B2 h1 ]6 C; B2 T, m8 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 G' e; h* w. H9 ~
  20. * kind, whether express or implied; without even the implied warranty9 P6 n+ O6 c% |+ S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 p1 Q& |, I; h; z
  22. * GNU General Public License for more details.: _, Z5 i; K+ O4 c
  23. */- p/ V; B5 z" f$ U$ w3 H' V
  24.   G' n2 @$ p  N# Z$ F2 ]
  25. #include <linux/module.h>
    " P/ |/ I( D9 l9 t* o# J+ e
  26. #include <linux/init.h>, ^; D0 S: f+ b# G: ~
  27. #include <linux/errno.h>
    % K. ]  p& g. j3 b3 n+ q
  28. #include <linux/types.h># {7 Q7 P, S4 }( l; |0 |! L1 g
  29. #include <linux/interrupt.h>* ^' ?( T" c7 @
  30. #include <asm/io.h>
    5 J% y& x2 M9 |" S, z( i1 x
  31. #include <linux/moduleparam.h>) c% t' \! Z$ s5 `. Y9 b
  32. #include <linux/sysctl.h>
    $ }9 Q) }. M8 s- z, E7 K
  33. #include <linux/mm.h>& ^2 k$ @5 G' ^( n( i6 o! Z
  34. #include <linux/dma-mapping.h>0 w: @0 V- P7 T+ |: M

  35.   O& Q2 Y- T8 \! q
  36. #include <mach/memory.h>8 Z- a# m# a2 Y2 \; d4 B
  37. #include <mach/hardware.h>
    ; @2 W, S. d) U  R
  38. #include <mach/irqs.h>& E' [" C. G( x& ]* U2 r
  39. #include <asm/hardware/edma.h>: q0 M8 k' E+ ^  c; ?6 w+ v2 U* V
  40. - x8 C9 P+ T( a3 ~& P5 t
  41. #undef EDMA3_DEBUG" f4 y2 d$ y/ Z2 X
  42. /*#define EDMA3_DEBUG*/: o: C- W" ~5 G- b' o0 h
  43. 2 L$ j/ @7 I3 b  l1 |) r
  44. #ifdef EDMA3_DEBUG
    ( g# e* }* |! m5 Q: i! q9 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 j' d4 [& _& g' e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 D' V8 B: Z" Z5 A+ x6 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  e8 u- w$ \/ T% D( o
  48. #else
    8 {0 t2 C4 A+ b% d% Y
  49. #define DMA_PRINTK( x... )4 c) b. y0 M6 N& C
  50. #define DMA_FN_IN
    + j% S- G0 a' {' S2 u. x+ X/ U
  51. #define DMA_FN_OUT
    6 r% M! B* x! j, |. f) I! P; _
  52. #endif) X& c- W# f3 E+ n8 R' L, ]! t( T$ [. Q

  53.   K$ r2 D1 d; {% R* L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 W" c1 L$ o' B* h" z+ }- }
  55. #define STATIC_SHIFT                3
    2 V1 j" M7 j5 C+ e
  56. #define TCINTEN_SHIFT               20
    , |& I" ^; A% V
  57. #define ITCINTEN_SHIFT              21
    - h) n3 j+ H( b9 p
  58. #define TCCHEN_SHIFT                22: z4 a- H  O) t# [! n. k
  59. #define ITCCHEN_SHIFT               23
      f8 F' Z5 M9 U8 `
  60. 9 R7 U( t# ^: g/ _6 K" n0 ^2 o8 a+ N
  61. static volatile int irqraised1 = 0;& i3 Z7 ]9 [9 c0 U& m
  62. static volatile int irqraised2 = 0;
    1 X' R, U* g6 ~7 z: u" w

  63. " m/ V. X2 A5 r; x0 O4 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 o. h! _' [+ t" a2 b. u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o( |  W8 K' b9 A: l7 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . f8 q2 c4 a9 A. [& |
  67. 7 j" v$ {2 k1 V; B0 w- y* c
  68. dma_addr_t dmaphyssrc1 = 0;
    ) L1 N. u0 y! _6 S7 G6 u) t
  69. dma_addr_t dmaphyssrc2 = 0;/ J+ R5 Q. Q; B# m( q7 d
  70. dma_addr_t dmaphysdest1 = 0;
    & G) f6 S4 ]7 N2 Q
  71. dma_addr_t dmaphysdest2 = 0;# P0 l9 H: e, Z

  72. , v7 c2 s% U3 ~" L- Q0 n) V
  73. char *dmabufsrc1 = NULL;
    - |2 g- F  W8 {) t$ I4 P
  74. char *dmabufsrc2 = NULL;4 A$ [* v9 _  J# {9 p+ y  \3 K! u: c
  75. char *dmabufdest1 = NULL;
    ' R' N: H( G: I0 D, K7 M
  76. char *dmabufdest2 = NULL;
    ) [6 @6 c! j$ ]1 G+ d; O
  77. ) i7 z1 ?0 S, N4 y  p- ^8 ?
  78. static int acnt = 512;
    ' h5 _! k' e$ R" D
  79. static int bcnt = 8;$ \' \9 R( ?% O4 p) C
  80. static int ccnt = 8;
    % [+ U, O. ^1 b! T) n8 `
  81. ' m' x# h9 ?, B- w+ a4 [8 l: ?$ d
  82. module_param(acnt, int, S_IRUGO);
    # T: h! |8 A% w. Q. E! f+ Z! W
  83. module_param(bcnt, int, S_IRUGO);
    $ x4 H! w; L. j* V3 ^- O. `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- `% m; {$ x( s% Y. a

3 S. r5 G3 p% j1 m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* k. J3 h3 K: h" A6 i2 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 s+ n$ _3 `, \) I, U' n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 [( F2 l5 l# G2 M3 E, f/ t) M( m7 e

1 p; Y8 U  f+ [5 }7 l7 H6 H9 W: G& q. a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-10 22:41 , Processed in 0.042217 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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