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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! z" N# H+ V. P9 E
  1. [code]EDMA sample test application! Y. N- B& F+ N) o" K
  2. /*2 D8 }# G) P3 x5 N. a( A( J4 @
  3. * edma_test.c
    0 W" ?7 D6 L$ l' ~% I  @( J) R
  4. *7 s) P8 y( q, Y, d# ~. j8 \$ d2 J
  5. * brief  EDMA3 Test Application( ]2 s; `. ~. v$ ?1 W. P; o
  6. *
    8 R* I7 m; ^/ Z* `" ]
  7. *   This file contains EDMA3 Test code.
    ' P) w: s8 u6 u* A( f# v4 Y" H
  8. *  D6 e; A' r& z- D. o) G0 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 U( f; ^( T. i# V% M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) U- s6 P; W/ h1 @' n
  11. *         TO CHANGE.
    7 H+ A/ J8 h; h; B
  12. *
    ; x2 M  j# q, ]" g& t1 ?0 ~. Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, e: z% X' M- o' w9 G( b' T* r
  14. *
    . p) r8 Q2 L6 R, ~/ f' O
  15. * This program is free software; you can redistribute it and/or
    , s0 [- `2 P7 ]
  16. * modify it under the terms of the GNU General Public License as8 _& f/ P9 C7 j
  17. * published by the Free Software Foundation version 2.
    & Z, O  r3 h, C
  18. *7 q9 O) S9 r. d( `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 Q$ @. s$ r3 F" m: \/ _
  20. * kind, whether express or implied; without even the implied warranty
    & V6 S% d& g3 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , k( N$ {. r- V' C
  22. * GNU General Public License for more details.
    8 y; P* _! W( I9 J4 J$ l  _* N
  23. */. {: R& }8 {# [8 k9 V/ d1 ^0 [) n

  24. % O, S0 c& A! ]$ j  D  O5 S- z; J
  25. #include <linux/module.h>
    9 \1 n* O# \- {, `
  26. #include <linux/init.h>+ ~0 f* V& Q* \( t; S
  27. #include <linux/errno.h>
    2 Y) O: M" c& J! i  y$ C
  28. #include <linux/types.h>; P8 x- y2 [, G, D$ ]" v
  29. #include <linux/interrupt.h>
    # `9 `" Q/ [# y9 q' a" V
  30. #include <asm/io.h>2 x1 L% Y. I) |# P6 t8 f- g
  31. #include <linux/moduleparam.h>* Q$ _1 Y$ c9 G' U. R& N
  32. #include <linux/sysctl.h>
    & G" V, E5 B7 D5 v
  33. #include <linux/mm.h>
    $ R6 [6 N4 k3 y$ y! i
  34. #include <linux/dma-mapping.h>
    # F& T3 U" a8 a: A3 t, e4 T

  35. % [/ L. L2 `( C6 V
  36. #include <mach/memory.h>
    & G! m3 e4 W3 k6 h$ \6 c
  37. #include <mach/hardware.h>
    5 ^: h8 }# X7 ]: q3 W
  38. #include <mach/irqs.h>6 v& O, N4 ^: P, V6 e: {
  39. #include <asm/hardware/edma.h>
    9 Q8 f1 n$ c9 X
  40. % i7 @; H# {/ a/ \+ R% ]0 k
  41. #undef EDMA3_DEBUG
    - ?/ o4 ~" A) f* _6 D3 ?
  42. /*#define EDMA3_DEBUG*/+ F( c& t5 I. x5 j( R- b- K. d- J$ W

  43. 3 L3 I3 e1 x3 J0 P( g
  44. #ifdef EDMA3_DEBUG* h1 p/ L0 U6 z: j/ F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + R7 J! l& V, F& y" ]8 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# L2 a5 I7 J0 e* r; g1 L# x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % R2 m  ]- B) t" I0 Y
  48. #else
    + }, s' I  l3 C+ ]& o2 z' k
  49. #define DMA_PRINTK( x... )1 \! `- c9 h& H: _+ r5 v; }) i
  50. #define DMA_FN_IN$ t; N- Q7 U; n# z# c/ P
  51. #define DMA_FN_OUT- y* Z, c% |3 l' h1 L. q% U* ?1 X, I
  52. #endif' q7 n& W% k5 Q7 n' T/ G5 R
  53. " }3 z# f! {6 ^" I  X2 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ Z: n% L8 G" ~: l, X0 Z
  55. #define STATIC_SHIFT                3* ~6 x' L( t1 ]& V2 X1 i4 ^5 p
  56. #define TCINTEN_SHIFT               20
    : w2 `; F* b' f/ b% {" M# q
  57. #define ITCINTEN_SHIFT              21/ A8 ?7 T2 E& {1 N
  58. #define TCCHEN_SHIFT                22; w* v/ u8 r) F$ N$ K
  59. #define ITCCHEN_SHIFT               23
    % [2 ~: Y! J0 J6 h

  60. . g, p5 e! w( I0 b$ v. |
  61. static volatile int irqraised1 = 0;
    + f0 Z& s3 B1 S3 |) {( y3 ?( W
  62. static volatile int irqraised2 = 0;3 ?! F4 F  \" I! l& L$ [

  63. 5 C* l; R! E/ Z8 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 h' }2 ?+ I7 r: i3 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ o& @- T3 @1 ~5 m0 o5 N5 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & e* _; ?0 e# g8 E, S! J# e5 Z- g

  67. 2 x1 X( f$ [: {7 @7 K& s  t
  68. dma_addr_t dmaphyssrc1 = 0;
    " ^" I) ^# b2 y4 M' ^
  69. dma_addr_t dmaphyssrc2 = 0;
    . F+ e( Q  B  D# z
  70. dma_addr_t dmaphysdest1 = 0;9 R% Y7 r9 y; k( Y' _
  71. dma_addr_t dmaphysdest2 = 0;
    - Q9 Z9 |# K' `8 `! l2 o

  72. 0 G1 B# u: \6 H# F. b
  73. char *dmabufsrc1 = NULL;8 z! ^2 Z' f; j8 t( q6 {  E
  74. char *dmabufsrc2 = NULL;2 B6 Z6 K" ], S6 |/ y  f8 q5 Q! A
  75. char *dmabufdest1 = NULL;1 F4 E( A0 @6 m- V: F
  76. char *dmabufdest2 = NULL;
    * k) |9 U) A" p* L6 f
  77. * h5 G3 J3 P5 n- G" Q4 I
  78. static int acnt = 512;& [, P1 X  S) f( ?9 G3 O
  79. static int bcnt = 8;
    . ^7 h3 b. H! X- m
  80. static int ccnt = 8;
    # n' E1 P' X1 ]/ y

  81. . ~3 _8 {# j! V' e3 m" p  G
  82. module_param(acnt, int, S_IRUGO);. a7 I4 @5 [4 E8 {- x2 t. {
  83. module_param(bcnt, int, S_IRUGO);. f$ z9 ^5 {" z: P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 v! B0 \" n$ {# s5 c" ]
+ `. q4 E, [; H8 a8 y6 {3 {. @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 S% [' v% D5 L4 J/ Oarm-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 Q& h7 d" z( ~2 g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% D/ ~  x" M. h0 B3 j* b9 W; k0 w8 _! W  p& i! C- _( `; I0 Y
6 C/ L- G7 k. d4 `8 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 18:00 , Processed in 0.040216 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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