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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : W6 ?! b* D( T+ j
  1. [code]EDMA sample test application& d) K( Y- [+ n$ j0 `6 D5 ]2 |3 n
  2. /*
    + C7 s' {6 v8 f% |
  3. * edma_test.c
    ' w$ d1 {$ d% A6 Y, a- l9 h
  4. *. U0 Y# \: a4 `1 H) a$ r
  5. * brief  EDMA3 Test Application# p5 [' y- ^2 Q
  6. *+ a0 r/ R+ |0 y* r: d) k0 M
  7. *   This file contains EDMA3 Test code.
    " z3 s: p; S9 t- J/ C: P  `& Z& M0 [
  8. *  o, E: p/ c1 q/ c( d2 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ P; P8 u( q# J6 M/ B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& ?% h; n% @6 g" M
  11. *         TO CHANGE.
    8 S6 {3 a1 t! ?: l* _8 x
  12. *
    * W7 @. |; h7 h3 \9 f' o0 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" d* N$ x# @/ {( M# b4 C
  14. *
    & l$ W* r# W7 n) w: B
  15. * This program is free software; you can redistribute it and/or
    + _. p8 [3 D& A4 B# x- M
  16. * modify it under the terms of the GNU General Public License as6 L4 @- P) S$ b* u  u* ?9 `6 C& P
  17. * published by the Free Software Foundation version 2.( B- Q9 o" v" O% H0 ?
  18. *
    $ k7 i" P2 r: x$ E$ {% j* p4 ^- c3 T% U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 W( j7 q, P9 U& l3 ^  j1 B
  20. * kind, whether express or implied; without even the implied warranty/ \; S6 X# L: Z& o" N$ ^8 J( R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: ?4 `/ L! Z! K' H
  22. * GNU General Public License for more details.
    ) c- M! u4 D3 I" X9 Z( Z
  23. */
    * }. O1 M1 @. I% k; B
  24. $ |3 ^7 X& `. y; j1 H) e
  25. #include <linux/module.h>2 ^2 z' P  e1 o/ W
  26. #include <linux/init.h>
    % W  b& m3 `3 g" W
  27. #include <linux/errno.h>1 c. H. `0 D0 ?
  28. #include <linux/types.h>1 U. _3 W, I' m8 X: v! G
  29. #include <linux/interrupt.h>
    6 K* |% \8 S$ g( F0 Z
  30. #include <asm/io.h>
    . B; Z5 D% u1 w
  31. #include <linux/moduleparam.h>$ A4 L7 X; Q% M0 W+ X" W
  32. #include <linux/sysctl.h>, j5 K; `" V6 x5 p* q
  33. #include <linux/mm.h>
    # Z! \. v7 b+ q% U" h: H8 ?
  34. #include <linux/dma-mapping.h>- s: Y5 G; p/ U, k
  35. : G, j; K# u# J+ ~4 v- V
  36. #include <mach/memory.h>
    1 Q: T- u: f9 f! |" H/ V, e
  37. #include <mach/hardware.h>* `, b1 w/ V$ E! S; L" |* X
  38. #include <mach/irqs.h>) |% O2 N8 p0 U1 ~
  39. #include <asm/hardware/edma.h>( P6 `5 C5 h8 t- M8 V

  40. ! ~6 `7 t" G% s1 ~
  41. #undef EDMA3_DEBUG
    . g7 u2 p" p# b2 l6 S8 x- X/ o
  42. /*#define EDMA3_DEBUG*/
    8 E8 G5 @* z7 j8 P3 E% J6 Y

  43. 0 L* k, X5 A9 N
  44. #ifdef EDMA3_DEBUG7 P6 J' i  i$ a3 c, }" ~0 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 u9 M, u( o# F( T5 w* s; J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ d' t9 k. w/ J5 j( W2 s7 g- |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " j' j6 D( b" I: A( _+ w" s
  48. #else" V1 \+ Q! F$ w8 N( P% E
  49. #define DMA_PRINTK( x... )
    ( M$ o+ l+ l* G9 I; S
  50. #define DMA_FN_IN2 ~- Q6 E7 T, [
  51. #define DMA_FN_OUT! W8 u6 S! g/ ^9 W' v9 L
  52. #endif) K1 ~4 M. U5 q$ s# V% }

  53. 4 y& n9 H0 O# _/ e3 F, R* {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# [2 v! \: s/ e3 h: ?4 p
  55. #define STATIC_SHIFT                3. T! O! g, {; t- m& {
  56. #define TCINTEN_SHIFT               20
    3 Q$ K& v8 H3 [% \) o- \  ]3 F
  57. #define ITCINTEN_SHIFT              21
    ! Q- d1 Y* u; v/ I' ]
  58. #define TCCHEN_SHIFT                22
    7 H- Z' p/ S( ^! C' m0 w6 K6 H- k
  59. #define ITCCHEN_SHIFT               235 O' k7 o8 y2 ?* S% T+ f% t

  60. ! \& b" n* T" v
  61. static volatile int irqraised1 = 0;
    ; F6 m. }6 W! S, g6 D
  62. static volatile int irqraised2 = 0;
    4 B: z4 o: }: g0 z8 t3 B3 @8 o
  63. 4 H1 o% ^0 a) ~6 y" y, F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ?" l" s$ y/ V4 h( i/ m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 Y/ ^( D3 h0 F+ A' M0 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# w1 U+ U8 S0 X2 y
  67. 4 b' l$ Z& r- t0 c# r# B
  68. dma_addr_t dmaphyssrc1 = 0;: t' e9 O6 F' G3 _, |7 r& ?+ ]
  69. dma_addr_t dmaphyssrc2 = 0;
    & M8 `& a% b3 Y0 T3 R. G' s" k
  70. dma_addr_t dmaphysdest1 = 0;# x0 q, N" F8 {/ y1 b% ]* {2 w! A
  71. dma_addr_t dmaphysdest2 = 0;9 I. O% R8 ]6 E* b/ y) |
  72. ( S- J9 x. G/ b# ]
  73. char *dmabufsrc1 = NULL;
    ) k3 x- y: U! v$ T1 w8 r: N
  74. char *dmabufsrc2 = NULL;( \( g3 U: U+ z
  75. char *dmabufdest1 = NULL;
    ( w% g4 G; R% P' }4 S
  76. char *dmabufdest2 = NULL;
    : l& g: t/ U8 s+ n: E4 |& c

  77. ' U( L% c- m4 R/ a$ E
  78. static int acnt = 512;! y+ A4 u! |6 f7 w, I$ l% D. o
  79. static int bcnt = 8;
    " F/ x2 ?, `0 d0 x
  80. static int ccnt = 8;/ }) I; F7 n! c2 v' K
  81. 6 s5 a' [; o2 K2 `# X! }
  82. module_param(acnt, int, S_IRUGO);
      T# F: ]1 D7 H) g2 L
  83. module_param(bcnt, int, S_IRUGO);2 r( ?% H: `5 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 z! s# j9 u. o) k$ {$ D7 b

# y# z9 R& Z" W3 Q$ R& N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ m6 O9 w- Q. ]2 W* W' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" A/ F  \  O. c  l# K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; M9 q, V! Q" i' Z  X: u! L; B7 \8 B1 A
  a8 _& c- B1 b  x/ C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 19:49 , Processed in 0.041329 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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