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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 z* x$ D5 X* b
  1. [code]EDMA sample test application
    3 C' m" n( u/ p3 O4 M
  2. /*
    4 d* `+ @9 W3 @0 V* N! j+ k# k
  3. * edma_test.c
    2 F  }3 g3 d# O3 C- ]2 t
  4. *
    . l5 [. P) V+ l7 ?
  5. * brief  EDMA3 Test Application
    5 x9 g* O# W: b  P
  6. *
    : V1 o* p9 w3 V$ ^8 f" {* S+ ]0 Q
  7. *   This file contains EDMA3 Test code.
    ( X( C6 P5 C0 ]3 O2 R# R
  8. *- _+ w/ x! B1 e) u. |7 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % g/ g" q. Z  Z5 m5 u. x; I8 w: U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      }+ ~1 ?/ [* f' O+ t  c- Q3 ~
  11. *         TO CHANGE.7 m, U. J! E0 P% c0 m  E6 w
  12. *" u: h3 u% x9 Z; R3 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: L+ w$ s' M4 c1 w# H* a% D0 O# {1 s
  14. *
      b0 W2 x8 x/ J% y' |
  15. * This program is free software; you can redistribute it and/or
      Q1 K# h' H2 X7 @3 z
  16. * modify it under the terms of the GNU General Public License as9 Y) j2 s: E2 c% \
  17. * published by the Free Software Foundation version 2.
    ' L" u( f7 Z# t& ^2 Y
  18. *
    : \/ N# L- R% ]6 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . B" w6 e$ P3 T* L2 y0 }$ y
  20. * kind, whether express or implied; without even the implied warranty
    $ o* o3 ^; c. v2 E* W) L0 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 H7 T7 I8 B7 @9 h- U0 g
  22. * GNU General Public License for more details.
      z/ w& H$ x3 Z4 \# H
  23. */% X$ x5 U9 s/ @- G  ]$ V. O# I
  24. ( ^, q8 ]; S  Q' [7 O2 L! j1 i
  25. #include <linux/module.h>" h6 ?4 d" u. T: a* {1 g' P8 [
  26. #include <linux/init.h>% z4 o8 {$ L* j& I
  27. #include <linux/errno.h>
    1 P7 G& X4 z& k3 T7 G% S9 d
  28. #include <linux/types.h>
    : w; S2 Z# h. p& [/ o
  29. #include <linux/interrupt.h>
    ! \- ^5 l# S7 B$ ^1 T0 }+ ^3 J$ ~
  30. #include <asm/io.h>
    ! j& t  }5 r. E7 U& }# i
  31. #include <linux/moduleparam.h>
    3 e. Q; K8 {& ?+ i: N& |* b
  32. #include <linux/sysctl.h>
    9 h+ f$ Y* Y) X7 u. X
  33. #include <linux/mm.h>' A+ H& ?# G# l, v& ^# p4 o
  34. #include <linux/dma-mapping.h>0 P1 X; l$ y$ y/ k& }! D3 @
  35. 2 G$ X$ }, M- ~' y  S
  36. #include <mach/memory.h>
    " f* S$ S% |; R' Q0 J
  37. #include <mach/hardware.h>
    # G: l- U; W: I6 c' \& A
  38. #include <mach/irqs.h>0 K. e; O- V) N, Q; S% a2 [
  39. #include <asm/hardware/edma.h>6 V  R: n, [* l* C" ^7 _

  40. * \0 z! j6 ]1 l  y
  41. #undef EDMA3_DEBUG5 P4 c; y( O; j0 v, n; {
  42. /*#define EDMA3_DEBUG*/: ]9 m/ d7 Q; ^$ Q, c2 W
  43. " q1 |  {* B! ^
  44. #ifdef EDMA3_DEBUG
    2 G3 T6 M' F4 a; O' z; L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 {7 f# L6 W" ~1 y% @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + A4 u/ \" R2 s, N! x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 Z& E% ^5 t3 I  w( T
  48. #else# n. t0 E. v* U; P/ |; E: P" v
  49. #define DMA_PRINTK( x... )
    / c: W7 m( t: C
  50. #define DMA_FN_IN
    ; j8 o; r1 d- {. K8 n& h2 h
  51. #define DMA_FN_OUT
    1 A, T0 s* l) q. P
  52. #endif1 ^/ m3 r; l+ T: t( ?& o

  53. - B' Q+ R! I6 [3 I5 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - S/ u( r1 p1 F9 [# @3 S0 k
  55. #define STATIC_SHIFT                3
    5 I4 k3 P0 ^+ u
  56. #define TCINTEN_SHIFT               20
    ) A7 O! B7 d8 m" i0 g8 A+ k
  57. #define ITCINTEN_SHIFT              21. y) `' s! r8 }; {5 f4 o) G# Z
  58. #define TCCHEN_SHIFT                228 I, d1 ~3 G- [& b) u
  59. #define ITCCHEN_SHIFT               23
    ' T( r0 D% G$ Y# X* [
  60. ' X; T6 h8 \7 V) l5 `1 r) ?
  61. static volatile int irqraised1 = 0;! u" a+ i$ U) G0 B  K) _6 I6 e6 w
  62. static volatile int irqraised2 = 0;4 h* D% I: ?# j2 c
  63. 3 }4 a0 l( h# E& q9 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 K  L: r# D9 g$ o8 f+ q- U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 `: j: \3 A1 L% ]4 u- T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 A3 z9 G9 e2 r3 x+ z) p& {
  67. 5 x( W" O7 j8 i' F! L
  68. dma_addr_t dmaphyssrc1 = 0;% Z2 N5 Z7 ?3 G1 B2 b2 q' ?
  69. dma_addr_t dmaphyssrc2 = 0;, U+ z$ y, N) \, p! |- e# v
  70. dma_addr_t dmaphysdest1 = 0;: [3 w( E8 f" {  Q( g* t
  71. dma_addr_t dmaphysdest2 = 0;
    3 r# i% y6 j: ?" q' D2 y9 D. p

  72. $ v- q8 k3 K; p6 L
  73. char *dmabufsrc1 = NULL;7 g* d, h2 j" n' ?! W' T' J9 Y
  74. char *dmabufsrc2 = NULL;
      `6 ?: e1 B  N/ o1 O
  75. char *dmabufdest1 = NULL;
    ! W6 Q; ^5 b: C6 S8 B$ e8 c' n! z3 M, j
  76. char *dmabufdest2 = NULL;  K- L& A: L: b8 @' x4 T: I( g! K

  77. % P0 |3 @5 t2 j2 t( d
  78. static int acnt = 512;& x: k4 V7 n5 E1 u. P& w, G( U
  79. static int bcnt = 8;4 s1 d9 u( _4 L9 @" g8 _
  80. static int ccnt = 8;
    6 M! |0 Q9 s; B/ V: W

  81. 6 l# Y4 R4 g' X! r+ G
  82. module_param(acnt, int, S_IRUGO);
      q" E- }: r( {; i
  83. module_param(bcnt, int, S_IRUGO);
    2 G2 z1 A9 ?7 x! `+ z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! W3 E! A& W* ]( {3 A; s8 c

, c9 v% q5 U& F" h; ]7 A5 {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Y1 Q8 {4 S9 ]- O
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 J8 p. Q0 C1 J- e: _; \1 A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 a' E6 t, b* y1 s6 z- P, U( E' w/ \8 Z1 V* S- w

2 r8 V; E6 Z: Z. z$ Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 06:45 , Processed in 0.043331 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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