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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / I3 f7 y4 L8 j& c5 x/ X
  1. [code]EDMA sample test application2 q% @: l& V9 K; j" s2 |, U5 m
  2. /*. ~2 l5 E* A) m, W7 q* v) i9 h
  3. * edma_test.c. G$ x; Y; B% ^$ h5 m  X
  4. *( |$ C2 M5 K) {5 R: b# J
  5. * brief  EDMA3 Test Application' ]5 L0 P  @7 @* s4 }% `
  6. *) j3 f" G6 o7 p- c
  7. *   This file contains EDMA3 Test code.
    7 q' _6 P% u, L( b2 g7 O1 t5 X, d1 i
  8. *7 n# e% P' s& K& n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 {: d7 F8 E) o7 T# B, E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; Q3 Q9 o7 O% B7 U
  11. *         TO CHANGE.. Q7 E0 Q/ E$ H* L5 K8 h) D5 P
  12. *
    6 u- i! b4 _7 a( m8 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 R3 O% {. R; Q- H0 i* G
  14. *
    3 X, `4 i5 {5 K  p! S( U
  15. * This program is free software; you can redistribute it and/or
    * W: S- k4 f3 |1 B) X) H. [
  16. * modify it under the terms of the GNU General Public License as
    0 }: J/ m; v% X9 s; j# J! v% E
  17. * published by the Free Software Foundation version 2.
    * ]" q+ i9 r9 x' O
  18. *
    $ r. J4 }9 f- t. q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. O  b( \) ?$ z% n+ d
  20. * kind, whether express or implied; without even the implied warranty2 @7 L0 Q* q0 r1 `, M  }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- C, Y, h2 s* U2 d3 j6 m7 l- Q
  22. * GNU General Public License for more details.
    + T4 \  ^. F7 D; ~
  23. */
    1 w( D# G( y8 W) }/ a8 i/ D; }

  24. 7 m( ]4 o% T( x% I$ G% I2 V; U
  25. #include <linux/module.h>
    ) N) T+ P8 U, O8 f
  26. #include <linux/init.h>% [4 D8 ~4 Y  D# \0 a
  27. #include <linux/errno.h>
    8 O, O+ u5 }' z) [0 |- X
  28. #include <linux/types.h>) Y% r/ w8 O% C$ W
  29. #include <linux/interrupt.h>1 E0 H0 o9 l$ `
  30. #include <asm/io.h>4 y1 J5 I, Q4 }5 `1 W/ q) K
  31. #include <linux/moduleparam.h>" ?7 ^/ y4 p) @& t" f8 B
  32. #include <linux/sysctl.h>: j' a( C) ?: G" n- F% Q. l
  33. #include <linux/mm.h>
    : D, O6 A$ f/ o/ C) s/ V1 p  X/ m' ~) V8 R( D
  34. #include <linux/dma-mapping.h>
    $ y% d( U9 V7 u$ P" E
  35. - U! L& `, a5 S3 t
  36. #include <mach/memory.h>1 f1 L1 J, E  h- Y  j
  37. #include <mach/hardware.h>7 g/ W! Q% n+ \" i% W1 |; G& M
  38. #include <mach/irqs.h>* b/ C2 d, n. |6 F* P4 [' z6 i
  39. #include <asm/hardware/edma.h>
    : M8 ^( E0 P: O7 C% H" ]
  40. $ \# c4 c9 z3 p  z: m6 C) N, c
  41. #undef EDMA3_DEBUG! a, j' v9 |: K+ p( a
  42. /*#define EDMA3_DEBUG*/4 @7 U* h1 B: ^$ N% @: e
  43. 6 C5 m5 W% k% g& Z
  44. #ifdef EDMA3_DEBUG" K: m# @: t2 I" C/ O- `& e* L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 N4 j, E1 [. n  F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ~: l; `4 q0 u( Q% T8 U  `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 W9 t6 p) A  o8 U( S0 I1 J
  48. #else
    ( d: m. t; s1 H( g% y4 x
  49. #define DMA_PRINTK( x... )
    6 U3 h, ~% z2 X+ u* \0 j
  50. #define DMA_FN_IN6 q8 F3 t$ c3 M6 Y2 i/ p
  51. #define DMA_FN_OUT
    ) x# n, v8 s+ e# f! l0 f
  52. #endif% x: p2 n: v- _  s# u
  53. 7 ?+ ~1 |* m$ \/ T3 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; f  u$ ?6 y" \3 T  S8 R; h, m
  55. #define STATIC_SHIFT                3
    & h+ E8 Y3 P4 }5 y# m( N( w
  56. #define TCINTEN_SHIFT               20
    6 t+ I2 R2 E# ~
  57. #define ITCINTEN_SHIFT              212 D1 w3 c& M' q( }. t
  58. #define TCCHEN_SHIFT                22" v: W, h. o! c, O5 {
  59. #define ITCCHEN_SHIFT               23
    4 A8 h( F8 a3 u1 l8 P. }2 ^

  60. + @! O' D; d" ~# d$ ~; h6 y9 K( K% x0 S
  61. static volatile int irqraised1 = 0;( l) T3 m/ n/ _* J: {) t3 u
  62. static volatile int irqraised2 = 0;
    ' i3 I9 J# C2 z8 m% u8 M
  63. & }+ l, t& Q. ?+ L8 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % d/ l) G6 Q5 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / {- g. C& H$ Z6 T: a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      f' M- h% t% N0 p" I
  67. 1 L' m! M' A5 b: @/ B# p1 g: K0 \
  68. dma_addr_t dmaphyssrc1 = 0;
    * T5 g0 Q1 y  I
  69. dma_addr_t dmaphyssrc2 = 0;0 D# e9 i4 P! j
  70. dma_addr_t dmaphysdest1 = 0;
    2 P2 q& Z1 z/ X3 ~" W& W# L
  71. dma_addr_t dmaphysdest2 = 0;
    : U9 k# e/ r; N0 I
  72. ( c' L. V+ p9 ]' p1 ~: @: l
  73. char *dmabufsrc1 = NULL;) A- |" k7 B, P
  74. char *dmabufsrc2 = NULL;
    ' [+ [! R8 a/ n% P6 p, v2 r
  75. char *dmabufdest1 = NULL;4 ]' M, Z9 o. j
  76. char *dmabufdest2 = NULL;
    0 |; G+ Q0 b3 m- i$ B1 J

  77. ; U3 H- N3 ^, G: p. j: M
  78. static int acnt = 512;
    . u5 Y4 |  q; P
  79. static int bcnt = 8;% E1 r: f+ y8 T; _7 Z
  80. static int ccnt = 8;
    9 F* }, Y& F, O2 t6 g+ g

  81.   Z4 U" }8 J& F; H: x; c
  82. module_param(acnt, int, S_IRUGO);
    2 M$ y( ?: a6 K- K) w
  83. module_param(bcnt, int, S_IRUGO);
    , f# M4 |: V6 b( G* i% p  C" m4 b4 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( o5 N5 a- p' |3 `
4 H( F, n" ]: N, E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 ]1 v1 b% Q/ K* C% ^; `8 z. Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' c+ g1 D6 a- t' w6 x+ q' @: |: ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 c( S" h* f& c2 r) E
( _5 _5 {7 O9 @& p1 Z# x

, K; R2 K. L; i) J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 14:30 , Processed in 0.043823 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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