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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' t' y) K: z7 N6 x, r; U: l
  1. [code]EDMA sample test application
      h) S- U9 G- C* K% p% R: C
  2. /*
    & P  B7 s+ J  ?) {
  3. * edma_test.c
    0 N& S/ r# R% N" X2 K+ }! v  ~
  4. *8 h! }( y. f% v6 `
  5. * brief  EDMA3 Test Application
    $ ^: N3 w: `7 p: K7 A' X) l
  6. *
    ' Y% M- c' O0 ~3 N4 ?, u
  7. *   This file contains EDMA3 Test code.2 W3 c& V2 N5 ^( [8 P
  8. *
    2 B4 Q6 X" f3 V) l# E3 \, G. Q; h6 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 N+ N, G" K, n7 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( ^- {) N$ R  Y$ z
  11. *         TO CHANGE.
    . c7 N* k, c- \( G
  12. *
    8 I. ^$ c- z. A/ D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " y3 d6 w' l4 S* w; a7 y4 T) e
  14. *
    " R% {& d/ i' @3 V) n
  15. * This program is free software; you can redistribute it and/or
    - \# a9 s: A. H
  16. * modify it under the terms of the GNU General Public License as
    9 M, ^) O! N8 b9 f/ O
  17. * published by the Free Software Foundation version 2.' P) y6 n+ S& i4 u' I0 v
  18. *
      V* A3 {4 P1 Y8 ]6 O8 n7 m& c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ m2 ]( R8 R! O! G- g7 \+ w
  20. * kind, whether express or implied; without even the implied warranty  W4 s0 |$ T: V/ ^6 }: T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / s# a$ m7 [0 m, L1 {
  22. * GNU General Public License for more details.5 Z( P3 V+ k' b& [7 p/ g
  23. */$ ^# r% A; s# `8 k7 b- I! F
  24. 2 v! b: E5 I) A- @$ m3 G3 w
  25. #include <linux/module.h>
    % F. q7 _- W. I' b
  26. #include <linux/init.h>$ E. [. @. |  e1 {
  27. #include <linux/errno.h>
    5 N. J& n: v- S' s
  28. #include <linux/types.h>% K5 O& @3 n$ ?; }1 p# m
  29. #include <linux/interrupt.h>5 j; h& W4 \# P' S
  30. #include <asm/io.h>$ v" c2 [" K$ K/ g9 E
  31. #include <linux/moduleparam.h>
    : S, \- E, U/ c2 f5 t. O
  32. #include <linux/sysctl.h>4 I% K0 n5 g. j1 G) }- U  Z
  33. #include <linux/mm.h>7 v( c# G+ U  `4 K6 U
  34. #include <linux/dma-mapping.h>
    1 f+ |$ j$ U+ w! D2 J
  35. ) l. c) T0 ]% ]/ X9 b6 \
  36. #include <mach/memory.h>
    , n- G+ W+ K9 ]4 M
  37. #include <mach/hardware.h>
    8 P6 r  g* A/ `% U( Q( f
  38. #include <mach/irqs.h># k2 ]) F4 ~9 V" M4 B; K' A
  39. #include <asm/hardware/edma.h>
    * P, O5 V" X  }
  40. ! X( R, M4 S/ b& W
  41. #undef EDMA3_DEBUG) f( n1 D; ?% T' K% }2 A! ?
  42. /*#define EDMA3_DEBUG*/; [! N. z' h. b- [! B( V

  43. * ~' B( m9 q) T* S
  44. #ifdef EDMA3_DEBUG! ?: a! X9 m" f! w) t! ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* M  M& h# f1 n8 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% T- {" T9 n# v1 V& K# o& x$ W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 v7 ]4 j+ D" q3 p
  48. #else; ?( F2 ~0 u/ E# d- s$ Q  G/ A, i5 X
  49. #define DMA_PRINTK( x... )
    ' B4 N3 ^8 v4 o& n2 D
  50. #define DMA_FN_IN
    9 X$ h. H5 i" z6 f1 ^, [
  51. #define DMA_FN_OUT
    " \# _/ _. ~( \4 }" V) n
  52. #endif: [/ B! |! u/ Y; \5 i" t

  53. % Q: I, u% V, x6 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 j& O1 p, T/ l, j9 u. b7 `
  55. #define STATIC_SHIFT                3: f+ I- ?1 D- E5 R" ]) ~
  56. #define TCINTEN_SHIFT               20
    + ]4 d( T" N& y/ c  Z
  57. #define ITCINTEN_SHIFT              21
    $ y# D1 ]! R9 C8 X( k& n# ^$ [
  58. #define TCCHEN_SHIFT                220 ^/ [: r; t! a3 `1 O4 @/ N) z/ G
  59. #define ITCCHEN_SHIFT               23  ?" m  `- t( o$ I; m
  60. % @: j; L$ [! l
  61. static volatile int irqraised1 = 0;; ]# l6 u1 i) j6 o. F
  62. static volatile int irqraised2 = 0;
    9 [/ ]$ b! T! k' G  Z# \
  63. * F, L4 N2 o) T/ q9 {8 R3 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) u3 z4 n5 E, ?! W8 L9 U$ }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 v" v3 |" r6 \7 `# k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 {) b% C, c2 }. e5 x" i

  67. 2 X( X. h1 x6 Q' x: r3 S
  68. dma_addr_t dmaphyssrc1 = 0;
    ! p* _* e$ N7 W) A# N+ v( h
  69. dma_addr_t dmaphyssrc2 = 0;3 Z, o7 g8 S& Z
  70. dma_addr_t dmaphysdest1 = 0;  Y4 z8 R' M. ?4 y: G
  71. dma_addr_t dmaphysdest2 = 0;6 ~4 i/ s. D6 A2 ^5 Q2 K( j+ U
  72. & G. R% b- B) U4 N# s! p
  73. char *dmabufsrc1 = NULL;
    ' C- N6 Z. T) b2 J
  74. char *dmabufsrc2 = NULL;
    6 f$ l6 B. \- |6 Z* M
  75. char *dmabufdest1 = NULL;. q( E) L, X  o8 m
  76. char *dmabufdest2 = NULL;! x! Y( G! I- o7 J% j
  77. : d; ?8 s% E; p1 G7 s+ _
  78. static int acnt = 512;- z9 n5 m+ Z, j0 `4 ^
  79. static int bcnt = 8;  `1 b) t* r, l3 b6 m* U
  80. static int ccnt = 8;- {8 w2 \' I6 O
  81. + f7 X8 ~; }4 n8 n; S% w
  82. module_param(acnt, int, S_IRUGO);) {+ x6 [' {3 @. b
  83. module_param(bcnt, int, S_IRUGO);- K7 O' g- Q/ f+ [/ n: y" a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# @2 [! s# w7 X/ f4 ]
7 S, i7 c% P& q8 k5 o- {0 u& E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 }* I0 W5 g+ n! N7 F# d4 X; z+ s" m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ |: P1 I$ G- o+ [' T3 }% Q( ?% N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& ^. `( O* h$ C' |: [# j5 ?3 h! x' q) U

( b5 s  Y  Z* V  ^5 C3 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 16:23 , Processed in 0.037612 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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