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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 Z* m; i3 T+ `& c5 `& A
  1. [code]EDMA sample test application* r/ v( M* K6 e8 b4 g7 e% _8 `* U! R! T
  2. /*
    8 A1 N7 x+ l5 R/ g
  3. * edma_test.c
    3 }' D/ ?* L% x: k  {
  4. *
    ) @& v. G0 C6 U; O
  5. * brief  EDMA3 Test Application- _$ z5 @1 i+ y9 X7 T4 S5 R2 [
  6. *( s" l# \5 H: _( R( P! U' _
  7. *   This file contains EDMA3 Test code.: F8 T1 I" @4 y/ u
  8. *
    ( K3 P  X2 e4 f" j7 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & }3 I/ @5 e. m6 I) P" k- G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - k. N3 n! a; x- n2 j1 g, L3 L
  11. *         TO CHANGE.. Q. l  G8 Z' ?" ~% w* ~6 \; C# M
  12. *
    0 A9 t: [. Y4 B% U7 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// R6 E, z, R- i* @
  14. *: T* l( V+ g* I% Q
  15. * This program is free software; you can redistribute it and/or
    4 Q3 A' B9 ?6 w$ O# Q1 B, K8 h
  16. * modify it under the terms of the GNU General Public License as' u& Y, J0 i! q9 f* p6 C: B
  17. * published by the Free Software Foundation version 2.
    5 d! {4 O& W. Q2 q/ [0 h) J" d/ V
  18. *! H6 \5 w* J. r9 Z4 Y0 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 d5 r" D9 J( a0 h
  20. * kind, whether express or implied; without even the implied warranty
    - e/ x- a8 G' U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 L7 g3 d% O, g2 F" Z, M) O- S
  22. * GNU General Public License for more details.; y: E( B# v7 s) o8 U) Q
  23. */: `7 i. z0 v. ~' x( K& X+ l; F# s/ Y# d0 L
  24. ) |% I8 @0 K* n/ o+ k
  25. #include <linux/module.h>2 ]+ ^3 D+ T$ q  k
  26. #include <linux/init.h>
    0 z) U/ p+ f! x8 k$ }& d5 L
  27. #include <linux/errno.h>
      F1 H" E- P. `- D5 {4 F
  28. #include <linux/types.h>
    + H+ L* k6 i# }# S2 Q4 z. H0 `
  29. #include <linux/interrupt.h>) I3 I! m6 u& T; h8 q2 _; j( ]; Y& w
  30. #include <asm/io.h>
    # h9 y" R' \4 u7 Q' N
  31. #include <linux/moduleparam.h>$ _8 A0 @" \0 L- U' |( f" p" W
  32. #include <linux/sysctl.h>
    * Q( A# T1 U; V4 {' d- g/ `7 e
  33. #include <linux/mm.h>
    : m7 W0 e7 r9 Q2 d: l$ Z8 A
  34. #include <linux/dma-mapping.h>
    - g8 ~: [6 R6 ?! ]
  35. 8 x, `1 i( y& B, R# |' z
  36. #include <mach/memory.h>1 K% B# I+ @+ Z2 h
  37. #include <mach/hardware.h>, ^: \9 `7 C* O" V+ ^( G- d* ]
  38. #include <mach/irqs.h># p! J& l# Z) R5 d! Z
  39. #include <asm/hardware/edma.h>& c: ]- W* g' N( O% r: b
  40. ! H5 H- G6 n: E) W4 N, w" ?' t
  41. #undef EDMA3_DEBUG* ^5 ~# [* ]/ t3 A% V- v' w' [+ S* E
  42. /*#define EDMA3_DEBUG*/" c8 Y( O6 ~" Z# \$ w, _
  43. : j7 Z# \- {$ j
  44. #ifdef EDMA3_DEBUG
    ' ]& I  d& o+ z; l0 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); I' L0 ]& m5 F: ^# c  ^: a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / h4 I9 n, l' G  e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); H6 h+ a& n# Z& A. X
  48. #else
    5 `; ?& B. V8 ]" e  H$ f8 W
  49. #define DMA_PRINTK( x... )' p4 v3 Y3 N1 Q6 v" @/ m
  50. #define DMA_FN_IN
    1 ^# g* k$ a2 m, i+ ~. y2 a0 @4 D
  51. #define DMA_FN_OUT8 g2 P) T: l3 i6 l$ `
  52. #endif3 A, |! R/ g5 c3 [

  53. & r" T6 S! R" ~  _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 {* i; O7 Y! M/ o: \( b5 A
  55. #define STATIC_SHIFT                3* |% i1 ]& j* Q  \+ |& t5 o
  56. #define TCINTEN_SHIFT               20
    . q( u/ S: N! \! @
  57. #define ITCINTEN_SHIFT              21% P* n2 q( ~$ l/ W
  58. #define TCCHEN_SHIFT                22/ j! R7 V) T" ?7 c$ N5 [
  59. #define ITCCHEN_SHIFT               23
      c+ _2 R( F2 F0 Q6 J6 j

  60. * f0 X$ J% o' b- z
  61. static volatile int irqraised1 = 0;4 M9 v8 m1 T7 B( x7 r9 }
  62. static volatile int irqraised2 = 0;" U# W# i4 ^3 F
  63. 2 u+ R& Z8 t3 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # y  T7 N8 f. M; g% d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( W( d2 G8 `0 J0 U& L2 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; {: X& n! A/ m4 n- U

  67. ( V6 O) g; o  C7 H
  68. dma_addr_t dmaphyssrc1 = 0;
    7 r- ~0 M+ t& }: t
  69. dma_addr_t dmaphyssrc2 = 0;
    ; j" ?  J8 w: ]9 F0 E- A3 ^6 a5 b
  70. dma_addr_t dmaphysdest1 = 0;! G; N& x9 u5 G9 L# L
  71. dma_addr_t dmaphysdest2 = 0;
    4 y; Y7 ^* T; f" L
  72. 7 S. u* a, H4 w6 p8 y: L
  73. char *dmabufsrc1 = NULL;
    % `; V& q8 {5 x; _5 }% ?" |
  74. char *dmabufsrc2 = NULL;
    ; v# R) F7 I( z
  75. char *dmabufdest1 = NULL;
    8 b( H9 q' ?! h$ R" T; p. {2 s
  76. char *dmabufdest2 = NULL;
    ( ]: d: A: Y! b9 b1 t9 z% j
  77. , G( C" ?" L: T' N0 n
  78. static int acnt = 512;+ u4 h* F5 x/ q$ ~* i; I
  79. static int bcnt = 8;8 T9 Y0 p; d% n  b/ M" y0 y
  80. static int ccnt = 8;
    & g9 a- E+ I, q) h9 _) X9 U. _; _; ^

  81.   k- v/ m+ ~7 ]$ |+ [) U
  82. module_param(acnt, int, S_IRUGO);8 ~( z9 p: y5 G( C7 b* c: l9 O
  83. module_param(bcnt, int, S_IRUGO);8 k& c8 ?* `2 p7 o: m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, _7 S& h) [0 g$ L1 \
8 [+ ^3 X0 y! m0 U8 C8 g' c, h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, `% C  b6 m6 q, U4 d* M5 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) @( R6 D3 u$ B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  N1 e) n; V/ s! J3 j$ ?8 X$ K
/ O" I7 Q1 e/ ~# v' U3 v" }& q& T! }, n1 @% k' M* m2 R: {. m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 01:18 , Processed in 0.042334 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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