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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 l0 ^* O5 U" T9 l5 G2 ^7 O* j
  1. [code]EDMA sample test application
    ! m* P6 u! t9 D0 m6 ^6 B
  2. /*
    ) d$ e+ t! ~  P5 H8 t- Y
  3. * edma_test.c2 |) x% N! E$ T2 s6 E7 Q* F4 Y% j! {
  4. *
    # ?. U2 a# C7 T7 x, j+ I; \
  5. * brief  EDMA3 Test Application
    & u" g% u( g, E- }' V" ?4 _/ J- ^# K
  6. */ D: h. w+ H) ~" J# ]  Z+ W
  7. *   This file contains EDMA3 Test code.1 p* A/ x7 I, t/ Q, ?' P
  8. *
    : H7 K* W$ `& K0 k" A/ |9 U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 L. G/ z  b7 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ T! T# e7 B; a& {
  11. *         TO CHANGE.% R; k( U( s" M  \& |; d7 N
  12. *
    + Q0 X: p, `# L: m6 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; c9 w# c3 B$ u/ a' Q
  14. *
    8 K* w, T! S' G9 y1 z
  15. * This program is free software; you can redistribute it and/or
    4 p, w9 F- e( K9 J
  16. * modify it under the terms of the GNU General Public License as
    4 v$ u0 u6 m* H9 H9 T+ c
  17. * published by the Free Software Foundation version 2.3 w  A1 i: r1 ~. J
  18. *5 U# f  G' r; z5 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) X$ `5 }; k) T$ X* T/ \; ]! J
  20. * kind, whether express or implied; without even the implied warranty
    ( i4 X( h" K! S& Z# u% z; @9 v& K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" q) p' ]; t& B# n( K
  22. * GNU General Public License for more details.
    ) A4 Q$ j: T& e
  23. */# f4 i# k' K% i  u5 g2 \# Q

  24. , G: v4 k, b- a( i
  25. #include <linux/module.h>
    + ]% a9 B: ?* }7 D( q+ G3 V5 ]
  26. #include <linux/init.h>  A9 X) c. W% K$ x4 k, O! B
  27. #include <linux/errno.h>
    ! f7 n) j7 ]3 D! I/ h# X1 e& X) p
  28. #include <linux/types.h>
    : P( g7 z( R, ]8 e
  29. #include <linux/interrupt.h>7 G1 w$ ~4 P8 n+ _+ |, I3 }
  30. #include <asm/io.h>: {  h  Z9 Z6 G( K. |
  31. #include <linux/moduleparam.h>( B2 D( y. g8 J5 q
  32. #include <linux/sysctl.h>3 z6 ^# P+ j* ?2 K' z$ W3 ]* G7 r+ B
  33. #include <linux/mm.h>+ d/ a$ s/ k7 W% Y" r6 V) ~' c
  34. #include <linux/dma-mapping.h>: @& i* s( e7 h5 Z4 ~1 I* U8 R
  35. , L' k7 ~* o3 {: c" w4 c; ]; ^
  36. #include <mach/memory.h>
    : v* k- P/ C- S: X, _  m/ {% r
  37. #include <mach/hardware.h>, \, I/ N; I, \3 p! B
  38. #include <mach/irqs.h>
    3 m, q3 c9 M4 x# m$ C
  39. #include <asm/hardware/edma.h>5 D# E# [* E  T+ b2 n& g7 T

  40. 4 d& {$ A  t+ Z+ [3 ]
  41. #undef EDMA3_DEBUG: w" C. v5 n. V3 {$ Y6 j
  42. /*#define EDMA3_DEBUG*/
    " A% y- p, I% s$ F. `. M
  43. 2 I! L. R0 l4 c1 p8 i* G1 ?7 ~
  44. #ifdef EDMA3_DEBUG! I' R8 c- _, L3 @5 t: b8 x1 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( U7 I8 K) G+ u! S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # F* n/ p3 [3 k$ J8 G$ I* C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 V# N! `. V5 X, ^2 E- a8 ?
  48. #else) @$ g* V# W& J9 ]
  49. #define DMA_PRINTK( x... )
    3 B$ ?: ~( K5 A1 M
  50. #define DMA_FN_IN
    - C6 n0 O8 n' L( G7 ~* h
  51. #define DMA_FN_OUT
    $ R- ?, |# n+ g) Q' L) [/ `4 o
  52. #endif
    5 [* O: i8 E- p; u/ _

  53. , h* K: S( C& z& G2 ^7 S/ o: |3 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 ^2 i; N9 p6 T" P1 @
  55. #define STATIC_SHIFT                39 ]2 k4 O4 z& m8 B! i0 ^, v
  56. #define TCINTEN_SHIFT               20- j" z3 P; B9 q; _
  57. #define ITCINTEN_SHIFT              215 p6 o  g7 Y  a  W# o, Y  s, U
  58. #define TCCHEN_SHIFT                22
    4 m( V& k8 |6 E+ J# n. w* {5 M' B
  59. #define ITCCHEN_SHIFT               23$ K( K  K  W+ _- V: h9 {- L( H* R

  60. 0 Z9 s; O# b. |4 ?$ N* i1 _
  61. static volatile int irqraised1 = 0;
    : |2 |, V) o( I& V7 x) r9 {  W
  62. static volatile int irqraised2 = 0;, k/ n8 O6 [+ P. X
  63. $ ~  d* _: ]+ J) i; E( _; l6 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . ^" `! h% x3 ]+ O* X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* J$ Y% q5 C) U; c# @/ l  e- A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      w: M% z7 F* ^4 R# N
  67. % Y8 \: ^4 S- H: Q( L7 ?, \
  68. dma_addr_t dmaphyssrc1 = 0;/ b, g  A$ _# H+ j/ S  Y
  69. dma_addr_t dmaphyssrc2 = 0;5 M7 d+ z: C$ \' }' {$ h
  70. dma_addr_t dmaphysdest1 = 0;
    3 J2 H( `" i* @
  71. dma_addr_t dmaphysdest2 = 0;0 q# d1 T; V2 W, {8 v' u3 [) o  _

  72. 1 }/ k0 |( s: A$ \' v
  73. char *dmabufsrc1 = NULL;
    . y. N" `9 h! F$ t  k
  74. char *dmabufsrc2 = NULL;
    + {" i* ]$ y  C+ m5 p' o# a& }. M) |, c
  75. char *dmabufdest1 = NULL;
    , p/ \& Y  |: C2 F9 s, }
  76. char *dmabufdest2 = NULL;
    ( `' o$ W0 J6 e) n9 U3 \* e

  77. ; Q+ Y7 H* o8 Z) K
  78. static int acnt = 512;1 `7 X) Y! O4 Q4 a) e
  79. static int bcnt = 8;# U  h" N+ P; x8 b% n% n
  80. static int ccnt = 8;  B- B# t: h/ y' k: w( z6 l
  81. " Y# d2 i+ a" O% f8 T6 z
  82. module_param(acnt, int, S_IRUGO);3 z' ^/ A' Y' b& x& q5 G& L
  83. module_param(bcnt, int, S_IRUGO);
    / [" I* p! x; _$ p- P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 D. \% m8 P! i) z- c# e6 N
2 F, z# b  O- y0 P1 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! \1 I9 w% U" \! B1 Larm-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 \$ l& }* [  M+ t2 g6 r0 N( |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# v/ |+ E! ]' o! [, x/ T
. m5 _- @  @7 a" h- g  f# L3 @% p7 Q, g8 f. g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-23 11:00 , Processed in 0.039004 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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