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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 L( E( D5 ?% ~$ a4 c! l
  1. [code]EDMA sample test application
    . G9 f7 R8 l. m7 z5 ~
  2. /*9 P. q7 h. y; e  X# _# g9 E' _+ W1 m
  3. * edma_test.c* N. a  R& [7 b+ D% \, c! b: w! h! j
  4. *
      m. Z$ D5 o' u8 S
  5. * brief  EDMA3 Test Application9 [: c/ c( e6 A+ N
  6. */ {8 Q1 B. U' i4 h; s  F, g
  7. *   This file contains EDMA3 Test code.) K4 {( q2 B# E/ k
  8. *1 x5 i0 K; m: j- R# U! a# U1 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  z' t& d# `0 |' \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ n6 T! I& U6 {5 Y% k+ m
  11. *         TO CHANGE.
    3 E, z, d+ Q2 H. u
  12. *
    ( {& u4 p! M2 {: P% M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 f6 Y6 H9 `0 d* o! w3 Z
  14. ** M, h9 W9 }! ~( H; D4 `& }
  15. * This program is free software; you can redistribute it and/or
    $ _) p+ F# ^1 U
  16. * modify it under the terms of the GNU General Public License as
    & `# J$ F$ p/ w/ ^$ p8 k& b
  17. * published by the Free Software Foundation version 2.
    ' @, H- N' U  [( ?
  18. *
    - g4 @4 x! F* a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, U6 A- ?, {9 [# ^5 A! r
  20. * kind, whether express or implied; without even the implied warranty
    6 N- G0 ?8 D" v! y9 P0 d0 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # t. x1 B' Z5 a% W0 d
  22. * GNU General Public License for more details.7 C+ {4 u% ~% ?! D& t; X
  23. */2 R% k) h! `% V  G

  24. ( d( b6 C! _2 G- E  _6 J) R
  25. #include <linux/module.h>
    # @# L- ^1 X& }; b
  26. #include <linux/init.h>
    & V7 ^) W2 Z. q% f7 C# S7 h
  27. #include <linux/errno.h>2 O! j+ y. {5 |5 e( e3 g
  28. #include <linux/types.h>
    & h1 M; m  {) T6 I  p5 ?
  29. #include <linux/interrupt.h>  L( W! K0 R$ u$ \' {: ?- M
  30. #include <asm/io.h>8 V) r8 T" g% S! K0 b' p( m
  31. #include <linux/moduleparam.h>
      E; g* D/ J  [" x5 Y  Y
  32. #include <linux/sysctl.h>, \$ V; v6 o8 c. i! i' n- {3 v
  33. #include <linux/mm.h>
    ; X' r( k* Z+ o( ]) E
  34. #include <linux/dma-mapping.h>
    ( K. z+ \5 T0 x) Z. E% u! k6 Y

  35. ; A, A% x  L, ~& N
  36. #include <mach/memory.h>
    - B, g( d3 h: p9 b' @# L, D6 U9 ?, W
  37. #include <mach/hardware.h>( B6 _7 p4 E5 v! q. M5 k9 g8 `5 q
  38. #include <mach/irqs.h>! I! a; W& F  I8 \0 w1 Z
  39. #include <asm/hardware/edma.h>
    6 K. o$ d/ C/ M9 m5 V3 \4 g

  40. 1 h1 X6 q* Q3 a
  41. #undef EDMA3_DEBUG
    # p. d3 v7 O8 Q2 d1 d
  42. /*#define EDMA3_DEBUG*/: `' W+ [7 N) Z8 A" A1 {1 q$ \) C
  43. 1 i. \' l. T1 k* ]
  44. #ifdef EDMA3_DEBUG+ `7 a. u: F4 y8 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * I: B3 c, L+ t; n$ q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' k/ @: }6 {* e  m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " P6 N9 W9 C# P# k- m$ H0 `% d; \1 D" S' H
  48. #else% ?  c/ k% Z6 t, O* G3 c
  49. #define DMA_PRINTK( x... )
    ' K: [4 v& G% g* M) T2 v
  50. #define DMA_FN_IN. }$ {+ d# n+ m0 d$ \' @% E* G
  51. #define DMA_FN_OUT% j, ]) {" m: E% ]
  52. #endif
    ) ~/ s$ J4 R( Q" `1 h9 X4 M+ I
  53. / ^+ M! C  e9 o' o/ K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ M+ K1 Z8 t& J! [
  55. #define STATIC_SHIFT                3
    ' C; x  n  k( Q' X0 f3 o/ D; v
  56. #define TCINTEN_SHIFT               20+ Q# H2 f, d  k% X3 t) i% j
  57. #define ITCINTEN_SHIFT              21
    % |$ D( H# Z3 R. n" {6 h
  58. #define TCCHEN_SHIFT                22
    " q/ L8 J8 \% G& M% N7 C% |& P1 a7 x$ P
  59. #define ITCCHEN_SHIFT               23
    $ U1 m* P' }- j! Y! r& f

  60. 6 ]4 Y* b% B: ]  o$ t
  61. static volatile int irqraised1 = 0;
    0 H+ @# m+ `3 t# N" c& U
  62. static volatile int irqraised2 = 0;& F7 M& ?" v2 ~. T

  63. & ~+ N, k/ q( }* t- i- A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% X( w- ]% e0 n5 W6 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , z7 h( H4 \" A/ ^, a8 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  @" k8 h% N) ~- c% a
  67.   b$ J" Y3 ~% \/ Z: L3 J7 H: s
  68. dma_addr_t dmaphyssrc1 = 0;
      ~9 d# |1 x+ l0 P* d) [+ B# ]
  69. dma_addr_t dmaphyssrc2 = 0;
    5 m; G" @6 Z2 F1 g9 P
  70. dma_addr_t dmaphysdest1 = 0;' ^+ b. R' h( `
  71. dma_addr_t dmaphysdest2 = 0;1 P* O' ?5 `: N  P% l% A

  72. 8 k2 q# `1 H' B: ]: T# p; A
  73. char *dmabufsrc1 = NULL;1 q) o" Z/ U) ~8 u
  74. char *dmabufsrc2 = NULL;* l) M7 q/ G- I" Y6 U/ W$ W
  75. char *dmabufdest1 = NULL;
    / {! Q9 w+ e# ^4 e) p
  76. char *dmabufdest2 = NULL;
    7 b+ z: |% o; |* j% K; r. F

  77.   [& H4 v8 _4 C+ \
  78. static int acnt = 512;
    7 @1 G% N" C' w/ e& Y
  79. static int bcnt = 8;, Q. X4 C5 i4 |' T& u
  80. static int ccnt = 8;
    & v6 j6 v! f* h9 A% d7 q# ~) Y5 ]

  81. " x: I) ^1 t, p: F! o% t" _
  82. module_param(acnt, int, S_IRUGO);
    ! y9 q# ^# a2 M9 V: k  w% R0 W
  83. module_param(bcnt, int, S_IRUGO);
    3 y! F% m( Z) h. ^% A  [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 y- V$ _2 t, i0 f

  B& g* r  H" B$ x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; m1 o, O8 ]' J: d; j5 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  O$ z4 Z9 w, M+ O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 w) v# t/ |6 ^: X+ @1 d. `8 a) m. |# K) Z7 u' l
$ S5 x" I* }+ L' t; E4 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-3 17:33 , Processed in 0.045753 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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