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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( i' n1 {) {0 {0 E2 [. a; E
  1. [code]EDMA sample test application/ n  a( R6 T- Y* G
  2. /*
    , ~! q4 w3 D: x( s6 n; s
  3. * edma_test.c
    - F8 f! k8 @7 D! r2 [9 N
  4. *, a2 Z2 m& W, @6 k4 n- N5 p0 t
  5. * brief  EDMA3 Test Application
    ( V9 K# ?/ A. g+ t  l- d, h, ^
  6. *
    2 [/ E" G7 X! r) W6 x! A* s) [0 P
  7. *   This file contains EDMA3 Test code.7 D) U& s/ C9 ?+ i4 K
  8. *0 [: W* \$ N* M/ L1 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 q2 ?% N5 B" v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 a2 d$ |9 M' w8 d( `7 w
  11. *         TO CHANGE., U9 ^% Q1 g" w! J( J
  12. *  N2 r9 U4 A# M% A: ~" i. t5 e6 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; P& U6 Q  r6 c7 O0 k
  14. *0 P* n# F  |5 k  Y; u1 ^' y
  15. * This program is free software; you can redistribute it and/or
    4 x# [) m$ B# v6 M% Q+ M: r
  16. * modify it under the terms of the GNU General Public License as' ~2 N0 s( ?  r; ^8 \1 f6 B
  17. * published by the Free Software Foundation version 2.
    $ ^0 w6 k, L/ p9 N
  18. *$ Z5 I( R; W8 X  Z$ d3 ?5 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / v$ i7 a" ?5 s. @' T9 R
  20. * kind, whether express or implied; without even the implied warranty+ c% T# ^; L0 r9 P9 a. h% O+ u, B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : j$ u3 U) d; A5 t
  22. * GNU General Public License for more details.+ U! ]& [' @* H
  23. */
    + [  {/ |2 f- B

  24. * k' t0 p( G2 o/ \$ e; B4 v
  25. #include <linux/module.h>) @" ]1 q: I* W& q9 L( s3 R
  26. #include <linux/init.h>8 G! V+ R6 z5 f
  27. #include <linux/errno.h>
    5 E6 l4 z3 Y. a% N! N
  28. #include <linux/types.h>
    $ I) v- o& x3 J) o: w
  29. #include <linux/interrupt.h>
    1 ?! H* U- w* |: A: r
  30. #include <asm/io.h>
    3 r  i/ ?# d8 \; |, y! @+ k
  31. #include <linux/moduleparam.h>
    : J2 h/ ~# W' B& U7 V
  32. #include <linux/sysctl.h>
    & w1 S) {) m0 |: W5 j
  33. #include <linux/mm.h>8 R$ ]6 t3 Z- Y+ d4 [% F( w
  34. #include <linux/dma-mapping.h>
    " ~" k0 B: R6 i( u- H1 @! i6 u
  35. ; d6 g+ D9 |. d: R% @
  36. #include <mach/memory.h>
      i0 A: r6 j8 a' ^
  37. #include <mach/hardware.h>- ~0 \9 D8 t+ S) R
  38. #include <mach/irqs.h>
    & T) F: F: Q# T8 j; O2 b
  39. #include <asm/hardware/edma.h>
    $ X. X4 B, N7 `$ e) `2 N( w
  40. ( Q3 F7 x9 Q! e
  41. #undef EDMA3_DEBUG' W* Z7 g6 t2 h& L# i
  42. /*#define EDMA3_DEBUG*/
    2 D$ O# Z# `* W* w

  43. ; U7 r+ F0 o& p8 P  o$ E
  44. #ifdef EDMA3_DEBUG
    # A6 q' i2 x! D, _- H7 z/ @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 ~' ?" K8 H0 o0 @4 w  G- P" z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 s1 I4 n( O5 B% V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / M3 g. m4 C& e; K4 H- T
  48. #else: b( R9 Y2 f; A( {
  49. #define DMA_PRINTK( x... )- O8 a5 @* T! f0 B6 C0 |
  50. #define DMA_FN_IN. _6 I; U/ ]  H* W$ \. m
  51. #define DMA_FN_OUT
    5 |) G5 ~3 c& o: `. _- W3 O
  52. #endif: O7 P/ ^# e+ c

  53. 1 ]- f4 @0 m% v) W) o  f9 Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      h& ?5 K( }' l3 d) g. x+ d
  55. #define STATIC_SHIFT                3
    ) X9 Q5 y4 @1 X7 ?9 w8 c! a
  56. #define TCINTEN_SHIFT               20
    ; K6 I) f% I3 m
  57. #define ITCINTEN_SHIFT              21
    6 \! r8 e, G  `# a
  58. #define TCCHEN_SHIFT                22# o$ @" R9 ^# B9 ]
  59. #define ITCCHEN_SHIFT               23- {+ u* f3 F3 s: a) V

  60. + A1 p- L5 ~* D' Q4 h
  61. static volatile int irqraised1 = 0;
    ) R, V, g! Y+ B* f5 e- b
  62. static volatile int irqraised2 = 0;7 a+ f5 l5 K3 u0 w; u

  63. , K$ ]+ q! T5 s5 Q5 [% j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ _0 L7 O/ A# m% d, B( `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 i- ~% P" `2 Z- B* Z# s: c2 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 S0 _+ o7 Z  t0 S: U

  67. . {. z' l+ F* _4 v" H0 M/ K+ ]4 k
  68. dma_addr_t dmaphyssrc1 = 0;0 j; _3 a2 F, i- {' T+ J: o
  69. dma_addr_t dmaphyssrc2 = 0;( N( _- ?7 U- ~7 K/ o, p
  70. dma_addr_t dmaphysdest1 = 0;/ ]3 @. G) d7 q  K) ^6 N
  71. dma_addr_t dmaphysdest2 = 0;
    $ \4 c9 v4 d5 M6 a0 w1 i. {+ ]
  72. ) Y  f: Q, Z8 j% o3 M% x
  73. char *dmabufsrc1 = NULL;
    ! ^3 ~* o  a7 z8 p" w  j) j
  74. char *dmabufsrc2 = NULL;
    ' Z2 K5 {7 u9 J% w6 t% q
  75. char *dmabufdest1 = NULL;, f, Y0 g* f: t1 P7 m8 `) y7 C
  76. char *dmabufdest2 = NULL;
    1 U  D, ]6 e4 D

  77. * M/ f; Y* p) Q+ S4 j, U
  78. static int acnt = 512;
    2 z/ `9 X4 X% V  e6 k0 u9 ^' g2 x
  79. static int bcnt = 8;' n! j7 l: ?) l# l
  80. static int ccnt = 8;
    % p+ b3 y9 i- B5 a) ^4 M

  81. ; P& K% t5 [, J. j
  82. module_param(acnt, int, S_IRUGO);+ s  r3 n! J/ P2 t; S" K- }/ j
  83. module_param(bcnt, int, S_IRUGO);/ x/ s+ R0 f" F' D  \& a  Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ y. F8 Q' n2 a6 e# O

; ^$ e% `2 ~0 J" q7 V3 U0 W: z2 m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, Z/ ^1 _1 T9 f7 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 S8 o; F- A6 \% o  t* j" l! y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 q# T! g; V* d0 M
7 J" t/ [1 D2 O5 i8 l/ m8 _
+ s+ M/ K) `# ^# N3 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-3 10:36 , Processed in 0.046561 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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