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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! E0 X8 G8 s4 r3 y5 _5 D: b
  1. [code]EDMA sample test application) [4 `* `& R: t" |3 S8 Z6 q; C
  2. /*
    # Y" U$ x* r( A" c
  3. * edma_test.c/ P* w7 [! S, J, c, M
  4. *9 `5 C! x* m8 n$ M$ z) ?
  5. * brief  EDMA3 Test Application
    4 B3 Q5 c5 {7 X0 [6 q0 j( |
  6. *
    " N# g( q& R+ Z) v; X
  7. *   This file contains EDMA3 Test code.
    - ?) R% R8 w% M; q) D. U
  8. *
    : Y! h& W* e; x4 t# R, B! ~) I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - U5 v, F  n6 r2 v1 P4 A" J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! U! X2 Z: p  K2 _7 x
  11. *         TO CHANGE.
    ) F+ d/ X! a9 d6 t& w0 H2 P$ d
  12. *6 v% r: ]. D0 h2 E, ~2 d+ Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( @5 {: {( @; k1 W4 T
  14. *
    / P0 f; ~6 S# Y$ L: A
  15. * This program is free software; you can redistribute it and/or* x3 H: @1 b; a5 J! \
  16. * modify it under the terms of the GNU General Public License as
    ; ?2 G8 H% ^2 d+ u9 G" f
  17. * published by the Free Software Foundation version 2.; R! M1 ~. C9 r9 X) @
  18. *5 W3 v5 {: K8 Y1 O. J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# @4 K. ~( t' ^
  20. * kind, whether express or implied; without even the implied warranty
    ' p. `3 M+ H/ P9 t8 o/ F  a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  g- q4 j# V# i
  22. * GNU General Public License for more details.
    - m4 X2 k* o0 K( C; }: b# x4 P
  23. */( ?" ]0 s9 O3 S; T7 Y! O

  24. . w2 e0 B3 p2 S0 Q% b
  25. #include <linux/module.h>
    / e% H! m9 F* {5 w2 o6 R2 T6 @- O
  26. #include <linux/init.h>
    6 Y* R/ X6 C! r, w" K; a/ Q
  27. #include <linux/errno.h>
    / J5 [7 h3 W; v! g  t1 L3 j7 m
  28. #include <linux/types.h>% a3 _% z, t# v, o- `. U8 _7 W
  29. #include <linux/interrupt.h>( p  f. C% [3 ?/ s- x& \0 S
  30. #include <asm/io.h>* `! ^9 s" p, n$ X2 H2 v: a
  31. #include <linux/moduleparam.h>
    . U- B6 S( {& ?. s$ Q
  32. #include <linux/sysctl.h>
    % l! Y- S: I: S0 j3 G4 u
  33. #include <linux/mm.h>- }, `# f8 x/ o( Z  x# S
  34. #include <linux/dma-mapping.h>
    ) z+ S  {6 d' \# u
  35. : I0 h+ q) ^0 Z8 e% I# w) n  q
  36. #include <mach/memory.h>
    4 Z) k: x+ Q0 `( E$ c6 c' X. s" m
  37. #include <mach/hardware.h>
    ' J3 M7 M: E$ {+ A* H. A/ y
  38. #include <mach/irqs.h>
    0 B* i4 t% M5 ], t# M
  39. #include <asm/hardware/edma.h>
    3 ^& u/ t$ c) j2 o* b. ~7 S; L
  40. ; K- O9 M& ~6 N$ Z7 q
  41. #undef EDMA3_DEBUG
    + B* e/ A: p& @& h# O* {* d; a8 p
  42. /*#define EDMA3_DEBUG*/
    8 ]- B& V$ e9 K( N) Z6 a* E  E

  43. 7 G$ C* P" k  L" f0 k- G
  44. #ifdef EDMA3_DEBUG
      \9 t9 o# Q$ r1 S3 n5 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' i4 h- p9 {! H7 D- c' `5 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 |2 L* J2 M# L' T( z& d: z8 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 R; b( ^& u9 b- i
  48. #else
    * J# G: A1 e3 `+ x  G$ A( d
  49. #define DMA_PRINTK( x... )0 W& w  L" B; K2 W. V, O+ _5 j
  50. #define DMA_FN_IN3 ]. ^+ X" ^8 g% |" N
  51. #define DMA_FN_OUT
    % t. V: q8 c! r2 `& f
  52. #endif
    4 d. ]8 V% Z3 |% H- x! e" p
  53. 7 Z6 t; Z# V; @4 d1 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & g3 _! S& h8 K2 d( b, h
  55. #define STATIC_SHIFT                3
    ) @2 a/ [* c- z4 _2 V% O8 W
  56. #define TCINTEN_SHIFT               201 C- N( L. b1 w+ x& h
  57. #define ITCINTEN_SHIFT              21) r4 P( K4 t/ _4 ~0 w
  58. #define TCCHEN_SHIFT                22
    6 O0 Y: [" j7 A
  59. #define ITCCHEN_SHIFT               232 b! Z" l  K' g

  60. & _" _, A. S$ n' G: n5 K
  61. static volatile int irqraised1 = 0;
    ( ]- N% H4 H$ Y7 c) T
  62. static volatile int irqraised2 = 0;
    9 r% B$ Q7 X9 H6 G8 o! g  |- r, F

  63. / l6 o% T* c; _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 P) J! g; T4 J' U1 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# x& K5 ^* ~; t  y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ v. j5 }) F. N8 C3 P; M
  67. 5 T% \1 C) ^! I5 \& V- M
  68. dma_addr_t dmaphyssrc1 = 0;
    ; `$ }+ {+ p  K7 }
  69. dma_addr_t dmaphyssrc2 = 0;
    , R# G' c0 U" }7 i$ X8 v
  70. dma_addr_t dmaphysdest1 = 0;; F+ X; p3 c+ |( u
  71. dma_addr_t dmaphysdest2 = 0;% o. C! I7 }# X3 `) y9 F

  72. ' F8 E. L! `6 J' W
  73. char *dmabufsrc1 = NULL;
    * s8 l( C6 c1 H0 w' z& g
  74. char *dmabufsrc2 = NULL;" |/ L8 _, }; w" i; q2 }# q( W
  75. char *dmabufdest1 = NULL;6 a6 a/ R, U1 y0 z) k0 s2 B9 {7 N+ V
  76. char *dmabufdest2 = NULL;
    0 u2 J; w, t0 w- p3 z
  77. 7 U, m  q1 I3 n8 \& D
  78. static int acnt = 512;9 Y# x7 ?+ L9 B7 k- X* L3 K9 {
  79. static int bcnt = 8;
    ' N5 C9 L5 U  s" ~1 E  g
  80. static int ccnt = 8;
    0 }7 p. x5 J! ^- B

  81. ( N  L4 ~# W- Z! e4 p2 R1 Z
  82. module_param(acnt, int, S_IRUGO);4 _9 o& R) Y5 ^2 v
  83. module_param(bcnt, int, S_IRUGO);6 N4 y2 i0 `  n9 X4 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( W" u; j- y& l- ?) \

. H/ \' |( V: e: t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" h5 g2 P# L$ r0 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& I# `$ E4 p3 s0 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 L$ p$ d: Z( A  _$ k7 y

, `+ b% u( r4 C
) j! J2 T: S: y, r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 04:52 , Processed in 0.039107 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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