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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: J/ g6 p& N1 D. s
  1. [code]EDMA sample test application8 w/ s% g, s9 t4 a. _( f) V. r3 J2 |
  2. /*
    # G  Q1 J- D# n/ N  w+ P# f! C
  3. * edma_test.c  H' S. s  P! E2 n8 y* {' m
  4. *8 m/ ^, [5 R" {3 h+ I% z, s% ?8 ?
  5. * brief  EDMA3 Test Application# V0 {) W" ?; w3 p; U1 l$ h
  6. *. q, O5 B0 D  Q+ I% n
  7. *   This file contains EDMA3 Test code.- K3 g2 r0 X- j/ t6 G. W: ]- \: s. k
  8. *  C3 ~# b9 Q! ~* z3 `2 l# j3 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# s, \7 _, ^' d, J1 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  R+ {  J6 A5 o0 J- A! F# s! U0 _
  11. *         TO CHANGE.7 u) y% E# W3 `2 N' `
  12. *
    2 J! {/ V& Q5 `7 g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) S9 g) D. V8 c: D  y" D' M
  14. *1 j. }! G# a! F/ h$ n7 Y) @
  15. * This program is free software; you can redistribute it and/or6 M% ^) E! X4 }' }; C2 Q& g$ W0 L& f
  16. * modify it under the terms of the GNU General Public License as
    # J& [* z* z2 ?2 \( E4 t- x% r
  17. * published by the Free Software Foundation version 2.
    3 w3 F' t* e% O
  18. *
    ( S8 G$ C3 Z% w1 R' q' J0 ]( g6 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & i* ], K' c' |% q
  20. * kind, whether express or implied; without even the implied warranty
      h( O: ~( o7 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 `0 J8 C/ m3 f0 Y2 j8 z! j/ X6 R
  22. * GNU General Public License for more details.
    ! `5 u5 p) R, Y
  23. */7 Z9 K. i- R7 ]# {8 p% n
  24. # F' x$ e1 C! I- H* [( i" P$ M
  25. #include <linux/module.h>
    ( Q, v+ d/ b8 s( m
  26. #include <linux/init.h>
      a  ~0 M8 @! R0 R$ c; Q. V. B
  27. #include <linux/errno.h>
    , H! S$ [7 B" ~% A1 \4 s3 y
  28. #include <linux/types.h>- X! M. \! @& p8 [  \% R7 k8 K9 e
  29. #include <linux/interrupt.h>0 a# m- e, y3 X& \
  30. #include <asm/io.h>
    6 i# @, F% F2 f* W1 U
  31. #include <linux/moduleparam.h>6 @2 ?8 _: }' h, D, m2 ^) r: Y
  32. #include <linux/sysctl.h>
    ' K( S1 O. w$ @$ Y& f
  33. #include <linux/mm.h>
    ( ~- ~8 z+ z* X4 \/ i/ J
  34. #include <linux/dma-mapping.h>  @9 l& G; i" X' U

  35. / z7 O' r$ x) `' R
  36. #include <mach/memory.h>7 \; {0 B2 F7 e/ y7 Y5 \
  37. #include <mach/hardware.h>; ~. U# S3 ]4 t4 J
  38. #include <mach/irqs.h>- ]; g* U; C- P" P% @0 J8 d- t
  39. #include <asm/hardware/edma.h>% _. S9 L: J) [, Y4 E
  40. . c  P" b: n" a* w6 ^; ~; H4 ]
  41. #undef EDMA3_DEBUG
    # U6 u( g  G- A- [& B# K( z" r
  42. /*#define EDMA3_DEBUG*/
    3 O$ |/ o+ D" }  y" t
  43. 2 o! @+ j& k% s/ c7 d; b
  44. #ifdef EDMA3_DEBUG( a6 T& a/ p9 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 X4 n( o' c, `/ `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + p) B3 m: ~- H8 b1 }) S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ m0 \: x+ x* n, u8 j4 K+ S
  48. #else
    ) ~5 A$ o; [- O( \- i
  49. #define DMA_PRINTK( x... )
    ! B8 a3 [7 J1 b; c! l0 o
  50. #define DMA_FN_IN2 {0 n$ q: I: s2 w: l& M
  51. #define DMA_FN_OUT* j. U6 {; n* G( Z; y! g/ T
  52. #endif$ t8 _9 L  ]0 Q$ Q8 r

  53. ! e: S3 \" J0 M' X  J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + p. _* |6 G2 c- V
  55. #define STATIC_SHIFT                3- X% u; x2 j& U) n* b1 i, [7 b
  56. #define TCINTEN_SHIFT               203 T! a* Q$ `( s7 E% }& l/ R
  57. #define ITCINTEN_SHIFT              21
    7 N# `( G8 I5 u' [: c
  58. #define TCCHEN_SHIFT                22
    8 O  l$ g1 c7 l* C! P4 w
  59. #define ITCCHEN_SHIFT               23, k  M: O( T& W: n  j' B
  60. 1 D4 d+ x: ]6 i7 K( s+ v6 M
  61. static volatile int irqraised1 = 0;* {* X! P/ z) n- O1 [
  62. static volatile int irqraised2 = 0;- B' p" e3 X; t3 C# i

  63. ( d7 F  w5 R( G% c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ H) M4 S! L! v% o, E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) ]* e4 _, v9 k7 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; c; v( `8 d1 n8 c, s' q
  67. 8 \$ k! x0 x. u# P
  68. dma_addr_t dmaphyssrc1 = 0;
    # m# \' H. F' F! o
  69. dma_addr_t dmaphyssrc2 = 0;9 W$ X  j# W! f2 P! }5 y% f
  70. dma_addr_t dmaphysdest1 = 0;
    # P+ ^: i4 ^5 x) z, |8 V9 I) n
  71. dma_addr_t dmaphysdest2 = 0;
    1 ^. W: d0 X, r4 u6 b

  72. 4 H9 w* a4 E$ _* L( |
  73. char *dmabufsrc1 = NULL;
    . C7 N" Z- c9 Y) D8 S, Y8 c- G
  74. char *dmabufsrc2 = NULL;
    : t6 V: H9 i: Z7 s" K3 O& I1 b
  75. char *dmabufdest1 = NULL;7 J$ _6 L$ J6 A! _, b4 |  p/ ^9 s+ Y0 s
  76. char *dmabufdest2 = NULL;! G/ \5 m. z# m, E1 i+ v6 v' \6 b$ E

  77. $ t( F7 J4 X' h0 L
  78. static int acnt = 512;
    ) t) O3 ^3 H! k/ m6 k# F) B8 s* o& l
  79. static int bcnt = 8;
    7 f) c9 D, K) g* l
  80. static int ccnt = 8;. S$ n8 o9 M. {* A

  81. / F, A& `# s, j, p  r& A
  82. module_param(acnt, int, S_IRUGO);4 O# K8 h, y- ]* M1 J* D
  83. module_param(bcnt, int, S_IRUGO);
    0 g- M  Q: c' `) |  V: r( {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 [+ R3 B  Y# O3 z$ b
  L; e  j) z; Q% [) D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 `7 K: Y3 B6 B3 e: v5 T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ^8 R( Y4 v6 j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* T' M+ B( Q5 X
3 u7 p( Q. t! R' ?! g( e9 ~, t

5 J% g3 A  n2 T( x6 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 10:18 , Processed in 0.038588 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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