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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& [  P  B5 S# E4 R/ f8 h8 L
  1. [code]EDMA sample test application
    : ~& O  t6 D- n$ R7 I0 r# U( M/ s5 |
  2. /*
    - f  m6 q" p7 z0 ?* }/ b, L$ ?: V3 s
  3. * edma_test.c) l6 ]$ d( d- T( H3 p  `
  4. *
    : }) Z8 _7 V/ `- ^% Y4 x- F7 O
  5. * brief  EDMA3 Test Application
    6 \8 \& f/ |3 s# c; i9 @3 h
  6. *! w; `+ g' @! r4 ?9 V7 h0 N
  7. *   This file contains EDMA3 Test code.
    , L7 I$ B( `9 Q8 a: }  H% [
  8. *
    & {: _* O( ]# |* s/ [6 O  X# u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ E5 p9 c. H% G# C4 [- m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 d/ t& w5 s# k, @( W, M
  11. *         TO CHANGE.& K8 o2 }) K& x3 H. D
  12. *
      Q0 {* e/ K, L' z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' g- O0 j. L- |. i7 q
  14. *
    4 x& N# O0 q# w- U5 D
  15. * This program is free software; you can redistribute it and/or
    1 @: J8 Z# w0 d* E5 ~! d9 I; d. t6 d; Z
  16. * modify it under the terms of the GNU General Public License as
    5 d" j: t$ j4 r* c# [' c. Z& E
  17. * published by the Free Software Foundation version 2.2 m/ T5 H7 l$ U' @* \  B7 l: f; [; W
  18. *
    * I+ ]# J, K3 }) Z$ W7 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * S- j- W/ z8 T0 k/ l
  20. * kind, whether express or implied; without even the implied warranty& ~1 F; U) a4 `- Y$ `! L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' h( K' [7 ?; v! i( A
  22. * GNU General Public License for more details.+ Z1 j4 h) L, i. l
  23. */
    0 |; N# ], Z& `( S1 P( e

  24. 9 t" O- A% n) ^% I
  25. #include <linux/module.h>! ^, E+ x; r& U/ T: ~% m
  26. #include <linux/init.h>
    " r1 v# M. I" E9 W- {) N
  27. #include <linux/errno.h>
    9 b; _! v1 U$ x1 w( {) }
  28. #include <linux/types.h>
    . ~2 `) o5 v# y. F* q
  29. #include <linux/interrupt.h>  l, X1 v4 `) K3 b- ]" D
  30. #include <asm/io.h>: L) b, c7 l; a0 H
  31. #include <linux/moduleparam.h>
    8 N0 b. p+ \2 M! j' L% A
  32. #include <linux/sysctl.h>1 x+ [5 b8 j( S- O3 x) x* `
  33. #include <linux/mm.h>
    4 S+ a& P0 [" T) ?; s+ ^
  34. #include <linux/dma-mapping.h>
    & a, \/ Z/ i, R% l
  35. ( N+ \) g: T) o! u, k8 g* J/ R, h
  36. #include <mach/memory.h>; U! c* V4 j6 Q3 I! H  V2 F
  37. #include <mach/hardware.h>
    5 j# F. H  F# ]+ ^; I; G
  38. #include <mach/irqs.h>
    + G' L; A* f% M$ s9 h: G6 _/ [7 u" E
  39. #include <asm/hardware/edma.h>, J" A: U' ?" W+ F# O- O

  40. 1 Z+ j, H+ G& q' \  x& B6 e9 g
  41. #undef EDMA3_DEBUG7 b5 |# y. e: G2 Q8 k
  42. /*#define EDMA3_DEBUG*/
    - g& @2 ?  u! p" s9 A  W, U" `
  43. 8 y. A! O( a9 y! p' Z2 k. @+ @2 q
  44. #ifdef EDMA3_DEBUG- E- ]" l  R! K# ]. D; G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - E5 ~5 _+ Y' a, ]+ {4 K) O  z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 W7 K/ P- |. @; B3 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 J+ X' w, j+ {: D! p. y
  48. #else: A( {1 o4 B' |
  49. #define DMA_PRINTK( x... )3 N% V( Y$ {- [5 l
  50. #define DMA_FN_IN
    & |: J0 Y# y' o; s: n, }6 Q
  51. #define DMA_FN_OUT
    - n) s" c+ X* o0 v  \9 r- \! i& Y
  52. #endif# [8 n. z) c3 [: f  j
  53.   Q& S9 K* f8 F1 ~4 J/ i9 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' J  q" Q; c( \1 l, P' M
  55. #define STATIC_SHIFT                3
    & Y6 ]2 V# n0 O7 j2 P# r, I$ D
  56. #define TCINTEN_SHIFT               20
    ; D& ]5 \0 J2 q  [8 m
  57. #define ITCINTEN_SHIFT              215 R* }  _% z. b5 j! p9 F" X' |
  58. #define TCCHEN_SHIFT                22
    ' m$ H, ~* n, [" @& H
  59. #define ITCCHEN_SHIFT               231 X) ^( \2 n# |2 i! @. a4 [
  60. 0 b0 X6 L4 i. f1 {
  61. static volatile int irqraised1 = 0;
    % F! l' t' T# I) t* o+ q: C
  62. static volatile int irqraised2 = 0;, v. c/ B5 R' ?) W/ _) H- F" E

  63. ( H, e2 X  m6 r" G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & r5 d* z3 G1 q$ C1 u4 a" B! M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # q' u5 O- m6 r5 ]6 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 u# k/ e  D( ^3 s# M, u0 [: \
  67. ; j: P" s2 v" L( N) J( o
  68. dma_addr_t dmaphyssrc1 = 0;
    % r8 {) V, ^6 U! _8 I# R8 H6 U1 n) o3 [
  69. dma_addr_t dmaphyssrc2 = 0;
    * I0 r; e  d! \2 }9 i4 u
  70. dma_addr_t dmaphysdest1 = 0;) {% J# d7 D/ J- V, Q. d4 v' H
  71. dma_addr_t dmaphysdest2 = 0;
    0 |) h- S5 `# w. n& b: C. |
  72. 0 W6 @( F5 m# A* i  B" L
  73. char *dmabufsrc1 = NULL;! d" r, h$ D- Z+ V& @0 _
  74. char *dmabufsrc2 = NULL;% `$ q6 U/ ]- |; a1 J! `
  75. char *dmabufdest1 = NULL;2 e0 A7 m, Y: d8 ?( k
  76. char *dmabufdest2 = NULL;% d/ h/ V; k  N, j
  77. * V+ {7 R  E) G$ p2 w" U0 e) Q( A
  78. static int acnt = 512;7 p1 r, m# Y3 D  l" D" `$ v
  79. static int bcnt = 8;  @- h; O" H( l+ I5 h
  80. static int ccnt = 8;1 N" J, b- K9 y1 S8 [+ M  p
  81. 7 I) l9 g2 E. V- A: Y0 v4 f8 {& c" A
  82. module_param(acnt, int, S_IRUGO);# j. c" Q, N' X2 w3 Y9 T
  83. module_param(bcnt, int, S_IRUGO);
    % Z" k- X' ]* S( i: h) q% S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ |- n$ a# X+ C# y8 {0 r  @

2 K9 B0 b6 P1 W3 p2 P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" w9 O, s8 r6 n0 V5 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! }1 T3 Y; E' Z3 }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 c# E" g  p. P6 i
- i7 ]3 ]% j* i! U
# \. y" K& [7 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 03:20 , Processed in 0.041371 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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