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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  L' A  ~. {* l1 b: l
  1. [code]EDMA sample test application
    , Z# a, t- E8 P( w
  2. /*
    / T8 r& @; p+ u; R
  3. * edma_test.c
    5 ^0 o% \: p6 z3 q0 E! E
  4. *
    . |" f. H3 k6 u/ H
  5. * brief  EDMA3 Test Application
    " A4 S/ `. q$ Y+ ~8 Y& J- ]
  6. *$ ^& ~8 R  W* _$ D9 @$ _
  7. *   This file contains EDMA3 Test code.
    . r7 F9 a2 N4 P% X, t) T5 [
  8. *. m  O9 Q4 c9 @! ~% o/ h3 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: i3 C: b2 d4 M: K; T+ J) O6 s/ K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ i# @5 K; R8 R' p, ~2 |
  11. *         TO CHANGE., `. I" s8 z3 Y
  12. *
    9 x+ X2 `3 J7 t9 y* q0 m# s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * P$ z1 ~- F) _$ z/ h% c
  14. *8 h) o8 y# D% H, ^! T
  15. * This program is free software; you can redistribute it and/or# u$ e8 _. p6 ~, n5 K, G
  16. * modify it under the terms of the GNU General Public License as
    4 W0 J- ~9 U; Z$ B8 D  e
  17. * published by the Free Software Foundation version 2.
    ' ]( ^( O/ f, u' s
  18. *2 b5 y" R3 b! ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 a, G, i1 P; c4 u3 @
  20. * kind, whether express or implied; without even the implied warranty
    ) m8 G* D8 ~" D& d$ q1 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / W% u' S1 j: }
  22. * GNU General Public License for more details./ w( t0 L3 E9 Y; U; ~$ e. ?
  23. */% ]. y0 q  `2 k' S9 D1 Q5 W9 z
  24. 3 m: W6 k8 a9 _7 `+ N/ b
  25. #include <linux/module.h>
    $ C$ i& @: O* {3 m+ K
  26. #include <linux/init.h>% {" `' N5 u! V% y' O
  27. #include <linux/errno.h>5 X1 r- T. H6 X3 t% @, w, d
  28. #include <linux/types.h>
    + Q; O' p, I) Q# w. q5 ^* q
  29. #include <linux/interrupt.h>
    & x' q: e, R( x1 j3 F; B
  30. #include <asm/io.h>
    2 E) C* r) t9 N* d7 r; {& o; O
  31. #include <linux/moduleparam.h>- l( a! A& O0 {) }1 E; ^# t8 }
  32. #include <linux/sysctl.h>) A7 x' t# M$ u. l; g7 B
  33. #include <linux/mm.h>
    3 Q( Y" s9 K2 ^1 z$ B) O- t: d
  34. #include <linux/dma-mapping.h>- C; C  p$ k2 l

  35. 9 l8 r% O0 M5 l# ]1 x6 F
  36. #include <mach/memory.h>
    3 ]* N- U; w1 Z/ w! V( G  b
  37. #include <mach/hardware.h>
    . d4 b3 g6 U4 _" N+ C1 I
  38. #include <mach/irqs.h>; N, C/ F, ^9 t' g
  39. #include <asm/hardware/edma.h>  r* [3 L  e1 b! q* c" `
  40. 9 q. l, k* M; K$ g! x0 a  \
  41. #undef EDMA3_DEBUG( }2 A: M& g9 T4 G5 a4 G/ u
  42. /*#define EDMA3_DEBUG*/. }( R  S' G" Y0 h  E
  43. . l5 b$ V$ @8 y  a' B
  44. #ifdef EDMA3_DEBUG9 k$ r8 S2 y# _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 s* e! w; \  ^1 s2 O& J; H3 j4 A1 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 I; j! [0 y4 c4 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 Z& P( S% }! w( Z5 f8 @
  48. #else
    " H6 ~1 n  W! y/ ^3 F
  49. #define DMA_PRINTK( x... )
    7 R$ c$ Q$ x+ U
  50. #define DMA_FN_IN
    . l/ q) T( t8 {# J$ q9 Z2 x
  51. #define DMA_FN_OUT$ s9 w9 L- |2 N* d  ^
  52. #endif' h; Y% r, J( ]& l) v; I( S
  53. * @' x( j7 c2 z" L3 m, [' r# Z# [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& F# u% M/ p. Q- M+ h2 t/ b* h
  55. #define STATIC_SHIFT                37 r/ w' H* G( j! |, L& y8 u# W
  56. #define TCINTEN_SHIFT               20" e1 s0 ?" O# n! r7 T
  57. #define ITCINTEN_SHIFT              21
    7 c% _3 v" t! L; J
  58. #define TCCHEN_SHIFT                228 t* S# g2 J3 k$ O
  59. #define ITCCHEN_SHIFT               23
    6 I6 ~( o# E- z2 G
  60. 3 s& c" f) ?$ V! z3 ?
  61. static volatile int irqraised1 = 0;" t" S5 C8 \- |5 l: H* ]6 n+ @
  62. static volatile int irqraised2 = 0;- m# ?9 a! s2 e
  63. 1 Q- f3 L0 a7 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , N# ]3 E+ d3 n6 D) g. S6 \2 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 r5 _+ [. p. i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" [, H# M% Z7 O  s

  67. & ]0 g+ h: y$ o  H* E0 _4 ~. B
  68. dma_addr_t dmaphyssrc1 = 0;
    + c& _; `4 M! B' {# w6 r
  69. dma_addr_t dmaphyssrc2 = 0;% A2 w( c  n- _# {
  70. dma_addr_t dmaphysdest1 = 0;: D/ {2 Q, l+ \
  71. dma_addr_t dmaphysdest2 = 0;
    . n  A+ ^' X, v+ v4 Q& l
  72. 4 _/ B( e0 _8 D  g; ?
  73. char *dmabufsrc1 = NULL;
    8 p1 \3 K* P5 U% J0 d+ D# c( ~
  74. char *dmabufsrc2 = NULL;
    % |* G" i& b5 n  K
  75. char *dmabufdest1 = NULL;
    / c( a' j) a) A4 t( w1 k
  76. char *dmabufdest2 = NULL;
    9 P4 M7 E* S+ ~
  77. " \1 P0 q. Y5 m  W
  78. static int acnt = 512;/ _& j5 N4 A- Y* Q/ }
  79. static int bcnt = 8;! _0 \/ G$ R% o
  80. static int ccnt = 8;
    - B3 M& g. N  H

  81. ' W4 o. t8 H5 N
  82. module_param(acnt, int, S_IRUGO);
    6 O1 F2 G( C, P. g
  83. module_param(bcnt, int, S_IRUGO);
    - Y( F, |6 l6 A; \: }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* A7 V" E4 q+ u8 l' k

3 i! v/ V) ?( I7 Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 ~' C! R0 e9 \6 ]) X$ y' L+ L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- K% d7 J* ?4 h# Q' i2 h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: F- u+ f3 I; b2 Z$ }1 {! ?/ \' d

) b+ I6 r# y4 g! [$ T" Z- K2 U% W& z$ V% W% W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 07:27 , Processed in 0.039088 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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