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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# P4 Y- M  A. A/ y& w0 D  C
  1. [code]EDMA sample test application
    % g; q. T. i, Z) v6 r! Z
  2. /*
    & m9 S, q( f$ ?( ^; L; T  T
  3. * edma_test.c4 B0 x* V8 h3 Y! [& M
  4. *
    ) Y: C0 p# Z, Z  [2 S% J
  5. * brief  EDMA3 Test Application/ {8 w/ Z8 ~& H" \
  6. *- s3 s' t& d8 I9 g* ?( i  _
  7. *   This file contains EDMA3 Test code.
    ( V3 b% O, b! K$ I
  8. *. D4 M* y/ s5 A" f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- Q1 c; I. t. N7 q: [' K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & N9 B: K$ X% g! C& i9 }' u8 T4 ?
  11. *         TO CHANGE.+ v, h8 q$ [- B  A
  12. *
    # W) V& m% y0 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / R) V0 X& D9 R* Z
  14. *1 G4 g8 Q4 O# n) j
  15. * This program is free software; you can redistribute it and/or
    5 F5 H+ |+ M# G* g& H4 y2 [2 R: \( e
  16. * modify it under the terms of the GNU General Public License as
    1 \3 B1 Y8 z; J5 `
  17. * published by the Free Software Foundation version 2.( L& r, C- v4 V$ w5 L
  18. *9 G3 T7 w( p$ a1 O* A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - d: B, X& }9 ?( P" \9 g
  20. * kind, whether express or implied; without even the implied warranty: i  s! o" x" \% F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % W5 M, l  q+ a  L6 q4 u/ [! T
  22. * GNU General Public License for more details.
    9 x, F" \5 }! G! X
  23. */; A# N; {# P4 r9 p: m
  24. , h( }4 p2 {9 G9 `* r
  25. #include <linux/module.h>
    3 l. T, o5 Q: D5 _$ i
  26. #include <linux/init.h>( c; ?9 T! Z# V
  27. #include <linux/errno.h>, g6 j8 \4 x; O9 |) k) j' P
  28. #include <linux/types.h>2 ?0 i% b1 L0 {( J: `  E) h
  29. #include <linux/interrupt.h>+ d; \! N, Q9 i7 n( g# O2 \
  30. #include <asm/io.h>" r  r4 r2 y: F
  31. #include <linux/moduleparam.h>: E. g2 @' v3 t
  32. #include <linux/sysctl.h># n3 ?- K5 N0 v. O: r! _
  33. #include <linux/mm.h>8 g) L* n& T( _" E6 O5 `8 `5 u
  34. #include <linux/dma-mapping.h># _" b9 a) Z5 X& n2 Z

  35. . L$ y- l, s, c5 E3 e
  36. #include <mach/memory.h>
    . @3 w: R' m" W/ ]
  37. #include <mach/hardware.h>
    0 J6 L1 D1 ?" K/ _: t$ Z# R, J
  38. #include <mach/irqs.h>4 X/ h/ k" X# n" u; g
  39. #include <asm/hardware/edma.h>/ A  G% E" Q6 F
  40. / o8 I: ]" [  c8 a+ M9 ]% a
  41. #undef EDMA3_DEBUG! h+ S/ w8 i: z2 f' |3 @( g
  42. /*#define EDMA3_DEBUG*/. B! I1 _4 U$ t: w

  43. 0 \$ n/ P( g) y; H, E6 m
  44. #ifdef EDMA3_DEBUG  }* F5 |0 t1 s3 ], N, m6 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; E' `3 ~0 q; K- E9 r1 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - |) r7 O9 y' Z- ^3 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 N- |( S1 h' j$ b& G
  48. #else
    2 j. Q7 S: F& H% Z1 b& Z
  49. #define DMA_PRINTK( x... )& o0 @; ]& W6 d1 C: b/ f
  50. #define DMA_FN_IN* I; T5 `6 P- _% @. \9 O0 z
  51. #define DMA_FN_OUT
    6 b0 c9 i$ L8 K' ^: I: v) g
  52. #endif& X9 q: S& ~, N6 X+ }+ w9 L
  53. . n# s8 Q4 h# M2 G$ `( w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & n# G! C& o( e+ j* Q. J
  55. #define STATIC_SHIFT                3# @% A$ q0 c5 G! l' N$ n
  56. #define TCINTEN_SHIFT               20
    ; V$ T, m6 S; u. ?- c% q
  57. #define ITCINTEN_SHIFT              21
    & E, n2 X6 ], U& s
  58. #define TCCHEN_SHIFT                22
    7 i; v9 O* l; y- `
  59. #define ITCCHEN_SHIFT               23
    3 g* D* c: |+ \' u: r: N
  60. . q) H0 D* p+ `' q. ~6 T
  61. static volatile int irqraised1 = 0;
    / v; j% s. P6 g: K4 ^
  62. static volatile int irqraised2 = 0;. H: c9 L( J# y) |  l- q

  63. % p. f" q: ~+ G7 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 D/ }& |, E4 u% E9 T& d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' N& b( @: E$ w) c, e- @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " V9 c2 e- `9 [  E3 n, d
  67. ( ]  s: C% y# G6 [8 x3 D
  68. dma_addr_t dmaphyssrc1 = 0;
    ( w1 Y' V$ X% x7 X$ D
  69. dma_addr_t dmaphyssrc2 = 0;. `5 Y* [" f" P9 F9 e( c! A; }8 {
  70. dma_addr_t dmaphysdest1 = 0;
    . |; a$ C1 S& h# T
  71. dma_addr_t dmaphysdest2 = 0;
    ; [9 I& a) G) x# {7 t" R

  72. 6 \, m; h7 m/ P$ W% m( Y
  73. char *dmabufsrc1 = NULL;
    8 ^+ Q6 S4 F( _# T9 J3 \
  74. char *dmabufsrc2 = NULL;: ~3 ?- Z1 u3 P3 Y) i
  75. char *dmabufdest1 = NULL;1 q3 r* m3 }' s5 k9 p' a' V0 _
  76. char *dmabufdest2 = NULL;
    3 c  e8 q& F4 [7 [
  77. 8 j) ^$ r! O4 f4 n/ T
  78. static int acnt = 512;
    3 q9 {( N* g) s, [+ a8 L$ r, s
  79. static int bcnt = 8;2 T! a; W# V: O3 S  F
  80. static int ccnt = 8;1 c: b* @3 d- g4 p5 F4 K
  81. 8 P5 r8 o# q8 z4 T, _4 E1 F% Z
  82. module_param(acnt, int, S_IRUGO);
    ! i/ a/ L7 E, W5 U' T& s: M1 p
  83. module_param(bcnt, int, S_IRUGO);
    , O2 W& Y; Z) H2 ^$ y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" F, ?, b+ D0 {' I: N6 y" I. n
6 z: m, x. Z( U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. @" v. O8 J; Y9 u$ ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 j6 z" V% [! Y4 I* n  ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# s7 ]4 O1 _9 E0 `! @
) F, t" T6 N- B& j" d8 ^. G! |! F* p7 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 06:21 , Processed in 0.037641 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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