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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / f( g" _" i2 \0 j: Y
  1. [code]EDMA sample test application
    * M! V" j  Z9 v5 Q
  2. /*+ T3 y5 A, e+ h
  3. * edma_test.c
    % B, ^) A. O1 }- B2 d0 u
  4. *) z0 ]- S) d) |( v
  5. * brief  EDMA3 Test Application
    3 K" N% i$ e/ c5 \& d# M" }+ e5 ~0 {
  6. *9 |4 E! Z! x0 C- J) u+ W
  7. *   This file contains EDMA3 Test code.; K3 [4 }2 ~0 k5 Y! d6 V
  8. *
    * b& e; e5 o' o* f! I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 _  a8 f. S* L- `( S' ]% e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + o; ^$ U: S3 S  g8 |
  11. *         TO CHANGE.
    6 s* {* s3 _! L' ~6 K' V; b+ ]
  12. *
    1 A/ T/ A; u# a7 N) ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 G) ]" E+ x! e% l
  14. *
    - @& d8 F% h' O$ L
  15. * This program is free software; you can redistribute it and/or8 y! v& \: y' e" `7 C
  16. * modify it under the terms of the GNU General Public License as+ K* P9 b/ u3 O, N2 {% q- n
  17. * published by the Free Software Foundation version 2.5 u; Y4 E2 `0 W
  18. *& [& o) K. o. f  F4 A+ Z7 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ ^7 X' R" ~7 M( ?* U' v
  20. * kind, whether express or implied; without even the implied warranty
    + x  h* I: s- z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % O' H$ l  t! M( G( j
  22. * GNU General Public License for more details.
    8 ?; c# H( E1 u5 r+ \' E  |
  23. */; G0 f8 X9 c1 Q4 b$ R& |
  24. ; n2 \7 w  q/ D" Y3 _0 E& Y& Y
  25. #include <linux/module.h>
    + Z( m! Z' p/ m" ^
  26. #include <linux/init.h>6 `3 I* t) S- ^
  27. #include <linux/errno.h>1 I6 u) y. X+ [3 G5 B0 Y0 k: N, ~
  28. #include <linux/types.h>
    5 {4 e9 R: w. h% U
  29. #include <linux/interrupt.h>
    " U5 s; R0 A4 E& Q/ o+ K
  30. #include <asm/io.h>
    2 q0 L3 N0 q9 x, q
  31. #include <linux/moduleparam.h>
    % N8 H( Z- o4 m1 N4 L7 _" }
  32. #include <linux/sysctl.h>9 [! s9 x! `5 X* k- g4 }4 y6 y: e
  33. #include <linux/mm.h>
    * X5 Z3 ?7 X* J7 o) B
  34. #include <linux/dma-mapping.h>
    . y7 ^1 l. S% k- }" G2 l

  35. + @  T- y* Q, _4 E7 [
  36. #include <mach/memory.h>9 f! }7 z) q7 y+ |2 W
  37. #include <mach/hardware.h>
    " j/ J3 o9 `9 A5 X7 r
  38. #include <mach/irqs.h>
    4 J3 ?% D% [" d4 U% T. Z
  39. #include <asm/hardware/edma.h>
    * p+ q3 n6 ]+ Y8 _) \. J# x8 Z" }) L

  40. , u3 s: G+ f9 H5 u  p5 p" X
  41. #undef EDMA3_DEBUG
    & t  ^) }& E. k3 b, D( w. s4 c
  42. /*#define EDMA3_DEBUG*/
    ! {9 k  \, p9 S4 ^$ v- H+ G8 L
  43. 9 r" \( g8 ^. @$ m8 `& R
  44. #ifdef EDMA3_DEBUG$ M" o# Z6 z9 N/ d) t& Z, B% K' e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - N: R* U+ X5 ]8 s9 W; v) g* }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - V" O  b) K, v. m1 P% X; [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- ?7 W5 Q4 ~1 r! c2 S
  48. #else
    . E" h- o8 I& f5 [2 O/ B
  49. #define DMA_PRINTK( x... )5 ?3 h  X5 G% t* n
  50. #define DMA_FN_IN- T$ o, K) Y7 r3 G
  51. #define DMA_FN_OUT7 Z( p. d6 g) E: {6 e" }+ ]/ |
  52. #endif. [8 q7 I( T! L5 J5 Q4 \. G

  53. ' Y% ]$ z" F1 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * A0 B! s, a* v$ m0 L% P- M8 L! \
  55. #define STATIC_SHIFT                3
    / O4 g3 H4 E5 x9 N, w( l
  56. #define TCINTEN_SHIFT               20
    - T( I: r/ s& p: p) S; X) V
  57. #define ITCINTEN_SHIFT              21
    2 U& v9 _& v' ~. P9 ?
  58. #define TCCHEN_SHIFT                227 D/ C6 I4 U# L( K0 Z# T
  59. #define ITCCHEN_SHIFT               23
    7 v% H4 U2 d( Z+ t/ \6 ^

  60. % p+ S# k0 v8 L( m# q; \7 q; E, K; D
  61. static volatile int irqraised1 = 0;
    # V% o5 ?- N( Q2 m+ y
  62. static volatile int irqraised2 = 0;9 `* N- d0 u4 X5 l0 h

  63. ) W  \: g# a3 S. B- ~4 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 z) q% v8 k8 O) }( P* y% L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 n, O' ~3 b, l' Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) `: c9 d- W0 b; ?

  67. , u0 t# E6 ?8 t5 Q; G7 `; m& d; J
  68. dma_addr_t dmaphyssrc1 = 0;% b9 j$ l, c  Y4 i# m% C/ `
  69. dma_addr_t dmaphyssrc2 = 0;
    7 o4 H! y, l8 C8 L' a3 \
  70. dma_addr_t dmaphysdest1 = 0;
    & W7 x5 }4 D! K/ d: {
  71. dma_addr_t dmaphysdest2 = 0;" F' H" S( \+ e- h3 t/ v+ p
  72. / g/ ]- U0 S" `5 p( c
  73. char *dmabufsrc1 = NULL;4 b$ W2 Z5 S/ S6 _8 n6 E
  74. char *dmabufsrc2 = NULL;- h6 P% e7 }& S9 W; s+ v& p
  75. char *dmabufdest1 = NULL;# k. Y$ h  c4 R+ W# c8 y
  76. char *dmabufdest2 = NULL;
    * h: n8 ^2 @' {( e) G

  77. 8 d+ `1 t/ k/ ~6 C* v3 T
  78. static int acnt = 512;& _: Q8 u6 p* \3 g+ \
  79. static int bcnt = 8;! K0 G. J& y  Z& L" p! O5 T; k% ~
  80. static int ccnt = 8;! K: K* F$ @# H9 t3 K

  81. 5 x# [% i$ L3 {9 f
  82. module_param(acnt, int, S_IRUGO);
    ' u; k! u, X  {2 g, B
  83. module_param(bcnt, int, S_IRUGO);8 u0 A6 W; l4 \$ |) w3 Z" u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( M# x% f+ q) y. t9 C. ]- ]
$ P: U, Z! T7 d( D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, z+ ]: j$ J7 v' x1 U$ D! \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' a/ N" q: S  |3 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 I' X, K; ]- v. x* E- |2 [' A8 f' _
" I: I% B7 i# k0 g( ]# a6 m) P4 ?: i8 d
& o: r; Q: w* P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 21:15 , Processed in 0.041768 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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