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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ Z' S3 c. G- a, e. P
  1. [code]EDMA sample test application
    ! _$ X* D! X! I4 B8 ^+ u* C
  2. /*& t; E0 J* T8 M6 r1 _- j$ G
  3. * edma_test.c
    ' w  ]! t0 T6 V( E4 \6 B  B! V
  4. *; N: ?  J& W2 o) E' {/ \! U: P
  5. * brief  EDMA3 Test Application
    # M% y, q" z1 i0 `/ x5 }
  6. *
    , k$ D0 a; R% P9 s7 m9 p! L& _: c
  7. *   This file contains EDMA3 Test code.9 i8 X0 C* t/ T! ^* q# c
  8. *$ ^1 ^2 U6 V7 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 a$ V( J7 \3 _% ^- r' @3 |! M3 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & @. u/ T% t: y+ `0 q
  11. *         TO CHANGE.
    ) B2 ~9 Y* w! q4 {+ g3 P$ K
  12. *. B% O, B/ N8 H1 A2 q: P# |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 T" V, b, i6 E3 Z3 A" J3 {
  14. *
    8 W+ J. P4 x( ?; S4 K' @  u
  15. * This program is free software; you can redistribute it and/or
    1 j% r$ |4 D. A! I, \
  16. * modify it under the terms of the GNU General Public License as% ?1 R$ ]3 L; w( x
  17. * published by the Free Software Foundation version 2.
    & ]( K7 `3 m' C( H
  18. *# ]* @- k+ V3 A0 t: j6 f  w: `' Z( f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( j( X- M8 ?' V4 l. Y+ u7 M9 O
  20. * kind, whether express or implied; without even the implied warranty
    / h" o3 a) d+ M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 s" L- _1 a5 n8 u$ q  R
  22. * GNU General Public License for more details.
    6 _$ f8 u. b5 a) ~! h
  23. */" g( s; o. a6 U3 [$ y

  24. 4 K- _8 N3 n3 `; @
  25. #include <linux/module.h>
    * @5 v+ O% _' J' \! ]
  26. #include <linux/init.h>  S4 ~9 i) e. q, M& L) h* n5 {
  27. #include <linux/errno.h>: t. x3 H* l( |
  28. #include <linux/types.h>
    7 X' D4 q, J: ?3 B2 S4 i8 N
  29. #include <linux/interrupt.h>
    & c" \' T- V4 ]( g4 e( A
  30. #include <asm/io.h>3 V& L; D: v' f
  31. #include <linux/moduleparam.h>+ p- s3 B4 U7 @$ R  w
  32. #include <linux/sysctl.h>
    ! ~; V' Z* Z4 D( [  @: o
  33. #include <linux/mm.h>3 X1 P# ^' q, l" T: |7 L# l- k
  34. #include <linux/dma-mapping.h>
    $ @! h  D; C" }' |
  35. ' Q6 S1 s; i+ H3 [
  36. #include <mach/memory.h>
    ; X0 L, ^) g. ]2 e* P5 K
  37. #include <mach/hardware.h>2 q7 a$ z1 B/ |# C  R" V; U
  38. #include <mach/irqs.h>5 ], u" g; y7 T. n0 R
  39. #include <asm/hardware/edma.h>
    2 ^& u8 l( k; `/ A, O- h3 k' K
  40. ( y4 V) o6 R; D6 y& @  M- Q6 G
  41. #undef EDMA3_DEBUG
    0 S8 b& H4 z; G6 D  Z3 j: |4 W
  42. /*#define EDMA3_DEBUG*/4 _: ?7 D9 ^9 W+ W' I
  43. ) L7 H- ]* u9 d# w7 s& N/ C
  44. #ifdef EDMA3_DEBUG2 c! S6 o2 B& X8 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 B! p0 c0 r! b& Q  R/ I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- n* L) N- t, M( B' c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # f: O% r2 t; E/ I6 j, ~4 Q
  48. #else( E* N" E; l) V
  49. #define DMA_PRINTK( x... )" Q; t& o  e1 ~9 ^0 C: C
  50. #define DMA_FN_IN
    % ?% w3 _3 e7 g- `: H( W
  51. #define DMA_FN_OUT* c2 d2 n% f, ^" A8 v, E3 @
  52. #endif' d. b7 C) ~6 H. @  S$ v1 ?: S
  53. 1 }9 t: d# E$ \/ A1 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' n& M: Q! z, n( [' `' U
  55. #define STATIC_SHIFT                3
    % B: x& t, r& Y: R4 K" C4 m
  56. #define TCINTEN_SHIFT               204 P2 H2 d4 m6 [( @) E! b
  57. #define ITCINTEN_SHIFT              217 N$ c; I/ A4 s# I0 K/ s( W7 q
  58. #define TCCHEN_SHIFT                22
    $ ]1 P8 `3 M! `1 P
  59. #define ITCCHEN_SHIFT               23
    & ?% o8 {' _, j) e' x

  60. & b, e4 |( t1 y4 J/ B
  61. static volatile int irqraised1 = 0;; a! b3 G  x/ [8 x# C) W  q% v
  62. static volatile int irqraised2 = 0;7 g1 B% N7 P% Z: [- c

  63. . ~& c. I4 z. g& `9 \9 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: D% ~; u0 }9 \" C) _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 b% z5 Q, _- k% D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: m4 w1 I2 H! g3 L" t- U/ X

  67. 5 B* s4 `2 P! P0 v0 e7 ]- I. w8 R: x
  68. dma_addr_t dmaphyssrc1 = 0;7 s6 s" i1 V! u; n. T
  69. dma_addr_t dmaphyssrc2 = 0;3 {6 Y5 m+ g: V5 x/ ?( {8 u  ]% g& @
  70. dma_addr_t dmaphysdest1 = 0;
    : s, c1 K7 Y% V& O& `4 M# m
  71. dma_addr_t dmaphysdest2 = 0;
    4 o3 R+ G5 v8 ^2 h% E' r
  72. ; q% Q9 @6 f+ O- z& \) ]# K
  73. char *dmabufsrc1 = NULL;
    * ~1 [" ?7 n9 V8 t' T5 i
  74. char *dmabufsrc2 = NULL;
    % x3 c% R- F0 b( V9 m& y7 a
  75. char *dmabufdest1 = NULL;
    . ~; |( t' V/ X, N) ]' S- ]9 r
  76. char *dmabufdest2 = NULL;
    ) c% ]5 E! ?3 b$ x, D

  77. - i' [/ ?5 X- M$ C2 A8 I
  78. static int acnt = 512;
    2 X' K/ i" D+ m
  79. static int bcnt = 8;
    8 i4 [; d7 F7 f7 w, @
  80. static int ccnt = 8;
    2 y% V( Y. v9 m9 H4 p
  81. ( O: u" v9 [- \3 k7 \% v
  82. module_param(acnt, int, S_IRUGO);# E, a$ G4 @) Z1 ^% |4 N
  83. module_param(bcnt, int, S_IRUGO);
    * U6 W' ]; P$ L! Q7 {% U. `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 Y, S* }- W( K: L+ m7 h- N

# e" s# V! I2 ]4 @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) z6 I, f. O1 _( y% P; t$ uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( ?; V, E1 u0 h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. `- h+ i2 F* O; Z$ I! y: M( }/ V$ o
; \7 U, s8 O+ n" ], r% B% ^
0 F. J: m$ b/ Q& P9 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 21:28 , Processed in 0.038997 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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