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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# D/ `, A+ P$ [3 g4 i; D- f
  1. [code]EDMA sample test application% @( z% _+ b0 {/ C( d, S
  2. /*
    , F. X. {: @0 m+ o! x. `3 J/ i
  3. * edma_test.c
    ! ?0 a+ d6 ~( x- u( S
  4. *! k0 p; m% @- p: i8 j1 \
  5. * brief  EDMA3 Test Application9 d6 v) i- l: X% k  _6 z- E. j
  6. *0 D  r: Z4 H1 W/ k$ H8 z1 ~- K4 \
  7. *   This file contains EDMA3 Test code.
    . `- ~( J# \+ a+ P
  8. *
    * P; s* S2 I9 X9 t& ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , I3 w# l0 {0 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" r1 D# S* v  |- T2 W3 W5 D
  11. *         TO CHANGE.
    0 q- ^' \7 ]3 D! T/ \
  12. *
    7 L. q8 y# {- R, [6 e' B" V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 V4 w/ c" o' `" f# k  I
  14. *$ ?9 s6 P% L6 G' u5 i& b9 \' O
  15. * This program is free software; you can redistribute it and/or
    ) N) U1 s# ^$ {0 ]; L
  16. * modify it under the terms of the GNU General Public License as+ d2 P; M1 O: Z! x" ?4 G9 }/ Q
  17. * published by the Free Software Foundation version 2.5 j: D; q; E, y8 a
  18. *
    ' ^3 f4 y9 W/ m$ G% U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# O) S7 F' q4 ~
  20. * kind, whether express or implied; without even the implied warranty
    * w& i: d+ t, G7 f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / ?, @. I1 w1 F6 q2 q
  22. * GNU General Public License for more details.
    : x. o9 j' e  Q% m" E2 V5 a
  23. */
    * d: ?& ?. r" K" e$ l& K7 Y

  24. ; d! c* E7 A5 P
  25. #include <linux/module.h>
    2 M: t' U+ ^* U  I
  26. #include <linux/init.h>" {! n6 J3 V$ D* K( u& x' G* J
  27. #include <linux/errno.h>% Q- k* Z6 x- N+ M
  28. #include <linux/types.h>5 F. |: Z; ?* k! y: Y+ S
  29. #include <linux/interrupt.h>* {, Q2 i1 r, g# h( R" v% j" z' T
  30. #include <asm/io.h>
    ( e7 l6 y. d: x6 |
  31. #include <linux/moduleparam.h>
    ; I' m1 a8 ^( ]5 H! M
  32. #include <linux/sysctl.h>% M, G( I( ~9 |# r; o
  33. #include <linux/mm.h>
    9 C7 G2 g' s4 P3 C* j4 G
  34. #include <linux/dma-mapping.h>
    ! R7 ~- ?  c/ p4 |$ [0 E6 J& [% b

  35. ( D% ~( B1 n, [; x! u" f: }
  36. #include <mach/memory.h>5 z4 R3 l* s9 i4 o
  37. #include <mach/hardware.h>
    . w( A* I* B) H/ o9 z& P
  38. #include <mach/irqs.h>2 C! {6 r% S! \5 Q- [
  39. #include <asm/hardware/edma.h>
    & {% }0 y8 r# P! J# d

  40. 1 A+ T/ r1 j- N" m0 e  w
  41. #undef EDMA3_DEBUG
    " H, G! i! G$ j! R& v9 u  v" B5 g
  42. /*#define EDMA3_DEBUG*/
    6 X7 I! b8 [* o  A" d% R

  43. ) I# t4 V& p; B9 ~' e/ Y0 b$ C
  44. #ifdef EDMA3_DEBUG
    ! M4 J$ Q! f6 X1 O- y) w6 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ ^1 q0 y4 n3 s% _+ d  g% C- I- p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + r1 [! N7 A4 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( E4 Z- f# K( Q( d
  48. #else
    / a8 s7 {5 H5 q; H+ I. @0 g
  49. #define DMA_PRINTK( x... )
    ' H% j( }  f' K+ h' p
  50. #define DMA_FN_IN
    3 Y% S7 B# X4 j2 j
  51. #define DMA_FN_OUT. q" _* G! ^% E; |- V
  52. #endif
    7 w) V2 l; K% k( u0 h

  53. + @( }& q( T7 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) p$ H: i' v( v2 ?6 ]
  55. #define STATIC_SHIFT                3- {! ?- Z4 K! M  e) W) S- k/ G$ f
  56. #define TCINTEN_SHIFT               20
    2 P4 s( F* W9 e. b
  57. #define ITCINTEN_SHIFT              21) O8 k/ ~* t( W, [
  58. #define TCCHEN_SHIFT                22) }5 {# }1 S# @
  59. #define ITCCHEN_SHIFT               23; A# Z* _- v" e1 e. c- {* b

  60. 9 L; j. G, N1 U7 f5 u
  61. static volatile int irqraised1 = 0;
    7 u1 u# V# E6 w) [- A/ V
  62. static volatile int irqraised2 = 0;
    ! F( f, S8 b4 w% I0 N
  63. $ F4 ~& N8 A5 C5 N) c8 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( w! S* T$ L* s* ~# w/ _1 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / n+ y; |2 h& D& g# f( i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' `4 A! t5 d& C9 f% V

  67. 3 ^  M3 M* I3 [6 b8 ]% Y& H3 z
  68. dma_addr_t dmaphyssrc1 = 0;
    : q* k0 z; P* W- T7 V
  69. dma_addr_t dmaphyssrc2 = 0;
    7 [  L$ j0 V) X0 c* }
  70. dma_addr_t dmaphysdest1 = 0;$ W* C7 e4 E9 K3 _! B* y8 s5 T2 e
  71. dma_addr_t dmaphysdest2 = 0;* Q  `) X4 n6 C6 y& d# R1 F$ a! p
  72. $ t7 I- i2 V( k3 o6 e) C
  73. char *dmabufsrc1 = NULL;
    ' q, A# k. J  L
  74. char *dmabufsrc2 = NULL;
    . a1 V! Q5 L8 X& ^! a  I
  75. char *dmabufdest1 = NULL;# X+ c3 p4 B- \$ v/ ]. i
  76. char *dmabufdest2 = NULL;
      q) I5 d  Q  x1 ?% C; b

  77. " `2 w7 |& B: u; ?8 I% K" Y
  78. static int acnt = 512;$ G( r! k. ]! O# `9 a
  79. static int bcnt = 8;
    " m- }0 \. `9 g) `
  80. static int ccnt = 8;
    - U) H, f8 ]" K4 e3 z

  81. : d4 t$ d9 D7 U5 K( w) W% e
  82. module_param(acnt, int, S_IRUGO);
    % n+ L5 F0 }8 c. E9 l" \
  83. module_param(bcnt, int, S_IRUGO);3 C0 L2 o6 I8 q- G/ w5 @5 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  @: i5 ^9 C; @& o
: F- ~  s8 ]6 V: ~5 T4 e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 I2 F$ ~$ a( i+ U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ A& C0 O  g1 U: \$ }' y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. F  W  K$ ~3 u+ @: ~0 F8 J

8 b: S) X0 Z. y& J& A2 f4 ~  d$ @  l3 l6 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 16:49 , Processed in 0.040016 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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