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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; U! z" Y) F% H; m( ]
  1. [code]EDMA sample test application
    , m+ y  c9 r  U
  2. /** M$ O  u! h) I
  3. * edma_test.c
    - E: A" }4 o! s/ E. k
  4. *9 w8 O* G0 Z6 ?2 C+ n3 u7 U
  5. * brief  EDMA3 Test Application( T& X1 H  A1 f" W$ S% y8 M
  6. ** o; ~9 W. q7 g& P, H2 b. j. f; j
  7. *   This file contains EDMA3 Test code.
    9 c/ q# d1 y9 D3 u
  8. *' j* G2 ]0 m0 h3 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - f4 I0 I! R' s2 j8 R& t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 L( y% b" q6 x; k# B' W
  11. *         TO CHANGE.
    " I$ i% G: X: D, _% ]- ]
  12. *2 K) s4 h5 o3 Q% A* Y/ G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 ]- U& }4 e- D, u. A' K7 c
  14. *
    8 y- W$ u! h& t& ]$ S" |+ W
  15. * This program is free software; you can redistribute it and/or# b, c1 i9 N* a+ c' P$ O
  16. * modify it under the terms of the GNU General Public License as; a  J  R# _7 }: O
  17. * published by the Free Software Foundation version 2.
    0 d8 [- i! y- Q; _3 r- ?( g; q
  18. *
    . }' k" V5 M6 N+ u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 y8 _7 P) P; N7 B
  20. * kind, whether express or implied; without even the implied warranty
    2 y6 R+ b/ Y" X: }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " D* A4 O! T$ r1 K; u) G; H
  22. * GNU General Public License for more details.9 Z9 f% j$ }# _( u5 ~+ O
  23. */
    ; I. Z' `6 x, b# Y" S

  24. " \( b# K/ T. B8 m
  25. #include <linux/module.h>: _* m3 O. F* h! l% V) |
  26. #include <linux/init.h>
    - {" Q; ^- [$ r3 k5 P/ V
  27. #include <linux/errno.h>
      v) U, B$ g9 i! S7 o# x( i
  28. #include <linux/types.h>3 N0 M* O1 P8 {# d
  29. #include <linux/interrupt.h>
    # K& \- N2 v& P
  30. #include <asm/io.h>
    2 h7 _; V, }3 }% ]. r
  31. #include <linux/moduleparam.h>
    $ q: \8 w/ ^/ j  W! F* r8 Q2 P
  32. #include <linux/sysctl.h>
    - v& y% y1 v5 M  d
  33. #include <linux/mm.h>& g* J/ i0 H: B6 q) p& P' J; p
  34. #include <linux/dma-mapping.h>6 W- b5 k; h/ G  F' F. y8 Y( b
  35. " W: [. W: O$ s5 ^: @; y
  36. #include <mach/memory.h>3 _  z6 g: a/ p6 z' O" v
  37. #include <mach/hardware.h>" q, Y/ r6 L# V  Z( [$ |6 \
  38. #include <mach/irqs.h>4 x6 e7 B; S+ ^. V. ~* z6 x1 ~. s
  39. #include <asm/hardware/edma.h>
    # L0 U; H) I2 B
  40.   O. p2 n; S4 E0 m3 `' o
  41. #undef EDMA3_DEBUG! }/ K6 ~* q$ N' Q
  42. /*#define EDMA3_DEBUG*/% X( g' |- Q$ p3 e
  43. 6 f( ]- f8 H, h3 I5 ?, S
  44. #ifdef EDMA3_DEBUG
    ' g' b( d/ m& M6 o. J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * w% n4 r; s4 f9 h& t+ ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * {3 \$ e5 }; y: D8 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 O$ M% g  x% u6 P* e7 T8 _' e$ K
  48. #else
    . c2 M: y2 }) _( _
  49. #define DMA_PRINTK( x... )
    . _' s; O+ V; _( M/ f
  50. #define DMA_FN_IN
    2 I% A& A/ X  E% N) ]( `" j. I: x
  51. #define DMA_FN_OUT( v! S* I+ W# ^$ K4 ~/ i  q
  52. #endif* E" {% v3 Z5 s- D/ V6 B  D

  53. 1 e( f, B: P- l6 `4 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ T6 Z6 r/ L  S( y# H
  55. #define STATIC_SHIFT                3# j  u: \: {7 I% s# t
  56. #define TCINTEN_SHIFT               20! y* q' A; c2 O; N
  57. #define ITCINTEN_SHIFT              21; u1 }& W0 i7 A1 m) S5 Y: r$ i2 k
  58. #define TCCHEN_SHIFT                224 y% e! Y5 F0 |" L  D
  59. #define ITCCHEN_SHIFT               23
    ; u( [5 \" a7 R2 U5 l  T
  60. : N+ h" {, m+ S- S5 p7 t
  61. static volatile int irqraised1 = 0;
    : D. j0 Y+ W8 a3 ^; t! W% `- ?
  62. static volatile int irqraised2 = 0;. F! R$ u8 F; \

  63. / M) D' y8 r( B& x( ^1 q6 o  B5 o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & C$ g. p. I3 N2 l4 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % P8 D& b6 M/ i. o" c/ Y9 p1 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - m* u: r, j4 o+ m7 x" _  w: y
  67. " @+ U  d$ r2 }' v
  68. dma_addr_t dmaphyssrc1 = 0;
    9 \! j# O; k  L( f1 ~  l, r6 Y; L
  69. dma_addr_t dmaphyssrc2 = 0;5 T* Z* g0 X# s7 a
  70. dma_addr_t dmaphysdest1 = 0;
    & `6 q) Z1 t* T- m. s' {
  71. dma_addr_t dmaphysdest2 = 0;
    / U! Q$ q1 \  ?3 Q1 T$ A
  72. % G9 z' K2 e1 @; @0 E& j8 q
  73. char *dmabufsrc1 = NULL;7 T7 i4 D' t2 @
  74. char *dmabufsrc2 = NULL;
    7 j/ G  J8 ?# j2 }$ y3 j$ K3 w
  75. char *dmabufdest1 = NULL;
    ' |0 c4 ~  _. V* `
  76. char *dmabufdest2 = NULL;; c6 _# K# r" i

  77. 9 b. T* l. j: @9 h, [, s- O
  78. static int acnt = 512;9 U# S7 [  ?# Y& l
  79. static int bcnt = 8;
    ) x6 Q+ }! p' R3 a' F, Z% Y
  80. static int ccnt = 8;
    % p! {4 p( R- V3 ?8 s

  81. 1 L! a+ S- V' r. J, e. B5 B+ O
  82. module_param(acnt, int, S_IRUGO);
    # y( q, c! O9 y9 D% I8 d
  83. module_param(bcnt, int, S_IRUGO);
    % @; x/ E; Z' h* W: z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 p+ J7 U" m: A0 q& b* i- s$ I8 \/ i* X4 o& x/ j6 V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ p# p: d# R4 U8 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 i8 K8 E& r# X$ [7 M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 }* b9 M& f5 p; ^

2 n+ K9 O! K8 i! i1 F) t& J( F" H$ V, U+ _1 M  G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 05:12 , Processed in 0.036365 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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