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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( \3 P: D! |5 A+ R
  1. [code]EDMA sample test application
    6 {9 ^9 a5 @5 `% k# B9 `
  2. /*
    ( h7 V1 H9 J7 h
  3. * edma_test.c" y" D5 \$ F# a4 P) l
  4. *' J0 z5 w! N; x: t4 [
  5. * brief  EDMA3 Test Application
    & J+ |$ y" b+ c; S8 a. u8 d* n
  6. *
    1 r1 M8 O8 r3 e( G4 Q/ u* c
  7. *   This file contains EDMA3 Test code.. R4 q9 S( d# R' J  R
  8. *
    , ^# U1 t% K2 _3 f4 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 O( @2 g9 S% U2 K3 y( @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 B+ Q. Z- _+ v; z
  11. *         TO CHANGE.
    " x8 t" @/ o( u- `' W
  12. *
    1 N6 i( q4 g4 z' M7 B$ A4 i2 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & r2 |4 k8 J3 ?3 |
  14. *  V* Q3 Q% k, i) @  @
  15. * This program is free software; you can redistribute it and/or( Q2 E! ?. f* k4 s( l
  16. * modify it under the terms of the GNU General Public License as6 `3 ?+ Y3 \4 z3 T, \5 T1 d* I! D
  17. * published by the Free Software Foundation version 2.
    ' X4 M5 g. [+ i& l* W
  18. *
    - R# I  ?! J' ^; X  r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - R5 @  F- {2 v1 z
  20. * kind, whether express or implied; without even the implied warranty
    . f8 z4 ?$ `/ _7 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % O- n- Z: X2 \* U2 K$ k9 m
  22. * GNU General Public License for more details.9 G! j# o: [- K, o7 ~, _7 J' N* a
  23. */7 d8 F6 I* u8 t# m% m) b. B, [# h
  24. 6 Z! ^- m: z1 ?$ s& T% O
  25. #include <linux/module.h>3 i: e- `$ B1 B- i- O# ^
  26. #include <linux/init.h>/ Q4 M2 F1 C8 l
  27. #include <linux/errno.h>1 q) z1 `3 g& M8 V9 l
  28. #include <linux/types.h>, n& e7 o$ Y2 ?
  29. #include <linux/interrupt.h>
    & S: w3 i3 f& W$ C
  30. #include <asm/io.h>
    2 b0 r; I; K: `% ?' G. M2 m+ g
  31. #include <linux/moduleparam.h>
    ' h/ F7 i: B. T+ {/ x
  32. #include <linux/sysctl.h>
    9 e9 }! k  z' G, A1 o% k8 X
  33. #include <linux/mm.h>
    3 Q  o4 S/ c) H5 i( Q/ ]9 _
  34. #include <linux/dma-mapping.h>
    ; I9 J, H5 o" r9 f6 f0 M

  35. , c# D: ?* z- x( ]  A+ D1 V
  36. #include <mach/memory.h>
    2 v+ c" y1 @, L4 q" g
  37. #include <mach/hardware.h>1 t- R) e# B) j
  38. #include <mach/irqs.h>
    0 D7 \* r- A1 r8 ], k- @8 K: N
  39. #include <asm/hardware/edma.h>
    ' C1 y5 j$ @. L/ e4 x/ T) S7 k9 q
  40. ; w& G! M: O0 F& l. Y
  41. #undef EDMA3_DEBUG$ w. f4 a% a7 U6 O% l
  42. /*#define EDMA3_DEBUG*/5 k- Y! h8 E1 H7 N2 z6 H" K

  43. 5 f* l0 g' l# y$ H5 S
  44. #ifdef EDMA3_DEBUG" a* u8 R( d! O* H8 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' O, u$ V$ a1 l6 j) g  G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& @. V# |4 x  w' ^! z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! i+ a+ W& z6 Q4 d; P" u
  48. #else
    ) r) [2 G. ^, _1 y, o! a. r
  49. #define DMA_PRINTK( x... )% O+ Z3 U  r( M  N
  50. #define DMA_FN_IN/ }  \9 O( ^9 K- L3 G
  51. #define DMA_FN_OUT
    1 {5 A8 n- ]% M- W. L' ^
  52. #endif
    4 k* F# M. h1 J, n6 q
  53. - d2 Q; c/ Q% l, v4 E- i1 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - b, L- k% n, {7 d) \9 t
  55. #define STATIC_SHIFT                3& }! |6 V' m. m, T) e3 y
  56. #define TCINTEN_SHIFT               20
    1 L7 f& i* J& z7 l( E& a  w0 _8 r
  57. #define ITCINTEN_SHIFT              21$ I0 A" E1 X& L" ]" `5 I
  58. #define TCCHEN_SHIFT                22
    + L1 m- y/ I' c: f3 D
  59. #define ITCCHEN_SHIFT               23
    $ \9 H: P; |3 X4 j6 q
  60.   u7 V& e  U; |9 [' ~7 T
  61. static volatile int irqraised1 = 0;: R+ ~+ Y& {7 d6 t% C
  62. static volatile int irqraised2 = 0;. q3 ^8 v) a1 @& q4 V1 u  l

  63. . {: h' S% `0 `/ x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& P9 K" ~4 ]9 ]' m& Q7 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e4 O, j; e' e. w& ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 G+ y! x  c0 h$ J& e$ }

  67. 2 i% q/ b0 `7 n& d1 J
  68. dma_addr_t dmaphyssrc1 = 0;9 F- D+ |3 M1 s- e
  69. dma_addr_t dmaphyssrc2 = 0;0 q- d' l, s' B  c/ O% E
  70. dma_addr_t dmaphysdest1 = 0;0 M: u6 L0 B; ]' M  R
  71. dma_addr_t dmaphysdest2 = 0;
    : m9 h) d* U4 q" Z$ U' H# N

  72. 5 u% ~0 ]+ S' Q  F  W7 s
  73. char *dmabufsrc1 = NULL;
    4 m% [" G1 D/ h# P. o- s; A
  74. char *dmabufsrc2 = NULL;
    , K  s! O6 o# {0 E
  75. char *dmabufdest1 = NULL;
    / H- G8 {$ u1 _  R
  76. char *dmabufdest2 = NULL;
    ' c% e7 G4 L1 Q7 V" P7 W
  77. 6 M8 x$ n6 t+ x4 n: a
  78. static int acnt = 512;
    9 \# E& c# }% @9 x
  79. static int bcnt = 8;
    * V' _  ~$ q6 v" t
  80. static int ccnt = 8;4 M# @! @- A: Y9 E4 o0 ?! ?
  81. * R* ]( P5 r, ?& i: _5 L4 k
  82. module_param(acnt, int, S_IRUGO);  Q$ x3 I9 a6 |) f# M; h: ~. @
  83. module_param(bcnt, int, S_IRUGO);
    : ^) c* D1 C& `2 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- h% n, c8 J, ]* j
6 u, J! U! b: ~" M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# J& U6 V* q  Q3 Y/ d* c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" _1 j1 f% d/ Q& \* C  ?' q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 ?, Q1 N) I2 t9 g9 m
. p% Y+ t7 a: X! w. J' \+ d
( D  A6 M& ^. t3 P1 O; z; L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 01:45 , Processed in 0.038338 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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