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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) Y3 h( C: c, \2 O/ E: P
  1. [code]EDMA sample test application# h4 t0 L" C* U! j8 B" M
  2. /*; o5 A0 n# k* u( s6 L7 O
  3. * edma_test.c
    + ^9 p6 k/ y7 x
  4. *( n* K9 ]# `8 }0 T5 g1 [/ @
  5. * brief  EDMA3 Test Application
    ' s- f" s0 W! d" F
  6. *
    ; n. x8 f: g( F* Z
  7. *   This file contains EDMA3 Test code.6 J* }# z  X2 S) W$ N
  8. *0 q  y. w3 Q& Y  x: Q/ Y! c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . O) e8 |; A, e& v: n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 V; }  v% j. i. b
  11. *         TO CHANGE.
    , u+ ]* `1 d' a2 q8 T7 O
  12. *
    1 S" g3 G  N2 P3 d: U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 @' |% J# l' {" V( \" D
  14. *' g. l- B% e0 |6 Z3 v
  15. * This program is free software; you can redistribute it and/or
    & [7 z; B! B7 Q: n2 t) v% a
  16. * modify it under the terms of the GNU General Public License as5 Y4 I1 m7 @( C
  17. * published by the Free Software Foundation version 2.3 M6 ?8 e$ e0 U, P$ R/ {
  18. *
    - o1 h/ A: l7 P0 o0 n' T% G! o7 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 L6 b' h8 s/ c+ X
  20. * kind, whether express or implied; without even the implied warranty5 s2 G. L/ q/ e$ R' Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 H; o2 x; H0 U" W* r1 `: Z
  22. * GNU General Public License for more details.
    & o* g1 V% P5 N( K- m
  23. */8 \6 c: O. d: `9 U  U; b

  24. 9 ?/ u3 ^) I% \+ y5 O. o
  25. #include <linux/module.h>/ P# [# A$ ~) H# h( r2 S
  26. #include <linux/init.h>
    6 s7 a' N" M/ J; a, Q
  27. #include <linux/errno.h>3 j2 Y+ w8 B# r0 i3 }
  28. #include <linux/types.h>
    5 x3 i) C# c0 j3 s3 s
  29. #include <linux/interrupt.h>
    $ c, h6 C$ `) s. N
  30. #include <asm/io.h>: N0 ~  i" {; F+ h
  31. #include <linux/moduleparam.h>
    5 I/ |$ @' X7 Q3 f' V+ ?
  32. #include <linux/sysctl.h>$ D) f/ A5 z+ C* S$ k- `
  33. #include <linux/mm.h>
    0 f1 t  m/ b, Y: o
  34. #include <linux/dma-mapping.h>7 k/ l$ B! U1 X2 H3 l5 k. O

  35. ' o- Y6 Z  ]" V! J& J, ~. M
  36. #include <mach/memory.h>2 U) s+ v- i1 D4 e! F4 D
  37. #include <mach/hardware.h>8 u6 T) e) z/ G# B
  38. #include <mach/irqs.h>' A$ V7 F' L0 f! p8 ?$ I
  39. #include <asm/hardware/edma.h>
    , s1 c& d; t6 l% n8 X  u

  40. / e# w" l/ P% _2 ^
  41. #undef EDMA3_DEBUG0 e  J; S6 Y  h9 B; e" d/ J
  42. /*#define EDMA3_DEBUG*/
    5 b7 Q2 B9 }. O1 v. m$ H- G
  43. ; n) N9 c0 b9 v. B2 q9 b
  44. #ifdef EDMA3_DEBUG
    & L2 \8 w1 w, Q, {! S) ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 c: C+ w2 w9 @% j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 K" g9 Z% a! A' ^& T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 B1 `1 ~1 @/ i
  48. #else
    3 Z- D9 T" d+ g0 i/ P" g
  49. #define DMA_PRINTK( x... )" F0 e+ M4 F2 j& M4 j% f
  50. #define DMA_FN_IN- h5 L7 A  J% m/ v
  51. #define DMA_FN_OUT
    ! |4 t1 t& e6 t3 z$ _/ d
  52. #endif- u$ s& D; i8 m; e' Q3 N) _! {
  53. 4 O1 y% M- j) r  F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * h: ?  v% p5 c( ^- u5 V6 r
  55. #define STATIC_SHIFT                3
    0 H& H& o/ z( _' z, J$ ?/ G% e
  56. #define TCINTEN_SHIFT               20
    " }# c3 m1 o; ?8 c0 a% P+ H  v: R
  57. #define ITCINTEN_SHIFT              21& N, I9 N# `9 ?7 l9 I. A$ f1 D
  58. #define TCCHEN_SHIFT                22
    ! h& E1 ?7 k4 x; v( q6 R& L- ~
  59. #define ITCCHEN_SHIFT               23: [% O9 A2 h# i$ u/ e. T

  60. " K3 v; m0 h' u4 T; [" d
  61. static volatile int irqraised1 = 0;
    4 Z7 h% L6 j( b% Y$ A: t1 H/ `
  62. static volatile int irqraised2 = 0;3 V2 |5 l, n/ y- v$ k
  63. - {. x1 y7 f7 d, w5 |* ~' s* H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ^& ?- x3 W7 G. L7 u! {" v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 }3 c( V. V$ R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  ]4 k2 T8 L" I4 F+ p4 h. @
  67. * W( f4 a: E. U
  68. dma_addr_t dmaphyssrc1 = 0;& h* \- E; R4 x8 R
  69. dma_addr_t dmaphyssrc2 = 0;2 C- W# z# `4 O: w: M
  70. dma_addr_t dmaphysdest1 = 0;
    $ F, e) B7 s$ D) Z* Z! }. C/ S7 U- v
  71. dma_addr_t dmaphysdest2 = 0;
    - V+ d) y0 U5 B1 ]
  72. $ p  _& z/ x- i( y: W5 K
  73. char *dmabufsrc1 = NULL;1 q+ Q& T$ d) q' d9 V! K! X( d
  74. char *dmabufsrc2 = NULL;
    0 k, Z9 R, q: ^( S
  75. char *dmabufdest1 = NULL;
    % p6 R- |8 V' M: M9 y/ z& Q
  76. char *dmabufdest2 = NULL;
    ! R9 i2 d% O. M- b, i! r
  77. 4 l: e1 l5 D! s5 f  x: G
  78. static int acnt = 512;, I2 Q$ p; J, E6 F8 F0 A' k
  79. static int bcnt = 8;
    / P  M  f. H7 H1 w0 ^6 K  B
  80. static int ccnt = 8;( v+ P; \: ~4 I" G* E
  81. ; {9 e: t6 D/ @: x
  82. module_param(acnt, int, S_IRUGO);6 b$ `% [1 ^0 X% w
  83. module_param(bcnt, int, S_IRUGO);
    3 p$ B, \! V; a- a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% y! b0 }" C) ]: ]) ?$ [/ t  l

1 k. _! i3 w9 P- i* w' S+ p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 C; J3 v' G2 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' M$ T  m; s& n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. M' y, O9 [, a7 v$ Y
6 ^' K+ P* y( s' s! Q  W
" A( y7 {' i1 S, T7 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 21:15 , Processed in 0.043372 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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