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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   ^& C  Y8 s& X7 W7 x
  1. [code]EDMA sample test application
    ; P* ~# b2 B4 B9 m1 n& L% @7 o
  2. /*) O" H  K% M8 N) C: b" d/ z, W
  3. * edma_test.c7 n' |0 Q9 C3 x8 B5 _
  4. *
    8 R7 W5 F& a: T9 P' Z
  5. * brief  EDMA3 Test Application
    ) _2 y; ^4 C+ o- p% b; [
  6. *! d' Z2 F' P! p
  7. *   This file contains EDMA3 Test code.
    3 }. S2 z8 K3 J; X4 ^7 ~( p0 {2 G- N
  8. *
    ! R* u0 {  s+ Z( k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# e& C$ X! L7 q1 H; G4 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' T% p$ `: C( V" Y( z6 L
  11. *         TO CHANGE." {8 n& H( ^$ @( `
  12. *
    9 g6 Y# W  V/ C7 y* [# N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 L9 A- Q& L( R1 m. H. c
  14. *" [9 g. t3 y! U0 G% T
  15. * This program is free software; you can redistribute it and/or
    % I7 O" \% }0 W
  16. * modify it under the terms of the GNU General Public License as2 G. b5 i  o" H, |
  17. * published by the Free Software Foundation version 2.4 Z# ~7 w4 Z8 o/ H- E+ y
  18. *
    ; S& M; y) k3 v) ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, u, y# f/ {6 m" _) s: X' S8 j
  20. * kind, whether express or implied; without even the implied warranty/ o2 L: o- o5 E. w( A+ D0 n8 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . C  O3 s! [* ]% i6 z9 e
  22. * GNU General Public License for more details.7 p# U# {9 W! q9 V6 }1 r, y
  23. */. z! d& Q& ~) f7 B/ a* p% v; W. x

  24. . f$ X# B3 h4 {8 `  q
  25. #include <linux/module.h>: q: J# Q; V' c: @. [4 [
  26. #include <linux/init.h># V% p+ B. T. ^' W# e- j; B
  27. #include <linux/errno.h>- h6 U9 i% C7 u* ~% R! [& F# R
  28. #include <linux/types.h># r9 A' c/ Q8 l
  29. #include <linux/interrupt.h>
    ( M7 F  `; b0 _+ b( V
  30. #include <asm/io.h># i. E$ v8 I2 b0 Y0 c
  31. #include <linux/moduleparam.h>
    . h9 |% O- H* u
  32. #include <linux/sysctl.h>
    ) U4 k- D3 c% P9 T) `+ H
  33. #include <linux/mm.h>& w/ z  D, L  l6 I  p
  34. #include <linux/dma-mapping.h>
    ) P2 ^" a% T; o) }9 o. v

  35. & A% X  l" T3 u7 B4 }3 x
  36. #include <mach/memory.h>
    : M" q6 e1 k5 y/ S
  37. #include <mach/hardware.h>( h" Y: q, n. N  K. j  U( f# T
  38. #include <mach/irqs.h>& N& }6 i8 {) @6 F
  39. #include <asm/hardware/edma.h>
    ' n+ K" ~; M# x7 [- \

  40. 4 B/ d: D, |8 L9 _, p
  41. #undef EDMA3_DEBUG
    : b8 V+ X, d2 V  Z* I& P! V
  42. /*#define EDMA3_DEBUG*/$ d. Q" P- J4 t' D7 i" s

  43. 5 U* U4 Z4 |( E$ I; u. [
  44. #ifdef EDMA3_DEBUG( W$ J9 e( K0 Z. H: p1 i* g: q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 p0 p$ p6 N) c9 c7 J1 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' P! R. M1 f+ W1 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). A& b( e. K1 S9 r* S, x
  48. #else
    8 J" m0 b. K* f* O  f$ N- a  x
  49. #define DMA_PRINTK( x... )
    1 A! w- I- j3 ]; h- {2 o
  50. #define DMA_FN_IN( b5 m1 s& V+ H; s" [- _6 B* i/ Y$ b
  51. #define DMA_FN_OUT' |, G) \9 j; ~# S
  52. #endif
    - w; i4 r% U& O  y. ^& O* B7 @

  53. ! U" S" A5 C! }3 b! ^3 H* V. u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ I8 v# t( L2 S7 N( S; v
  55. #define STATIC_SHIFT                3
    ( _& n2 [% O* D* a- \' M- O
  56. #define TCINTEN_SHIFT               20
    0 Q# g: D3 b3 s+ Y1 \
  57. #define ITCINTEN_SHIFT              212 K% _3 h) s- V# a4 w: V
  58. #define TCCHEN_SHIFT                22+ t. f/ X7 }' h* P* f0 v7 j
  59. #define ITCCHEN_SHIFT               235 U9 S5 h/ g6 s" P' m7 |1 C
  60. . l1 f& Y  w: Y' t& q
  61. static volatile int irqraised1 = 0;
    + z5 |$ i+ g$ k
  62. static volatile int irqraised2 = 0;
    0 j8 k" _& h& [, m- M/ I

  63. & {. R+ s) @3 ?" R( P3 [' y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% h1 U/ G% [2 [+ f/ \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- P! ?/ o: g% I4 Q; a$ Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 F8 C6 l. [* `+ B; k
  67. 6 S0 B- _6 `7 Q+ D8 [+ a; d' G
  68. dma_addr_t dmaphyssrc1 = 0;
    4 b) H1 D/ g) o( N) N+ h( ~* ^
  69. dma_addr_t dmaphyssrc2 = 0;
    ( \4 U- ~8 u' @' o7 k
  70. dma_addr_t dmaphysdest1 = 0;
    ! h" ]8 G- d. ]$ L$ C) X" K
  71. dma_addr_t dmaphysdest2 = 0;
    / x4 u! ?# c  U$ [
  72. 3 F; Q1 L6 @) P* s# G: Q; y& \
  73. char *dmabufsrc1 = NULL;5 b4 b9 {2 n/ R: i9 W: g2 n8 q
  74. char *dmabufsrc2 = NULL;! [0 Z' G$ u6 g0 P$ X& A% L5 p
  75. char *dmabufdest1 = NULL;  f9 i8 c. w+ ?5 K
  76. char *dmabufdest2 = NULL;
    ) _3 l; B1 n, f7 {0 G; t1 d
  77. . {; k$ j# a, K7 @9 Q8 W
  78. static int acnt = 512;$ Q* h' `0 }, }0 q/ a$ t+ v
  79. static int bcnt = 8;1 W& r0 u* @. s. T: V  r
  80. static int ccnt = 8;$ w( k4 u+ @. j/ X; r
  81. 8 o% W. ?9 M" i
  82. module_param(acnt, int, S_IRUGO);
    + K' r" L9 N$ K: l
  83. module_param(bcnt, int, S_IRUGO);" f5 r. k. ?$ j5 _) Y1 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 X  S9 ?0 E& A* }5 p) I8 k

0 _9 K% ]" ]/ u/ a# w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 K- z% y! k3 V- J- q' zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' f+ d; h& ?* D: c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 O' n4 P$ k2 W3 G- x+ h
# H, S. a; F% N) K: L# u( M! z
7 Z- ]" X4 n2 R  ~# Z2 z# A9 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 14:38 , Processed in 0.038734 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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