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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  x; o" i5 Q- a0 s0 H
  1. [code]EDMA sample test application( O) F" a) o7 Y- K
  2. /*
    ; h( F6 ^1 [$ {" u
  3. * edma_test.c: [" r  j! B8 S! ~
  4. *
    , {1 H+ n5 [* @5 A
  5. * brief  EDMA3 Test Application
    8 \( L. A  K( s6 t0 r3 P
  6. ** _$ w2 I- u: s. G
  7. *   This file contains EDMA3 Test code.
    : c, f6 z, @3 l) }0 f* d9 _
  8. *" i- n1 w* w8 A  E, ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 d, ?; q6 u; A; m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 D6 Z% U/ ]  a+ x* T8 g1 y. Q! b
  11. *         TO CHANGE.0 w! n9 Q# n7 D2 A6 T3 Z8 x) L) @
  12. *
    / {6 n3 H) S6 l( K/ x' _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 K! |' `# c: X
  14. *
    . I5 W5 y  }. f: J4 p
  15. * This program is free software; you can redistribute it and/or
    2 _6 `: N0 B) a. f$ C( }4 M
  16. * modify it under the terms of the GNU General Public License as7 ^  _8 f& T2 _9 ?0 B% o
  17. * published by the Free Software Foundation version 2.
    & I2 }7 r2 ~* J; F  c3 l8 Z' E
  18. *, Q2 b- s+ e* {$ B5 d6 H- J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: X, X/ h  s$ |5 d4 _+ a% c
  20. * kind, whether express or implied; without even the implied warranty& D: w# @0 `6 A# a  ~0 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : s. p/ O9 w. W% d. G
  22. * GNU General Public License for more details.3 v4 z. D, O; Z, h5 f+ B' u
  23. */6 w6 R& z' N8 o, h, N  w
  24. " H% s; z# A0 M/ g5 r3 z
  25. #include <linux/module.h>$ @) N8 p# g- M3 i% _
  26. #include <linux/init.h>
    ' V, J% l9 P7 c
  27. #include <linux/errno.h>" f8 F: C6 ]. y# N% V
  28. #include <linux/types.h>6 O4 g' D( j% N( G. [% x1 @
  29. #include <linux/interrupt.h>4 {, Y" n& N6 A4 }# J
  30. #include <asm/io.h>
    # g; Q8 g: z& J( z
  31. #include <linux/moduleparam.h>1 o. [1 q6 }% H* A* V! G1 I$ J& L
  32. #include <linux/sysctl.h>
    ( G0 {/ k4 N" ~- r+ L" ~
  33. #include <linux/mm.h>
    1 T1 v4 c! T0 N: w6 d% e
  34. #include <linux/dma-mapping.h>1 E& b% I! L; p, G4 A$ s# _* S, B
  35. " H4 ^* p" }, }
  36. #include <mach/memory.h>
    3 r4 o' g  V8 [1 J
  37. #include <mach/hardware.h>
    5 `( @. u; W' T
  38. #include <mach/irqs.h>
    / d$ z( H4 `( D
  39. #include <asm/hardware/edma.h>
    ( N# i) p4 q- ?  {- I" H8 |) s  s

  40. ; b' z! ]1 ^0 l1 z
  41. #undef EDMA3_DEBUG& w* v5 ]8 C2 [3 O* F
  42. /*#define EDMA3_DEBUG*// v7 W" K' V+ s( e
  43. 9 P5 N, f3 z' g- o
  44. #ifdef EDMA3_DEBUG( {& C  g5 G! A6 w$ K4 P) c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! N& N  z- b4 r  Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ ]5 s) k- p: M+ {" J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 J! o7 T5 r& l4 V8 c9 @
  48. #else
    ' [- @$ I7 h% V
  49. #define DMA_PRINTK( x... )
    + s2 ?! g; J* C, [  S+ \; B/ R. p
  50. #define DMA_FN_IN, \# }0 \8 T- |" _5 Q1 G8 V4 b
  51. #define DMA_FN_OUT
    1 T) i1 _: R: x1 q! P
  52. #endif! Z) M3 S" C2 H

  53. " q& \5 t2 T! x9 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& s+ b  l! }: D3 O5 _+ P
  55. #define STATIC_SHIFT                3% h7 j% z. t' G# ]6 _' L# w! u
  56. #define TCINTEN_SHIFT               20( G% }" h+ V- B; h
  57. #define ITCINTEN_SHIFT              21
      l+ i7 L* G; o6 X! a
  58. #define TCCHEN_SHIFT                224 }7 B) Q$ @( _+ V' t& N) K) r
  59. #define ITCCHEN_SHIFT               23
    0 ]6 g# K$ T" e9 f6 E
  60. 9 m( H! y9 [( e
  61. static volatile int irqraised1 = 0;% B) ^8 g2 C9 v$ t' ^; d
  62. static volatile int irqraised2 = 0;) l; T/ p% Z3 ?! W/ f: a
  63. - B" n. X& R! _$ \  D$ p& L# C2 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 Z$ M, {. G3 Z/ K' l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 H* v! f% T8 S8 \3 b6 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % G* G$ B: {" _% Q1 Q
  67. ; U; l4 o# |6 F0 `
  68. dma_addr_t dmaphyssrc1 = 0;. h/ V: x! E* e) F  l0 A; i
  69. dma_addr_t dmaphyssrc2 = 0;
      D3 G- ~% m  q1 a
  70. dma_addr_t dmaphysdest1 = 0;
    $ h1 U# [7 j: T8 S/ q$ h3 v
  71. dma_addr_t dmaphysdest2 = 0;% t4 V# _! k" @
  72. ! W1 o+ |( {! l
  73. char *dmabufsrc1 = NULL;# Y7 w8 `3 c7 T6 n* D) ~: d
  74. char *dmabufsrc2 = NULL;
    # o  T1 r4 y' ^" e7 ], u- T
  75. char *dmabufdest1 = NULL;
    ( \/ X- @6 [- j3 ]
  76. char *dmabufdest2 = NULL;
    : Z. J4 t" I4 i" T6 F8 T
  77. * Y( b0 C; U9 n" u! e4 i
  78. static int acnt = 512;5 p  \' ]. I7 ^5 S* X% O" R* [
  79. static int bcnt = 8;
    % J- ~* ]9 @! |3 {4 B4 A
  80. static int ccnt = 8;1 h% L2 M9 t7 f* C! n2 F# l

  81. : ~$ R% t$ @) q6 m, L6 S9 k
  82. module_param(acnt, int, S_IRUGO);% l$ C1 E! x, M2 Y( b2 W
  83. module_param(bcnt, int, S_IRUGO);6 D) q3 \6 ~9 `& D9 \  N% ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 I* Q1 D0 b3 v" W- F
1 L) _0 t* z' t. |7 _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 k. l$ P0 K8 S3 r9 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; e: I; A, m0 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; x3 k" P( @% m; u: A4 r# L- K! H9 [/ f4 `7 o4 R" o6 \# ^

) E! h& o+ p; n, v8 v  w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-25 10:10 , Processed in 0.040418 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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