OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& T* P$ U7 l4 t0 G; L  A) V9 r8 a7 C
  1. [code]EDMA sample test application* D& e* a; n  \% K) I. i+ N1 _/ x( I
  2. /*; C, @! d( K4 L; S: }+ J9 o, q
  3. * edma_test.c
    # q/ A8 `2 e  N4 d
  4. *
    / F0 F& j. \# T6 s& g( g/ P5 K- b
  5. * brief  EDMA3 Test Application8 x- Q7 ^8 _2 Z5 y- h
  6. *3 @4 P0 s/ }$ p- z  R
  7. *   This file contains EDMA3 Test code.0 n; z) X- R5 \8 ~, E' b9 Y2 d/ }' U
  8. *
    8 z' i$ ~4 Q- e/ l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. G' T3 b6 w: X  @* p$ J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" Y. q+ Z+ x) f' V" ?3 u# P
  11. *         TO CHANGE.; L( l* C2 U) q: V! H) J' c% v
  12. *3 V/ |4 w" x( X$ n) C' l3 B2 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; F- f4 Y& O  C. C' q: ^/ n7 c
  14. *
    " v) S: J. o" f. ], n
  15. * This program is free software; you can redistribute it and/or
    8 e6 j& z4 V" e2 o* R
  16. * modify it under the terms of the GNU General Public License as2 o/ M; N$ q! d0 q" a5 R
  17. * published by the Free Software Foundation version 2.
    / m1 D/ E# Q+ N. r0 z& z: A
  18. *
    - `, c! O9 c4 j) i* w5 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 c" J% [7 U- `+ W
  20. * kind, whether express or implied; without even the implied warranty
    ; N! c: a, H" P" z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; P$ u; p; L- V# q3 k/ N
  22. * GNU General Public License for more details.
    4 X8 O3 L, I" ^4 ^, c4 i: T( |" u
  23. */
    5 ^6 O+ G3 q1 }" V1 G3 y0 M2 o

  24. . B1 o; r$ a" K6 p
  25. #include <linux/module.h>- L4 [9 R, ]/ ?7 e
  26. #include <linux/init.h>
    * ^) @1 y3 N- n7 U8 N, U
  27. #include <linux/errno.h>) e8 e% d7 _1 L. T! K0 h
  28. #include <linux/types.h>
    # S/ N: P$ H+ o7 J# s
  29. #include <linux/interrupt.h>5 s' J3 W. p  L
  30. #include <asm/io.h>
    9 A7 B+ \3 C* L5 `( }3 x' F2 o8 a
  31. #include <linux/moduleparam.h>
    # g) j, e7 S/ y8 n
  32. #include <linux/sysctl.h>, x5 B! w* M& }/ t
  33. #include <linux/mm.h>
    1 t( ~! s& H9 P" O5 L2 I
  34. #include <linux/dma-mapping.h>& s3 S1 w; ~  c; ~- f, r

  35. 4 e6 ^4 s, d+ y  k- S+ U6 b" I
  36. #include <mach/memory.h>) g( Y3 i8 Y7 u2 l' {1 g
  37. #include <mach/hardware.h>
      @0 w- \; h( {) }6 U
  38. #include <mach/irqs.h>" \  ?. ~" S- T% Z
  39. #include <asm/hardware/edma.h>* C% K% }6 x& ~: _  F" W* _
  40. 1 ~, ~0 t& k) F1 R! F/ {
  41. #undef EDMA3_DEBUG
    # C& L; d& r' d8 `4 ]4 k2 M
  42. /*#define EDMA3_DEBUG*/' i- k  u$ P& H6 d; @
  43.   W. T7 {  @- d4 M% J, y; M
  44. #ifdef EDMA3_DEBUG
    4 G& `7 w1 z, C) L) M& E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - T5 q" W1 Z5 _8 z0 c; y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      R- p/ \3 Y; J7 I1 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" S' `2 ?' u1 p5 a, ]+ n$ Q
  48. #else
    * I, Z: q% z5 d3 L: s
  49. #define DMA_PRINTK( x... )+ v7 X; j' {7 G6 A: n
  50. #define DMA_FN_IN
    4 {6 {/ t/ Y' U' I( X( P/ Y
  51. #define DMA_FN_OUT
      F6 p1 e( n3 }. k/ m% X
  52. #endif2 L# z5 x. U0 x* a5 s' }+ ]+ e

  53. * O* V, a( J, u$ m# F: k( Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 x" U/ ?) x, ?7 d7 }4 v. ~
  55. #define STATIC_SHIFT                3) `1 ]  U1 |( K5 x
  56. #define TCINTEN_SHIFT               20; c" R& A) |* @( P5 t5 v
  57. #define ITCINTEN_SHIFT              21
    1 j7 u) U. z8 l0 [0 ~- S6 U' Q% ^% k6 M
  58. #define TCCHEN_SHIFT                225 j+ g' |9 F, I. @/ x% j0 a
  59. #define ITCCHEN_SHIFT               237 B4 K* j2 w) |2 g7 P
  60. / r5 d7 {1 E8 N. l" W
  61. static volatile int irqraised1 = 0;7 I! @" C; j9 Z/ A' {* M
  62. static volatile int irqraised2 = 0;) r) @7 h* `2 _/ M
  63. 3 _" o4 r& H( N! u2 X; n% |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 I2 |3 x2 ^1 D- P. p% H" M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& N* h& t$ d+ Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 J1 }8 J! s8 D0 r& L

  67.   S8 |! ~7 t: i0 t1 G( V' o
  68. dma_addr_t dmaphyssrc1 = 0;
    ) ]+ F" a) h5 p5 [; S! M
  69. dma_addr_t dmaphyssrc2 = 0;# k/ ]- H' s( u
  70. dma_addr_t dmaphysdest1 = 0;( L& K5 \, a' q2 x; y
  71. dma_addr_t dmaphysdest2 = 0;
    $ T3 B1 B. E4 g4 [, t3 D% I
  72. 3 m  j1 X3 y' r
  73. char *dmabufsrc1 = NULL;
    2 G' m# J% T" C# z" [* \# e
  74. char *dmabufsrc2 = NULL;4 Z9 ^( m9 F- m
  75. char *dmabufdest1 = NULL;
    . [; w5 G4 [- R( g
  76. char *dmabufdest2 = NULL;
    4 X2 ^5 O" L2 `0 t* e2 q

  77. , {7 {0 g4 l0 U3 T% ?
  78. static int acnt = 512;0 I4 v" E* s, V  q: }
  79. static int bcnt = 8;4 L( r. y( X$ F6 h
  80. static int ccnt = 8;
    , F9 ?- Z' L% P4 u# h% [$ X
  81. # t* \% m" ^2 C- g3 {" Y
  82. module_param(acnt, int, S_IRUGO);! r$ s# G: z7 Q! {
  83. module_param(bcnt, int, S_IRUGO);, L5 h1 W6 c/ t4 G5 B1 _& ^- J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 d/ q6 H1 k: I! `& M, t! W! ~& w- z0 y# M/ X! c& H, ^4 \# }" P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) p, q3 v( m' Karm-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" _# o3 V3 P6 d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: C( ?; ~. m0 ?3 z( E7 U

% C, W- ^( h4 n  x3 k( p" A9 Y' ]) g, C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 01:29 , Processed in 0.036381 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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