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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 x! Q/ W1 w) D  _- U
  1. [code]EDMA sample test application" a3 A* [7 |0 i- Y+ D
  2. /*) i8 w* e4 d9 e$ m+ j
  3. * edma_test.c, }+ E5 _" y& \, v9 H
  4. *3 {8 D8 Y9 t! R4 k& R; n6 h3 h
  5. * brief  EDMA3 Test Application, f  ]5 H6 r3 ~, B* w5 s0 W' _
  6. */ U3 k, O9 b2 i- T  w: c
  7. *   This file contains EDMA3 Test code.
    ! \5 r* u* n" m1 p/ G1 T
  8. *# t, f  `: z- y1 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 w1 v2 l* q2 P. t2 C; e- p3 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) ~# I: j# d9 M$ y% d
  11. *         TO CHANGE.3 ?5 @  L# g, p" @
  12. *7 d, n* I6 H3 e  [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// E" m5 Z8 v4 o
  14. *2 H8 L: L& F" G2 \( ^  O8 x. ^
  15. * This program is free software; you can redistribute it and/or
    0 p- B; b+ b4 I& Y+ \  Y, G, w- y
  16. * modify it under the terms of the GNU General Public License as
    1 r: x/ e- }$ }! u+ s+ O) {
  17. * published by the Free Software Foundation version 2.- ^0 _9 @- G0 U, c/ f9 p
  18. *" r7 T# z2 l$ P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ e/ a6 c! ]7 P$ ^+ ]
  20. * kind, whether express or implied; without even the implied warranty
    ) V4 q( t- d" I1 u$ P& D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 x0 R# G  p8 R
  22. * GNU General Public License for more details.8 l. k/ K0 O& Y8 a. ^  {4 A7 T
  23. */
    + _3 ?" i3 b9 o! ?4 W
  24. 4 L/ Y$ o- x' S2 T" R6 a" [
  25. #include <linux/module.h>
    3 x& e7 q, Y. f: l1 V% o4 z4 c; N
  26. #include <linux/init.h>
    $ ~& W' [" E/ D% [; e3 O- S% K* |
  27. #include <linux/errno.h>% C# W5 n3 V! s( L6 K7 ~, U
  28. #include <linux/types.h>
    ( Z& _& ]1 U: J2 P. j
  29. #include <linux/interrupt.h>4 f8 K; @. }) s" ^/ q/ s# Z! {
  30. #include <asm/io.h>3 Y/ h7 G" g1 r% {2 K  @5 Y
  31. #include <linux/moduleparam.h>) `1 t3 j1 A+ ?, X. G
  32. #include <linux/sysctl.h>2 e( r) g$ K( }/ A: ?2 U9 ?" F4 s
  33. #include <linux/mm.h>% h! _3 }* N+ I- B1 l, s# O8 {
  34. #include <linux/dma-mapping.h>
    ( j- W2 P1 g4 V/ K
  35. / {  b' _* X1 H, N( j# G1 v- P
  36. #include <mach/memory.h>* G- ]3 c$ Z5 e' |# q$ s9 s7 d
  37. #include <mach/hardware.h>% G; m& n3 E( e' M
  38. #include <mach/irqs.h>  Y) e  P' U# C9 O1 N# t# G' S
  39. #include <asm/hardware/edma.h>
    ) d; ^. n: B& g7 a8 U& h
  40. ( Q6 \. h* h$ E  N
  41. #undef EDMA3_DEBUG
    6 C- m7 C( d7 d" C5 C
  42. /*#define EDMA3_DEBUG*/" w/ h! N+ K7 m: z
  43. / Z! ^) X- s5 ^5 _* m% n$ a0 @) L1 {: p% Z
  44. #ifdef EDMA3_DEBUG8 d2 X1 q' u9 T( J% K( P! J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      q& T8 Z5 Z! m+ l# x/ u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- n0 S  m# l* ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) T) V7 Q& }6 r/ l2 q
  48. #else" a/ K# O1 e. d
  49. #define DMA_PRINTK( x... )
    2 b; p: ~4 z; G0 Z% B" x- D' ?
  50. #define DMA_FN_IN! z) _& W& b$ \( w# |
  51. #define DMA_FN_OUT7 f  N6 R( `. U
  52. #endif4 s2 l2 K5 t/ n1 U) j

  53. $ A6 |/ ~, \* }( x9 S6 S% K! p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), l- n. x- ]0 d6 X
  55. #define STATIC_SHIFT                3
    # w8 c# f5 y0 x) s* r, M! X% @
  56. #define TCINTEN_SHIFT               20
    ( g$ ]5 \8 |" v1 s2 l1 w5 b
  57. #define ITCINTEN_SHIFT              21
    3 Z5 }/ w* f9 U
  58. #define TCCHEN_SHIFT                22
    5 T! [9 [) x9 ^* f# F7 G9 s) k
  59. #define ITCCHEN_SHIFT               23
    - W) V2 O; e2 i% \
  60. 5 R/ ?5 ]/ S6 a1 v. q4 a* d
  61. static volatile int irqraised1 = 0;( X: d. Q) N+ l3 N
  62. static volatile int irqraised2 = 0;
    ' \2 L" X: B* J- `
  63. ; S5 _  Q6 {" B* j; ~2 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + U$ k4 p8 C/ h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 \6 ?7 @$ a( O6 X) W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 m$ q/ j9 S  r: R
  67. ; ^4 ~9 x3 F# K' @
  68. dma_addr_t dmaphyssrc1 = 0;6 }" d1 L+ }. y7 }
  69. dma_addr_t dmaphyssrc2 = 0;: g! L( s. n6 P/ d! [9 L
  70. dma_addr_t dmaphysdest1 = 0;
    % D. m7 T- h$ |7 G, N$ H) K) t
  71. dma_addr_t dmaphysdest2 = 0;
    ) D$ |+ Z' L6 G, x
  72. * b  W8 W8 E4 v5 ]4 g
  73. char *dmabufsrc1 = NULL;) }% l" L: U4 i. {
  74. char *dmabufsrc2 = NULL;0 k) m) y2 i5 w0 @7 R; D! o
  75. char *dmabufdest1 = NULL;, s$ w' c" C% q7 W
  76. char *dmabufdest2 = NULL;
    4 G* b: v( U3 F% d- J! G

  77. 4 ?4 B4 d* n/ l+ Q2 C' M  O7 g
  78. static int acnt = 512;
    ( D2 B4 `; O  B& M3 \# n8 F: _& f
  79. static int bcnt = 8;: A: @( U  ?( z
  80. static int ccnt = 8;7 i$ M3 b3 t( U' v- F3 m
  81. & B# t6 k  }* a( i- X3 j
  82. module_param(acnt, int, S_IRUGO);% ~/ c& U9 U8 Y- A8 U) k
  83. module_param(bcnt, int, S_IRUGO);7 V# w0 J2 d% \5 ?' ?) K3 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; ?5 U; d3 y' _9 ?5 T& V' k$ x1 l

1 `- A4 J  E- v+ K" [+ h+ l7 o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 P! Y% r9 R9 t/ `1 ]4 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 n( O& x9 H1 B, d0 h# f+ r% b* h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% Q( p9 a) P' e% i  y9 V( j0 Z! `
4 U7 o) X. [: q: _  f7 _+ C

( @- y: ^: E1 m6 [) J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 17:57 , Processed in 0.045928 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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