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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. \" @: j/ G8 p
  1. [code]EDMA sample test application
      F6 m+ I9 ^1 ~3 U' C5 G; e
  2. /*
    & X9 ~3 K% H: Q: F
  3. * edma_test.c
    9 @1 K, {% V! v. ]. M
  4. *
    1 B% Q2 @+ Y+ w! d8 k" V) |' e9 ^
  5. * brief  EDMA3 Test Application
    3 _8 P3 }7 Q0 N& U0 J: d
  6. *5 E2 m4 \* c9 j; k& u, R1 s
  7. *   This file contains EDMA3 Test code.$ {) y4 ~3 p( t" R2 ]  _; W
  8. *
    ; P6 s8 m! l  A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 q; L! k- u5 x: `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) l' K% T1 x. v- q% g* o
  11. *         TO CHANGE.
    0 z' s  m' v5 w/ c
  12. *
    " O) x6 v4 o* ]  t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * R$ {) v$ e( A' J5 D/ Z( e
  14. *
    ; }* Y" v. w) x" G( T/ A0 P
  15. * This program is free software; you can redistribute it and/or
    * K" _" V1 P) b1 g- ~+ \
  16. * modify it under the terms of the GNU General Public License as- Z' B4 b5 G) U9 e0 s' }1 i$ I
  17. * published by the Free Software Foundation version 2.3 m& u" P, G: g3 d
  18. *# w( k0 I" l  }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& q1 f8 ?" G# ?3 O/ w. c; Y
  20. * kind, whether express or implied; without even the implied warranty; M% b  K( R; b* V  X% O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! i% @9 g9 d: ^! F1 q) n2 a( Y4 `
  22. * GNU General Public License for more details.
    - [- o6 o' J. V
  23. */
    $ Q$ b3 g; J% s' D) b3 s$ `) G$ {

  24. : s# v9 O1 {* @2 p
  25. #include <linux/module.h>
    * s( E5 R6 @; \: d2 s
  26. #include <linux/init.h>& w9 }5 Z) [  ^7 @* D
  27. #include <linux/errno.h>; m6 M9 p3 d; `! s  d
  28. #include <linux/types.h>+ F  V) [) x) D( z. ~7 g9 ?
  29. #include <linux/interrupt.h>
    # a5 p; q2 F3 P5 @, B
  30. #include <asm/io.h>
    + ?1 w2 a: Q6 Q' R9 o9 s
  31. #include <linux/moduleparam.h>
    , [* J1 c2 X! Y0 _  M' t5 I
  32. #include <linux/sysctl.h>
    % L; l- F: S5 ~
  33. #include <linux/mm.h>
    - |0 n7 `/ v  b. o5 H+ F
  34. #include <linux/dma-mapping.h>$ r- n$ c& q' p0 X: O0 c! g' f

  35. 6 }5 C, U  ]$ L$ f0 b: x% v
  36. #include <mach/memory.h>! L0 k0 `+ a- d: F7 H
  37. #include <mach/hardware.h>8 \8 l0 f9 P' @6 m& I. O+ E/ G8 |
  38. #include <mach/irqs.h># f& w0 o8 k- b
  39. #include <asm/hardware/edma.h>
    " l. Y, f6 r7 o# p6 }/ k
  40. 6 n' ~: b5 D1 h$ n* j
  41. #undef EDMA3_DEBUG
    ( F; I% T: A) F: N2 K
  42. /*#define EDMA3_DEBUG*/# i% R' K2 b9 j& M, p5 t& c
  43. 2 J" x9 E1 c% X6 N# v! N7 s
  44. #ifdef EDMA3_DEBUG9 S' O5 ^7 w" |/ b; T) ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). }5 Y' _' Y+ A- p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ b$ D6 q4 u1 h0 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 J8 y: O& y* e( s6 y' q( {
  48. #else9 C2 q; B% g: L" s; X/ f
  49. #define DMA_PRINTK( x... )% _! C# E+ b: F. Z3 i
  50. #define DMA_FN_IN- C  t: p7 B; O) `7 t- y* Z/ @
  51. #define DMA_FN_OUT
    $ H8 Z: i/ B/ ^$ b' i
  52. #endif5 y% {: b- Y. H" e1 W1 g' w* g
  53. ) ]' |" ?4 E/ g; s: u/ F( c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . B: U2 K% ?2 ]. x4 k/ G
  55. #define STATIC_SHIFT                3/ o; J: l: ^! m
  56. #define TCINTEN_SHIFT               20
    2 k6 z+ U- E. h. N0 r
  57. #define ITCINTEN_SHIFT              21
    1 X. w6 Z+ I% X2 a  F' [
  58. #define TCCHEN_SHIFT                22# V+ B* b& G6 Z& L
  59. #define ITCCHEN_SHIFT               23
    8 H1 p. k* p& Q" C
  60.   _$ H8 ~; v; T, k  B
  61. static volatile int irqraised1 = 0;
    . t0 C$ J' m& W$ M$ S7 s5 c: M
  62. static volatile int irqraised2 = 0;
    " e7 m4 N8 `* f' I" k& w7 U- X) i

  63. / M& c5 U2 C. p6 G. K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & M& n6 y: S+ ~$ L$ n0 O, C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- p$ \( ~: E& @* ^$ W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 r! P( _* G) J5 _1 ]0 ?: j
  67. . ~, K- P, B+ O& ?  i5 c' X* O+ `
  68. dma_addr_t dmaphyssrc1 = 0;
    7 i( P) X1 |& O. e
  69. dma_addr_t dmaphyssrc2 = 0;
    9 g0 _7 f3 i" v7 a% e8 y# ~
  70. dma_addr_t dmaphysdest1 = 0;
    8 `2 Z0 x7 F/ ^- }
  71. dma_addr_t dmaphysdest2 = 0;
    & v' ^. e1 [6 t! X, g

  72. / {( n( C; z& ~) z0 \' J0 B% O' D
  73. char *dmabufsrc1 = NULL;4 U( t; W1 V# ~5 g+ r( O2 `
  74. char *dmabufsrc2 = NULL;
    ) `7 w# @/ d1 f& _# T
  75. char *dmabufdest1 = NULL;) k8 n" k3 t- r* L- [. e
  76. char *dmabufdest2 = NULL;
    " z( N/ \: ~" e4 [# {/ i8 F
  77. 9 t9 ]; E$ X/ g( G2 w% R1 `( t
  78. static int acnt = 512;
    9 J  L3 t6 v& f
  79. static int bcnt = 8;
    : g+ g- ~7 Z, c( A! R+ {
  80. static int ccnt = 8;( D4 O# C( z  b6 ?0 V

  81. & R2 B( U2 w; H& p1 N/ B% y6 X& t
  82. module_param(acnt, int, S_IRUGO);
    8 R/ ~. M" T3 Q8 F) W
  83. module_param(bcnt, int, S_IRUGO);3 a* A6 a; h( r' }% N. O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  m# f* _, Y6 s0 V/ S; K
8 L! V2 w* U1 q4 ^" k# a8 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) c( y, i$ Q' I- q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 v1 T. |4 W5 {* U: i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 _/ E2 T4 T5 ~$ e2 O
6 m, f* R; V& F; ?; e: g: O
) q4 d$ X3 g7 J" B$ Q$ V3 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 04:45 , Processed in 0.036593 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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