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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: y+ [6 K! S0 F$ g& O/ \# Q- X( A  \
  1. [code]EDMA sample test application
    % z' ^1 i7 N1 Q* T" @6 C
  2. /*6 Y  u- I- X0 x: E
  3. * edma_test.c
    4 H6 ]" I" w9 Y8 P" q
  4. *3 E( B- R6 s- l8 Z7 [+ E
  5. * brief  EDMA3 Test Application  D8 N( e2 _2 {4 x9 V- K0 k" c
  6. *. [. w/ }& W- u4 |7 D1 i
  7. *   This file contains EDMA3 Test code.
    4 P0 c( W$ B) A9 r1 S8 S
  8. *
    ( F% O0 f6 b* g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 [" |1 [% _. R6 q. V+ d, n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) f' \1 i) s3 f$ Q2 ]( g4 [
  11. *         TO CHANGE.1 Q4 b& l* b# D1 _6 q  ~2 \
  12. *
    4 o2 [$ f' Y7 ?" P3 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 G/ w2 l( m1 I5 P  S- B
  14. *5 W" X  u  R* c3 _) D6 \
  15. * This program is free software; you can redistribute it and/or. K, u4 J- W7 f; I8 n' P7 E
  16. * modify it under the terms of the GNU General Public License as
    5 o! B9 ]* D+ M
  17. * published by the Free Software Foundation version 2.
    ; f# W; O4 g- ^1 B
  18. *
    ( s' I4 o4 }9 L0 J! C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % H7 `% n0 ^# |. _
  20. * kind, whether express or implied; without even the implied warranty, Y" X7 Q6 f0 N# c8 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 _* K8 T- @& h4 e& C1 D6 S
  22. * GNU General Public License for more details.
    4 W9 @( v$ g% Z! r" a! t" C" [
  23. */
    - ]: \; [& t4 H! B+ p% V4 h4 X

  24. 6 O/ j8 B. _: C+ u  U
  25. #include <linux/module.h>3 \, I/ ^7 p5 e+ W4 b; m- F9 X
  26. #include <linux/init.h>
    % T: J+ c3 \7 R5 z5 _; P1 V
  27. #include <linux/errno.h>5 M! i6 k- P: N1 z
  28. #include <linux/types.h>! J# w* X7 B  u+ o9 ~% q$ i
  29. #include <linux/interrupt.h>
    ' Z8 A$ ?: ^5 n0 L
  30. #include <asm/io.h>
    " g' U# o/ w: J; [
  31. #include <linux/moduleparam.h>
    0 `; t7 d  h1 F; o/ R# Y( j6 A
  32. #include <linux/sysctl.h>2 U: |# [3 T5 e- f4 o
  33. #include <linux/mm.h>7 s! d' s, }8 W9 c* c( C" @
  34. #include <linux/dma-mapping.h>! D/ n" k6 A  s0 Q
  35. # v0 d0 ?0 T" d: j2 f
  36. #include <mach/memory.h>5 D: p: P- b8 b* b
  37. #include <mach/hardware.h>! e# X$ K! A  m$ l" q- B! F( n
  38. #include <mach/irqs.h>
    1 S; s8 v7 p7 c- k3 ?7 o
  39. #include <asm/hardware/edma.h>
    " w. |" `5 |9 X$ r: I

  40. 9 U, W. ?* E6 Z  ~- T* L
  41. #undef EDMA3_DEBUG
    / c' m3 c) G) q, y
  42. /*#define EDMA3_DEBUG*/
    # N( E" p  H7 x9 M3 {

  43. 0 I& L  i, A! [& I
  44. #ifdef EDMA3_DEBUG- K, J# x4 |3 U+ I' ^6 }3 I& Y2 I4 }; @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * v& }  u* H' m3 r. I! [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      e# b$ \& A% g. X7 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& ~/ J1 y" [, B
  48. #else
    7 A4 h+ Y5 V! V% r" l6 B
  49. #define DMA_PRINTK( x... )
      `8 z/ O7 ~* L' v5 d" o& o
  50. #define DMA_FN_IN
    8 G4 k$ t2 _, v9 w0 R
  51. #define DMA_FN_OUT
    9 @" T( f  l  a
  52. #endif
    ! t/ J( ~# V- b5 `
  53. + q( V8 ?8 r4 A% e# y- _5 A) m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 @  R. X# p; R4 Y; n0 V7 E
  55. #define STATIC_SHIFT                33 A3 Q' L; p. ]3 w$ K
  56. #define TCINTEN_SHIFT               20
    1 H$ @7 Q5 ^' d7 Y
  57. #define ITCINTEN_SHIFT              21
    * B% j" j" X8 E3 o- J3 t6 u
  58. #define TCCHEN_SHIFT                22' T7 D: K. H; o  U# J) U9 [' q
  59. #define ITCCHEN_SHIFT               23# l' ]6 R8 m3 t/ u2 w
  60. 8 ~6 p, J( B  N+ Q8 }
  61. static volatile int irqraised1 = 0;  L4 s( V6 t& N$ m+ J( o/ @, l- j
  62. static volatile int irqraised2 = 0;3 D! K5 U9 v8 ?/ w* R( ]! M  \
  63. * @# x' Y; Q% F+ O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 K" a8 S, D' p/ t  E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' d5 w4 ^9 O1 f& H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- v7 {6 }0 l& O, E% E  |3 S
  67. 6 ]* g2 G6 r2 P7 E9 `: q4 g
  68. dma_addr_t dmaphyssrc1 = 0;
    / b1 U0 r+ G( {7 v+ i; u0 W
  69. dma_addr_t dmaphyssrc2 = 0;2 E; y! j# c4 q& u
  70. dma_addr_t dmaphysdest1 = 0;
    - X, f! k; K9 h+ H6 G
  71. dma_addr_t dmaphysdest2 = 0;4 G0 F% p+ ~; q& ^: R* q
  72. 7 b$ ~. \6 @* g- p, y# b2 M7 i; |
  73. char *dmabufsrc1 = NULL;. K, P' @1 N$ V5 p9 X5 D# i
  74. char *dmabufsrc2 = NULL;
    $ d% r* i9 v% c7 o" k1 V+ R& Y
  75. char *dmabufdest1 = NULL;
    ' S3 l2 A+ E: M5 T% I
  76. char *dmabufdest2 = NULL;$ @  [$ s2 B& _# j5 J

  77. 4 f: [( U+ j* V" p; S/ G  o
  78. static int acnt = 512;
    3 k" A) J3 Y6 p2 S0 S) D) B# E0 C
  79. static int bcnt = 8;
    7 I1 w8 e+ a" Z% Z* Z
  80. static int ccnt = 8;' h, q$ `0 M* n& y- G9 T1 B  z- R
  81. 1 O% E( h( ^- G. z8 Z" L
  82. module_param(acnt, int, S_IRUGO);- r+ M; K0 M* _
  83. module_param(bcnt, int, S_IRUGO);
    ! O- c9 H" n; c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) m- C+ j; a+ O  O
% d" |5 w) I' \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 N; A/ m# K. L9 ]* Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) B# ^3 A) k& e7 ]9 f1 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ Y9 s; x. E* u4 y: c" e+ }) N5 [% P0 H' T5 \2 [; l$ o! Q8 J& A: O
3 y3 O/ y/ m$ N0 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 12:59 , Processed in 0.088803 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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