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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ W1 T6 N- K3 U9 Q/ @
  1. [code]EDMA sample test application
    9 p4 Z1 e5 s' @" z0 W" p" O
  2. /*% K, [( J  g. v! |# X0 J. B
  3. * edma_test.c
    2 C6 J  X" }+ i" F2 @
  4. *
    3 l( t  O9 P2 L% e
  5. * brief  EDMA3 Test Application
    $ w6 w) q# A( l$ U3 B3 x
  6. *
    3 @8 N4 w# n9 c; k- j
  7. *   This file contains EDMA3 Test code.. b# d/ h( r5 a+ `. Q& g: J
  8. *
    . W; P- T- j5 d+ |2 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " a6 C2 v" t6 |1 q3 {* T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; E  m0 n$ k2 y# \
  11. *         TO CHANGE.
    3 m+ X0 N3 P# ^+ @' z- |
  12. *
    / O* t% u( G" |2 c( b% g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; X' ]+ r' u( r8 z8 |
  14. *
    ' j" F& G$ k7 C$ j0 `. N
  15. * This program is free software; you can redistribute it and/or% _) [: \4 O. S& ~, f3 @% H
  16. * modify it under the terms of the GNU General Public License as
    1 R" S. p) q- l' [, a# w5 I
  17. * published by the Free Software Foundation version 2.
    , P: a# y* g2 {9 H, k& d+ P! x
  18. *6 `3 K. u! v1 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 j6 o9 S  b% i7 D' {) {$ v
  20. * kind, whether express or implied; without even the implied warranty5 f: E0 I! h' X9 `3 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# ^. g3 [( G( M7 L* R" e5 J( x
  22. * GNU General Public License for more details.
    ; O! g7 a) z, {8 m$ M
  23. */
    4 f! U1 D5 t; B. ]; H9 c2 H

  24. ' @4 Z1 C+ q1 Q9 m+ F/ R8 P8 R
  25. #include <linux/module.h>; K/ k( X+ R' m6 J
  26. #include <linux/init.h>. t! f/ o& }- k1 g+ x8 ^" \
  27. #include <linux/errno.h>
    2 ~/ b# S6 V4 ^. ^
  28. #include <linux/types.h>
      b$ Z  l# P" Q& K9 `
  29. #include <linux/interrupt.h>7 y, {! |6 H5 K! l1 L( a# |
  30. #include <asm/io.h>  @% h# e5 O) D2 v& w
  31. #include <linux/moduleparam.h>
    / s% [$ G) b7 u3 K
  32. #include <linux/sysctl.h>
    1 ~# D8 N, C" j/ P5 ^
  33. #include <linux/mm.h>
    8 N6 V3 }' O. X/ z6 B  `1 i
  34. #include <linux/dma-mapping.h>
    . G  [4 H: J, x$ [+ K' x
  35. 6 B. M2 o5 C" W9 h/ R$ I
  36. #include <mach/memory.h>& e! ~" {9 h3 I2 f; X& I. C) f
  37. #include <mach/hardware.h>0 }8 s$ n; K# l8 X3 s& m  [
  38. #include <mach/irqs.h>
    3 X* {) M& y& ]& c5 ^$ I
  39. #include <asm/hardware/edma.h>
    6 ~- d! Q& _1 e& Y
  40. * Z8 E  r9 e) |) [; ?' L' B( z1 {
  41. #undef EDMA3_DEBUG- J3 I! R% f/ a" G
  42. /*#define EDMA3_DEBUG*/
    9 u# h1 ^# s1 Q
  43. + O; X( |- W5 O1 X
  44. #ifdef EDMA3_DEBUG: K9 f- }/ c/ y' @8 _0 P# U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 h! i- O# L" G2 N0 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / T- Y" K, [1 Y9 z4 W: o+ w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). {! [( V# Q' g' X; j
  48. #else
    2 p7 ^# n4 h; }7 a. w
  49. #define DMA_PRINTK( x... )* {; y# o8 @% y1 v
  50. #define DMA_FN_IN
    * l* n$ n9 Q* n5 N
  51. #define DMA_FN_OUT
    ( T' l; R3 s0 T
  52. #endif
    6 ?* k* K- Z' s: V* _8 _
  53. 1 d3 _' U9 v; d+ |# m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " G5 ~* ?  F& F' K8 o7 f- |
  55. #define STATIC_SHIFT                3
    & o1 _! p) D# x6 E" i  M
  56. #define TCINTEN_SHIFT               206 j3 b+ O: p& D9 X. O# ?
  57. #define ITCINTEN_SHIFT              21/ X: t, e/ B  G
  58. #define TCCHEN_SHIFT                22% F3 K. B$ G$ t1 t
  59. #define ITCCHEN_SHIFT               23
    8 i/ E/ }6 K, A& U5 |% |( Y
  60. 5 U4 ~4 u9 v6 `* y7 O, }( U  @( Q( l
  61. static volatile int irqraised1 = 0;
    5 Q  R) w% V9 e+ Y) D
  62. static volatile int irqraised2 = 0;
    , z) b- Y4 p# G
  63. 4 _( p# y, Y& }5 a' ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . {8 }8 y  g& ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 _$ Z/ ~7 i" `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 D6 k8 n3 r( z% u
  67. + G2 W% D& H1 ?5 ^4 C
  68. dma_addr_t dmaphyssrc1 = 0;
    , R. @7 v# e7 M  M' B; U7 s9 V
  69. dma_addr_t dmaphyssrc2 = 0;
    / s  D6 X' T8 i& O6 g1 O
  70. dma_addr_t dmaphysdest1 = 0;
    6 A: `9 ]3 w1 R* r; L0 m
  71. dma_addr_t dmaphysdest2 = 0;
    9 h6 v/ Y7 u2 E5 o' y
  72. + Z7 P! b) h/ m$ K0 V
  73. char *dmabufsrc1 = NULL;! W: r! C& g6 g
  74. char *dmabufsrc2 = NULL;, l' z$ b, J) w6 F1 `
  75. char *dmabufdest1 = NULL;
    3 R+ M6 R1 K3 i$ e; g. e
  76. char *dmabufdest2 = NULL;
    2 U& ?9 R- h, Q5 C

  77. $ m' v' w* \: ^% k: G
  78. static int acnt = 512;  t+ A% z8 c4 n$ m
  79. static int bcnt = 8;* A: o; i& f6 i' B. N5 T* Z
  80. static int ccnt = 8;
    & B9 F5 T! z3 o! g3 m
  81. ' r# q! U2 ]+ |9 d. S7 f" n4 H
  82. module_param(acnt, int, S_IRUGO);- L7 A; \: w8 I; ~6 c4 @0 ]5 ^
  83. module_param(bcnt, int, S_IRUGO);- V5 E1 E0 T8 p/ ?6 C3 r& s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( y) K( ^- p- m: U- o' `
0 Q. @3 T! _( V4 q  Y. V: P8 M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 H3 }+ M: h- _) g2 ~% v# b( R7 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 W, ^# t" r% J0 s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! R( \4 g2 A8 ], Z  U) @
: \- `% s8 X* i6 X- R

% k. r+ w: G- U% c/ a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-1 03:43 , Processed in 0.048760 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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