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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( D; [1 g; o8 M+ _; T/ S' \
  1. [code]EDMA sample test application
    3 n' q7 `2 o& Z, X; V$ H
  2. /*
    5 P5 i; ]+ |( {6 T6 [
  3. * edma_test.c
      Q! S9 ?: W7 x, l$ ?9 k
  4. *- p9 _" k+ x* w' n1 k
  5. * brief  EDMA3 Test Application
    + R1 E, R; Y9 b4 x9 q" a
  6. *
    $ ?7 a. d" P* w& Q/ [+ V
  7. *   This file contains EDMA3 Test code.% t2 _- v0 E" Z+ j1 k+ \5 R0 R/ c
  8. *3 l) o( \- X% K, j1 n& w) n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* d! d' {; M5 N# v( i' [0 r! u& d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# ~* a! h6 s' L. O# x
  11. *         TO CHANGE.
    1 f! F1 s4 f. y6 y- J9 s
  12. *
    3 x% A  i- I# Y- [7 d# g( L8 x8 R( m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) I5 |( p3 h" e8 H3 L; _
  14. *: D* e4 ]1 N: f
  15. * This program is free software; you can redistribute it and/or
    / `+ |3 n4 ]6 M* J. y
  16. * modify it under the terms of the GNU General Public License as+ O5 v6 ~, t( p$ U, `* N- |" u
  17. * published by the Free Software Foundation version 2.4 S3 l* _' A: Z2 N
  18. *
    # M0 i5 x$ H# ^" P  Q" t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- b6 O$ O* O, ]; Z2 e* S9 u
  20. * kind, whether express or implied; without even the implied warranty9 o3 w, a& J- _2 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% r8 y$ w& k8 C6 x# L
  22. * GNU General Public License for more details.
    , O+ D' Y0 w0 Z$ V+ q( A1 v: q
  23. */7 Z. r: f3 t3 r
  24. 5 e# N- z* M. P
  25. #include <linux/module.h>
    " X) l" ~& F) |" V
  26. #include <linux/init.h>
    % [4 R9 e) v# q: o/ D5 W0 V0 g$ |
  27. #include <linux/errno.h>: o  ~  Q) C. j& J. k8 C* N+ i( d
  28. #include <linux/types.h>, h/ G4 t5 l6 Y1 ]4 ?
  29. #include <linux/interrupt.h>
    5 F1 t: W' G1 q3 L9 M
  30. #include <asm/io.h>
    8 ]  B$ d, C: w) B( p3 x4 w: X+ I
  31. #include <linux/moduleparam.h>$ M' u  f$ W6 p' U2 s
  32. #include <linux/sysctl.h>
    : ~3 R9 a6 a- j$ f* _& \
  33. #include <linux/mm.h>
    # b2 S& a, m; P6 j7 h
  34. #include <linux/dma-mapping.h>4 O4 L5 H5 V& N% d3 g. J

  35. / M3 F& r, o! R" k9 ]7 s$ L
  36. #include <mach/memory.h>
    : s' [+ u, v# L/ ]6 Q* i$ Z
  37. #include <mach/hardware.h>! }) U# K8 |3 D: u- V: ]2 }
  38. #include <mach/irqs.h>; I( e9 P2 C: Z+ }2 F
  39. #include <asm/hardware/edma.h>( Z/ `7 K8 U* }: \
  40. 5 @6 m- V- r0 a, s  {9 L$ x, v
  41. #undef EDMA3_DEBUG
    % e8 n" u. l3 D6 T: Y
  42. /*#define EDMA3_DEBUG*/
    ' t5 q' d- i: c- h. S

  43. % l* ?! A+ I) ^3 X
  44. #ifdef EDMA3_DEBUG
    # g+ o5 \* Y& \: u( [  X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 {3 d. t/ K) v; G. T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& n; @, ]- t% o, X( o( @! ?8 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 P9 G6 f+ h6 N7 n% t3 B6 g# k$ `
  48. #else1 X& |9 l" H/ \8 N4 K
  49. #define DMA_PRINTK( x... )
    ; ^$ |! K3 Y( F# W
  50. #define DMA_FN_IN
    . X& p- I* Z  @
  51. #define DMA_FN_OUT
    5 }* r( ]6 j( g# g2 ^. e5 w: o
  52. #endif
    & b$ ~1 j, V1 p# G* ?& ~

  53. 3 \  ~, z+ c. H, z( R3 i/ Q3 [2 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  u3 A! A; Q" P$ I! K3 ~
  55. #define STATIC_SHIFT                3+ y2 [# J& T7 U. P
  56. #define TCINTEN_SHIFT               20
    * w' ^& ~+ F/ Y, H
  57. #define ITCINTEN_SHIFT              21
    8 ^/ J9 @# L. }$ R3 t3 I! ~3 {
  58. #define TCCHEN_SHIFT                22; i, X% \+ ~& a$ ^+ j
  59. #define ITCCHEN_SHIFT               23) ~6 L1 d% H$ \2 [! @2 [- y

  60. 0 ~9 y& z$ ^3 N. p6 h$ X8 G# b& x
  61. static volatile int irqraised1 = 0;* M/ q- Z* }5 i) Q/ b
  62. static volatile int irqraised2 = 0;5 M, g% j2 c' M5 z
  63. ( x5 q! B4 }5 g0 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : H. y! c. m) D) ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ?/ P& T% u2 l, s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, G. i( v4 a3 G# A

  67. , P$ j9 g8 ~5 m1 w7 _/ e
  68. dma_addr_t dmaphyssrc1 = 0;
    6 k' s" ?) z/ c1 A4 ], }' y
  69. dma_addr_t dmaphyssrc2 = 0;
    % Z6 S2 |; F" ^4 Y, X
  70. dma_addr_t dmaphysdest1 = 0;
    $ F" `( P& \8 Q* ]: h- I* E
  71. dma_addr_t dmaphysdest2 = 0;" i. K7 N7 a2 J9 ^; p; s
  72. % K0 U& P& ^# t8 {$ g, {- C
  73. char *dmabufsrc1 = NULL;
    , p& O* @) t; |, }& _
  74. char *dmabufsrc2 = NULL;
    ! }8 X* t# [9 @; O# n
  75. char *dmabufdest1 = NULL;
    ' P# Z" I; O  s
  76. char *dmabufdest2 = NULL;
    ' E9 c" o) v7 D% p+ j7 n

  77. / ^& N6 `% r( ]- K
  78. static int acnt = 512;
    - Q  F. K% v3 U( J7 k3 a
  79. static int bcnt = 8;% Y" T1 c( s, t& F
  80. static int ccnt = 8;% C/ A( v, n- n" }; {1 a
  81. * u% D# F. y& L, H% _. d
  82. module_param(acnt, int, S_IRUGO);) [" W5 |9 V; h
  83. module_param(bcnt, int, S_IRUGO);
    - m) f8 S  W( d! |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( T3 U% v; N, J3 {& _- m+ z1 ]# d9 B0 g8 \  t! r( X- I; Q1 l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 @, Q4 n; W  `- z2 g9 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& H, T$ \7 }3 k; I* k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' r1 ]- [4 M& O' _% @# b- \; K7 ^/ i; a( b
9 ~0 Y# S8 a: W$ ?( O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 11:41 , Processed in 0.043808 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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