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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 {! S, U- q2 r3 ?; V1 C, m. X; J7 t" C
  1. [code]EDMA sample test application
    $ O! p6 T( {( S7 M8 s* b1 T( K
  2. /*
    7 }9 ^1 ^6 t$ k$ ~, @& F
  3. * edma_test.c
    % O' y1 P1 a- ]% {- t& K0 C" p
  4. *
    5 r( q: N, F. U$ ]* _  U
  5. * brief  EDMA3 Test Application
    0 x: [! t" b0 T7 Q5 T- o
  6. *
    ; e/ \) w$ J& J* I( }9 w! Q/ |
  7. *   This file contains EDMA3 Test code.% F8 Y% ~; s  S7 g# B# h2 k5 A: k
  8. *- r1 S: D; I  X; P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( }4 {( p! |: d  A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 K( E! ]: b- g' Z2 |  r1 I( H
  11. *         TO CHANGE.6 I4 q. n5 Z6 d, [3 H
  12. *
    8 M- ~, Y( \$ }7 ]9 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , X( M. v2 |3 m( i1 N2 w/ V6 Y
  14. *
    4 e8 E9 @5 k2 x; h' }2 r6 D4 @- Z
  15. * This program is free software; you can redistribute it and/or5 u$ k* o- ?" `/ r3 K# v6 ]
  16. * modify it under the terms of the GNU General Public License as% G. o8 q/ p" {6 X; `
  17. * published by the Free Software Foundation version 2.  f3 v- N2 C3 T4 J
  18. *
    + T+ k$ {) m/ |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 }% i; F  L4 k* P2 o# z
  20. * kind, whether express or implied; without even the implied warranty% \4 @+ ^3 a" w& E6 U+ a" Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: W  o8 n8 r# }. ?; F: W
  22. * GNU General Public License for more details.$ `# W9 `% E# Y/ V& G9 u1 z
  23. */
    . Z$ Y5 P* I! E5 r: P, S8 `9 h* y
  24. - _7 ~8 ~* [9 r2 b- W8 U3 R1 [
  25. #include <linux/module.h>
    8 x) M! G$ r% d$ m  N
  26. #include <linux/init.h>+ {* y8 ]4 e7 S4 u# j3 A8 L7 v4 g
  27. #include <linux/errno.h>9 c  F! z) B7 u5 \, p* _
  28. #include <linux/types.h>
    ; Y- L0 }. ^  Z8 y- D) X$ A
  29. #include <linux/interrupt.h>
    , C7 s$ \% N8 o2 C: L! c
  30. #include <asm/io.h>
    ' \/ a" L& V5 [4 ?
  31. #include <linux/moduleparam.h>
    9 C+ [; ^% J" d7 v4 R
  32. #include <linux/sysctl.h>
    9 _: J$ [/ `3 h) g
  33. #include <linux/mm.h>
    5 Y  P/ ?2 c$ i: ?
  34. #include <linux/dma-mapping.h>% A$ g1 ^( u: b% M8 |
  35. & S/ ]" P! ?( _9 h, t
  36. #include <mach/memory.h>
    $ Y4 j7 d; B4 V2 g( v
  37. #include <mach/hardware.h>
    5 X- C7 c2 ~3 d# n
  38. #include <mach/irqs.h>5 ^$ e/ ]6 t5 y# K( O
  39. #include <asm/hardware/edma.h>
    ( ?3 o0 n" c% h9 l
  40. " m4 \) a; w5 [# p' q6 ]8 C+ A( h
  41. #undef EDMA3_DEBUG
    ! U7 C8 h. k# q( ^0 f
  42. /*#define EDMA3_DEBUG*// T4 D) M$ O  Q$ ?' X. ?
  43. , ?2 _% |' N: k7 S) H) t; |
  44. #ifdef EDMA3_DEBUG' N: {9 l  x, j. L& F  W/ {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 a2 e1 U7 O( p# ~0 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " H, j  h  O5 W* P% f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 Y( U; X$ A1 `% c# j
  48. #else
    0 y( L/ e+ E4 O7 C( b
  49. #define DMA_PRINTK( x... )4 Q* s+ i' u# G" a3 o  n
  50. #define DMA_FN_IN
    / J3 O3 n  Z: U+ s  g5 o
  51. #define DMA_FN_OUT! K+ q8 w/ c1 w0 f2 d& k' H
  52. #endif
      K6 A. ?% t  b7 N/ e

  53. 7 z0 X# I/ M0 u- F$ |, v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 E9 D: b" k/ ]" d8 `
  55. #define STATIC_SHIFT                3
    & n; o7 E1 k; s8 f% H3 N9 Z4 b: H# k
  56. #define TCINTEN_SHIFT               20
    9 X( G' K2 [  c8 f% N, [
  57. #define ITCINTEN_SHIFT              21( m  X5 V. r1 A- w' L
  58. #define TCCHEN_SHIFT                22
    , [% u* g& }; p) m3 Q3 p
  59. #define ITCCHEN_SHIFT               23' Q0 ?. h) b" h$ o$ q4 F4 Y
  60. ! t6 {% h% X) Q2 J) C
  61. static volatile int irqraised1 = 0;& L0 x# s9 z2 P0 R! ]2 J. p4 B
  62. static volatile int irqraised2 = 0;
    1 P. O" ^9 D& D+ f, k
  63. - m, n6 i5 Q3 J, C9 y! Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# A, I6 T- ^! `" b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; X: w: \# E- L3 t1 c0 E  n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) ?* b% e& a8 [/ h

  67. 5 V( }; u; s' }% W, E( P5 `) e  S2 I
  68. dma_addr_t dmaphyssrc1 = 0;
      i. |5 i) K* C  v6 l( W; d
  69. dma_addr_t dmaphyssrc2 = 0;7 j0 q5 m( X! @# T5 |1 X
  70. dma_addr_t dmaphysdest1 = 0;
    6 V; Z; M" i- k' l2 F/ V+ W5 ^
  71. dma_addr_t dmaphysdest2 = 0;
    , f5 _$ N3 R6 h$ C+ ^: q
  72. 6 c* U4 _+ k/ c9 U; i- F
  73. char *dmabufsrc1 = NULL;
    3 \& z0 w! L- V
  74. char *dmabufsrc2 = NULL;
      n, T* U) K6 \6 I. r
  75. char *dmabufdest1 = NULL;5 Z: C9 J# Z6 z6 K0 f
  76. char *dmabufdest2 = NULL;$ M5 a* n6 _, T7 X

  77. 5 D8 p" A. F; F
  78. static int acnt = 512;
    3 ]0 c/ y+ w! Z
  79. static int bcnt = 8;
    ) C7 X) _- `: x& n% O0 r
  80. static int ccnt = 8;+ C# z& v* C# G

  81. + s- w* l: s( k: v( L* D
  82. module_param(acnt, int, S_IRUGO);
    5 s' d/ |. G5 G$ n, h/ f
  83. module_param(bcnt, int, S_IRUGO);/ E1 R! i/ w/ y% G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% s2 q. D& M0 s4 J- E* O& c0 T
3 s, `2 _0 C5 J2 Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, ^/ U7 }, c$ I2 ~3 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) x( o! q  C  ?6 h# z4 k1 w6 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. B' [+ L3 i4 M% p! N/ r0 p0 q+ V+ o* R0 d! k5 k; e: u% x: ^% n

% N# t: b! h- ?% L& {% o6 {( B. k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 05:34 , Processed in 0.036094 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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