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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 f$ H2 N6 E: D* \. R# t
  1. [code]EDMA sample test application6 ~+ p# a" g' h* F: L+ U. G
  2. /*+ W) A7 \7 m' |0 f! m
  3. * edma_test.c$ R+ ~/ A# ?/ f
  4. *$ \' F  J$ m: ]4 r; ]- o3 E
  5. * brief  EDMA3 Test Application' k' x% O1 Q9 w+ H
  6. *( t7 O/ a% z& F/ N: u  G7 W3 K
  7. *   This file contains EDMA3 Test code.
    0 s: o# X1 J8 @# o  o" o! Z  f2 y
  8. *
    ' o0 ~& u3 ^/ T9 f& J4 r: D( a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  R1 B; P( U& v2 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  U7 B; u- k/ H6 V. a2 r: y
  11. *         TO CHANGE.3 c5 P; a* V8 Q( D  f% p' `
  12. *0 I4 {9 p( [: u% c6 J+ k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ s' i8 O' B" @) T' I# @0 B+ C( W8 V& B  Y
  14. *7 \' V: i" J. c# w# G* v
  15. * This program is free software; you can redistribute it and/or
    7 r. X4 G$ w; i2 w4 G
  16. * modify it under the terms of the GNU General Public License as
    ( q' @7 a& f+ x1 J; E: |. W
  17. * published by the Free Software Foundation version 2.
    " w5 C0 U3 C! p' X) ]2 q' [
  18. *9 d  P, t' i) w- V( \! i8 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 [& R. W* l/ u# N" y
  20. * kind, whether express or implied; without even the implied warranty; h* D/ b5 f5 @) J# p- R, N1 I* U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ l1 v0 A+ J% }; Y1 L! F) y
  22. * GNU General Public License for more details.* B& f8 V$ T/ ^4 o+ K9 k
  23. */
    : u( N" e8 c  L8 @8 o9 E: c
  24. # J& d2 f! U5 _1 M/ v
  25. #include <linux/module.h>
    2 ^% r& t/ x# z
  26. #include <linux/init.h>
    5 L0 B% j+ `$ ~, ^0 m( S6 c
  27. #include <linux/errno.h>
    + {2 \/ C5 H# D2 f. c
  28. #include <linux/types.h>$ V2 D3 j! A! \5 M/ V/ k/ a! M+ g
  29. #include <linux/interrupt.h>
    % A+ I- D- m% [1 F; }# D
  30. #include <asm/io.h>$ ^0 D. T* O9 n
  31. #include <linux/moduleparam.h>
    5 [  |/ M- {5 p" l9 V. ~
  32. #include <linux/sysctl.h>
    , b6 A- {% u& L) b
  33. #include <linux/mm.h>
    0 e  D6 d/ r" |+ y& `
  34. #include <linux/dma-mapping.h>
    ( j$ \6 `+ }+ n' c: ?
  35. ; N! D) D# z7 s+ u; {# H
  36. #include <mach/memory.h>0 R; S9 k) x/ k/ Q" ?
  37. #include <mach/hardware.h>
    ) M, v& o+ W, P0 P9 Z
  38. #include <mach/irqs.h>& ]) u+ D3 h4 J' u( s
  39. #include <asm/hardware/edma.h>( C: g" h; j5 }: ?! Q3 j# B  z
  40. + o% u- M' l2 a# @+ t
  41. #undef EDMA3_DEBUG# ?2 Z" P9 Q' s. G) Q- }
  42. /*#define EDMA3_DEBUG*/7 S( \) ?2 N- B) _% x: C
  43. 8 _2 y5 G$ l1 m
  44. #ifdef EDMA3_DEBUG, W3 i6 e! k: G5 h: ?7 s0 J% D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 c. N4 U. |; {  e0 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 @# b# {& p" h/ l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 Y( G$ T9 o" U
  48. #else9 d7 A& V, ~7 I# c
  49. #define DMA_PRINTK( x... )# Z8 t8 }5 o# G, p) s
  50. #define DMA_FN_IN
    2 [) M( j/ E: z! c
  51. #define DMA_FN_OUT* P4 U5 Q3 [+ D( e& X& b
  52. #endif
    & W* ?+ q: U- }( X* w+ \5 x" w
  53. ) z8 V* A/ I, m0 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , z) a; {$ B% v4 ?8 Z6 Q& o
  55. #define STATIC_SHIFT                3/ z" _4 g3 d7 f2 K8 a2 J. }" c0 C" w
  56. #define TCINTEN_SHIFT               20
    $ I8 I6 B0 j# W% h3 y3 U+ {
  57. #define ITCINTEN_SHIFT              21
    $ y! E  c- f$ ]7 \7 N/ ~$ p' C! j
  58. #define TCCHEN_SHIFT                22
    / ^* ]# U! d$ W
  59. #define ITCCHEN_SHIFT               23
    4 E; S/ D: u, @
  60. $ t& @2 t: s9 {' n
  61. static volatile int irqraised1 = 0;
    1 O5 C7 ^- x2 }
  62. static volatile int irqraised2 = 0;% d/ _& \/ n; o, H2 e
  63. # N4 Y5 P# r4 `3 t7 [% o: A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% S3 f( W, s$ U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 _  o) c" M% P5 s0 R, ~0 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) M8 R+ X  W" l
  67. 3 Q& _; V  Q2 e) h3 u" B7 Z
  68. dma_addr_t dmaphyssrc1 = 0;& q& i( Z2 C3 Z$ M  q- z
  69. dma_addr_t dmaphyssrc2 = 0;
    + O' C! Q  Y! j; ~
  70. dma_addr_t dmaphysdest1 = 0;
    + _# @& i: }. Y4 M# j& z! X
  71. dma_addr_t dmaphysdest2 = 0;1 \- l. z. [+ i/ g, s; m
  72. & u# t" ^% \4 J( P4 ^
  73. char *dmabufsrc1 = NULL;
    & v+ r. M& g) N" N' O- N
  74. char *dmabufsrc2 = NULL;: r; @( P8 l0 `0 q
  75. char *dmabufdest1 = NULL;# V: S% b6 ^6 u, T
  76. char *dmabufdest2 = NULL;
    7 d" V3 h  f9 i! o" `

  77. ; x7 @( U" t$ h# T8 J6 p
  78. static int acnt = 512;
    7 @/ @, l4 H, W
  79. static int bcnt = 8;
    ! {/ S1 T/ X6 Z& D+ L. ]: ~
  80. static int ccnt = 8;1 s% U5 z7 P, Z' [$ ?
  81. % L# y& f; f' ^
  82. module_param(acnt, int, S_IRUGO);# L4 s2 T9 A9 m: j
  83. module_param(bcnt, int, S_IRUGO);: p+ H6 e3 |0 D4 W" r1 x* ?' n9 E( h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ O4 j% i3 Y, T% N/ Q8 I  _1 y4 F  L: A; `5 _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 t" s2 Y) _! h+ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# q+ l. w, E7 C& |+ r+ A' v, ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ o5 B" z. T% r1 r% B6 t# ?9 R2 Q3 d/ Q/ c6 n

5 @$ c, U. [+ d- Z$ s, s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 14:33 , Processed in 0.043553 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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