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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 I( V5 O/ `6 u' U: t6 T
  1. [code]EDMA sample test application* E; c) I2 \! w; Q( i
  2. /*5 o# f1 a# [# ~  N2 P
  3. * edma_test.c" g# x; J; A' y
  4. *. T& p) n: \: x+ }( ]4 r! c
  5. * brief  EDMA3 Test Application4 }0 V. W5 P% z8 M! J
  6. *
    ) y4 w2 m2 W3 T3 i
  7. *   This file contains EDMA3 Test code.0 M7 x6 F2 V! ^
  8. *
    & g+ j% @* e/ Q0 w& O3 V1 Z3 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " Q& a: b8 x2 J& V2 S- ?" Y' f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 [3 Y* F+ o" J9 X5 ~
  11. *         TO CHANGE.
    6 K5 E0 Q& e3 c, ~
  12. *! C- P% f6 E3 _! `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; F$ C; D8 m  V' Z, U; h6 i9 X& \
  14. *
    # y& A) W. l6 y. l  t
  15. * This program is free software; you can redistribute it and/or0 M/ U) i+ K* j; r6 F
  16. * modify it under the terms of the GNU General Public License as& R% G1 H5 k5 c9 W
  17. * published by the Free Software Foundation version 2.
    $ ?/ M& m9 p# M$ g& N5 V
  18. *
    & M8 r  r' U( V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: \' ?  n" x7 U
  20. * kind, whether express or implied; without even the implied warranty
    # P- k" R# _  B; d! S. H7 g  z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! k: _+ b! @; E0 S4 i( [
  22. * GNU General Public License for more details.& z; Z0 e" E, z* o) Z5 }, v
  23. */
    ! P$ T" u2 ^! F
  24. + R0 m$ {3 q, o' Q3 E1 F6 P
  25. #include <linux/module.h>8 u3 K# `1 h% K+ ~/ T/ Z* \
  26. #include <linux/init.h>
    ) k7 B8 D# u2 x- [9 O/ T2 ~
  27. #include <linux/errno.h>
    1 w6 K/ f; |+ M- g9 k  b+ o
  28. #include <linux/types.h>
    + l; B" m$ h$ O# Y9 {
  29. #include <linux/interrupt.h>: b8 Y8 T) X& G1 z0 {
  30. #include <asm/io.h>/ |( @# P; Z( q2 b/ A' J
  31. #include <linux/moduleparam.h>. {2 ?, T$ L) h* h0 x& `
  32. #include <linux/sysctl.h>
    4 L+ O- z, n% |( s4 t- r4 c
  33. #include <linux/mm.h>
    / ]; i. R% v; v; ^( n# p, f
  34. #include <linux/dma-mapping.h>' p7 _2 z9 b* n# E# q$ Z

  35. $ @' Q4 Q& t" m" j: x
  36. #include <mach/memory.h>
    ' U) \1 A' B9 f7 B1 ^
  37. #include <mach/hardware.h>
    4 k$ t' [+ ~: g, ^. f
  38. #include <mach/irqs.h>
    ' ^% p; U$ s7 I8 e* q
  39. #include <asm/hardware/edma.h>9 k6 \5 H9 R! U0 G# O
  40. * d  b& ]6 V$ u* N7 k
  41. #undef EDMA3_DEBUG: D  ?9 o  P& B4 j; p& y
  42. /*#define EDMA3_DEBUG*/2 l/ z  C( a! I3 O: c

  43. : [' c. ?3 p1 O' @& x+ T
  44. #ifdef EDMA3_DEBUG
    ( H, e8 S. E$ g: B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; t3 f0 s- ?9 c2 |) D' k6 ?: |$ J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); G/ O) I) G$ e3 _% f' _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# K( `6 n5 i' O9 h
  48. #else
    # c# E4 q( n  ^7 g& k
  49. #define DMA_PRINTK( x... ). `: ^0 o3 e# S2 e2 o
  50. #define DMA_FN_IN
    $ b7 Z5 F% v6 l+ V- B
  51. #define DMA_FN_OUT! p: G* Q5 {$ }
  52. #endif. R) [3 l$ K2 g0 m" I8 o
  53. 9 O4 X6 I" K) M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% X5 E! z$ K; E% y7 M
  55. #define STATIC_SHIFT                3; f5 l- f: K5 {9 L5 R; L1 G8 e
  56. #define TCINTEN_SHIFT               20
    : l; E6 _: ]* `6 Q, r
  57. #define ITCINTEN_SHIFT              21
    : v# m9 a+ g6 k& t, j# \3 p
  58. #define TCCHEN_SHIFT                22' z4 X5 p; V% p9 j  |3 @! d) [
  59. #define ITCCHEN_SHIFT               23
    " @: y$ }: o# A3 n9 I6 v
  60.   z. W  Z& P3 H. p9 M
  61. static volatile int irqraised1 = 0;
    9 y) f9 F: I' ]+ F7 D
  62. static volatile int irqraised2 = 0;
    $ J5 o" W& N1 [7 }$ U

  63. 7 U) w  q% E6 F" y  \- ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ t) k+ t' {; u! B' j9 ]5 A7 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 V& f& m; G6 @* ~2 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + L+ h) i4 ~2 f' {

  67. $ P+ P' U) a9 }1 E+ ?
  68. dma_addr_t dmaphyssrc1 = 0;
    3 w/ ^6 F' B4 E. O$ ]
  69. dma_addr_t dmaphyssrc2 = 0;8 n" z& }( l" K! r4 K# \
  70. dma_addr_t dmaphysdest1 = 0;
    ' M% l0 o2 V9 D
  71. dma_addr_t dmaphysdest2 = 0;
    - o) i; T: O# J: f
  72. ! F  \, B2 [/ v8 h* k! i2 R: f7 T- p
  73. char *dmabufsrc1 = NULL;
    5 G  U& }' X: g; I: p! |& [
  74. char *dmabufsrc2 = NULL;
    / x" ~/ ^0 q# j% C3 [
  75. char *dmabufdest1 = NULL;- }9 V! m) L+ D4 i; y6 s+ h
  76. char *dmabufdest2 = NULL;( J4 F/ A% e$ C

  77. . N; y4 x$ p6 F# ~
  78. static int acnt = 512;
    . B) t# R/ r0 J+ @' t
  79. static int bcnt = 8;6 y2 U9 l" x( Y8 x, `* X- D* p
  80. static int ccnt = 8;
    4 Q+ [% c" D$ z1 U, N

  81. ' ?% F. u( f5 L
  82. module_param(acnt, int, S_IRUGO);
    ! L* V' o! }8 J3 T
  83. module_param(bcnt, int, S_IRUGO);
    9 o: `3 M( z2 K! e1 k+ _4 D- {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: B3 F6 X3 k) R. U* w9 F
  F2 c; a7 E# K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 F) V! _( m4 `* C4 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" M- F) v& C0 F& p2 p& L6 @+ h  y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% w/ u, b$ d/ k" h5 l6 I0 b! ?6 T! i. }

& \' F2 L* i/ H; a1 p9 V) ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-9 10:02 , Processed in 0.039491 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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