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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% n7 L& \- l* x. k! j
  1. [code]EDMA sample test application3 o" {7 q3 ]! i- B
  2. /*% E$ O5 C$ {/ P4 Q3 R
  3. * edma_test.c5 X4 s! N" i% T$ q
  4. *
    / y! |6 h/ I% q" Q
  5. * brief  EDMA3 Test Application
    6 `- M, Y/ D  i. U: N
  6. ** o/ W0 e4 }% W! c3 g! s2 |+ G
  7. *   This file contains EDMA3 Test code." `6 n* o6 R9 [; U* d
  8. *' A& D6 J3 D* B, ]2 w/ Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( a; P# S& t  ~' k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  q' M; B! J% B! F( V
  11. *         TO CHANGE.$ N/ c* S1 j: I9 E9 _
  12. *+ P. P+ g) s, I- i% P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 g$ U: ]- ?8 {* M+ @
  14. *
    * e% `% [. w& \1 i- ^; C! `6 x
  15. * This program is free software; you can redistribute it and/or
    / T3 U- w) Y9 G7 c1 i
  16. * modify it under the terms of the GNU General Public License as
    3 o0 R1 l) v3 J' H, x) I, o& f! \
  17. * published by the Free Software Foundation version 2.
      _0 R( t5 x" B" i' W/ i2 u. B- Z
  18. *. U6 G  n+ u! a: O8 x5 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 B: ^" H1 @# ^# s6 q7 r
  20. * kind, whether express or implied; without even the implied warranty: \- U8 C! y) O2 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 H3 B1 N. x( ~6 t( n) C
  22. * GNU General Public License for more details.7 I8 N3 j+ `+ W8 d1 a4 p
  23. */7 M  v$ i6 L3 \+ h4 r
  24. & `- M' s, B0 |( U( c- A1 z
  25. #include <linux/module.h>8 I  {+ B5 }7 O) r. p( Q
  26. #include <linux/init.h>
      Q5 V& t/ B3 z' R7 n
  27. #include <linux/errno.h>
    ! Y6 p# T) y8 }. C8 D
  28. #include <linux/types.h>
    ! H9 p% h. e3 f& l' s
  29. #include <linux/interrupt.h>
    5 C% Q. e3 l3 w0 P
  30. #include <asm/io.h>
    % m. W# t5 M0 U: t$ }
  31. #include <linux/moduleparam.h>
    & Y) X# L( t0 O8 |
  32. #include <linux/sysctl.h>9 W4 b/ X, F1 D( G  a
  33. #include <linux/mm.h>5 i1 @1 c% w+ q. g$ g
  34. #include <linux/dma-mapping.h>1 q: C  M0 r. v2 ~' s' U

  35. + i' X1 u/ j2 w) Y& P! _
  36. #include <mach/memory.h>5 K5 G) l8 h3 a2 e
  37. #include <mach/hardware.h>- m/ }  s: w+ D# V  q) y, x0 s. _
  38. #include <mach/irqs.h>/ B* s; M6 `6 Q5 t" Q- e8 }$ S
  39. #include <asm/hardware/edma.h>& @# }' a" r, m& [* O

  40. 2 J7 r  |+ n  N% Z0 N" C0 K, K: Y
  41. #undef EDMA3_DEBUG
    % B& Z/ N: _( h4 |
  42. /*#define EDMA3_DEBUG*/& u( d' [! J* g
  43. 0 G0 P3 z' {0 `& D0 M
  44. #ifdef EDMA3_DEBUG
    0 N1 b4 Z* \8 ]; i0 F/ b: y1 T6 `7 |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% N) B3 B2 n5 w! l/ c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 T. y5 g: u9 L8 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ |+ P* W) o2 H$ V
  48. #else
    : k( a; \6 V; P  [+ g) q
  49. #define DMA_PRINTK( x... )
    ) P9 h2 z+ p- w" |' T/ |# U
  50. #define DMA_FN_IN! r  e. B+ W$ n' W
  51. #define DMA_FN_OUT% m  W% {# a! s
  52. #endif
    / P4 `& ?/ z& X

  53. 0 N; |% h; T1 t4 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & B$ Z9 Q6 [4 }+ e0 Z
  55. #define STATIC_SHIFT                3
    . o0 q9 E4 @4 C! W  O: V
  56. #define TCINTEN_SHIFT               20
    5 R# ~- ]% q, Y
  57. #define ITCINTEN_SHIFT              21
    ' `7 |) c* |3 Q6 ~$ U2 i
  58. #define TCCHEN_SHIFT                22
    . i4 Z' @7 y9 V2 F3 B9 N
  59. #define ITCCHEN_SHIFT               231 d) @2 \4 f& F4 c! k

  60. + I) E* P" a% `
  61. static volatile int irqraised1 = 0;
    ; [; g3 l! k; Z0 F: \& R
  62. static volatile int irqraised2 = 0;/ X9 Z: l: l# r4 A# f' l

  63. 8 b! k) F: P5 v# F4 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 ^8 M8 t' y: t+ ~5 N% Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * G' [; x! r" l! H* o% Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) f3 t# ?2 r8 F9 G/ N

  67. % @! h) H0 A$ L9 w
  68. dma_addr_t dmaphyssrc1 = 0;" D; E4 M, ?6 s5 R
  69. dma_addr_t dmaphyssrc2 = 0;
    7 {5 B& j0 X# r/ ~' E
  70. dma_addr_t dmaphysdest1 = 0;
    ; M" c: M6 w2 L# I) V7 ~' q7 s; c
  71. dma_addr_t dmaphysdest2 = 0;
    . l2 D" W- |7 c9 V
  72. 1 {) {& M- T, \, m0 j
  73. char *dmabufsrc1 = NULL;
    6 T( L7 R0 t9 @
  74. char *dmabufsrc2 = NULL;
    , l( a. t' a# g1 D; V. q4 m7 z% C
  75. char *dmabufdest1 = NULL;
    0 B- j6 B' q; |9 _3 @( z' k
  76. char *dmabufdest2 = NULL;
    ! o* _4 p( `* l8 J
  77.   a* q8 x; E6 s
  78. static int acnt = 512;
    " Q/ _" @5 W) d7 c$ [4 Y4 J
  79. static int bcnt = 8;' x9 g( H0 F9 e' F
  80. static int ccnt = 8;
    4 U# |2 R( ?( I+ C) T+ X# f; o2 G

  81. . O) E% J) |& D7 G6 I
  82. module_param(acnt, int, S_IRUGO);
    7 H1 M) p) f, E, [- H/ M0 o
  83. module_param(bcnt, int, S_IRUGO);3 N% \2 Z) O( {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 ?7 f' M+ _. |8 ?

8 O, B" V* y8 s' e( v- p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ I+ b5 l2 H# T, `! Y1 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  ?' |$ ~8 w  z1 [$ Z, F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' O: d4 v4 H7 ^' p; u* d3 G3 \

  V5 x( u3 M+ v; V9 M+ f1 `2 i8 f% ?: d4 x+ V3 }7 Z8 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 04:00 , Processed in 0.038441 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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