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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! _% l4 {8 V' d* |
  1. [code]EDMA sample test application( Y0 V$ q0 n9 P( L0 @6 V+ K
  2. /*
    & {% h$ q0 [) ?9 Q
  3. * edma_test.c9 I7 J7 Y, p/ y7 T/ E5 `9 y
  4. *
    ) E( b) N& ?  d& w9 N
  5. * brief  EDMA3 Test Application
    3 L3 U( i" L3 Q1 A2 @# l1 Q2 u. ^9 h
  6. *
    3 e1 V2 ^  C8 \3 o2 t: f* @
  7. *   This file contains EDMA3 Test code.
    7 h9 e% H  H" t* P3 I6 U" V
  8. *6 w7 W" \* u) w7 K) \" n. ~' I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' H* J) ]4 h) H8 \3 ?, J0 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# X( k. e: D' Y3 X# r; B
  11. *         TO CHANGE.) E- z# O' s1 ^( n3 \% e" E& @
  12. *9 |+ e( O9 X  D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & O, ^4 s# O1 q
  14. *
    3 e. t2 s' ]6 [7 s) s& s
  15. * This program is free software; you can redistribute it and/or3 M1 D8 J" w/ W% g) C6 H: |! ~
  16. * modify it under the terms of the GNU General Public License as
      J: C& N" D4 J& n
  17. * published by the Free Software Foundation version 2.$ }0 `/ _1 ?: c  o& A
  18. *2 C1 k& Z  ?7 A4 \9 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + [, _  ?: M* R& U3 j, J9 i3 M' \
  20. * kind, whether express or implied; without even the implied warranty& Y. m* S. Q! y& G3 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / q: {& U2 L+ B7 g" w
  22. * GNU General Public License for more details.) U7 j3 @9 G1 h
  23. */
    5 F- R3 o% l3 [. y7 V

  24. # s2 R$ F0 C" B/ R) |9 j% f4 A. B
  25. #include <linux/module.h>7 S5 W. u& R& k) f  d8 x9 \% Q$ U7 |  i
  26. #include <linux/init.h>
    2 E1 Q+ f7 ^# x
  27. #include <linux/errno.h>
    ; Y3 i4 ]9 R% b- n
  28. #include <linux/types.h>
    6 p( O3 C1 P/ I
  29. #include <linux/interrupt.h>
    ( b# S' ?0 u  t' h, @' n
  30. #include <asm/io.h>/ h9 H3 ^1 e) p) S' F8 }
  31. #include <linux/moduleparam.h>! ~3 {  r! P8 o  g+ v
  32. #include <linux/sysctl.h>. R* g$ j2 R+ D3 ?: o7 P' ?2 U* N  d
  33. #include <linux/mm.h>
    & n/ Q" E) [& w8 c5 `" [2 }) `8 r
  34. #include <linux/dma-mapping.h>- @' S6 O: A- ?2 M, a% I- W

  35. ' s  V6 D$ u4 w( |# a0 I1 E- T! m6 V
  36. #include <mach/memory.h>3 V1 @4 {3 h9 p$ r5 c! d4 h" I0 r3 E
  37. #include <mach/hardware.h>
    ' o) i" A4 ?* T7 p8 K
  38. #include <mach/irqs.h>7 z+ u4 i9 M4 U$ W
  39. #include <asm/hardware/edma.h>5 ?1 V8 @& ~% C; P: G7 w7 a4 k/ Q% j0 m

  40. ( Q: a8 a) ?0 d
  41. #undef EDMA3_DEBUG
    ; a; M% H9 K9 C, V
  42. /*#define EDMA3_DEBUG*/7 @- d/ A: i3 a: c+ G+ x1 w1 u- Z

  43. & o; _0 Z3 ~6 p5 _
  44. #ifdef EDMA3_DEBUG* l7 ]+ y- J4 H$ A' F* G/ j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      T3 g4 h* n+ K0 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . e* f( |/ ^- s+ E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      j7 P5 R+ R; E
  48. #else" H- a/ ?7 A" b: V% x& A
  49. #define DMA_PRINTK( x... )
    8 D- l) w# x8 o; ?1 e* V5 i
  50. #define DMA_FN_IN% b- O3 p8 Y6 D) W, Z, @3 Y7 Q
  51. #define DMA_FN_OUT1 @$ Q  I4 e% b2 P7 ~$ ~: b
  52. #endif# W+ e* q- f: S
  53. 0 l( I; X. T. c3 ?2 ?# }; f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% i$ ]$ u4 B/ G: N
  55. #define STATIC_SHIFT                3* u# b  C6 w  S# Z$ M: A
  56. #define TCINTEN_SHIFT               20$ I9 D7 S) [+ m$ |
  57. #define ITCINTEN_SHIFT              21- x) t# e2 m4 M. m- `; N
  58. #define TCCHEN_SHIFT                22% c+ U9 u1 J. i
  59. #define ITCCHEN_SHIFT               231 D' a- Q5 d) _+ N7 \# w: {

  60. / a# I3 G4 Q6 K' [
  61. static volatile int irqraised1 = 0;1 e7 U6 C4 X6 n* V
  62. static volatile int irqraised2 = 0;8 C& }' K0 k9 _4 y

  63. 2 [8 C5 ~1 N. m5 W  I, F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* f8 y! l  E5 V, {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 A6 o  ~( n. ^- _' p/ `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 c& L5 C" m) q7 u( R5 E
  67. 0 P2 F! T2 j) d( \" [' ~5 Q9 z1 @" G' L
  68. dma_addr_t dmaphyssrc1 = 0;
    7 K8 h% C/ @3 n0 J# k& k. `
  69. dma_addr_t dmaphyssrc2 = 0;+ N/ U9 L' T6 j8 i  @
  70. dma_addr_t dmaphysdest1 = 0;
    6 ~# N* i) _8 L' @2 K
  71. dma_addr_t dmaphysdest2 = 0;7 ~% i4 N! v5 _! b/ f

  72. 7 m2 s. h/ @- w# L( K7 y9 q; f
  73. char *dmabufsrc1 = NULL;" U% Y! h- u1 ^* R0 Q! p
  74. char *dmabufsrc2 = NULL;
    , |# S! h/ _9 J% ?
  75. char *dmabufdest1 = NULL;+ G' n3 x' T8 g* j1 n4 s7 j9 ~
  76. char *dmabufdest2 = NULL;
    : U' M* `( W% j+ e5 ?  h" H. X; ~7 r

  77. 6 }( V1 u( H5 W" P% Z" N
  78. static int acnt = 512;
    8 ]3 H' d  O8 J- x& z  e
  79. static int bcnt = 8;
    3 y$ X. O2 s# M; @$ K
  80. static int ccnt = 8;0 h3 f! [9 O, N1 j# d, P6 x# M
  81. 2 k2 Q  Q7 M; S( B
  82. module_param(acnt, int, S_IRUGO);
    ' ?6 z* R8 m3 O* m, T2 {
  83. module_param(bcnt, int, S_IRUGO);; F9 k' [+ g. x4 C0 ]! ?& k3 n/ |; x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 J. g! e3 B8 `# _6 L$ k7 L, @6 S
) x; |! {5 o! c3 r/ ^# q: z) ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" d9 e: P  ?  H  l0 xarm-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 E3 r' p: s/ w- `/ D+ ^* G( `, Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) ^, D: f: J; w) u" k
$ c0 {9 c- U( `2 N9 G
( c: i" S  ~. y7 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-6 20:38 , Processed in 0.039567 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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