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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # \0 C  s% U0 _, a+ l* y1 h
  1. [code]EDMA sample test application
    * j+ X9 o+ l! \7 K+ u- @, m; k
  2. /*
    # T. x( G) @4 ~0 m" I& J
  3. * edma_test.c
    ; q0 C$ f4 t/ C
  4. *9 _. `& K* I2 @3 M
  5. * brief  EDMA3 Test Application, M" U# N+ D, y3 \3 [+ A
  6. *1 D* k% r6 q9 y
  7. *   This file contains EDMA3 Test code.1 [' Y2 y7 ?! j
  8. *1 U! @! G/ M) A, m% v  j" O1 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: k9 G9 c. J6 G# v" v& |# c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / z* w) s4 u4 G* a
  11. *         TO CHANGE.
    ; F6 M. x# [5 d  n  i3 |4 l# l% K
  12. *
    % V) J# K0 t; R/ J  h: V; i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 e- p3 N5 H9 B7 P9 Q% ^7 l5 y
  14. ** v" x+ M. v1 q/ d
  15. * This program is free software; you can redistribute it and/or
    3 r  w# V9 X, j6 v# o4 N3 D
  16. * modify it under the terms of the GNU General Public License as5 u  T4 `; W3 G* W4 f( ^
  17. * published by the Free Software Foundation version 2.
    2 g7 G* X/ R9 E% i) I
  18. *
    ) C3 g4 q# Y+ i' _8 d1 V" |1 _* {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 I+ R) a7 F$ J" r& J2 f9 a
  20. * kind, whether express or implied; without even the implied warranty
    2 x: x* V0 R! |5 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 ?9 y1 A0 \6 q& p, |1 d$ ]
  22. * GNU General Public License for more details.
    1 Z2 G1 i% ~7 O& C, N" i0 @
  23. */
    & W1 A! v# ?( F) v- q! o

  24. ( @; I1 c7 _7 c- U+ q: t; X7 e
  25. #include <linux/module.h>- }5 K( ^  U# s/ b
  26. #include <linux/init.h>3 i4 y' k0 t% W0 S; l- i- M+ v
  27. #include <linux/errno.h>
    2 s0 O$ f) S: b" _
  28. #include <linux/types.h>3 o8 t: b& ?/ b; \; \
  29. #include <linux/interrupt.h>
    * m; C$ x- o* w$ j3 J
  30. #include <asm/io.h>
    7 f5 Q6 J* v. S, M3 \9 `# A. C
  31. #include <linux/moduleparam.h>" m% O# s# Q% P( d, t* ^: \- T
  32. #include <linux/sysctl.h>
    ! Y; ]) X" n4 x$ P" D2 Z: D
  33. #include <linux/mm.h>% Q6 H6 v/ {1 O, y7 K6 J
  34. #include <linux/dma-mapping.h>+ z- P: t( D3 p( I

  35. / @( U. b  ~, S. f
  36. #include <mach/memory.h>8 N* \! ^) Q$ w3 H- R" G+ b
  37. #include <mach/hardware.h>. o! h; }/ q  l$ C; d
  38. #include <mach/irqs.h>$ `6 P1 `+ w! O
  39. #include <asm/hardware/edma.h>' A$ K) I4 i: {
  40. 4 p! g' [! S5 b" u- G
  41. #undef EDMA3_DEBUG6 ?- b1 F) V( l, r4 l7 E* p* o* N. x
  42. /*#define EDMA3_DEBUG*/  n7 n! d7 J" a! Y4 m, G+ h
  43. 1 l. E) `; P2 M' M
  44. #ifdef EDMA3_DEBUG8 [$ I5 I: b: P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , l2 H6 }1 h1 V1 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% ~$ g+ W' v$ ?  c3 {& Y$ |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! H2 X7 z$ W% l. _
  48. #else
    # {" e" E# F1 ~. E% y$ C& `
  49. #define DMA_PRINTK( x... )3 s1 }* Z3 `, N, A# u
  50. #define DMA_FN_IN+ x) `" G1 A. a5 `4 u
  51. #define DMA_FN_OUT% w5 H2 t! \5 h, d7 n
  52. #endif
    8 O3 V# i* u$ f6 D
  53. + g* l- j  P. Z+ M) U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 v1 p. H# V: _4 h
  55. #define STATIC_SHIFT                3
    - ~8 X3 [2 i- j& H3 J9 B- y) W0 n1 {5 z
  56. #define TCINTEN_SHIFT               20
    4 a7 k0 Q0 d3 ~& x
  57. #define ITCINTEN_SHIFT              211 Y5 _1 \4 U5 `& \$ A
  58. #define TCCHEN_SHIFT                22
    ' R2 r* v6 n& ~1 I& Z" O" B
  59. #define ITCCHEN_SHIFT               23# T9 b8 M8 m5 Q0 w( v8 |7 r( q
  60. 4 F  C0 L& q# k& t
  61. static volatile int irqraised1 = 0;( S( _4 I  E# P- V  C& s) ~
  62. static volatile int irqraised2 = 0;. u9 U, h/ |2 n- R/ p) k
  63. , S6 @; I/ O6 y  H% D: n- y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! [7 e3 H$ P7 g' |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - C  U3 }* M! Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# A6 b8 F6 }/ B& q9 Y7 U9 |
  67. + @5 b8 l& G4 f5 Z
  68. dma_addr_t dmaphyssrc1 = 0;' T9 c9 T/ j+ Q1 }
  69. dma_addr_t dmaphyssrc2 = 0;
    - a! z3 I7 _& B6 U1 S, t+ R( l
  70. dma_addr_t dmaphysdest1 = 0;" p- X: z4 ]8 p5 |4 ?' P7 ~) P+ Y; ^
  71. dma_addr_t dmaphysdest2 = 0;
    ' C& F8 d' x7 E$ A

  72. / C! j: B% ]: ~& [- R: P* _( N
  73. char *dmabufsrc1 = NULL;6 {6 S  @* k" R* L8 K. J2 H
  74. char *dmabufsrc2 = NULL;
    ) C3 J' v: L# T
  75. char *dmabufdest1 = NULL;! m1 P' }3 i$ B8 L
  76. char *dmabufdest2 = NULL;
    ; R0 c! Y& g# R# ]" E

  77. ) l# a, n. f: E( k$ @9 I4 R' a
  78. static int acnt = 512;
    $ d! Q7 D2 P2 D' y* e8 y2 F
  79. static int bcnt = 8;
    8 M3 n5 o% A. r+ S5 y) ^6 u
  80. static int ccnt = 8;$ }7 c4 ?- @# P' H$ }2 F
  81. 9 F$ \% D! S+ T7 [& P% G, O  K
  82. module_param(acnt, int, S_IRUGO);6 b7 c' p) l, T8 g  @+ t
  83. module_param(bcnt, int, S_IRUGO);
    + F1 o, Z* Y' ]" O! m  a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' C+ |5 K. a& J
; F7 M/ c  D! K4 g- ~0 X5 W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" Y& e5 X+ K/ v" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# b7 v3 S( ]( p; ~: G8 I) `; t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; Q% m4 \' ^+ w
9 B" }2 ]$ m6 b& o4 r: D
4 u) W/ L# o- _5 j; _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-8 21:31 , Processed in 0.042516 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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