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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. K! ~8 `8 U, w: }) a
  1. [code]EDMA sample test application  ^8 @) R8 J3 N1 g4 G9 ^
  2. /*
    # b/ O) t' Y- ?7 ~. `5 u
  3. * edma_test.c) g. x2 u+ U3 E7 U
  4. *
    # U4 d; b, J4 \! P+ D9 T/ c, Q
  5. * brief  EDMA3 Test Application
    . J! \. O0 L; O6 u; ]
  6. *
    & u" S4 j8 l+ O& {
  7. *   This file contains EDMA3 Test code.
    / g& z1 t7 s) B  w5 [
  8. *
    1 D' Q! |. N8 [8 S, M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * N5 V8 k3 j" F+ |7 m* }0 D) {0 n7 k, K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 P1 S5 D' m3 h' y
  11. *         TO CHANGE.$ A4 E$ ^, S6 G% U1 K1 y
  12. *4 W& b/ Z6 w; a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- f# r/ B; `' N- S! n1 A
  14. *4 J- A) E* }) h/ h3 }/ `4 X2 H# `
  15. * This program is free software; you can redistribute it and/or5 }' m0 q; F& s
  16. * modify it under the terms of the GNU General Public License as
    7 k1 s% B2 H( z% W
  17. * published by the Free Software Foundation version 2.7 m3 o, f& i( c
  18. *5 F: S; A0 d+ b0 v: y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 @( p1 ^. `) x' j) H; i
  20. * kind, whether express or implied; without even the implied warranty- w1 v4 \! \2 Q$ l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 x6 z1 H- L' O/ T9 |) Q
  22. * GNU General Public License for more details.
    " X$ }* o5 a" q- B. o
  23. */
    6 L+ o1 r8 s7 S) H+ K) _' m

  24. & {) o, j6 c. h2 Z8 u5 f1 [
  25. #include <linux/module.h>
    . N4 ]3 A* J3 u+ U! k3 {7 p) V! U
  26. #include <linux/init.h>. U6 @9 c" }4 Q, v
  27. #include <linux/errno.h>
    - ~+ A4 x" J2 O; q4 q+ L# E4 a
  28. #include <linux/types.h>; y: N! K1 S6 B, G3 t
  29. #include <linux/interrupt.h>
    ) s; ]: ^# m% Z" e* W  g8 e
  30. #include <asm/io.h>
    * L& U# [/ E& V5 p! c
  31. #include <linux/moduleparam.h>
    0 W# t* H; s# e* c$ f, i- Z' Q
  32. #include <linux/sysctl.h>
    % \3 F. f1 v1 e; G+ E+ Y) m. h
  33. #include <linux/mm.h># b- U- a# V+ d, w
  34. #include <linux/dma-mapping.h>
    " j) v2 I5 @9 }- ]! @
  35. ' u+ N  v  \# L! M; Z: I* _
  36. #include <mach/memory.h>$ S* B$ q. F2 s, z- ]; ^
  37. #include <mach/hardware.h>0 F# ^8 ]" ^. t; m1 V" W) A( z1 x
  38. #include <mach/irqs.h>7 f* D+ z8 ~  q6 {, A6 b
  39. #include <asm/hardware/edma.h>9 ?7 i: p. |# r

  40. / S+ N" a; ]. ]  R* n1 ?" x
  41. #undef EDMA3_DEBUG
      M" f1 O) L  M. M9 X( N2 i, r
  42. /*#define EDMA3_DEBUG*/3 T: |) H; h  |7 o( h
  43. 9 y" U% v! u$ a" k
  44. #ifdef EDMA3_DEBUG; ]. }& S9 R+ i% I2 g; ]0 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + w3 v4 e, q# ]) l4 C/ y8 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 P8 [/ E' W( A- j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 z( G7 _! i3 X$ V
  48. #else* d* F: b) {1 C' d' i8 E
  49. #define DMA_PRINTK( x... )/ H8 {3 S& P  B/ ^/ v/ b5 j2 M
  50. #define DMA_FN_IN
    % i6 s  I2 `1 X, j( n
  51. #define DMA_FN_OUT" ~0 T0 y& @1 {' y1 E# C/ t
  52. #endif7 }+ Y! Z# P/ S: t; l" ~2 d

  53. * ?& [+ S! X' ]& X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  w# @" @- I3 E% o# U
  55. #define STATIC_SHIFT                3
    # R3 o2 H! P! H( ^
  56. #define TCINTEN_SHIFT               20
      ?2 I* X; L& Q9 d
  57. #define ITCINTEN_SHIFT              21
    2 H# \. b' t* m/ L9 m; s
  58. #define TCCHEN_SHIFT                22
    # A8 h4 n$ R, I
  59. #define ITCCHEN_SHIFT               23
    , M  h9 P! d* l* F3 K

  60. # j+ V( W- g: c& J
  61. static volatile int irqraised1 = 0;% c8 A8 d+ T* u& Z
  62. static volatile int irqraised2 = 0;
    $ L5 ^& y- @- ?/ h" J
  63. 3 K0 x% |% z4 Q; \1 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 h: d" {' U, M1 V5 q6 Y: s5 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 r# U5 v. m5 y: \: q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + H6 Z2 A( f/ F, u: {/ f% v
  67. # p' [4 W! O" B# D0 }8 y$ ^
  68. dma_addr_t dmaphyssrc1 = 0;5 U1 d/ i" y# ]3 w3 ]& u5 o7 H5 S
  69. dma_addr_t dmaphyssrc2 = 0;
    & R$ d' z, V1 e# s% J
  70. dma_addr_t dmaphysdest1 = 0;5 `( A! }) ^/ `: j. z2 s( R  r
  71. dma_addr_t dmaphysdest2 = 0;
    / W- B: X+ W. o( u  j
  72. # A% R* U- q; m" [
  73. char *dmabufsrc1 = NULL;
    : v  n' h! k# x# b
  74. char *dmabufsrc2 = NULL;
    ' V, X$ A+ g! o
  75. char *dmabufdest1 = NULL;
    $ a- D) `( R" P2 I: T+ l& @7 y
  76. char *dmabufdest2 = NULL;* o$ M6 B+ H3 W
  77. - v( o1 \% z! r7 d9 k
  78. static int acnt = 512;( ]: h0 W  s+ V5 X
  79. static int bcnt = 8;# d7 [) x* K8 U- @
  80. static int ccnt = 8;
      P, A, M, ^' n0 U5 {  O

  81. ) i/ b: A/ h4 H
  82. module_param(acnt, int, S_IRUGO);5 E0 P0 Y9 v4 A, c4 [
  83. module_param(bcnt, int, S_IRUGO);
    4 s% ~0 X& S4 {( }6 c4 W, i+ y) u% h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: E2 L0 S: N9 f! U0 x, w  d
7 x3 \; j5 o* o4 v1 t" q3 f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; x! R, B8 T: J; N7 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# `* X3 {' U, \# v) d  c4 ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. b+ W) `9 m, i" I7 x
6 G+ D$ b. \4 d( M6 G$ i' X, S' F8 J, p( g% o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 08:47 , Processed in 0.044842 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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