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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. m0 p1 I6 U1 a2 g: |2 |2 Y  v
  1. [code]EDMA sample test application
    ' u6 |& z) \8 Y( d; S
  2. /*
    8 }  Z% U" y  \6 N6 M. \
  3. * edma_test.c$ w7 N. w. V" {
  4. *- o$ q6 x! c( \
  5. * brief  EDMA3 Test Application- R. w* z- {' q. M5 P5 w
  6. *
    ' Y0 x( B8 @" H6 v
  7. *   This file contains EDMA3 Test code.( V* {, ], a/ @3 L# y
  8. *0 o# l* f0 F4 N3 [9 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 ~  Z4 q* O1 r. o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 p. T2 ]0 s/ Z
  11. *         TO CHANGE.
    0 A: y9 s7 F/ @+ d- c, K
  12. *( Y# p( B0 O6 P3 g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * g# o/ [4 D0 J9 `
  14. ** J3 f1 K; H2 Q7 a- ~9 ~" H. ^
  15. * This program is free software; you can redistribute it and/or* x3 G2 {3 K) a0 `& Y0 `! d, ~
  16. * modify it under the terms of the GNU General Public License as
    , `2 W( D5 m* Z; o5 `: K$ R& H
  17. * published by the Free Software Foundation version 2.! {: L9 X$ P9 X6 G! a% D& j% e  E
  18. *: t( y. u* M, M  {7 U* z3 B+ B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! a+ \# Q  _5 O
  20. * kind, whether express or implied; without even the implied warranty, v) Y3 x$ ?3 r# g2 T: R  V$ a; |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 \- `; J! U  F% G1 l) v5 [
  22. * GNU General Public License for more details.2 N7 ?  x  c) {5 a- r. y
  23. */
    8 [: }/ Z+ X7 k( s. N' I
  24. : X# \, V- a* n" l
  25. #include <linux/module.h>( |2 a. y8 n( O9 a( x
  26. #include <linux/init.h>  q2 ~- F$ @. L% T5 G9 ?+ a
  27. #include <linux/errno.h>
    ! P  \- a. y9 {
  28. #include <linux/types.h>
    8 p% S8 H1 I. u0 ^: h
  29. #include <linux/interrupt.h>
    4 Z( Q- o6 s) v5 g' D
  30. #include <asm/io.h>
    7 S' c% ^  w+ @3 v
  31. #include <linux/moduleparam.h>
    # U) ~% y" Q  u6 m4 S; X: w/ G+ G
  32. #include <linux/sysctl.h>
    / I/ @/ b: r6 @8 Q, m
  33. #include <linux/mm.h>8 R5 v, p- h/ C0 u' O4 o. p
  34. #include <linux/dma-mapping.h>8 Q2 R9 F+ B+ D

  35. . H5 {% z8 D  v2 ~
  36. #include <mach/memory.h>) v8 a; D; z8 ?3 r& y
  37. #include <mach/hardware.h>
    ) j. c+ z: e3 T
  38. #include <mach/irqs.h>8 ?0 ^; h# R3 B+ H! K
  39. #include <asm/hardware/edma.h>$ k8 E8 h1 w5 R/ ?! A8 Y: o! I& h
  40. 5 E# q3 P: c- \& t5 G! y; ~! s
  41. #undef EDMA3_DEBUG
    8 j& j* d$ X# A2 Z- v6 F2 K0 N
  42. /*#define EDMA3_DEBUG*/, `( g& E' J( k# O& m7 X
  43. - G) A, R- w/ {5 Q5 Q/ m) h4 R
  44. #ifdef EDMA3_DEBUG- _. u/ V5 K% y, o- L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : w& P8 e7 _: F( n$ b1 b3 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ U! |! w- @3 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' w" w  K8 h" Z/ u. k& ^( V' U
  48. #else
    " R: f% x2 t# ~( `' a# ]: B- X+ w
  49. #define DMA_PRINTK( x... )
    4 w- T5 q- L8 T! b0 y
  50. #define DMA_FN_IN/ ]  s+ k. M) [  p% r9 i) f# a" p
  51. #define DMA_FN_OUT
    ' \5 i$ l3 E! H2 F, U3 s
  52. #endif, f8 c1 C2 |. p4 F
  53. 8 B& c/ ?/ A, W( ^, Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 p, Z5 g) O0 m
  55. #define STATIC_SHIFT                31 ^7 \3 _' E3 d. X( q3 ]
  56. #define TCINTEN_SHIFT               20
      ]( \( E2 z6 J4 r& v
  57. #define ITCINTEN_SHIFT              215 f. i( z4 W- Q) T% q4 n
  58. #define TCCHEN_SHIFT                22
    , x; Z" L- \5 }3 D. B
  59. #define ITCCHEN_SHIFT               23% j0 h3 J% ^, y+ P2 f# _% a0 D
  60. 0 O/ M3 q, b  v  l0 a
  61. static volatile int irqraised1 = 0;
    5 F3 {% Y) S3 ~
  62. static volatile int irqraised2 = 0;2 F  p6 r+ |1 W8 G/ a
  63. - O' A7 u$ A) y. Y% I& q; w. K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 U& d' D, `$ j  I; {  P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # }; L( Y: _5 I& t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 l' L$ j$ {1 O7 v1 F7 x

  67. ! ^; X5 B+ K# _. c
  68. dma_addr_t dmaphyssrc1 = 0;
    * f( O! B& u0 P. g  `. T
  69. dma_addr_t dmaphyssrc2 = 0;
    8 ~% P( r+ a7 ?3 ?4 z# `0 w# H# U
  70. dma_addr_t dmaphysdest1 = 0;; q$ Z7 L6 [" k
  71. dma_addr_t dmaphysdest2 = 0;
    - K+ l% T3 [* X$ }

  72. , I1 H% O& a& ?$ i; A9 q5 Q6 c/ Y7 I
  73. char *dmabufsrc1 = NULL;  g3 N$ V: X/ W4 k+ O5 h' g
  74. char *dmabufsrc2 = NULL;
    ! Y; e# ]  E6 y
  75. char *dmabufdest1 = NULL;
    / C. n3 ~* U# _9 X7 M8 K  g
  76. char *dmabufdest2 = NULL;
    $ E2 _  p! I2 i$ I+ F
  77. ; x/ v; N! P: f0 I9 L! m
  78. static int acnt = 512;
    . m, q% w+ ~* M* ]9 D
  79. static int bcnt = 8;$ y9 h8 O! D* F- j5 t" V
  80. static int ccnt = 8;3 }, k" L6 b- O' U" [% M" M
  81. $ y5 ~, \" M$ e' K( z1 x
  82. module_param(acnt, int, S_IRUGO);  B- b6 \# U+ |) H% Z$ J9 e  y
  83. module_param(bcnt, int, S_IRUGO);; G* }0 Z  g, g( V( A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ Y- A1 I( w1 [/ a! N! T6 |  v2 b6 b. g! }4 W# {1 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' C. b* q* N* C0 X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 o  l  g1 q+ t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 [& D4 Y2 N1 R1 d- j- n, P; _+ j. ~0 t+ s: [8 `
8 ?8 E/ U: B8 y9 O# k- V2 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 05:57 , Processed in 0.036866 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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