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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " D1 L; q4 x& l, `. A1 _& ?
  1. [code]EDMA sample test application
    ; z2 b2 `% C0 M6 m0 \' q, o) Q
  2. /*
    ; u* y' d! [: s* L, u
  3. * edma_test.c
    * S4 r, B& S* l; ~
  4. *' ^# |! Z3 P$ u% g
  5. * brief  EDMA3 Test Application
    + A( v" t+ H. U% D
  6. *# G: ?- T7 A% G7 N
  7. *   This file contains EDMA3 Test code.) n% b% `$ C1 ?7 x6 L7 B
  8. *
    $ t6 X, t( m2 x7 D% S+ e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  C  V( {) R; T1 V1 |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( y4 h4 r# n- T" m* {9 M0 e
  11. *         TO CHANGE.
    7 E* w3 y. g6 T8 j
  12. *% F) y) z* K- Y& ]7 L  @4 C) a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! l+ q5 [! H/ S: ~+ w  C4 E
  14. *: b! H  h: p% i4 T: C# s, G
  15. * This program is free software; you can redistribute it and/or  U- k5 ]8 N, S8 s- n/ ~
  16. * modify it under the terms of the GNU General Public License as
    : G7 w; q( d2 ?' c2 ]
  17. * published by the Free Software Foundation version 2., d1 s1 a! N$ r+ A% i
  18. *. C7 a5 \( R1 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# e. n0 O2 E& s0 G
  20. * kind, whether express or implied; without even the implied warranty
    % c' c9 w5 E2 k) ]5 E- {# [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * [& r4 B  m% ~* H$ R
  22. * GNU General Public License for more details.
    - ^! l  W! ^: z" G8 V7 T
  23. */
    ; g* w) \* o. n1 `- T1 U
  24. ' t$ ~$ y1 g+ l
  25. #include <linux/module.h>
    ! u4 c, _9 d, {: T7 p
  26. #include <linux/init.h>7 w2 M5 i1 u7 z
  27. #include <linux/errno.h>2 W# g* \  [' H( e3 K2 F9 A
  28. #include <linux/types.h>
    0 s5 L2 \3 v# C7 ]5 I
  29. #include <linux/interrupt.h>% S+ \5 M) H1 m2 {( j
  30. #include <asm/io.h>
    0 f8 E* O0 |% k9 x$ g* G
  31. #include <linux/moduleparam.h>8 z: ~. F# O0 m& l
  32. #include <linux/sysctl.h>
    - X) K0 r3 |- e4 a, W! o
  33. #include <linux/mm.h>" `9 X% k1 G3 S3 M
  34. #include <linux/dma-mapping.h>; O: {  \: I6 d
  35. # ?; A. D2 I1 X" t6 K: m/ O# d  A0 M
  36. #include <mach/memory.h>  i( G2 X4 G. C
  37. #include <mach/hardware.h>
    # L' Y) K, p* d# ?7 M0 ^
  38. #include <mach/irqs.h>5 S; S; I  `' T1 |) o+ ^
  39. #include <asm/hardware/edma.h># l$ D1 {+ I( C, `$ i
  40. # T' O+ j/ Y3 u; E+ Y* u: X9 b( n
  41. #undef EDMA3_DEBUG, ^  ^. n9 J( X& l: D; A6 o$ v; I' r
  42. /*#define EDMA3_DEBUG*/  M3 F3 G8 G/ N& ]0 f
  43. ' W2 G/ R  y0 @8 ~
  44. #ifdef EDMA3_DEBUG- z, V9 X) {* i* W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 n+ S( U" j; B/ m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ I. I# C% _8 x. z) W; c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " `% |( A  w8 U; D' s
  48. #else. }- m: d7 T/ Y& @
  49. #define DMA_PRINTK( x... )
    8 W, Y8 e' R1 r* ^& d! f  g
  50. #define DMA_FN_IN
    , `. j0 r, D" ?$ v3 {6 j# D% ?
  51. #define DMA_FN_OUT
    ( z' V# g$ o4 r3 R
  52. #endif' o% J2 Y& Y; q
  53. . R5 i6 K% ~; W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). s; w- J* H/ H
  55. #define STATIC_SHIFT                3
    $ A+ K6 c9 Q! d6 o  M
  56. #define TCINTEN_SHIFT               20) V. D+ I+ G- T$ r# d6 t" W0 t+ `
  57. #define ITCINTEN_SHIFT              215 Z+ @& g  o- e- S* R! i/ o
  58. #define TCCHEN_SHIFT                22
    6 i( s1 O. j% u! e
  59. #define ITCCHEN_SHIFT               23
    8 J! W) m/ o6 X8 q) Y8 [
  60. - w1 v- ^  u) O7 G- S- x
  61. static volatile int irqraised1 = 0;3 N$ j7 {; Z( n
  62. static volatile int irqraised2 = 0;
    ; ]0 u- p: a, Z! U

  63. ! |+ `8 W! \/ F' [& f: J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* `8 N& ~" L) @! p4 n  f3 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) Y0 o7 @7 R- O/ f9 e' `) x3 }6 }" ^* a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % X5 x5 G; o0 G; M) g  h+ G5 }3 C

  67. / e4 u" Z0 p9 s4 X5 X7 E
  68. dma_addr_t dmaphyssrc1 = 0;9 F5 p9 Z: p4 {% v( D' D( N2 U
  69. dma_addr_t dmaphyssrc2 = 0;4 B& w& t3 h2 G+ t6 A/ J" g0 z
  70. dma_addr_t dmaphysdest1 = 0;
    / W) m4 @4 b: @% H. A
  71. dma_addr_t dmaphysdest2 = 0;5 P% L9 y  H* M7 K) q. E
  72. ! ]8 H* H, A0 ?+ H) J: g
  73. char *dmabufsrc1 = NULL;
    - ?$ x' r9 b# |. |
  74. char *dmabufsrc2 = NULL;
    4 h# V& A+ s% s4 d, _0 p+ ?) Z
  75. char *dmabufdest1 = NULL;
    8 j1 O' H# n, q! g
  76. char *dmabufdest2 = NULL;
    8 c$ I4 k/ ^8 g  j/ ^* E( t( ]
  77. 5 V& w4 U4 s. p2 q! a! [+ w
  78. static int acnt = 512;1 c; j2 ?, B0 C# r( z
  79. static int bcnt = 8;
    # ?" {7 m" D& b
  80. static int ccnt = 8;
    ! p5 x6 W4 C% E, I& {- I; U

  81. % X/ v( ^, m" O0 z2 B% S/ s' V
  82. module_param(acnt, int, S_IRUGO);2 c3 {6 ^; b* G) j) i
  83. module_param(bcnt, int, S_IRUGO);
    % P, E+ n% i$ c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* F4 X* V4 u* E" }  j4 Y" ~& s( x5 f) d6 |! |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( y' C8 V* _+ Z+ T, Iarm-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% U3 P# c  i. g! M; w/ {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 H& N# K9 h2 b' ?: L; W* k2 D

% O7 U+ }5 ]( b$ O  @' D) u# @% |" u* X+ s8 b; T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 22:29 , Processed in 0.039930 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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