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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 m! p; _" ?1 j7 v  Y
  1. [code]EDMA sample test application. ?" i# V3 Q1 d* f1 V
  2. /*
    % J9 i& R% r8 g" g9 _
  3. * edma_test.c9 Z5 [  t, `8 s# p2 N$ \
  4. *" R$ B: A2 c0 g/ r$ R% A* I
  5. * brief  EDMA3 Test Application; A. b$ C+ t8 ^. e
  6. *
    1 }" U5 |; l% y2 F, O$ j
  7. *   This file contains EDMA3 Test code.7 P" C& a) `+ Y% e: U
  8. *
    0 l5 j, R5 H3 U  ?' I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 }4 ~/ ~4 D- m: _+ |! }, o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ t* h: j) h- b" X' K
  11. *         TO CHANGE.
    ( _0 @6 m$ `+ K3 q" ?
  12. *
    4 V! b/ \1 T5 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # J; ~1 d. b1 t3 s2 f% ~
  14. *
    1 P& O; c/ v9 N% m( @! W: H
  15. * This program is free software; you can redistribute it and/or) m# ]/ w0 P4 q& b; D1 D
  16. * modify it under the terms of the GNU General Public License as1 P$ Z# F5 ~, i8 l* e
  17. * published by the Free Software Foundation version 2.
    ( r1 P  \+ z3 A
  18. *8 j% E5 d9 H; u# |4 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" ~1 P; W) S/ p
  20. * kind, whether express or implied; without even the implied warranty
    + G' b# V+ z7 k) [  E1 u, Z" |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; g$ v  |  B0 e$ ~% h
  22. * GNU General Public License for more details.
    6 n* y9 N; F* Z5 L+ C
  23. */
    ) l# E( F0 \' O& h8 f( x

  24. . b6 q; r/ z7 V5 R
  25. #include <linux/module.h>
    ! x( ~! {1 H$ S! n
  26. #include <linux/init.h>7 p8 q3 k) `8 \- K) g' h: j" w
  27. #include <linux/errno.h>$ v9 F9 z( B  {$ I' p7 r
  28. #include <linux/types.h>0 U* S# ?+ ^7 O! Q7 o
  29. #include <linux/interrupt.h>
    8 Z" g3 Y2 q5 M) A- {$ o* m
  30. #include <asm/io.h>' z( ^$ L; i2 Z
  31. #include <linux/moduleparam.h>
    ( U- j3 K. ]2 R$ J
  32. #include <linux/sysctl.h>1 H0 F+ J1 U+ R9 @
  33. #include <linux/mm.h>3 D, c3 k" g+ J  U4 q) W1 I  x
  34. #include <linux/dma-mapping.h>/ A% u5 P) g+ ?

  35. 0 _( H+ a) O! Y, Z- b0 H
  36. #include <mach/memory.h>& |7 Z3 h- D. L) X1 ^
  37. #include <mach/hardware.h>
    3 r9 A1 ~3 b" Q  s+ [9 p* ]3 ^: j
  38. #include <mach/irqs.h>
    6 [$ k5 U/ d" y, \  r. w! x; O
  39. #include <asm/hardware/edma.h>2 f! L. s) b, g% O/ H6 p

  40. 7 {; g. L  X( T
  41. #undef EDMA3_DEBUG
    3 T: t& Y, J0 o7 x
  42. /*#define EDMA3_DEBUG*/
    5 ?2 [; y, h4 D8 S) `

  43. 4 i, T* D3 J# j" K7 [3 H* m: u
  44. #ifdef EDMA3_DEBUG
    ( d8 J7 g6 }; c8 o' @$ R+ r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ M. o' b- m# y, _5 a5 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 i! [2 i# y: a2 O2 ]6 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 D9 p7 |2 Q6 u
  48. #else( w2 v1 `' r3 v$ {0 k
  49. #define DMA_PRINTK( x... )% S# e! o+ O7 Q+ f2 H7 h
  50. #define DMA_FN_IN0 i' a. [  y3 q/ {+ B
  51. #define DMA_FN_OUT
    & v( H* N- H3 P. Z2 [
  52. #endif
    + M- o2 t! k; S% E+ q
  53. 3 |+ M* P8 t, ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + W( G5 W4 z5 `: R' w
  55. #define STATIC_SHIFT                3
    9 h5 p' m% d& H+ w0 n/ A0 w
  56. #define TCINTEN_SHIFT               20( K, ~# p( n, x4 U) g! H
  57. #define ITCINTEN_SHIFT              21+ M) z  y, k/ p) P( _4 R4 f' p
  58. #define TCCHEN_SHIFT                22
    6 L9 c% D3 v: b# ?7 N) Y4 c1 S% c
  59. #define ITCCHEN_SHIFT               23  d5 @+ L, x  a& ]# W# Z2 ?

  60. + x; N! W8 N$ i7 k& D
  61. static volatile int irqraised1 = 0;
    - V5 g) g/ f! q1 k  e
  62. static volatile int irqraised2 = 0;
    ( B2 s7 j* w8 K7 g

  63. 8 L  G) |+ I5 [" L2 U3 z: x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ c; g$ K& P3 w' [: S; j/ I1 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! s7 C2 O; v8 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 Z8 g3 |. x# E; C

  67. ! x3 A; S$ H2 o% M0 m2 ]
  68. dma_addr_t dmaphyssrc1 = 0;% _9 Z6 g* O& A& u/ u; ^
  69. dma_addr_t dmaphyssrc2 = 0;1 F, q& n! `; |( z, B, @& c$ O- {
  70. dma_addr_t dmaphysdest1 = 0;
    1 q8 v. Q( {0 c
  71. dma_addr_t dmaphysdest2 = 0;
    0 K! c5 E. I6 t, y; f% e
  72. 9 N% M" ^/ z6 w& q( i- W
  73. char *dmabufsrc1 = NULL;5 I, o1 J" F7 n( [8 L) w  t4 [3 ^
  74. char *dmabufsrc2 = NULL;
    8 _4 V; `) D, n7 [, Q
  75. char *dmabufdest1 = NULL;
    ) |! B8 ^9 z' r8 x! q; b/ _
  76. char *dmabufdest2 = NULL;
    / I- G" g; }) A9 a1 }9 v

  77.   x! N. _! d& w9 W, o+ _
  78. static int acnt = 512;
    0 p6 v+ O! Q8 i6 C- z
  79. static int bcnt = 8;
    $ u$ E* o6 v! o7 I3 g
  80. static int ccnt = 8;
    * E5 C" `( l8 n8 a7 h' w
  81. 8 [7 C( K  F% S
  82. module_param(acnt, int, S_IRUGO);- |2 j9 @# {' h3 _3 m4 D) T
  83. module_param(bcnt, int, S_IRUGO);8 Y# W: ]& G* U7 ?: o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" m' O- f7 R5 ]# h$ ]
2 O; _, s0 j4 I, R. I; R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ u0 B, ^9 l: Aarm-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 g* h- N- G6 `- [+ B" A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 c: z2 q# P7 s* ]5 b, z
; H3 u9 c' p. u- R* A4 \6 a3 R- [

- |+ m) R0 _, X: U( c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 12:34 , Processed in 0.062187 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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