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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 Y- b9 K6 H# s2 A7 K5 {% s) g1 k
  1. [code]EDMA sample test application
    5 Y, I/ Y' B9 V& x4 {) l
  2. /*+ y8 o! H8 K  \% w' r' Y
  3. * edma_test.c
    1 @& B4 W- O/ a- O
  4. *
    2 e1 X; A/ j  g; V( D& D
  5. * brief  EDMA3 Test Application  L4 O) m& h0 v9 \- c8 G
  6. *
    $ W' _: Q. ^2 R: N( [3 m) _
  7. *   This file contains EDMA3 Test code.$ X, a/ F7 b* t, w& q. j; `: I$ V
  8. *$ Z) a4 V- D, O% I% ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 G: d7 T4 g* X* n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 A: W3 ?$ j0 C* i
  11. *         TO CHANGE." r! v9 N- w+ v
  12. *3 J& V! g3 C6 d7 p$ A# R0 e( ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' x0 N9 H$ m" F! ~1 V4 \
  14. *
    % z7 @" W8 u) r9 `* j# I3 P8 W7 y
  15. * This program is free software; you can redistribute it and/or7 ~  _1 x7 F7 E1 g2 {: W: u7 B
  16. * modify it under the terms of the GNU General Public License as
    1 Z( O6 W7 Z! z7 Y
  17. * published by the Free Software Foundation version 2." A9 J6 j) R) P3 I; J( F
  18. *
    5 m8 F, |; t+ I! q8 B" Z6 V4 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  |( i" H; B$ w# \' l5 D  |
  20. * kind, whether express or implied; without even the implied warranty0 N* r! X1 R1 R: B. N4 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , \, [6 R5 F9 N, i" P
  22. * GNU General Public License for more details.3 H5 i6 b  N+ J( Q8 i
  23. */% r& F9 C9 m3 M$ P
  24. - r  X2 J# R6 p  R  [7 i: ]. y2 i
  25. #include <linux/module.h>8 `* Y8 _; E: u0 j4 r$ t( _; B3 W
  26. #include <linux/init.h>
    , K1 s9 X% o1 {1 j0 U
  27. #include <linux/errno.h>
    ! Y' P9 B; G6 i# R
  28. #include <linux/types.h>
    7 @% E/ R3 A( }4 c. `
  29. #include <linux/interrupt.h>7 u) O) J9 R/ ?$ x: X
  30. #include <asm/io.h>
    ) z/ u  S+ C6 A1 M9 p. x$ m+ n
  31. #include <linux/moduleparam.h>2 N! \8 @0 h7 b2 V$ _1 F: x
  32. #include <linux/sysctl.h>  W: @( |  \) }9 ]
  33. #include <linux/mm.h>
    8 E$ Z5 Y+ ~1 S) b
  34. #include <linux/dma-mapping.h>6 K/ P. G3 o3 _9 _+ W& t- T7 P
  35. ! N7 A" y+ e$ o- U
  36. #include <mach/memory.h>
      w4 W1 u' K3 c3 F1 _; W$ `' m
  37. #include <mach/hardware.h>1 P' k3 {$ m3 B# X
  38. #include <mach/irqs.h>0 O  g7 X) ^' T+ ?
  39. #include <asm/hardware/edma.h>! G5 e6 l9 D1 f. j$ f
  40. 7 j' H& w- T# u& q7 i$ P
  41. #undef EDMA3_DEBUG; ^. \# |4 W/ l1 K0 _
  42. /*#define EDMA3_DEBUG*/" r0 ^# M# W8 E: e5 l2 g1 S9 L
  43. : N1 O8 y0 `3 P: c
  44. #ifdef EDMA3_DEBUG
    8 ~2 s+ M; M. Q7 u0 Q/ n3 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( g- S& [8 z% i5 Z& U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . T/ d( _" c( g; {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # X. I. X% Q- R% h" g) e
  48. #else, Q  C! u9 U7 Z+ d- y: R- @" c
  49. #define DMA_PRINTK( x... )
    " W/ I/ d4 X% n, J8 [7 K
  50. #define DMA_FN_IN, `) O$ u7 h2 s" h
  51. #define DMA_FN_OUT5 r2 c7 W1 X. C& g
  52. #endif. l9 D% ~% O- u1 h3 X: }

  53. : H' y+ D# t7 @# `& p' W9 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 r7 C, C& M/ s" i% V9 a3 A9 T
  55. #define STATIC_SHIFT                3
    9 G  W$ O- ]; V1 j
  56. #define TCINTEN_SHIFT               20) [8 l  s0 ]( h4 W; ~/ Z7 g2 G
  57. #define ITCINTEN_SHIFT              21" P. i4 b" j' B6 L! T  j1 g* m: `1 d& h
  58. #define TCCHEN_SHIFT                22  c! o2 Y6 ~5 T6 U* @
  59. #define ITCCHEN_SHIFT               23
    " u8 R4 m5 r& o* w; |
  60. + @0 b  B' }$ L* c5 b; h9 ^
  61. static volatile int irqraised1 = 0;
    7 G- C# p8 D5 o/ l9 |6 u
  62. static volatile int irqraised2 = 0;4 L: h/ a8 M( L9 T* [, z/ @( A% D  Q

  63. ' y) U9 w5 P  ^$ W' p  S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 x' i. f. S+ F* k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ a+ \. {& i( s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 v2 c' m( I/ \( M

  67. - {7 {: S+ V5 G  \- E
  68. dma_addr_t dmaphyssrc1 = 0;5 C8 n: ]# k% T7 i+ d! Z7 W
  69. dma_addr_t dmaphyssrc2 = 0;
    4 B# D2 [. W3 i& _  K. l
  70. dma_addr_t dmaphysdest1 = 0;
    2 `  w% c, a7 f2 p# v$ S
  71. dma_addr_t dmaphysdest2 = 0;/ G  M: \7 I. o, t. \
  72. $ |3 a" u- o  g. b, l1 _/ I" B
  73. char *dmabufsrc1 = NULL;
    8 S1 D7 O4 c6 v
  74. char *dmabufsrc2 = NULL;5 q9 a, I* M9 v8 a- k# Q6 o
  75. char *dmabufdest1 = NULL;
    2 i9 b% e0 N+ C# K# w+ Q4 b. @% P
  76. char *dmabufdest2 = NULL;: {. o% \3 T4 g9 e6 ?( h! B% E
  77. 4 N1 }' z5 S! r! b
  78. static int acnt = 512;
    7 q0 k! J' ~4 C0 H
  79. static int bcnt = 8;
    ; k8 Q2 c4 m6 R6 ?
  80. static int ccnt = 8;
    " t- U% X& H4 f/ o

  81. 5 B4 f9 I4 H6 ?* V1 E, o' `7 V% R# Y
  82. module_param(acnt, int, S_IRUGO);# N% O0 M: j9 Z' ]5 V3 P5 L$ |
  83. module_param(bcnt, int, S_IRUGO);
    . G/ r1 v, r. J  _- ?: b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 G" \" S, M6 c: b
- i/ K( C9 s* H! v  Q% E# ]' M( X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ^% r& N: u& v/ u; r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 `" D. q. I8 [; ]" ]6 q, H/ p1 }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) `5 }2 f/ G7 v  _2 O& R$ h! P6 \+ N
$ u6 v! ]! _7 s9 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-26 11:43 , Processed in 0.041398 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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