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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 ]5 i1 k, t  c+ ]. \+ R& z
  1. [code]EDMA sample test application, h1 l, q4 b* \; N% H; c
  2. /*
    # @3 p8 f( q3 R0 ?0 x
  3. * edma_test.c0 ^7 }1 @$ P; o9 a
  4. *
    % r' i* d2 x1 r
  5. * brief  EDMA3 Test Application
    $ U& c& }% Q3 e0 \5 o! U4 x5 d1 o
  6. *
    / ~' }0 e# u$ I
  7. *   This file contains EDMA3 Test code.+ W4 m8 n. f9 i  G9 C( W3 e3 v8 I
  8. *- @- J( z; {! V0 I2 c  R2 w3 O, Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 H' I6 P, V& C1 G& j& [0 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " R/ \/ e; |' L7 K
  11. *         TO CHANGE.
    8 [, Z7 \( f7 j7 Z% C; `9 b% s
  12. *. V1 F. r3 I3 C0 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( v) x/ `6 |* c. l
  14. *. r: C( h8 t8 [" F9 N
  15. * This program is free software; you can redistribute it and/or
    4 e$ f" k8 U, a' r: [1 l. c
  16. * modify it under the terms of the GNU General Public License as) l7 p" J4 }' y1 W' W# L( F
  17. * published by the Free Software Foundation version 2.
    " E8 S% T7 l* w3 l. }0 F
  18. *
    % g0 J7 E7 l2 l. o' n1 Q) f3 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, O7 \4 v+ P0 w4 R
  20. * kind, whether express or implied; without even the implied warranty
    ; a1 `( z; c$ N) B7 z" o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 ~" t2 J. q6 p0 s1 M  o
  22. * GNU General Public License for more details.
    7 L& i% J* V; j7 O) C' j! w
  23. */" P- D6 P: v* L

  24. 9 D- i+ M7 }# r( @3 `$ o
  25. #include <linux/module.h>; W6 C; I& f$ r3 ^
  26. #include <linux/init.h>
    , f0 R% O# u& s% o+ u
  27. #include <linux/errno.h>5 Z  \3 H  Z/ b+ m/ N1 @
  28. #include <linux/types.h>
      |) L6 `; X+ \. V* _4 M; d
  29. #include <linux/interrupt.h>+ K/ q! O# D! W3 v( ]
  30. #include <asm/io.h>7 s& r" p; ?  O, N) ?/ `
  31. #include <linux/moduleparam.h>
    : Z$ n0 {7 q, O- y' ]4 \
  32. #include <linux/sysctl.h>
    7 [4 l) h$ a* w& `$ q# v. @
  33. #include <linux/mm.h>3 j) F7 z6 c0 m3 I: ~8 b
  34. #include <linux/dma-mapping.h>
    + Z! r; w- `8 ?7 M5 x9 B

  35. 4 c1 j, M; n+ _& z
  36. #include <mach/memory.h>
    / g# W% @" X+ O$ C7 ~0 U
  37. #include <mach/hardware.h>& H) ]0 i) o$ ^0 g- z6 P
  38. #include <mach/irqs.h>
    0 ]3 q8 B4 ]! m
  39. #include <asm/hardware/edma.h>. Z$ m( x4 z! u, k! v9 Y# ^8 I

  40. ( F7 k5 v+ a# q7 u# ?8 q
  41. #undef EDMA3_DEBUG
    + d6 }7 V# Z2 B5 g: n# j
  42. /*#define EDMA3_DEBUG*/' q" p- c; M% c9 `

  43. 1 R0 ~+ T6 Z' r( y: d; _, h% \
  44. #ifdef EDMA3_DEBUG
    , K' w# v' r' @  p( b8 P# h9 |) ]; M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , u# r. h5 n" i# C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 N/ q+ w9 F( o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* @) w1 @6 I) I
  48. #else
      X" `2 ?9 Q, m
  49. #define DMA_PRINTK( x... )' y5 C4 e. C$ i+ x% [6 [2 q- g1 K
  50. #define DMA_FN_IN
    3 a* E9 L$ Q: c) m
  51. #define DMA_FN_OUT* J6 z" m' _  R0 v
  52. #endif
    ' ]& |0 j8 X; z0 n" p% Y

  53. ( w9 d9 p: q8 I; H0 ^1 D% M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 w$ \( s  x- D/ t: |& c2 F
  55. #define STATIC_SHIFT                3  J  C  M0 v9 r7 l( g, P1 D
  56. #define TCINTEN_SHIFT               20
    9 I9 F3 A8 m# S# J
  57. #define ITCINTEN_SHIFT              21: c% e- f$ }' v( Q$ q. L
  58. #define TCCHEN_SHIFT                229 M6 _/ J0 X" k1 i$ k, K( N; W
  59. #define ITCCHEN_SHIFT               23
    4 }0 x0 x( l5 T( w
  60. " d% S' U8 H+ y2 r. k) h
  61. static volatile int irqraised1 = 0;
    7 y  K* W) b* _  X' a* \8 G7 _" u
  62. static volatile int irqraised2 = 0;8 U. r; t7 t$ A# N" S: c( Z
  63. 3 d3 g& h# U3 G5 Y/ u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! _7 q# ]) R0 X0 t2 E9 I) k. n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 R/ l# E- t+ L8 Y. H# L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 F4 J* y/ ^) k

  67. 6 X( U6 c/ [0 p/ \
  68. dma_addr_t dmaphyssrc1 = 0;
    ! w4 v' Z3 ~2 X! J; U+ t1 H
  69. dma_addr_t dmaphyssrc2 = 0;6 U: T1 A( X9 Q; \! r
  70. dma_addr_t dmaphysdest1 = 0;7 u6 |" H/ _; [. `$ ~8 v1 D
  71. dma_addr_t dmaphysdest2 = 0;
    # w% D/ b% q, ^% t' j' }

  72. 2 A& Z0 ~; K3 u- ^2 A
  73. char *dmabufsrc1 = NULL;
    ( W5 @  }6 M+ s: P5 b0 z
  74. char *dmabufsrc2 = NULL;
    ! o( s# q7 P+ B- U  w2 `3 \) t
  75. char *dmabufdest1 = NULL;' K9 [$ Y  C* E7 N* M9 P& p
  76. char *dmabufdest2 = NULL;
    % C- o# `) G$ ^, z" j

  77. 1 ]# }) l" a9 {3 C$ a" ^& T, G
  78. static int acnt = 512;& O5 g, S; n* |7 N1 }# W: R  D7 B  b
  79. static int bcnt = 8;
    1 B* C; X! G- Y; d0 l
  80. static int ccnt = 8;
    4 G' {; b+ I( ?$ }& [
  81. 0 x! R, m) i: |
  82. module_param(acnt, int, S_IRUGO);; m# e. n7 U+ i  Q) r
  83. module_param(bcnt, int, S_IRUGO);# @* ]0 m) P/ u& S0 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 N* M- |) A; s

9 D1 c- l7 F3 `' P) Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& \4 J) ?- r8 n" M4 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ X6 Q4 q; z; T8 e8 k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, O# ?* d$ u/ I0 Z8 `

. k' |" V* n. ?+ r
- c2 p$ H: l; i8 w" Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 19:47 , Processed in 0.039881 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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