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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 e- h% M( `5 ~+ X
  1. [code]EDMA sample test application
    , Z. k$ n( o! E" f* e% L6 V2 }
  2. /*
    # l9 D6 W7 O3 ^) G
  3. * edma_test.c
    ! X& l( t4 T1 u' }+ H/ R' F; _: Q
  4. *8 @6 E5 {* j! s2 u$ N
  5. * brief  EDMA3 Test Application
    ! z5 Y; _+ r* r9 b, L: L
  6. *
    6 ^: J7 M4 C8 n5 t& b! `0 S$ x
  7. *   This file contains EDMA3 Test code.5 i* w( @  c& u/ ]8 @  {
  8. *
    , U+ ?( e! P5 e- [6 p; z) j' B& Q! a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) _- R( k: q; ~0 M! L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 ^+ `6 S+ I% J/ i
  11. *         TO CHANGE.1 e5 l( \7 }; F
  12. *
      `- M+ w- z& H. h( @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 l# a- D& R6 m% B2 B- l$ ~
  14. *
    . C4 t) {. m9 B, `' Y
  15. * This program is free software; you can redistribute it and/or
    4 f! L. x/ H) h2 h' D. H. j
  16. * modify it under the terms of the GNU General Public License as
    & H6 v% A" P/ ^) }4 ^/ H
  17. * published by the Free Software Foundation version 2.: e  |1 r& `' S" |" X1 G
  18. *
    5 D! e, Z3 G5 O% C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + B  |4 N$ W  w& k: g$ ^
  20. * kind, whether express or implied; without even the implied warranty! b4 ]0 G& d" g  O) s- e5 _' B1 L- q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ j) |- S0 h5 b# B9 o
  22. * GNU General Public License for more details.! P  E$ e" l, |, o( K- ?5 R; |6 n
  23. */% N. W+ ]/ K5 Z1 y
  24. 3 \1 U7 B7 H% X. t& ~+ d
  25. #include <linux/module.h>
    # H$ M* @" b5 u) @
  26. #include <linux/init.h>
    ) d' D& \1 J2 k8 F0 u$ f
  27. #include <linux/errno.h>5 W, n7 {; t1 M7 W
  28. #include <linux/types.h>  @$ Y! D5 O/ n' ?- L
  29. #include <linux/interrupt.h>5 P1 K1 n, s* @( ]1 X: h, v
  30. #include <asm/io.h>
    ( @  R' A  o  I8 {# U7 N! d8 x
  31. #include <linux/moduleparam.h>2 [/ Z  F: V' J( Y0 k
  32. #include <linux/sysctl.h>
    7 d% v7 B, u, \6 o2 L
  33. #include <linux/mm.h>
    % _" T+ o, Q2 }& U" s
  34. #include <linux/dma-mapping.h>! n$ Z$ x* A3 z1 O4 a2 r+ d: |3 {
  35. ( @7 P# _$ l: d  U; g, A
  36. #include <mach/memory.h>5 |/ J! H' v6 c% n8 S3 w/ f
  37. #include <mach/hardware.h>
    - \- j6 ~& E/ n7 R
  38. #include <mach/irqs.h>+ h  K, H& z$ N% w1 C, C
  39. #include <asm/hardware/edma.h>
    6 M2 F& m" p; k$ O* q
  40. : u- ]# b5 Q; M0 y3 ]
  41. #undef EDMA3_DEBUG: e, x5 j: {$ n
  42. /*#define EDMA3_DEBUG*/4 v( U: d# T( @% G3 r" j8 E

  43. 2 I" C, y2 ^; \. Z6 f
  44. #ifdef EDMA3_DEBUG& m5 L5 R& W* s4 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " y4 c  H5 c% A2 F( ?( X" ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). g$ c% Z" v% D( G1 a! g) [9 A( X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); u& c7 _. u$ N# @! F4 [) y- C
  48. #else
    ' i! k; V* C: p% S! ]
  49. #define DMA_PRINTK( x... )4 O1 ?( S& J+ G2 N6 ~3 E0 Y
  50. #define DMA_FN_IN
    1 j/ G% \! {* [( c! M+ I
  51. #define DMA_FN_OUT) v2 t# @% N4 e: m
  52. #endif" m: K( F% g! f8 U7 E  T

  53. 9 L( C* a; g, I( `; R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 D) o9 B3 x; D1 M- b2 q9 z
  55. #define STATIC_SHIFT                3
    9 ^  \) v* L9 Y% J) n
  56. #define TCINTEN_SHIFT               200 k2 E: m' X% O6 ]# t/ |
  57. #define ITCINTEN_SHIFT              21
    ) ~( k( s, S: `
  58. #define TCCHEN_SHIFT                22
    + o7 \  U$ S# Y
  59. #define ITCCHEN_SHIFT               23& z6 y1 S( @1 A; d7 q# G+ d

  60. 2 S$ ]$ y& [! Y. c% ~# e0 H
  61. static volatile int irqraised1 = 0;  z% }$ s! V0 V' B- g1 S* ]7 W, y
  62. static volatile int irqraised2 = 0;
    + a; F' Z  l& s6 I$ t9 I: i
  63. 1 L( g$ g9 p$ ~- g0 B1 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 [6 E3 J1 f: g7 K2 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 R( x" l" Q1 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 @3 Q' L! Y; W, L- [" `* g# _

  67. 9 m) H" ^8 B" [: N) a1 T. }
  68. dma_addr_t dmaphyssrc1 = 0;' w% ]! c2 w% \& C# F
  69. dma_addr_t dmaphyssrc2 = 0;
    ! G. C+ \1 L5 u+ Q- j
  70. dma_addr_t dmaphysdest1 = 0;
    ; B; {" x( \" Y% T
  71. dma_addr_t dmaphysdest2 = 0;
    % D+ v; r2 q; W

  72. $ Y  y+ {! }8 g: Y! h) x% E
  73. char *dmabufsrc1 = NULL;
    # ~. D- Y, I; M$ y% O
  74. char *dmabufsrc2 = NULL;. q% ~$ z5 c! a* |4 }
  75. char *dmabufdest1 = NULL;& D- N0 X; v8 n
  76. char *dmabufdest2 = NULL;
    0 Q+ m" E" ~. p3 j, }" \

  77.   I! ^* s: F5 q" A6 S% `2 f1 F' v
  78. static int acnt = 512;  i; d9 o; s5 e- K1 J" E
  79. static int bcnt = 8;3 @; m0 V# U  Y/ ?9 W1 P
  80. static int ccnt = 8;
    2 k0 e$ c6 y# a
  81. 2 o/ e3 v" f: |. i+ W7 z. r
  82. module_param(acnt, int, S_IRUGO);
    ! R0 I3 S9 K- r: v
  83. module_param(bcnt, int, S_IRUGO);
    . C! K5 \; C) A% I& L& R9 \+ T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. v0 P% c# j* m- Y
5 |" m2 o: \4 n9 n2 `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& @+ t6 A4 b* W6 r! E+ R3 r( ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% g% K+ o5 z" F* Q0 ^, `9 T6 K' L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 r7 E5 f9 s+ x% ]" X
; N) f) ?0 ^" u+ q9 _' y8 l  e
: m% O' \& Y' f9 O; c' }" C) t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-15 03:57 , Processed in 0.037455 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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