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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' ?* |/ d  J, }* p$ ~
  1. [code]EDMA sample test application
    - Q$ w% D" a/ M' b% Z- o- H% d2 s
  2. /*  q& b! L6 o) I" R, g
  3. * edma_test.c
    ! b8 ]/ m1 o! M6 ?
  4. *
    : }8 Y5 t+ p. u% ^+ L
  5. * brief  EDMA3 Test Application' ]& }4 h0 T; ?0 ]. h
  6. *
    $ C# X: A6 f0 z0 i
  7. *   This file contains EDMA3 Test code.
    4 ?. W. X$ a: }' \; X, T
  8. *  c) K: f* C* j8 p& K9 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / l% D3 d2 N! @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + k: U& ?: m9 i$ h  i, O* x
  11. *         TO CHANGE.
    . X( m3 {7 c1 L2 S
  12. *3 Q: b7 e; Y; e7 v8 Y7 e7 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 ^$ c) u' v* W! |- c8 W
  14. *1 t0 r; T6 b  ?
  15. * This program is free software; you can redistribute it and/or
    3 _2 V  }: s/ U, T2 v
  16. * modify it under the terms of the GNU General Public License as  N4 |  e6 B' \# h) o1 U+ e
  17. * published by the Free Software Foundation version 2.4 T6 Q$ d1 W' I# c
  18. *
    4 C5 e8 c/ o% V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! A$ T) h0 F* Z4 }; x
  20. * kind, whether express or implied; without even the implied warranty0 P$ K2 `; b+ P( q# p& g' R* ^8 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 I7 L$ x1 P# r; c8 E. H2 m1 n; k
  22. * GNU General Public License for more details., e# ^0 u0 Y$ `& X' i
  23. */
    0 n1 N0 M, u/ b. a& ^" Y
  24. 9 {& I& @* I$ a5 J. M' U
  25. #include <linux/module.h>
    9 r1 F# J0 \$ \5 z) n1 {
  26. #include <linux/init.h>
    1 B6 w3 Y, f, h2 R  V
  27. #include <linux/errno.h>! E% T' W1 j+ c* r
  28. #include <linux/types.h>
    + v' q& K0 P8 H" y# D$ k
  29. #include <linux/interrupt.h>% n0 w6 _, {' k5 s" G
  30. #include <asm/io.h>6 B+ w4 o* v. T$ s, I/ @" N. d
  31. #include <linux/moduleparam.h>0 l  r/ n  A; g. L* Y& ]
  32. #include <linux/sysctl.h>
    ; Q& k, A8 s5 B0 g! R
  33. #include <linux/mm.h>
    1 r$ y9 I' [4 n7 R4 s
  34. #include <linux/dma-mapping.h>/ _& W5 B' y* [" j& ]- A
  35. " \" b- o/ ?/ l# x* u/ d# j
  36. #include <mach/memory.h>
    & @" Z& x5 `& t  \( s, T
  37. #include <mach/hardware.h>
    5 R3 f4 ]9 @' q1 ]# V+ m, e
  38. #include <mach/irqs.h>
    : j' ]; o- ]/ w8 r5 \3 s
  39. #include <asm/hardware/edma.h>! E, C' g% P' k' Z9 }6 b

  40. " V& \  A9 k' w9 W  \; A
  41. #undef EDMA3_DEBUG8 w* G# ~4 g0 j  y) n
  42. /*#define EDMA3_DEBUG*/. N5 |1 Y0 \/ |$ f) n/ V1 d) w! p# A4 W
  43. / _, i/ l- f5 @" n! D2 x. j0 ^& J
  44. #ifdef EDMA3_DEBUG
    ( C, d, F+ x# I) \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) u( Q5 Z1 G* @* h, W* a+ U$ k' {. F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 h* e/ z& a% |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ N( ]% p+ l0 C0 O' g
  48. #else# k6 m6 q9 U( y4 \8 j/ c
  49. #define DMA_PRINTK( x... )9 K! Y- k6 u5 O  M+ D" D
  50. #define DMA_FN_IN
    9 z- Q1 h+ ^' R- @* V" d- P
  51. #define DMA_FN_OUT
    ' M4 ~, d$ J0 o. ~% c- |8 U
  52. #endif  @3 [3 D; c, \; f- R
  53. & W8 ~) E7 D/ a2 M6 Y$ r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- Z: ]* `- |# N( a9 i3 ~
  55. #define STATIC_SHIFT                3
    , e2 B. q" A! X! V. @% |
  56. #define TCINTEN_SHIFT               20
    / P; C2 q0 X; R0 \* }
  57. #define ITCINTEN_SHIFT              218 X7 o) _, C* U7 l$ ]* a/ t! [
  58. #define TCCHEN_SHIFT                22
    4 r/ Y3 F) X) [
  59. #define ITCCHEN_SHIFT               23
    4 a3 E/ N& ^) I6 R8 U' E
  60. 4 K0 q3 I& V9 b1 S# j+ b& Y4 J
  61. static volatile int irqraised1 = 0;7 F" o, ~( X5 g7 Z. y. ?, r" Q
  62. static volatile int irqraised2 = 0;
    $ k9 m: H/ L! }# @

  63. 0 {& S. K! m5 H' m! @: m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( P' q6 Z! k9 g) |, P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 C5 g7 q* @9 r% h' z& B# m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Z0 x0 {$ N$ E$ o7 @
  67. % b# v; d( h5 }3 y! }! {& \) F# ~7 T
  68. dma_addr_t dmaphyssrc1 = 0;
    $ t2 x' F6 n' M+ @/ p# b
  69. dma_addr_t dmaphyssrc2 = 0;8 q1 E; v' f6 Q, }
  70. dma_addr_t dmaphysdest1 = 0;
    / A/ Q: `2 ^$ ]+ c: v
  71. dma_addr_t dmaphysdest2 = 0;
    6 Z7 P0 x% G8 V4 g' E" K

  72. % J* z( i* u1 e/ y. |( {
  73. char *dmabufsrc1 = NULL;
    : l# i4 D* H6 q# @
  74. char *dmabufsrc2 = NULL;. \- e" Y7 t3 n2 X# Y5 c
  75. char *dmabufdest1 = NULL;& s- A1 n9 h0 ^5 n1 K; x
  76. char *dmabufdest2 = NULL;" z# U" W& e! K8 ^  H
  77. / t! F9 e, O( Z, v
  78. static int acnt = 512;
    4 c, E0 s% x# X& e
  79. static int bcnt = 8;
    9 ?  t" ?) d# z, B" {: U
  80. static int ccnt = 8;% a2 y# e1 m& ^' U$ l

  81. 5 o4 w3 `* `: a$ D: O3 ^$ k' g
  82. module_param(acnt, int, S_IRUGO);& I1 f9 g8 x1 v( l4 s) d; y4 P+ N8 O, n
  83. module_param(bcnt, int, S_IRUGO);
    3 K2 [' ~1 i+ c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ k" \/ x$ r  N& Z" P# j4 J9 A8 g! a
2 Y/ J* E5 O' K- R3 B5 o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 ?5 u+ G* S$ m' i# a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ P8 e, c6 \  c9 Z0 R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( Z% X' B# j# {5 R& j
% O) h/ S" ]: @8 u9 W6 Q: T! a* Q* P. b( l& D0 I# z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 16:11 , Processed in 0.037764 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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