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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ _5 f8 ~" @0 h; |# q1 N
  1. [code]EDMA sample test application8 V3 T5 y6 F" A+ S$ L
  2. /*  v( x1 j5 ~) }( R7 P
  3. * edma_test.c
    0 `1 V. @0 x+ R6 I
  4. *% U8 U9 K+ ^3 C! s" F0 V
  5. * brief  EDMA3 Test Application
    2 O% {! C9 z& o8 n
  6. *
    9 `* l4 s* j& ^
  7. *   This file contains EDMA3 Test code.
    & X. A% @& t/ H7 Z$ w- ]
  8. *! |& \2 G5 d; i$ w( O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 `, K8 V# n8 M& Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 `) d( a- S* ]
  11. *         TO CHANGE.
    ! b$ V, o, Q* I+ s. g9 D
  12. *0 z# `8 B1 g2 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 K5 J2 j1 A" b8 b& L
  14. *- S& v- B0 F: v$ N
  15. * This program is free software; you can redistribute it and/or
    + A* G/ u$ ]8 K: {
  16. * modify it under the terms of the GNU General Public License as
    , [' d  V: r$ O  N
  17. * published by the Free Software Foundation version 2.
    $ V2 `/ K: |: [0 {( ?4 w7 X
  18. *
    8 ]& b( `& z8 G, b" L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( H5 G- s0 a7 g7 D* x7 C4 O% d" n
  20. * kind, whether express or implied; without even the implied warranty
    6 A, e0 }, r6 @4 T, e' l4 |, k8 D; E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & ]% B+ ]+ \, @  O0 I
  22. * GNU General Public License for more details.4 `7 p" b0 z) |- q0 `  p
  23. */
    5 A; H/ h$ a4 q, T" D
  24. 9 F8 d* Z* D  Y0 Z: E/ C* z0 y
  25. #include <linux/module.h>) Y! V9 y/ f$ q% K
  26. #include <linux/init.h>
    % A  Z* ~5 p8 L& Z. _' _
  27. #include <linux/errno.h>
    & E$ w% h1 B: n2 E, v8 H9 M; e
  28. #include <linux/types.h>
    / R& i& S/ U3 r1 @9 A8 s4 w6 ~
  29. #include <linux/interrupt.h>' J. {$ L1 A) T, G1 l
  30. #include <asm/io.h>
    5 u3 \% p, Y9 x! E1 T) o
  31. #include <linux/moduleparam.h>( _: g5 G- h( p7 L
  32. #include <linux/sysctl.h>
    " ?  g, ]9 A# g5 Y
  33. #include <linux/mm.h>
    6 N+ {& c) M6 V$ ]1 r" h
  34. #include <linux/dma-mapping.h>
    3 j) p* E4 D4 g  n8 d, j
  35. 8 w% J7 M4 q5 ^" x
  36. #include <mach/memory.h>
    7 _9 S/ {$ {: H
  37. #include <mach/hardware.h>7 g+ K6 Z* j; r3 x
  38. #include <mach/irqs.h>
    2 j( {3 v0 T+ j4 n: m* `6 Z1 {
  39. #include <asm/hardware/edma.h>6 f/ O  u( s& o! f  w0 J

  40. : ^" j. V4 @, P2 u$ K: r8 E% _
  41. #undef EDMA3_DEBUG1 r" b6 K4 f5 c1 F% y; r
  42. /*#define EDMA3_DEBUG*/1 y, a/ m# I5 R. d

  43. 3 |( ?6 J# ?9 y4 e% b/ r
  44. #ifdef EDMA3_DEBUG% T% G( A( Y: b! T# C" s  d9 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' I" h, S9 S. C0 J9 [, B& ~# S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! @( _6 T8 Y* i4 m: v7 e( ~$ x+ S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' @* \" Z+ ?0 p! ]  Y' p
  48. #else
    ' X1 Q/ t* g: s8 _+ n9 I
  49. #define DMA_PRINTK( x... )  f  y; U5 U5 r& O% n+ e) \
  50. #define DMA_FN_IN- p" @) `5 d! R: {. L; S
  51. #define DMA_FN_OUT
    / {6 `! {7 n+ M! E  F
  52. #endif- V/ Y# M8 p' N% s+ S9 o
  53. ( I' o" k! h5 J+ _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 Y/ A: T0 S. V  u$ M' z0 I
  55. #define STATIC_SHIFT                3
    3 _7 W5 P2 D, [6 W0 X% T8 F
  56. #define TCINTEN_SHIFT               20+ m- G5 Z7 R; p5 ?) [
  57. #define ITCINTEN_SHIFT              21
    # n/ n, f$ m2 V: v$ B: D( @
  58. #define TCCHEN_SHIFT                225 Z! Y6 G$ M. q, b; l7 D
  59. #define ITCCHEN_SHIFT               23
    6 }( i+ v) @' ~' s8 H, c! b4 V

  60. , `" D5 p* a  A& W+ W  R* W* F
  61. static volatile int irqraised1 = 0;  I2 A7 t# f6 o9 ^0 {1 Y
  62. static volatile int irqraised2 = 0;( C6 A- j/ n# S- m' ~( y7 @0 n$ ~

  63. ; ^8 H; _* p4 r8 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- |7 W5 \4 i/ ]/ F; ^. x# L0 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# l( A; e' V6 H/ M+ G0 U; f! ]: L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" C; T0 X+ L5 |, d/ a2 m

  67. , o' b: M' X. l' f/ s3 s) n8 t* q
  68. dma_addr_t dmaphyssrc1 = 0;
    8 n1 `9 ?: E+ Y3 C1 E2 `: Q
  69. dma_addr_t dmaphyssrc2 = 0;
    3 S* t9 I9 Z* i" w
  70. dma_addr_t dmaphysdest1 = 0;
    ( n. V3 R' w/ b
  71. dma_addr_t dmaphysdest2 = 0;; V( M3 s4 Q! B8 q1 \

  72. 5 _! N4 ?2 e9 n) o- l6 u3 d4 |
  73. char *dmabufsrc1 = NULL;
    & T, v1 A$ Y0 S
  74. char *dmabufsrc2 = NULL;
    8 m. y$ R/ a& i' O: E% w$ z" r
  75. char *dmabufdest1 = NULL;
    ' b2 g0 y* ~1 k% g# T
  76. char *dmabufdest2 = NULL;
    . z, E6 @$ L' D$ w0 R0 `$ D; W* }

  77. - i2 v  {/ M' n& x4 V
  78. static int acnt = 512;
    + H6 X9 e/ f  _5 v0 t. C; q: U* L
  79. static int bcnt = 8;6 h( a8 d3 k0 j/ i- c4 i5 w
  80. static int ccnt = 8;
    0 x8 z: e7 ~1 _. R

  81. 3 ]2 ?5 R# q3 j/ W$ A7 d8 h
  82. module_param(acnt, int, S_IRUGO);
    + [% f4 n. N- I2 ]) V
  83. module_param(bcnt, int, S_IRUGO);
    + C, F9 R  k5 t" K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 l& V3 G  z/ g) t
# O. i  u4 u6 {) x  E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" c( C1 Q! x5 y3 U7 B: ?9 `( J+ Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 s  s& e" U: J. {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 j$ D# ?0 }5 L' [+ ^5 F* e/ C9 v6 _7 [0 ^

7 x/ F3 u% }. o/ B: b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 13:15 , Processed in 0.037755 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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