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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 H; c. M$ w1 |2 V3 O
  1. [code]EDMA sample test application" E  J6 ~( V! r" B8 o
  2. /*
    ! \5 N8 c6 H! K9 l& l8 u' A7 w8 c/ ]
  3. * edma_test.c, ]# B4 W- u: J
  4. *" \& O7 N; b* _; |/ G$ K7 L. N6 T2 Y' ^
  5. * brief  EDMA3 Test Application
    $ P1 v  O/ |6 g' }6 L9 w
  6. *; Y2 M( R5 I' ^4 D- b$ M* r
  7. *   This file contains EDMA3 Test code.3 V) V% K; B7 p, s  B. A
  8. *
    + M# r1 I" N5 ]- I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) _7 ^$ |! _6 B$ i4 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / L$ T6 ^: Y: S. d6 G9 T9 C3 [2 r
  11. *         TO CHANGE.
    . n; @  W3 s* s/ F8 k1 v" A' V
  12. *
    3 K! l8 }% ]3 a0 A4 E8 e, [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# I; K$ O5 w2 h
  14. *
    6 }$ P) O" N; w& W
  15. * This program is free software; you can redistribute it and/or7 X6 `1 b' E1 e& H% e
  16. * modify it under the terms of the GNU General Public License as/ i  C" }, W+ [
  17. * published by the Free Software Foundation version 2.
    , ?0 O) H$ @0 E) F; b
  18. *3 A# i+ P  U  }1 X: j0 e$ ]' H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 ^+ s* P; n$ V4 P1 X# B" k$ [- `3 d
  20. * kind, whether express or implied; without even the implied warranty. }% k  h& p; H, L- s, q' T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 m1 |: s- J/ Q8 p4 q7 R
  22. * GNU General Public License for more details.; ?4 g$ `( k! Q! N* H) |" q
  23. */
    " S% {( w2 X! `2 |, @5 Q

  24. 9 ?& o" a: f2 x* t+ s* [9 ^+ b
  25. #include <linux/module.h>9 r4 B1 G3 x) J2 t1 a5 e+ w
  26. #include <linux/init.h>4 J0 h! q+ t1 |/ w: d
  27. #include <linux/errno.h>
    ' }3 v3 R8 Q- E: z' C) ~
  28. #include <linux/types.h>
    ( }3 W- w3 M5 O3 e# Q
  29. #include <linux/interrupt.h>0 I$ x9 Q- m" \  |7 w
  30. #include <asm/io.h>3 S6 ~8 Z5 j4 E6 Q0 _8 p0 d4 K& x
  31. #include <linux/moduleparam.h>
      v0 f% U7 i; W5 e0 m- U/ O
  32. #include <linux/sysctl.h>
    * a+ b9 B$ E# R2 L! c+ f% s7 W: g
  33. #include <linux/mm.h>5 H+ z- M8 U* |6 `3 n9 {, E
  34. #include <linux/dma-mapping.h>6 ^% _3 K# R# `- e

  35.   H- _% d) x9 Z& L+ J
  36. #include <mach/memory.h>, v$ P  D6 Y* E' b) m
  37. #include <mach/hardware.h>( `  T& M( o. _0 j$ I
  38. #include <mach/irqs.h>
    $ }; U: o' ^, ]2 d/ q% G1 D
  39. #include <asm/hardware/edma.h>
    9 l5 S/ I. \8 h+ V6 X* S. y
  40. ; C, H' d0 J' F2 J' w) q
  41. #undef EDMA3_DEBUG, v1 I# O5 x) `# O; ^& \
  42. /*#define EDMA3_DEBUG*// s' h- ?3 D' `0 C5 j$ U
  43. 1 \0 ]* @. Y* N# i$ N/ U2 a+ F
  44. #ifdef EDMA3_DEBUG
    : @( k! i* a# H2 i0 C0 x% R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! p  J  q( P- N1 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ j0 H4 ^( H& _7 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ p8 l) o) n" X" J  K$ l
  48. #else
    0 b. Q1 q8 ^* M" v! t
  49. #define DMA_PRINTK( x... )
    : E! G: `+ q$ L8 r
  50. #define DMA_FN_IN/ s7 Q) w6 q6 t! \
  51. #define DMA_FN_OUT; i8 `* k8 N7 R7 {) I2 k
  52. #endif
    5 G7 W# C& \4 X. B

  53. % I/ x+ J' ?; X7 f$ J0 {9 m: W7 ^$ h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & G5 @, h4 Z  u: \
  55. #define STATIC_SHIFT                3; K! {# H! q( t1 {
  56. #define TCINTEN_SHIFT               20
    6 h) S* g, u5 j% E
  57. #define ITCINTEN_SHIFT              21
    3 A' Y0 |  E& q
  58. #define TCCHEN_SHIFT                22$ ~$ ^3 K& I- O2 t9 ~) p
  59. #define ITCCHEN_SHIFT               236 F2 i) X. a2 t: R2 d. x% ]0 x+ e, }' _

  60. & K; Y% D; u" U( y! w7 b3 h3 S
  61. static volatile int irqraised1 = 0;
    3 w) o: I8 z3 i6 V2 `
  62. static volatile int irqraised2 = 0;; [+ Z% W1 E" W; S9 Z  k$ p& l( e

  63. : m4 n) l7 f) P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) w$ `5 g& s* }. I  w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% q9 c4 z8 I( Q1 Z9 H! ]: E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. V' H% j/ ^1 t* e' |' z; X$ p! z, J$ b7 v# E

  67. / A! x/ c8 l6 ]4 L* H
  68. dma_addr_t dmaphyssrc1 = 0;
      {% q- R* x3 Y0 [
  69. dma_addr_t dmaphyssrc2 = 0;
    8 Y. ?  L& O( X8 D& c4 T2 X
  70. dma_addr_t dmaphysdest1 = 0;2 q, T: o: [2 U( M  B, |& @
  71. dma_addr_t dmaphysdest2 = 0;
    , L5 P- s# L0 T& f
  72. 8 ^* C5 E1 z7 @/ Y
  73. char *dmabufsrc1 = NULL;  v' N; D3 v7 |$ e- c$ D$ n- E
  74. char *dmabufsrc2 = NULL;3 ?3 L: u2 _" z9 i' B, P( Y
  75. char *dmabufdest1 = NULL;
    2 k1 c* C! M& G. v5 r& \- M
  76. char *dmabufdest2 = NULL;* R7 P: |# r5 G' ]* ?* t" B

  77. ; L& r- B) ~/ V) q3 V
  78. static int acnt = 512;8 Z2 ~, J; q1 x0 T
  79. static int bcnt = 8;5 F' O5 J1 n4 F0 x% D# P0 V7 @8 n3 W
  80. static int ccnt = 8;# @2 s, u& x% F5 A) l+ s

  81.   h+ G# s6 q8 m2 G( z8 D; w& m* O% \
  82. module_param(acnt, int, S_IRUGO);
    : o  q3 l2 [4 j# |6 X' f6 t* `
  83. module_param(bcnt, int, S_IRUGO);( A- B2 f+ o6 Z4 v" Q5 y, ?. ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) t- s% V) @- {5 q% s* X) f
* T% e& z; C; Y' F$ b" r4 U. W/ w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 B; a% g9 z3 ?% k6 Q% f& F& d
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 X! S9 N; U. C4 J, j- K5 G- J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- n1 G3 K) O, J5 h$ h  m
+ T2 y( U+ G) O! c
. {1 M$ A2 Z# d* G: Y) R/ v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 12:54 , Processed in 0.037002 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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