OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 m: ^! B/ q& r# U% t% B+ n. u/ R
  1. [code]EDMA sample test application
    3 R$ O  A7 L% f7 i: I* m/ T
  2. /*4 F3 R8 C' Y0 M' w& S- ]
  3. * edma_test.c1 n) \- K0 _; F* ?8 V' ]" r
  4. *  c* T4 u4 W" X2 u  ~
  5. * brief  EDMA3 Test Application' k3 Y1 G$ \3 T2 x' ^6 h& u( z
  6. *7 _# l8 V4 V# e+ ~3 w
  7. *   This file contains EDMA3 Test code.% v0 F& u  x" g5 Z. p, b
  8. *
    % ^" ^% }/ S% o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 _' \+ `% D9 g5 c) N% D- q, @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! q. @: F; S1 S: f
  11. *         TO CHANGE.; C0 ^: A# X' f1 L- @! q0 j+ ~3 r
  12. *1 w- a9 U% m( c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 Q% b; z2 r4 Q# O* o1 ^8 c, G; N/ c
  14. *! h- [4 Z5 |- a
  15. * This program is free software; you can redistribute it and/or% B- y4 b8 \6 y
  16. * modify it under the terms of the GNU General Public License as& w+ d) o5 `" P; k* G
  17. * published by the Free Software Foundation version 2.
    / O# e# A3 p, }
  18. *6 a! Q* m% G0 o' r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " f' |' R( e+ x& e0 ~
  20. * kind, whether express or implied; without even the implied warranty
    $ X% o/ X' z9 H% [/ q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 V2 u3 P: u) w  R+ T- O
  22. * GNU General Public License for more details.
    # j1 ^! Z% \$ _4 ^* G9 |
  23. */
    , e/ c: M* Q2 H/ S* ~2 S

  24. 1 S5 X, X/ P3 \& T# \, U2 m
  25. #include <linux/module.h>7 [: Q% Y/ s9 w: ?' A$ O8 D
  26. #include <linux/init.h>
    8 a0 f1 |8 D0 [( E- x+ ]+ f: m9 F
  27. #include <linux/errno.h># _9 H, Z- h( E: g. p; z8 [) @
  28. #include <linux/types.h>
    * Y- ?/ M  S% E% H, x
  29. #include <linux/interrupt.h>
    1 T: e* D8 I$ h
  30. #include <asm/io.h>
    % O$ j: J, Z# V1 l
  31. #include <linux/moduleparam.h>' F2 `6 Z+ F2 `* r+ A2 `: ~
  32. #include <linux/sysctl.h>3 B; v: E* C1 ?8 |: q
  33. #include <linux/mm.h>
    : w- V1 W' Z9 E# \
  34. #include <linux/dma-mapping.h># K( O6 W0 B3 x5 y9 H
  35. # @4 s( g9 M# h  q# x; [* m5 U0 J7 c
  36. #include <mach/memory.h>: h' P& l, m5 }6 j
  37. #include <mach/hardware.h>
    & X9 T  z6 B7 \5 L% a* W( T' {
  38. #include <mach/irqs.h>$ n) i/ l% h0 ~# }" b, t
  39. #include <asm/hardware/edma.h>4 b, G* s3 D' ]# K  ]* e4 g
  40. * [' H1 R: l& u: e) e$ V" B
  41. #undef EDMA3_DEBUG3 S" B  p, V3 t3 f4 V9 D) \
  42. /*#define EDMA3_DEBUG*/
    ; v% n4 B; ~: z: y
  43. ) @" {9 r4 {# l9 `4 I- g9 y
  44. #ifdef EDMA3_DEBUG$ ?' a7 J2 `, N5 m# w! r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' e' i* R: e1 `0 h" P9 K% ^& d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ f5 ~! d9 W9 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 s: y8 p5 V, G8 e7 y* s' S7 a# @# {
  48. #else. ]- H/ {5 |, w8 l5 O' g
  49. #define DMA_PRINTK( x... )( r5 {; I5 x, D; ~4 |# f5 c9 ], s
  50. #define DMA_FN_IN
    ( K! j$ f. S4 I" B' F4 x, ~0 Q5 _
  51. #define DMA_FN_OUT
    5 M  L: y# }0 f4 z" @' n
  52. #endif
    & y# p0 S% t+ N3 ]5 i- R( e) ^

  53. 0 P* |$ }) {8 ~+ o$ D4 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % {) g- N8 g- y5 q; F  `) p
  55. #define STATIC_SHIFT                3
    + F9 B7 ]/ S% A
  56. #define TCINTEN_SHIFT               20! @  @# q+ V( h) k5 [- e9 h
  57. #define ITCINTEN_SHIFT              210 m# _. p* Y" c9 M7 T
  58. #define TCCHEN_SHIFT                22
    * P0 s3 x) m/ b, F! W
  59. #define ITCCHEN_SHIFT               23
    $ m2 U* @9 [0 d5 A6 m5 W

  60. % S  x; w& w1 g, K, T
  61. static volatile int irqraised1 = 0;0 ^; x$ M8 \" F" l: l+ r
  62. static volatile int irqraised2 = 0;+ ?9 \  p4 ^+ u3 z7 X

  63. . z$ {1 q3 ?6 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 y/ |  a( h. a  G) f% ~1 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; U  s: v, g3 }4 Z" I$ {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ^4 n% x  U) i7 m& R9 Q, l
  67. 8 k) h: h3 Q3 e
  68. dma_addr_t dmaphyssrc1 = 0;
    * k2 w1 r" Y. ?3 E* t
  69. dma_addr_t dmaphyssrc2 = 0;
    ( I: P7 l+ G6 o1 C" k
  70. dma_addr_t dmaphysdest1 = 0;- t. a( D) q% t# A- `
  71. dma_addr_t dmaphysdest2 = 0;9 d! e* r: n% C. }5 u# D5 {
  72. ; D. E4 N7 `+ M% p: }% M/ ~
  73. char *dmabufsrc1 = NULL;
    7 @6 Z  A- y* K+ d; P  `3 @
  74. char *dmabufsrc2 = NULL;6 Z1 y$ `5 z, G, t' E1 c
  75. char *dmabufdest1 = NULL;2 j" c3 I' h, a6 f
  76. char *dmabufdest2 = NULL;; m. g& R4 e6 c' q' m
  77. 8 v. H( q4 G2 N
  78. static int acnt = 512;
    / ^. D! E+ v% K7 R
  79. static int bcnt = 8;3 O+ o- }& p4 u0 I& x
  80. static int ccnt = 8;
    8 F+ `0 D" N7 g: j' H' k# s! t

  81. $ N; E6 q# T' W; Z. E) C1 J
  82. module_param(acnt, int, S_IRUGO);$ c/ S1 x1 Z! h' t
  83. module_param(bcnt, int, S_IRUGO);
    6 i) r7 e- b. b  G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( M  q' u; A" Q, _) h7 u  O+ b& Z& i5 n7 Q- E4 b0 \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 g4 t" \  U$ r' d/ U0 y) ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) B1 B5 U5 e4 _. [) d! z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% a  \- i7 A' r% ?% \7 T+ Z4 z

4 V4 p; V0 q5 t. m
9 ?( y; `* V0 c! T* I% k# k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 18:37 , Processed in 0.039418 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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