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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 F2 j7 s+ y  K( C5 j- Z
  1. [code]EDMA sample test application! u5 J2 ^5 |. v9 x. A* v8 q6 Y
  2. /*
    : w; D" t  A+ L5 V5 I: ~/ Q
  3. * edma_test.c
    . ]* L# s" a' Z- d/ e  S5 t7 h
  4. *- B( m; a4 t) T
  5. * brief  EDMA3 Test Application! I' b: q/ D  |* a; Z5 l' B6 }, r( F
  6. *# @$ G1 p# t) p2 O' [; ^+ V9 Z
  7. *   This file contains EDMA3 Test code.* k* O7 g, p% T
  8. *7 Q7 g# ?; _1 J7 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ }* _) d! Z+ W) v) J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; s6 o5 w( @6 W4 n  Q
  11. *         TO CHANGE.! d5 D/ \7 t3 W! ?
  12. *
    $ {0 |6 o  T, h# R) @7 V% x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 N# I; z% G6 a' X& W5 {
  14. *
    $ `0 M/ p! m9 P- X5 y4 P
  15. * This program is free software; you can redistribute it and/or
    ( l. _$ |! S. b$ E% X' _! O
  16. * modify it under the terms of the GNU General Public License as
    8 O6 R/ [; C. P" U9 X
  17. * published by the Free Software Foundation version 2.* d( A1 L; f2 S7 u! u* t5 m
  18. *
    5 P( F: f+ o; a/ U0 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ k( ]: s% b8 c* s. n
  20. * kind, whether express or implied; without even the implied warranty
    & H( [3 r8 z  r2 K1 Q8 q) b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 P- W- p& n; h' _5 U
  22. * GNU General Public License for more details.) X2 g# j( M+ H
  23. */
    0 k* h: @5 _7 }$ y( A

  24. : ~% Y* J! u' D; i' Y1 X
  25. #include <linux/module.h>) C+ r8 S' n1 X9 r5 P: K5 k
  26. #include <linux/init.h>
    " [: A  N, s9 B$ c* P# p1 @& {
  27. #include <linux/errno.h>
    % W" {. K" E1 T( l' W% [' |
  28. #include <linux/types.h>, G- T9 W) `  S% f0 G8 z' R
  29. #include <linux/interrupt.h>) s  D6 s" j/ P( b1 s" a: N
  30. #include <asm/io.h>6 u9 O- ?  t' d+ D  p5 X$ V
  31. #include <linux/moduleparam.h>6 ~* S" A& j- y9 S  J! B0 t
  32. #include <linux/sysctl.h>& \! ~- S  l) @3 \( P/ r! F
  33. #include <linux/mm.h>8 B# S. y9 u: A) m
  34. #include <linux/dma-mapping.h>, }" B; s9 b7 M. h! ^' Q0 e8 z/ }5 r+ H8 y

  35. $ p7 B) W, M  Q* v% a2 ?
  36. #include <mach/memory.h>
    & I! a% t7 Z, I8 F; L$ P
  37. #include <mach/hardware.h>8 z* ]- W: t: ]# U& I; h7 S
  38. #include <mach/irqs.h>
    - P$ Z* t3 V) I
  39. #include <asm/hardware/edma.h>
    " e( Z: D  V% L+ m' N& c4 e5 B% V' Q
  40. , v0 ]2 l! E. y1 U# J+ ]9 B0 n
  41. #undef EDMA3_DEBUG
    0 |+ {9 U( w$ }% j1 v( I7 I  Q
  42. /*#define EDMA3_DEBUG*/
    * k2 a% N$ c4 R: Z( V8 n  h" G: D8 k) A
  43. & k+ v& C" [/ w8 `7 z1 H
  44. #ifdef EDMA3_DEBUG
    * M% c* H- o/ C- b& j8 ~2 X* b. A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): Z/ u+ N3 A+ ^0 b. P. J# O2 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 z& i% f8 O7 C3 ?- ^. I2 n  O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ J, v; e6 t5 E( E, F1 }3 E& m
  48. #else9 \7 \5 Z6 Z8 }& a
  49. #define DMA_PRINTK( x... )5 P7 T& ~9 N0 W
  50. #define DMA_FN_IN
    / C8 J3 u$ {! l. @' f0 h
  51. #define DMA_FN_OUT6 s- Z* E6 e% L3 P& W6 D# n. @6 y
  52. #endif
    4 I9 T  L$ @$ z8 c, b2 i. c
  53. ' H& R# O' h+ \3 E. |' f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& Y% D0 h$ F$ w" Q
  55. #define STATIC_SHIFT                3
    ' I& c7 m+ Y! L9 {3 s6 y) V: `. W
  56. #define TCINTEN_SHIFT               204 E0 g2 B$ u7 |% W
  57. #define ITCINTEN_SHIFT              21  j; A0 v3 p! T, a2 q2 w, W
  58. #define TCCHEN_SHIFT                22
    - b/ P8 k  |- i
  59. #define ITCCHEN_SHIFT               232 t9 x' G# e% t( Z' T* y  q% N

  60.   a% x( |$ A/ I' U% I. r3 m# H
  61. static volatile int irqraised1 = 0;- S) ^) m8 Y" h$ w, r& h
  62. static volatile int irqraised2 = 0;$ r  p! [4 D+ M; ^# c- `
  63. 6 {, }: J, r' I% G5 w+ x; V6 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # V! j9 C4 v( r7 p$ X: Z& u! m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! z+ ]4 W: s% B/ b5 Y$ d/ l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: p. o3 C+ N1 F7 `+ }8 ]( N

  67. # d$ r! P* R* P/ K' {
  68. dma_addr_t dmaphyssrc1 = 0;+ l: Q- `9 l$ X/ x, _% [9 A
  69. dma_addr_t dmaphyssrc2 = 0;
    8 X9 y. ]* l% v
  70. dma_addr_t dmaphysdest1 = 0;
    - o% ?; [8 ^! G$ l5 T
  71. dma_addr_t dmaphysdest2 = 0;
    - O$ `) q9 w, P( K
  72. : `7 a( d" e! `; o9 t, V( E; ?
  73. char *dmabufsrc1 = NULL;
    ! w" P/ f7 K! j5 v9 f
  74. char *dmabufsrc2 = NULL;" T* }( ^  u9 ~* [* W( o, A& a
  75. char *dmabufdest1 = NULL;
    / R0 N( v& A0 T! ]! Z5 n
  76. char *dmabufdest2 = NULL;1 B- c3 D9 C9 V

  77. - v5 U; ]+ D4 Z2 b
  78. static int acnt = 512;# o$ G6 C. t% L  r
  79. static int bcnt = 8;( |2 o! k+ O6 J
  80. static int ccnt = 8;4 O9 K* B, J+ N2 i* |) G7 ?) t% H

  81. 3 m/ C- C8 t. i: H  k* d
  82. module_param(acnt, int, S_IRUGO);
    : ?- R! V5 x* x. ]7 K% |" u
  83. module_param(bcnt, int, S_IRUGO);
    % \2 l4 A& L& ]4 ~& N+ A! O2 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 C# j6 r% L6 ], T8 B0 w
6 j# k9 G( l3 ~& O% w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( y. O' n7 o8 M& }7 f3 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- V. Z7 S0 V" l, X" Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 V/ C6 h3 X3 d6 M/ Y# t- G

9 C9 G8 n7 V( c8 M% d8 e, [4 Q+ [' S: W5 V8 i& b/ s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 11:38 , Processed in 0.039183 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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