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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( C* ?# K9 m5 v& e
  1. [code]EDMA sample test application' [! i7 |4 z4 @
  2. /*
    * F$ b1 m+ W; [+ S: L8 [/ w
  3. * edma_test.c
    # Q. T: n" _7 ~  k$ }/ Q! [
  4. *% m" I( f8 J& e' i
  5. * brief  EDMA3 Test Application3 Z, [  ~9 E  ~- R4 b8 c1 F4 \
  6. *
    * K( X' Y* c8 W' j  s  m
  7. *   This file contains EDMA3 Test code." J, O4 ^. X+ n
  8. *& H" O2 H& N+ C( Y& b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      p) N2 P, R; S+ V) ~5 e9 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      s) l5 @* [3 \  D  r7 x
  11. *         TO CHANGE.
    & d; }& h* }1 i/ p
  12. *
    ; C! k$ i6 X2 v/ k  t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( F. v0 R0 a! d8 |# c
  14. *7 `3 _& t4 O5 C! w
  15. * This program is free software; you can redistribute it and/or: c% S2 t( q4 A, o9 z) j
  16. * modify it under the terms of the GNU General Public License as
    5 r$ U& }  G/ Z( k7 x8 P' H
  17. * published by the Free Software Foundation version 2.9 x) {2 [$ i( e1 v
  18. *
    9 s! C( _- t* W- ^) B5 D5 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' W/ n' V+ A3 k% y1 l
  20. * kind, whether express or implied; without even the implied warranty
    . [" c5 ~" G8 k1 v) |- r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! q. G) B1 ]# a8 H, ?
  22. * GNU General Public License for more details.
    : ^3 F$ l6 S, h% d
  23. */* y. _+ R: I# d: [  v
  24.   ~7 v7 c; f5 u1 i- S8 D/ J5 M- J* k
  25. #include <linux/module.h>
    7 A7 F% y0 S: V  k. ^6 `( Q$ E3 D
  26. #include <linux/init.h>
    8 v: K2 g7 b" u7 k$ X
  27. #include <linux/errno.h>
    ! m/ j: Y: G/ ]8 u/ G
  28. #include <linux/types.h>5 K6 a; T3 ]" ]% E3 v+ B
  29. #include <linux/interrupt.h>; V' i2 f9 z, k) |/ V3 v: h0 X
  30. #include <asm/io.h>
    1 f1 Z) n5 T- p4 C
  31. #include <linux/moduleparam.h>  y- Z! y$ u6 b' S/ ^" d/ g
  32. #include <linux/sysctl.h>
    1 b3 m/ O. X2 R" {
  33. #include <linux/mm.h>
    ! W9 w. @' W2 ~: M  h, q
  34. #include <linux/dma-mapping.h>
    # r4 e2 F0 A& v: R& I" Y

  35. ! K5 D! h# s* j- H6 X% n* w  A
  36. #include <mach/memory.h>
    ( ]$ Z  V2 A2 [& h
  37. #include <mach/hardware.h>
    ! z4 V% o% T% S8 }; F3 D
  38. #include <mach/irqs.h>
    ! H* F* _" b: r6 {
  39. #include <asm/hardware/edma.h>1 X/ Q: C6 J! v: z% L$ u1 n

  40. 1 U' Q/ J! d, d+ j# y
  41. #undef EDMA3_DEBUG
    0 G  b, `9 n% J* r3 I9 O; J+ s
  42. /*#define EDMA3_DEBUG*/
    + h  a- K" k  K$ Y9 L8 V
  43. & |! Z% d. L, ~! H, c
  44. #ifdef EDMA3_DEBUG- c9 q- J; G# @, d' m/ f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) I$ {; r+ S% V  Q, ?' a( U7 i1 D# Q$ \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 Y0 S6 B2 p& p) ]7 g5 L5 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 d* ^# \+ L0 K# m: _! {7 D
  48. #else
    $ x2 _3 t1 @3 `1 ^. g
  49. #define DMA_PRINTK( x... )
    , }( \8 \% E) L* n; h
  50. #define DMA_FN_IN
    2 A" J5 c& c4 |" ^. }
  51. #define DMA_FN_OUT
    5 W9 o) Y' n/ Z7 e: V
  52. #endif
    , T$ `6 h' h) w
  53. ) r& p. P& @9 b# s: h( E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , X! o5 r& B/ Y, t8 w1 }7 d
  55. #define STATIC_SHIFT                3' J/ `( ]) j: S) k  P7 P- o* n+ s
  56. #define TCINTEN_SHIFT               20, n/ |. d( z2 g$ j" Z
  57. #define ITCINTEN_SHIFT              216 g, y3 Q  R( z
  58. #define TCCHEN_SHIFT                225 X+ h( h9 c; b. ~2 d6 A
  59. #define ITCCHEN_SHIFT               23& F, @  p" u" f8 _
  60. 7 ^7 L$ f6 }9 G( P. J( e0 N9 E
  61. static volatile int irqraised1 = 0;5 g& }- J9 a  o- l5 Z
  62. static volatile int irqraised2 = 0;7 F5 B- t4 M% u
  63. . l- ^" u- q' E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - n3 i$ @) h6 |! e* i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 P2 e! _! n5 J5 A6 E+ p# n( @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 F, U, e4 U2 f5 v1 r

  67. , {+ K5 i" k; f; }7 l
  68. dma_addr_t dmaphyssrc1 = 0;
    * u( v% ?9 h+ B3 P7 u5 s
  69. dma_addr_t dmaphyssrc2 = 0;# M% f8 C; c; J0 }: K5 o
  70. dma_addr_t dmaphysdest1 = 0;) K1 U' P6 P( q1 l' v
  71. dma_addr_t dmaphysdest2 = 0;
    . o+ m0 s7 y2 `; b5 y4 W, n- [; I

  72. ; w; e  r+ g7 Z* m7 M- z; G# l
  73. char *dmabufsrc1 = NULL;9 x" ]) D: W& I$ \0 M" R3 J
  74. char *dmabufsrc2 = NULL;, @2 n+ W8 i2 {  O; `2 Y. w
  75. char *dmabufdest1 = NULL;( \' J3 N5 R! I2 V5 ~
  76. char *dmabufdest2 = NULL;
    2 b1 x4 b1 b0 ^9 A
  77. ! P+ B5 b' s- {6 `) p
  78. static int acnt = 512;
    & V: F+ E: E# R; G8 b+ e+ Y! ?* U+ V
  79. static int bcnt = 8;
    2 m9 p5 e$ M. k
  80. static int ccnt = 8;% j$ m9 ~7 i9 A& ^
  81. 7 p, s5 n+ K2 V0 R" {$ u
  82. module_param(acnt, int, S_IRUGO);! z& X2 @2 K( V! s" a9 c& v3 e" |
  83. module_param(bcnt, int, S_IRUGO);: [, B+ f+ T2 f* ^  H! N( W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 k. P& D* a% R8 r. n7 P3 E( ?. z) u7 _
/ G/ V' H1 j( \( B% Y! I  i# A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% _: j( I& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) ]; Y: f) f3 {! J- K" Y6 h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 t9 j$ L4 l" u! a8 G0 d0 `9 ^& \6 [8 O4 s5 l
1 P; _2 ~2 R, R/ H% N5 I( R& J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 20:00 , Processed in 0.039335 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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