OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, T* ^4 ~7 o& e
  1. [code]EDMA sample test application% Y' k8 t9 t) C. H% d% z
  2. /*
    1 Z0 ~* N2 C+ I4 W
  3. * edma_test.c
    ! w# |) N7 q/ t9 q( @, ~
  4. *. {) ^7 P6 ]; T- {4 ~/ {& Y: y
  5. * brief  EDMA3 Test Application) i- L! s# Z, @# K" W& H" c8 r" G
  6. *$ A# X' {( A. G3 h
  7. *   This file contains EDMA3 Test code.- u+ k  y: ~( w; T+ m( T  N# k9 v, b
  8. *
    % l, M  n- U2 `9 z7 M# t3 h( p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 x. M! L1 f9 E5 B7 K$ F/ H2 G: R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ k: @& G9 B+ {; b( O; A
  11. *         TO CHANGE.
    ! L1 x* z( O  Q  M! z  \
  12. *
    - G' t7 t+ I/ ?' G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 ?8 t) C, `& j! d0 O+ R  B5 j+ g
  14. *
    - q( R- k! _4 j2 f: l- h
  15. * This program is free software; you can redistribute it and/or
    + Z7 S* J: s8 F8 Y
  16. * modify it under the terms of the GNU General Public License as
    8 A+ e, o) {3 w4 Q
  17. * published by the Free Software Foundation version 2.
    9 M1 d& ?( q( h, A6 \5 k
  18. *
    ; f* `# s; L/ v: O5 q5 p5 Y1 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 m- L8 n2 [( v2 @: c; ~
  20. * kind, whether express or implied; without even the implied warranty
    * I. k  ~" N8 t" D9 e* O9 X3 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 `* N" r2 @) d
  22. * GNU General Public License for more details.5 o5 k! C) X; e$ `- @/ R$ t
  23. */
    + j0 n& }/ \2 V/ |) e$ z0 }8 x

  24. - m5 u; g- y. [# N% z3 s2 b+ E
  25. #include <linux/module.h>$ M( b) m& b" Y
  26. #include <linux/init.h>5 m; j  K& t! N5 t/ [! {; }8 t7 p
  27. #include <linux/errno.h>/ i( S0 u+ b/ q) B8 T
  28. #include <linux/types.h>/ C# T, q3 @# [: I9 R& y
  29. #include <linux/interrupt.h>
      p: Z$ i0 L  Y- S, C/ e$ M
  30. #include <asm/io.h>4 @' A) I3 v5 G) I1 ]( W
  31. #include <linux/moduleparam.h>
    ) ~. w2 ]( _) H$ f) ?5 l
  32. #include <linux/sysctl.h>
    $ G6 q) G! Z0 `% Z$ U1 Z9 }
  33. #include <linux/mm.h>! y5 V; e( t7 r5 h
  34. #include <linux/dma-mapping.h>( k6 t6 s) a! T0 n# t- W3 o" c6 O

  35. ' }/ t1 {7 D. j. \
  36. #include <mach/memory.h>
    * D/ d9 l# p8 B3 E) N0 [9 s% X: R$ w
  37. #include <mach/hardware.h>
      e/ G' g( `0 [1 O/ l
  38. #include <mach/irqs.h>
    2 I0 [+ s! `, a* k1 k
  39. #include <asm/hardware/edma.h>. ?4 e% c0 v, ^: n* Z

  40. % ?% b$ }1 \# T1 P" i: O/ ~
  41. #undef EDMA3_DEBUG
      y! _+ J5 B+ r0 o; Z
  42. /*#define EDMA3_DEBUG*/
    - W) `2 n9 W/ y0 r* D8 h
  43.   F* ?4 X1 a# o3 J5 D" k9 ^9 Z
  44. #ifdef EDMA3_DEBUG
    % z) }4 w1 r1 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ K  P; t* @( R* m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! N' u. i" g5 [+ C" q8 L" \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# x8 x- Q9 k- c9 O; q
  48. #else" P+ F+ ^  C  o; c2 x3 b. }
  49. #define DMA_PRINTK( x... ), K3 K5 v8 {1 f+ \$ E
  50. #define DMA_FN_IN
    4 G) M: b  O) I4 Z
  51. #define DMA_FN_OUT
    1 d( d& K* @  |' L, X
  52. #endif0 X% v* e( T, L0 S
  53. - m0 O- e9 S* N2 {; }3 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 E' q" [4 a) v" U, X- V
  55. #define STATIC_SHIFT                3
    . X, e* r0 G( e& w1 a% `* a0 g; e
  56. #define TCINTEN_SHIFT               20. h+ u! a0 K7 n  o% @* D6 j
  57. #define ITCINTEN_SHIFT              21: y4 n# l! ?& x$ x# H
  58. #define TCCHEN_SHIFT                22
    5 _; p. M9 U( I! @& d
  59. #define ITCCHEN_SHIFT               23" C( g/ \4 K" Z7 s
  60. + }* P( w; V. O
  61. static volatile int irqraised1 = 0;4 G- c  R2 f: d; Z: ~# R3 v
  62. static volatile int irqraised2 = 0;
    . m& J+ m5 g# l
  63. , Z, ~/ @$ d3 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 C$ G6 h) C9 c7 B- [4 U' O0 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 y0 C4 E( ~; c5 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 }* F+ e! M1 j( o) _4 N0 t

  67. ' S9 f7 |1 P' X" d. p' \* `
  68. dma_addr_t dmaphyssrc1 = 0;+ Y. u# |) I3 C$ l0 n$ A$ U8 ?& G$ ?
  69. dma_addr_t dmaphyssrc2 = 0;
    3 y/ Q& ~" T/ N+ V
  70. dma_addr_t dmaphysdest1 = 0;
    8 z5 m* J! {( L2 n8 x. g
  71. dma_addr_t dmaphysdest2 = 0;
    ! E! E/ B9 s% D% I# x
  72. ' i# p; b& D2 E0 I
  73. char *dmabufsrc1 = NULL;
    7 x7 @& w& d- |4 F; e9 y. D4 ]
  74. char *dmabufsrc2 = NULL;
    9 ~0 ^, }3 W5 x2 S$ p6 v( ~
  75. char *dmabufdest1 = NULL;
    9 l3 Q, @$ Q+ g% @" I
  76. char *dmabufdest2 = NULL;2 Z. v5 n, A4 o

  77. ! j" Z+ v- }$ {4 G5 `) N: G
  78. static int acnt = 512;
    0 j" ^$ K* n% z2 Q
  79. static int bcnt = 8;5 w: Z+ I3 G) `2 h+ ?
  80. static int ccnt = 8;* k0 m' u$ y' |) r, ]! H
  81. + [2 E2 {+ s, Y) e& \% v3 N6 X: t, ?
  82. module_param(acnt, int, S_IRUGO);
    $ a# K2 }, ?/ J" y, N; U3 o
  83. module_param(bcnt, int, S_IRUGO);- _( b% G/ n- m5 `( Q0 A& s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  X0 ?9 Y) S- x% _7 F$ x
" ^& n& k( w% k: [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 A* _0 @% m) K2 _# C& ~# Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 ]+ T! ?  U# v  B* O8 u/ B1 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( [" C* S+ x9 D! `
" W8 R& x$ x; ~8 E/ a4 G; o( T+ ^. v9 }0 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-11-15 00:33 , Processed in 0.048003 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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