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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% J- F# |, F  U2 ]! Y3 G
  1. [code]EDMA sample test application" F& h8 Z3 _1 j1 k
  2. /*, [% J0 h& G6 o, {* r& Q3 g% B
  3. * edma_test.c
    " c3 @1 v4 d4 v1 b: w  ~
  4. *
    * k( P0 w" y/ |/ N: u- V' v1 y0 c
  5. * brief  EDMA3 Test Application
    , i$ `& s  u+ M5 v
  6. *5 e+ n* x3 U% ], Q; Y6 [, v
  7. *   This file contains EDMA3 Test code., T0 ?4 D% U3 J
  8. *
    / P& R7 G4 h1 p7 L# n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 k; J0 b$ x  v2 B& d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. Y- N! d$ Y" k4 i# y( [
  11. *         TO CHANGE.8 }# N) X5 b- d. n# I/ |
  12. */ |# A7 S% [. k% n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) t$ r. y7 T  z& l* w
  14. *
    3 _4 U0 J! I" [8 U2 p8 M6 o
  15. * This program is free software; you can redistribute it and/or  K- c- `0 z6 }% r1 P% H; E
  16. * modify it under the terms of the GNU General Public License as
    9 B  H. Z& d! i6 K% q& u1 t2 k3 `+ O
  17. * published by the Free Software Foundation version 2.
    ) s( q  s( K0 m2 [! N9 R8 o
  18. *
    ) w8 d% p/ o$ y. U, @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 Y9 a+ C( q3 y" i$ W  h! v
  20. * kind, whether express or implied; without even the implied warranty% [8 M. V* K2 R" L1 Y% U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + I6 J" \6 P- P5 k: ?
  22. * GNU General Public License for more details.
    & v& N4 u9 W0 u) M# v& J
  23. */
    : @8 m* a. {) D! _. m

  24. & p  W" p: Q4 X, p: U2 w
  25. #include <linux/module.h>
    5 D- e' K) @0 r
  26. #include <linux/init.h>* v+ `9 _: _$ ?' P, q
  27. #include <linux/errno.h>
    ( [( `3 q: A3 }4 ~
  28. #include <linux/types.h>% q; k7 \1 @* _8 L* M2 I
  29. #include <linux/interrupt.h>8 O9 S7 I/ y4 k6 [; r: x* A9 b
  30. #include <asm/io.h>
    , p$ z- i. ^. B' Z) t- d& _9 o
  31. #include <linux/moduleparam.h>. L1 N# A9 l9 G) |, m3 U9 {
  32. #include <linux/sysctl.h>& z" k6 _0 D6 W9 T) F
  33. #include <linux/mm.h>
    3 [5 D' G, j; i* l! |3 t) I
  34. #include <linux/dma-mapping.h>) O! ?1 j3 j1 i* S- K
  35. / W! N! P+ n0 w6 K
  36. #include <mach/memory.h>9 D8 \# b: v" N" M0 u4 s/ ~
  37. #include <mach/hardware.h>' {% I- O. o8 S! _/ }
  38. #include <mach/irqs.h>: s; h" `6 ~5 l* y% K6 h
  39. #include <asm/hardware/edma.h>
    , D; Z# r2 h' E

  40. 4 G) Q, Y* T2 I- i8 ^6 ]
  41. #undef EDMA3_DEBUG4 F2 Y& u$ z6 P/ j" i4 n
  42. /*#define EDMA3_DEBUG*/8 R; P2 a/ h* ]! R* ?& d. K

  43. - G! N/ |, a; a
  44. #ifdef EDMA3_DEBUG
    ' ]" _% c# @7 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 Q. U& P8 r* b2 M# C; \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; j9 ~# U( C7 H1 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; q& [2 F* f) c+ X  O$ D
  48. #else
    : g+ c$ P4 U2 C+ g$ Y
  49. #define DMA_PRINTK( x... )6 S, R' O& P! s0 H
  50. #define DMA_FN_IN6 W/ B/ W) w. R8 e
  51. #define DMA_FN_OUT
    6 F- a6 F8 X4 y" m6 b# r, S7 o
  52. #endif: T8 c  C# C; p$ j$ p) n: x6 z

  53. " w$ I1 L& |0 q/ @# P3 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ \( M& h* Z) e1 {+ |
  55. #define STATIC_SHIFT                39 Y5 K0 C$ }1 ?3 H: V; T2 ?+ X$ W: t
  56. #define TCINTEN_SHIFT               20
    ) G2 L6 I, O  o, x2 \7 l
  57. #define ITCINTEN_SHIFT              21% D; X/ }/ I  H; m2 Q2 n
  58. #define TCCHEN_SHIFT                22& Q4 y; Q( A4 W! g2 Q+ g4 |
  59. #define ITCCHEN_SHIFT               23( \; n7 b2 U, g$ u, x+ E

  60. , v2 F* {4 Q# {. I7 t
  61. static volatile int irqraised1 = 0;' Q8 U- k2 ?# f9 k5 H5 {& r
  62. static volatile int irqraised2 = 0;
    1 {, [6 \8 g5 f; D% r) l' V
  63. # j; K: l8 Z( l6 S) S6 G4 V' E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 [$ m7 \4 l% ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ]; b: H$ I: e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( X. C; m1 n# Q! k; J9 M2 x5 F9 ]
  67. . I2 r! l8 ?0 `2 U/ T4 }; z4 e1 F
  68. dma_addr_t dmaphyssrc1 = 0;
    % w' K* P+ E$ [+ _3 {; ~0 A$ ~
  69. dma_addr_t dmaphyssrc2 = 0;2 k, V( o( u9 L9 a+ H" r
  70. dma_addr_t dmaphysdest1 = 0;
    + r0 r0 h  b4 q- t0 `! \
  71. dma_addr_t dmaphysdest2 = 0;. f2 X: E2 g! @6 C

  72. 9 N; Z  R8 V0 w& C
  73. char *dmabufsrc1 = NULL;5 |4 W/ M& C0 l7 Z0 O, Y
  74. char *dmabufsrc2 = NULL;
    8 g. i  l# t- O" Y* {+ Z  t
  75. char *dmabufdest1 = NULL;
    1 P' Q( \' X9 E
  76. char *dmabufdest2 = NULL;
    / {/ ^( R' C, l, t
  77. 6 j6 e/ R4 g6 K: o; ~, w- ^
  78. static int acnt = 512;' E( C8 v+ p3 }1 }( L/ d
  79. static int bcnt = 8;
    . `  f9 T: k# J1 ^
  80. static int ccnt = 8;
    " O2 n8 E! J: V1 x! {/ ]5 W& z7 {
  81. 7 X& T! a+ }2 F+ ~+ a
  82. module_param(acnt, int, S_IRUGO);( c+ J6 q: V# |8 J$ R1 z
  83. module_param(bcnt, int, S_IRUGO);% I5 F! W# d; P" F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( A( Y2 N0 S3 C# t1 r" w0 c7 l  I
& M1 {8 S8 Z4 r5 d3 n, ?2 b9 m2 j& f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 Q4 b2 x) z7 S0 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* X5 q( t( O( z: ^' W: F/ `1 P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# x" M# E. n9 B7 t2 g0 {; b
3 T1 _8 x  W0 f( W
) p/ Z' \& ]; d9 E" k9 E' _* z/ G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-3 12:38 , Processed in 0.037974 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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