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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 [* W8 Z2 @( C! P5 E/ Y
  1. [code]EDMA sample test application- G: ^0 Z4 M: S" n# @
  2. /*1 u2 N; _4 s  f* [: H
  3. * edma_test.c8 s6 [# P- D. E3 O, |& f7 j
  4. *6 M" N; M. g5 J2 V+ @# j7 S
  5. * brief  EDMA3 Test Application
    " \- f% P7 U! @3 u
  6. *
    " x. R/ V4 y* z$ E
  7. *   This file contains EDMA3 Test code.
    7 U+ p  o% ^+ K
  8. *: j, X: ~' n. W% A) W  x; e2 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) F# e4 A0 n' Z3 `0 O" s( y, [% O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 |4 W0 G! s( Z, }
  11. *         TO CHANGE.1 P+ t7 ~# e/ B0 k
  12. *' \+ _+ N( ~% V) R# f- [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ e% Z2 B3 J9 p- l* A+ Z, K
  14. *
    6 g. \9 G9 I1 j4 x
  15. * This program is free software; you can redistribute it and/or
    ; X* `( Q4 Z6 Y, m% X5 N( l* ^- H
  16. * modify it under the terms of the GNU General Public License as
    9 e# L) g( S3 H! f. m. f
  17. * published by the Free Software Foundation version 2.( ]% ], D# H, C8 [7 h& {
  18. *
    0 P1 l- F; P! n# C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; U8 y9 r/ u0 l& i: C/ A
  20. * kind, whether express or implied; without even the implied warranty
    5 s; r% q  s6 u7 D# k, J" g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! }! e. j* m3 g7 l' Y+ b
  22. * GNU General Public License for more details.
    ) P- y# G8 [- v7 B/ s
  23. */" h0 W7 L, j1 e3 U* r& W% N: \  [
  24. ; T2 t4 d) T% x0 @
  25. #include <linux/module.h>% y- C. `2 ]- K8 T! P7 T
  26. #include <linux/init.h>( P$ u/ l0 j8 M% S% \
  27. #include <linux/errno.h>
    ; N6 Y% F8 r/ p6 z8 v/ Z% N8 c& m6 O
  28. #include <linux/types.h>% S9 K. W* q: N# I
  29. #include <linux/interrupt.h>
    0 O6 h9 v6 j9 [5 x# ]+ O
  30. #include <asm/io.h>
    % Z; g8 ~' U; f% W- S
  31. #include <linux/moduleparam.h>% X0 R# ?$ @' A- [
  32. #include <linux/sysctl.h>
    5 K1 ]+ d  J# u) Z
  33. #include <linux/mm.h>; C4 ?: w- ~: Y1 b1 i( C; `' p! ]
  34. #include <linux/dma-mapping.h>8 ~* s* R7 A. `
  35. 7 P# d' _( b: G, ^3 t! ?, t
  36. #include <mach/memory.h>
    , M" _9 c. _7 {0 K- y7 {
  37. #include <mach/hardware.h>
    ; M7 ?4 c2 _: t1 h5 ?! }
  38. #include <mach/irqs.h>. c( i6 E7 D9 s2 M' `( m5 k0 |
  39. #include <asm/hardware/edma.h>1 ]# H$ T5 }/ F

  40. 0 ?% o; g( U2 F1 M0 l- _+ \. t
  41. #undef EDMA3_DEBUG+ D9 b6 }# }6 y( N$ |1 G! {
  42. /*#define EDMA3_DEBUG*/( U! S9 x  Z4 w2 ?

  43. / _8 M0 U  r6 ]6 `+ R% J
  44. #ifdef EDMA3_DEBUG- O7 @) q4 Q* h/ T! k5 @$ k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' s# ?2 L1 C+ z* ?: ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 g! _, \# c( D1 @6 C8 f' w( d: ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! Q  Q  q+ I# ]
  48. #else3 o. ^! v5 g6 F$ S
  49. #define DMA_PRINTK( x... )
    * f) W. I0 y1 O
  50. #define DMA_FN_IN
    3 w' V$ d& `! D9 ^: s, z6 L0 {8 {
  51. #define DMA_FN_OUT
    # [" }: J. U! h6 U" Y4 U' r8 B! G
  52. #endif
    # |. r5 [' @* z* Y7 W

  53. ) x4 V+ O- j* M& u: E. v6 Q* J9 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) ^% p: c5 ?1 Z$ r
  55. #define STATIC_SHIFT                3
    7 x* _, \$ y2 [9 q, Y
  56. #define TCINTEN_SHIFT               20
    6 d/ }8 }/ m3 V8 _! Y6 m
  57. #define ITCINTEN_SHIFT              216 g. S- B! P! I8 G4 ^/ J6 z+ m
  58. #define TCCHEN_SHIFT                22
    : B# J8 y: G# m5 Q" D
  59. #define ITCCHEN_SHIFT               230 S- B7 f6 }3 o3 d% x& y/ s' a% S

  60. ; }, z3 \: {3 R9 R- ~+ a2 F! S
  61. static volatile int irqraised1 = 0;  G7 q) c( g9 o1 C+ _
  62. static volatile int irqraised2 = 0;+ Z! {5 E7 o$ k
  63. & v* r  D- h; y: N0 t4 ?  \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . T, v; [1 U4 d9 p) D0 }3 C; ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. o" F) k2 V5 {/ p/ h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 ]0 z* j0 D. f# r
  67. 5 m6 r9 T0 i/ K7 q
  68. dma_addr_t dmaphyssrc1 = 0;
    , }8 q% v0 y9 b2 ~9 E. A% F1 ]
  69. dma_addr_t dmaphyssrc2 = 0;
    / U# }/ `* F& j( M8 R' H2 B* R- L
  70. dma_addr_t dmaphysdest1 = 0;$ ~) \# ?6 q" w5 |
  71. dma_addr_t dmaphysdest2 = 0;
    ! P1 v) ?- B  b0 m1 f

  72. 9 o$ [  e! v7 d: P1 l
  73. char *dmabufsrc1 = NULL;: b6 }1 u, L% ?. D2 c7 y
  74. char *dmabufsrc2 = NULL;8 r0 E% ?: ^+ n2 i$ P4 L
  75. char *dmabufdest1 = NULL;: L3 X, e* w# e0 @, P2 K2 y
  76. char *dmabufdest2 = NULL;
    8 M" T, b# q, x( [4 y' l2 a

  77. 9 t1 q  @2 w4 j9 o+ ]
  78. static int acnt = 512;9 i4 j' S9 E+ H& W: D1 t6 ?; f
  79. static int bcnt = 8;6 |( r' H# ]$ M4 f' {
  80. static int ccnt = 8;
    * C, f  o' t0 U) R
  81. ( Z' `7 T1 ~+ b1 c
  82. module_param(acnt, int, S_IRUGO);5 C$ {' }; V5 ]6 j+ A% Q/ E+ i& u
  83. module_param(bcnt, int, S_IRUGO);
    , _0 ?; U, X/ g7 m3 N' t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( X* |/ X& F; `; J3 G0 Y+ N

3 D9 Y) r7 q$ E# Y) n9 ]6 |% F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' `5 p$ b0 N% B- C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 e7 W3 ]( J( o. t5 i3 @, o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 i9 n: c2 z+ s* ~. ~
0 q% O7 i$ e1 C# n- ^& L% I' |1 ?# U6 b$ a; W; m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-9 06:14 , Processed in 0.039855 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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