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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - A0 X3 ?0 q2 S1 Y" U
  1. [code]EDMA sample test application
    : J) {: ~8 C* p! A
  2. /*
    8 C) Y7 O+ K6 I& a7 _1 N' m
  3. * edma_test.c
    . ?+ W4 {7 r/ v6 {- K5 k- W: r
  4. *  N4 Z* V/ b6 Q: J9 k' }
  5. * brief  EDMA3 Test Application/ r, d6 j/ H' T2 A
  6. *
    9 \* V8 S- G9 {& Q' g
  7. *   This file contains EDMA3 Test code." _4 H1 d) i) R
  8. *
    , N7 {  U' j9 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 a1 t0 V3 t( m# r/ y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# z9 Z2 k1 D2 X" Q( \. y
  11. *         TO CHANGE.
    8 d4 P& u$ i% x: l/ _3 |0 l" _
  12. *
    8 L9 `' V: @6 ]/ _3 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 z1 r) W( g* @+ K
  14. *3 @" ]  }7 X' g' a3 `7 g
  15. * This program is free software; you can redistribute it and/or
    + a" ?5 @3 y" x& F4 {* ]1 d8 V1 i
  16. * modify it under the terms of the GNU General Public License as
    1 N2 ]1 P3 s% F3 |- f" F
  17. * published by the Free Software Foundation version 2.
    ( s3 z1 ]% g- s9 i
  18. *$ C9 f( q+ {3 H* v+ r8 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) `  h/ Z) I/ x' ^  k2 S2 O
  20. * kind, whether express or implied; without even the implied warranty, f, W: ?5 ~9 `2 D& c5 l; i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * b+ w1 G9 i# V' o5 i
  22. * GNU General Public License for more details.# z+ N" W( O# w( P5 f
  23. */9 E% v* y/ J* \: F
  24. - e, c% m0 b' D. ?
  25. #include <linux/module.h>
    5 s3 T$ ?1 y% ?' o4 D! h9 [
  26. #include <linux/init.h>
    4 v" t& p3 z* m1 q
  27. #include <linux/errno.h>! {1 @3 H# u1 X* F1 d' P% S
  28. #include <linux/types.h>6 n1 o" ]! s1 N  O, s% _6 o
  29. #include <linux/interrupt.h>6 e2 {' j! E3 M% X) Z7 I. E# W+ n( Y
  30. #include <asm/io.h>( |0 O$ y3 L- D7 k/ k
  31. #include <linux/moduleparam.h>
      c& r$ l4 C5 i  ]; X
  32. #include <linux/sysctl.h>
    + F1 R, v% j2 C5 j
  33. #include <linux/mm.h>
    $ j9 z/ i# b# J* e; q- i, D( B* F
  34. #include <linux/dma-mapping.h>4 n8 c) J3 b( C4 A7 E, ]: \4 b8 Q
  35. 6 O3 n5 `- B& X+ C8 w
  36. #include <mach/memory.h>" S; D) ]2 O$ X2 h  Q
  37. #include <mach/hardware.h>( F$ ~2 u  @- J* q3 @9 h: p
  38. #include <mach/irqs.h>
    * u3 g4 Y- Q5 f1 `6 |* b! d& R3 K
  39. #include <asm/hardware/edma.h>( F6 }; j( k$ e9 j8 y; u6 U

  40. + W% I: d0 g! O
  41. #undef EDMA3_DEBUG
    1 _6 M2 M, L( U9 _+ Q; [
  42. /*#define EDMA3_DEBUG*/) ~+ ^7 u2 o) b% C
  43. 0 I% I+ ~1 c4 c( a2 T7 O
  44. #ifdef EDMA3_DEBUG' Q; Q) p: G+ `6 S+ K6 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ z" X$ T; d1 {2 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); _# `; C, c: r- x$ v- n* @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ @3 j0 q2 [$ T1 }2 _: q+ g' g. b
  48. #else
    1 g, p3 G: O9 r* ]! Y7 X
  49. #define DMA_PRINTK( x... )
    9 t0 X; K! `. M) n9 ^9 X! y
  50. #define DMA_FN_IN6 L0 ^5 x9 r: G* s: J8 }
  51. #define DMA_FN_OUT
    , e4 E' S& j, m/ G/ [4 ?
  52. #endif7 b, c1 R; O/ w3 ?" g8 t/ t
  53. 7 X2 b8 e7 Z# U& t: ^& d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + T' A% e6 t0 [
  55. #define STATIC_SHIFT                3
    2 t% ~  F" ?) z$ @: T" [$ x4 y
  56. #define TCINTEN_SHIFT               20
    ' h1 `5 K1 T% O1 u- B* m
  57. #define ITCINTEN_SHIFT              21
    8 D! y4 W- ~3 r) @
  58. #define TCCHEN_SHIFT                22- i1 o" I0 ?0 N$ t( \$ c0 k+ `
  59. #define ITCCHEN_SHIFT               23
    ' i  t; t3 k5 M8 H3 x' a  y
  60. : \  H8 e* h8 y; j1 R
  61. static volatile int irqraised1 = 0;' `  `- I6 @* G$ a. ^" k6 Z
  62. static volatile int irqraised2 = 0;1 A! N; p0 X8 L6 [4 t
  63. & Q' o& u4 Q) L9 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* O1 l, e) M+ R- _0 t* N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) S. v6 J* \+ G3 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' w# y2 T% E  K$ O
  67. ; H% A: u% p9 |: ^4 R
  68. dma_addr_t dmaphyssrc1 = 0;+ ^5 R* l+ k1 B  w
  69. dma_addr_t dmaphyssrc2 = 0;
    7 n4 r" V$ w9 Q4 g5 }/ k
  70. dma_addr_t dmaphysdest1 = 0;( l) d, `1 l2 V. b- Q/ Y- ?
  71. dma_addr_t dmaphysdest2 = 0;
    ) J$ l$ O1 K7 A9 ~- Y
  72. % X3 [6 w; {3 I  |8 {
  73. char *dmabufsrc1 = NULL;0 u$ F0 U& |: ~: W
  74. char *dmabufsrc2 = NULL;
    . X0 _( k  @0 o# ~
  75. char *dmabufdest1 = NULL;( v7 n* E, k$ A  m7 L/ L
  76. char *dmabufdest2 = NULL;
    ) K4 @/ p2 i% ?. R0 `( `

  77. 7 t0 C3 l8 d6 s+ M4 b$ ~' l6 g% `
  78. static int acnt = 512;' a' D! E( U# g7 N" Y2 Z2 f
  79. static int bcnt = 8;
    ) a! L' H$ v/ S7 Z6 W" h
  80. static int ccnt = 8;
    0 \2 Y$ K# A( s7 o4 g
  81. 4 s- I# P4 d% E: O2 I$ W
  82. module_param(acnt, int, S_IRUGO);
    : W4 d5 |" L7 L' o! F6 J. m
  83. module_param(bcnt, int, S_IRUGO);
    # g! K5 H; R# `) p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: G" E9 }3 J8 e  z- K' z# M
( k" O/ Q7 v: n1 D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. W( X4 |; P, {1 F9 K$ T3 d% m; z$ @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 [% P  [( z2 O' A4 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' U# A8 j+ U# ^/ P* l6 l2 W# r5 Q
# _' b5 x6 i/ p7 p- \. ^' b$ Q6 n7 n' M! X- Z6 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-16 18:17 , Processed in 0.040162 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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