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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- D, U4 k2 |& v6 u: y  Y7 e
  1. [code]EDMA sample test application6 t6 O: _6 \) f; c3 j
  2. /*9 [0 v$ D/ x& i3 s
  3. * edma_test.c
    & V8 x' g  X+ b5 Z
  4. *: v) [0 P/ L" H, K! G6 K
  5. * brief  EDMA3 Test Application
    3 ?3 k2 [( y( Y8 N# q/ {9 X, f
  6. *+ c! n. d8 n# L" E- u4 |8 B
  7. *   This file contains EDMA3 Test code.
    $ X! b( H% Z, ^2 `. B9 i/ T
  8. *! n! O* U# |; o2 Z4 d* C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 n9 {4 w: y% ~; O  _  J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( K  _. U) m- D9 S; U& Y
  11. *         TO CHANGE.' f5 I3 @  a/ f: K5 v* ~
  12. *- y! @- [% m2 V5 y! ^8 i- Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % I; N% p3 O1 P* U$ L- t* @9 T
  14. *' Y0 Q* r! E8 ?) Z6 |$ }
  15. * This program is free software; you can redistribute it and/or# a& T" b: e4 T9 r3 J
  16. * modify it under the terms of the GNU General Public License as+ ^% n; V: Y' L9 Q1 S
  17. * published by the Free Software Foundation version 2.) T( X6 G$ F; J8 o* n
  18. ** I7 c8 a, a! a6 t0 F% I/ D+ b+ C; ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 p: w$ j  t. x. I4 N" j
  20. * kind, whether express or implied; without even the implied warranty
    4 H. ]- I2 P* W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " [2 m4 C" e/ c
  22. * GNU General Public License for more details./ \: Z* @0 B- t8 I/ s) h
  23. */! m! e( ]) O5 W5 C; f$ R
  24. 0 J3 J9 x6 M5 W1 _4 `7 g( k
  25. #include <linux/module.h>6 j+ x8 N3 P2 C  q/ I& e6 a
  26. #include <linux/init.h>7 X& f. j- f% N7 H
  27. #include <linux/errno.h>( M2 l4 e* E7 M% [  m& n$ h7 c
  28. #include <linux/types.h>
    6 S9 M, E1 ]7 F$ R: _* |
  29. #include <linux/interrupt.h>
    ( m7 [8 p$ p4 d
  30. #include <asm/io.h>
    , W3 \) w" L6 S- n" c1 ]. y
  31. #include <linux/moduleparam.h>; a* x5 K; D- H3 b1 d1 _/ ~8 e6 _
  32. #include <linux/sysctl.h>
    & U: V  Z  }4 @- W, x7 l
  33. #include <linux/mm.h>
    : c" l& N( g) J- A7 o
  34. #include <linux/dma-mapping.h>* `  M& B6 `4 ]
  35. - b" n) E+ K" A: t/ M
  36. #include <mach/memory.h>
    8 F0 K8 W, `, O7 y- A# _* D2 q
  37. #include <mach/hardware.h>
    % n$ o! Z9 H! o! f
  38. #include <mach/irqs.h>% q" b" \. S7 M$ S& [$ G' e) `
  39. #include <asm/hardware/edma.h>
    2 N# r& ^6 O$ `& g3 a

  40. * }) v4 ]+ C6 v. o* U8 k3 p
  41. #undef EDMA3_DEBUG
    8 r$ j& u) [/ d- p" Z
  42. /*#define EDMA3_DEBUG*/
    # V0 A, e( ?7 T, l; Q

  43. " ~. K0 |: |* O/ r9 V
  44. #ifdef EDMA3_DEBUG
    9 w; t  T  `3 m% R( @  t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * Q8 U) ^6 w" u. H: m6 K/ g8 {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 N. w, w9 T  P) P3 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" a2 ^9 {6 ]2 |! ^% d  ?+ |
  48. #else
    # ^. v9 d! g( t% ^
  49. #define DMA_PRINTK( x... )
    6 T; T% h0 s) v6 k1 k* k
  50. #define DMA_FN_IN
    9 W: I, e  D6 f/ \. K4 ^7 P) `
  51. #define DMA_FN_OUT
    8 m2 q+ E& I5 `: a! w+ ~7 `$ @
  52. #endif+ G5 V7 X% L. P& M9 Q. i/ z6 r! N
  53.   l4 M3 G$ F! b! p/ x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # _3 ]5 ^3 @2 B3 s7 o( K/ h7 b
  55. #define STATIC_SHIFT                3
    , m5 \5 a. s2 b
  56. #define TCINTEN_SHIFT               20
    $ {- R8 m# v4 h3 R$ n
  57. #define ITCINTEN_SHIFT              21
    ) v, g! y9 z8 I( H& r  Q
  58. #define TCCHEN_SHIFT                22
    4 [) H( p/ I& q, K5 M  k
  59. #define ITCCHEN_SHIFT               231 d2 z. _5 h: Z: r: d2 P" c% k3 B$ x

  60. 6 i$ s0 F7 y% _# `
  61. static volatile int irqraised1 = 0;4 \6 {/ A0 A7 h4 n( y
  62. static volatile int irqraised2 = 0;  c; ^; p2 D! M- z$ v
  63. * Y9 H! s0 H8 ~# R, J$ T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * V; M7 q) S8 _- E& @2 Y. Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      u" j4 P" _/ I2 V# S2 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + R7 i2 S( k9 N- ^# v
  67. * Z( q* O2 n  ?. ~
  68. dma_addr_t dmaphyssrc1 = 0;
    . M3 w4 L( W  H
  69. dma_addr_t dmaphyssrc2 = 0;2 ?9 e" A8 ^5 X) q* p/ Y
  70. dma_addr_t dmaphysdest1 = 0;! d, e: d" a! z; u
  71. dma_addr_t dmaphysdest2 = 0;
    : J+ s- Q% n5 i9 d( @+ J# ]; q

  72. 9 j% V% }  u7 k* X6 r; E& R/ q; N2 V
  73. char *dmabufsrc1 = NULL;
    + t3 Q" [) j3 S' T; T8 F
  74. char *dmabufsrc2 = NULL;
    4 X/ \) v' h8 r" c
  75. char *dmabufdest1 = NULL;
    : k# ^; L7 s" v7 {6 [
  76. char *dmabufdest2 = NULL;
    7 I0 ]% t% z; L/ H) O# E3 G

  77. 9 I1 J1 R5 V- W$ `3 @. a
  78. static int acnt = 512;
    : `3 ^, n( m& V0 C
  79. static int bcnt = 8;
    ) ?8 ]( f- O. e# \# j* T. v7 v
  80. static int ccnt = 8;
    2 O; W+ X, a% G
  81.   m3 X4 D8 \6 R& c
  82. module_param(acnt, int, S_IRUGO);7 C8 K* {5 w6 c; y8 B2 v% w
  83. module_param(bcnt, int, S_IRUGO);
    ; M- ], N, j$ i0 x7 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ X8 a5 U/ f, r/ `

% m! D8 _: Q/ w1 g! P5 T% H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 Q* Q+ Y% a" B/ f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, R) z# i" `6 N& N/ g0 J) ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# s- h. J# R8 [

5 [& E6 w4 Z8 E, i; Y, E+ w
, k1 c- m2 M0 L; j6 W6 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 10:30 , Processed in 0.038307 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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