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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 l0 @# M0 n' a" }& N
  1. [code]EDMA sample test application
    6 p: C4 E2 S* w+ c3 f! Z& Z- u
  2. /*
    6 P. P" r6 W4 |: M6 @& T
  3. * edma_test.c, A( n9 V, ~( c8 g( C' ^" W' W+ E9 \
  4. ** ?- O6 M; q7 j$ `  t+ U( \4 V
  5. * brief  EDMA3 Test Application
    9 H1 ]4 [+ o" g" ^0 R4 `! Y% y
  6. *0 W0 m0 ]+ ^. @7 R# U: V
  7. *   This file contains EDMA3 Test code.3 n- u$ s" }9 Z# F8 X
  8. *
    ) `7 _! L5 _7 Y5 W0 x& ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ f7 C* J: O$ l, J0 h  x2 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 |3 f' w5 V% H! f
  11. *         TO CHANGE.
    $ F' z0 W" z2 p- f
  12. */ M: I; k! Q+ t- r7 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % }* T( J/ e6 n5 w& S- i5 T3 t& o% N
  14. *
    $ j2 J8 J3 k" T/ y6 f$ v1 `  |9 ]
  15. * This program is free software; you can redistribute it and/or( z6 X9 Z* ^1 x8 O5 e
  16. * modify it under the terms of the GNU General Public License as# }; _0 i2 t' v; h  d9 ~. t! Q) }
  17. * published by the Free Software Foundation version 2." W, c6 Q& e/ q
  18. *
    7 F4 |. j+ C0 a- W# `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: f1 K% t; e0 G+ }" z' H
  20. * kind, whether express or implied; without even the implied warranty8 O; \' \* p4 h  ^. s- S) W+ ?1 T. t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ C% S+ Y5 l& i  F0 I* S' |' t0 l
  22. * GNU General Public License for more details.) P- Q; f) {9 J
  23. */0 k5 T" }" P6 m5 @% r

  24. ( r2 G( A3 |& r# ~% |
  25. #include <linux/module.h>0 H+ A* d/ v2 q5 j. t
  26. #include <linux/init.h>
    $ {+ K: t0 ?3 O8 E: a$ o
  27. #include <linux/errno.h>0 g) f7 F# c$ u' I' @4 R8 j6 t
  28. #include <linux/types.h>
    3 b  d4 ^& i- Y! T8 X
  29. #include <linux/interrupt.h>' I! F9 R- u+ W4 y& Q% J% g
  30. #include <asm/io.h>
    ! [6 G3 ]* ~" C3 K
  31. #include <linux/moduleparam.h>
    . C: k; b# }0 m8 O, C7 n  B
  32. #include <linux/sysctl.h>0 N) T' `6 h9 U1 f! t$ k6 C: S
  33. #include <linux/mm.h>
    & T; K* X/ Q7 N: G5 ]- p
  34. #include <linux/dma-mapping.h>; P+ m7 i  H! m0 T, j: [
  35. 6 u" n" p/ j/ B) E$ r
  36. #include <mach/memory.h>6 M6 R' r9 ^$ U+ I  B* D
  37. #include <mach/hardware.h>& _0 h+ L, ^' r9 l1 [
  38. #include <mach/irqs.h>4 u9 f+ s" F% [7 `! n" e
  39. #include <asm/hardware/edma.h>
    0 _+ P, Z- M6 b( l  K) y
  40. ' ?) f; _! G1 @3 P
  41. #undef EDMA3_DEBUG
    + Q9 u. I" X1 e- A% N8 ~" D6 n
  42. /*#define EDMA3_DEBUG*/
    - p5 w" A2 C/ L2 [
  43. " `/ @- R" I2 a# p
  44. #ifdef EDMA3_DEBUG" ?2 s6 w7 m# A5 K, g4 i! b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  A- Y& \: ^6 u$ `+ r" F- X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ k8 \4 I: O9 V! ^! n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 `# _" r7 K0 K! U
  48. #else: F6 g/ ?+ V' _, k$ B* J$ Y! [
  49. #define DMA_PRINTK( x... )! z8 U0 L; W* ^
  50. #define DMA_FN_IN) f7 X# {8 K) w3 z; t1 i6 W
  51. #define DMA_FN_OUT
    3 j. u* l- o- V# e/ }% _1 z
  52. #endif; K2 R3 L  I/ W; }9 L

  53. $ T& o3 d6 @$ |1 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - T& j  a3 B; {0 \- t
  55. #define STATIC_SHIFT                3
    / ^9 V9 s7 w1 T! [& L# Y
  56. #define TCINTEN_SHIFT               200 |6 d; U8 R# z) S
  57. #define ITCINTEN_SHIFT              21
    6 ?% N6 j: n2 g( o9 F
  58. #define TCCHEN_SHIFT                222 {% c8 T% k9 J4 l
  59. #define ITCCHEN_SHIFT               23
    ) K5 O7 C5 N" _8 l: y5 q

  60. ( r- N. _3 y0 F) L3 \$ W
  61. static volatile int irqraised1 = 0;
    8 @1 H3 a) d, A
  62. static volatile int irqraised2 = 0;
    8 P( |, d8 g( T; g0 x# @

  63. 4 i- i0 c7 s: _3 b2 M+ v* q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# o# T* |5 p3 v6 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( c5 ]0 J+ g% m6 E% ~# }5 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: I5 N- y1 ~% c

  67. 1 f  h' \# x* E0 n$ k# ^- W
  68. dma_addr_t dmaphyssrc1 = 0;
    / M4 ~% l$ D- N2 z! I
  69. dma_addr_t dmaphyssrc2 = 0;% w2 ?! B- \$ G; g0 X! X
  70. dma_addr_t dmaphysdest1 = 0;
    # V# y1 ?" _/ i! W9 L
  71. dma_addr_t dmaphysdest2 = 0;
    + L2 O' K% T& V3 ]

  72. / L/ s+ g# \7 w: [
  73. char *dmabufsrc1 = NULL;
    . `' U; H' Y3 }1 X
  74. char *dmabufsrc2 = NULL;8 _0 D' B/ z& q: f! j7 X' m* j# E0 x
  75. char *dmabufdest1 = NULL;
    ' h1 j" k4 L, I. y( Z
  76. char *dmabufdest2 = NULL;! {( r; G# y5 m. s  F3 t

  77. 2 r% q9 }& x+ x! N3 t2 n( X6 E! y
  78. static int acnt = 512;, W' u: b$ {2 @1 {, S2 v* A" {+ B
  79. static int bcnt = 8;9 g9 Q, R! u; t9 M
  80. static int ccnt = 8;
    $ s( ^, I2 r& I- n! w
  81. " J9 N* e* ]% c3 |
  82. module_param(acnt, int, S_IRUGO);/ [) r* w! S# S3 t. X, P
  83. module_param(bcnt, int, S_IRUGO);
    ( F% y  R0 [9 n) i& d7 ]- p. Y! n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 a  T% w3 O+ G* _
! _* q# C4 v$ h+ p$ Z; ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. L: d2 y, V7 L- r* W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 z* r1 D. Q' a  Y" a* [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 w) A! ~. Y! `! m
4 u% a% n! M2 z$ v3 Y

3 N' ]( g3 @7 f' H5 v9 v+ \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-20 22:16 , Processed in 0.039798 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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