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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: X& I, {. A8 M1 Q" ]! f, j  x
  1. [code]EDMA sample test application
    % A' i& F9 X. W% j! V% }
  2. /*
    ! B% H/ `" [3 g" ~; I1 v7 z
  3. * edma_test.c- R) N' c; Z& h# q  P" N0 s
  4. *# ~$ f- F8 Z* |* k
  5. * brief  EDMA3 Test Application. w! p4 Y* o9 J6 m6 j& H
  6. *  E3 H' Y1 n  G0 A8 g; P+ d! n( v& [
  7. *   This file contains EDMA3 Test code.
    ; j3 ~& D4 e' p$ l. A  |
  8. *
    : Z0 m/ m4 M( a6 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + _& J$ Y0 X. Z4 z9 Y/ c/ N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . Y+ Z# h+ m# @1 F7 G# `  E
  11. *         TO CHANGE.
    2 T. [# @9 T  c, @: ~
  12. *
    9 S0 r" z/ u0 ]' c8 X' R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 u( L2 z+ f' I# G* [& I8 o
  14. *
    4 e# Y$ z0 V: S+ P3 X0 G$ `( ]$ D
  15. * This program is free software; you can redistribute it and/or
    % C! E6 e  |3 i8 k
  16. * modify it under the terms of the GNU General Public License as
    * R6 j; f4 d: \, A2 D, a
  17. * published by the Free Software Foundation version 2.2 X* j6 j0 e% n; n* l
  18. *
    / A7 |( {+ n% g; R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ Y1 ^! J/ X% e* O& E
  20. * kind, whether express or implied; without even the implied warranty
      v3 }* w- D, V) g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 l( P0 g0 i% B$ @% X* ^' C
  22. * GNU General Public License for more details.
    4 W4 G+ L8 h; ~# Y% k
  23. */7 {$ i! O4 }4 i+ t% J; V% I, ]/ d1 _

  24.   i& k$ D, J2 J3 ]" G' M
  25. #include <linux/module.h>0 c/ x0 T7 `5 S- E! b
  26. #include <linux/init.h>5 E8 S$ u/ e& n  h( B4 ]
  27. #include <linux/errno.h>
    2 F5 h9 R$ K) e0 w
  28. #include <linux/types.h>* ?3 f, o: d4 z2 W  B- Z
  29. #include <linux/interrupt.h>
      j* A3 s4 Y8 [6 o/ T
  30. #include <asm/io.h>
    ' g! R! J: Y+ Y8 y' b* Y1 f& _
  31. #include <linux/moduleparam.h>1 f" _  ~9 B& X! o# t: V3 Y4 O
  32. #include <linux/sysctl.h>$ Y# f4 y" \: x" G$ R, _' x  \
  33. #include <linux/mm.h>
    9 Y  p; Q. y& \$ L
  34. #include <linux/dma-mapping.h>7 f' \. \4 x0 u- w0 D3 W  m

  35. 5 g& ^' B0 b% J3 i$ z1 f' ~& A& h8 _& Q
  36. #include <mach/memory.h>
    9 C; k1 C, y* p
  37. #include <mach/hardware.h>8 E+ L: Y0 z* |
  38. #include <mach/irqs.h>, q  _  Q- V6 v) k, S7 I
  39. #include <asm/hardware/edma.h>
    ; q; v* ?, k6 D. R- G/ P  b! |' z# d

  40. ( G6 O+ L2 C+ ]: M* m4 i0 J7 M
  41. #undef EDMA3_DEBUG# Y6 {: h4 _3 \1 F7 S3 Z2 x
  42. /*#define EDMA3_DEBUG*/3 `$ D! h1 U; B' B4 V8 f
  43. 2 }1 p3 L% V. c7 j# S% e
  44. #ifdef EDMA3_DEBUG" A$ I4 {  H  D+ p! Y' L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" t* c1 y9 S& R  Y! ^3 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . ^0 s+ z, r) ^1 v. w8 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): N+ e* h# A/ j1 O: P
  48. #else5 u) R5 l5 ?+ R* n4 s
  49. #define DMA_PRINTK( x... )1 o7 e: X) N& _4 _4 |, `
  50. #define DMA_FN_IN* ^/ S3 `8 B+ ^: m+ l! u( O2 `" N
  51. #define DMA_FN_OUT1 _8 S& d$ H( v1 T
  52. #endif- d" m+ j5 Z( ?6 T/ f+ y
  53.   K$ b- T1 F) ~0 p' T! o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; f. z  A0 k+ c% N( D
  55. #define STATIC_SHIFT                3
    4 g% R6 [' O1 y+ }% ]
  56. #define TCINTEN_SHIFT               20
    # Z2 G; Q! ~2 o" o
  57. #define ITCINTEN_SHIFT              21
    . p, B0 w! [0 d. F+ `* a
  58. #define TCCHEN_SHIFT                22) u! O* Z. ?) G) \
  59. #define ITCCHEN_SHIFT               23/ ?0 L3 p, }1 ]3 B

  60. % ^0 [& X8 K: p7 }; N6 E
  61. static volatile int irqraised1 = 0;
    ) i5 i. N1 A  |$ Q; }. X) [
  62. static volatile int irqraised2 = 0;9 O$ W: f$ H3 c( o8 c2 O  X- v

  63. - p. B( g. |9 f' H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + A1 e5 W5 @1 `' X( p, f" b  ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 ~5 ?/ e3 f; O0 e6 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , k% A$ Z8 K6 |9 N! W1 m

  67. ! s+ U: T- A6 U6 Q2 y
  68. dma_addr_t dmaphyssrc1 = 0;
    : z' u1 d( r/ X) k3 t" s/ w5 f
  69. dma_addr_t dmaphyssrc2 = 0;
    6 G& ?: S' o1 R6 D! m6 f
  70. dma_addr_t dmaphysdest1 = 0;
    ( R2 g* Z6 Y/ W
  71. dma_addr_t dmaphysdest2 = 0;
    0 n7 o& f" x/ {

  72. 4 L1 {- }& F5 l4 a
  73. char *dmabufsrc1 = NULL;
    & f9 W8 q2 s9 ~7 G. V- ?0 ^) ?6 \- _
  74. char *dmabufsrc2 = NULL;
    3 S0 l; W% O" d" N. n- K
  75. char *dmabufdest1 = NULL;7 E7 X9 m$ Q1 G9 V* t0 i; _) v% R2 k
  76. char *dmabufdest2 = NULL;2 l& J7 Q$ S) t' c8 }
  77. 9 t( m7 H+ s5 K* f( F8 D
  78. static int acnt = 512;
    ( q6 r" Z4 e* M3 U3 y/ ?+ b' v
  79. static int bcnt = 8;. g9 ~9 Z6 p- M" F, |
  80. static int ccnt = 8;+ ~% @/ P! O5 a1 P3 V

  81. : t4 N3 Q& X  K
  82. module_param(acnt, int, S_IRUGO);( I0 j; c9 l1 c9 h( T4 P* C
  83. module_param(bcnt, int, S_IRUGO);* G4 P/ B$ g8 O  H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ P; [) a9 l7 W7 V
8 x6 `  i) k1 z: t8 g& G. F$ D2 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' J! b( G. A& C3 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; N1 z4 I) |. d* D* G* ~1 g& _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ B. G1 K8 C. t/ V: ?
0 ~( }# `) g9 h. K

& J7 f8 Y3 [/ E# j2 G& p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 00:47 , Processed in 0.037191 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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