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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # K6 r5 y: T  |+ Y$ w
  1. [code]EDMA sample test application
    : ~1 P( t2 Q8 |: |8 U7 j/ ~, Q
  2. /*
    ( O4 r. z3 Q! T
  3. * edma_test.c
    2 ]! t7 D6 m; x2 A- s7 `! t1 C
  4. *
      [6 B  M) O7 F. \
  5. * brief  EDMA3 Test Application
    9 a8 W+ o7 o3 b9 Y
  6. *
    2 H! h1 l4 h  e! m. y' \. q7 V
  7. *   This file contains EDMA3 Test code.8 s6 V$ O  q( H  z# U3 n
  8. *
    9 F5 @0 j9 M5 R" @; D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! `! l# t' ^! P. J# E+ g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 Q2 l6 x. i# N7 P# ]5 h- I( ?# _  J
  11. *         TO CHANGE.& ]( P8 h" v" g
  12. *
    3 d1 V5 W8 r: b  [+ P( L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( P, F1 a; t+ D/ k1 \
  14. *2 k; Z# A9 V, o' @9 G
  15. * This program is free software; you can redistribute it and/or
    % ^) F1 |$ _! S5 w. j1 A
  16. * modify it under the terms of the GNU General Public License as4 ~/ c5 I' `5 v0 x
  17. * published by the Free Software Foundation version 2.
    / h  u/ V/ w( q" j+ b, ]
  18. *6 z* C; n% A3 c+ y  n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: T. ?+ D) r: g  D* O+ ^1 J
  20. * kind, whether express or implied; without even the implied warranty
    ) B/ S6 _0 C9 A7 @1 A% H, V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 v1 D1 C8 @; s% T* N; l8 z+ b
  22. * GNU General Public License for more details.
    2 S7 @: j3 _5 g' N0 K2 F# O
  23. */4 p% C2 {. o2 i8 y

  24. $ Q% A) k7 A. _; i. t
  25. #include <linux/module.h>
    , K& P: |) }& M, G* E
  26. #include <linux/init.h>
      G9 U$ y' P) i% D4 H
  27. #include <linux/errno.h>/ |: O0 \4 u$ C( Q; T; s: _! j
  28. #include <linux/types.h>
    2 @- G" S% G/ S+ L2 T
  29. #include <linux/interrupt.h>* I7 W. Y* X9 m4 `3 E
  30. #include <asm/io.h>
    1 g1 l& B" ]8 a% k% U
  31. #include <linux/moduleparam.h>
    ; L. m3 V& U1 _! u# {( _' J, \
  32. #include <linux/sysctl.h>; `2 L, C- P  U4 F5 G
  33. #include <linux/mm.h>
    2 N; U; A7 p9 b& r
  34. #include <linux/dma-mapping.h>6 j: H0 j) W9 }8 i7 |& Q4 X

  35. 1 m2 Q* x# k# f2 x) K( I1 j% x
  36. #include <mach/memory.h>
    * d8 r/ k' A- |9 s. O
  37. #include <mach/hardware.h>
    % U1 S# L* r. L* i( \
  38. #include <mach/irqs.h>: a% W. S5 u$ K/ }
  39. #include <asm/hardware/edma.h>: P, c4 o' S9 N# p' i' i% W

  40.   L) {  V( y  r& E
  41. #undef EDMA3_DEBUG" t/ X* C  }8 R2 F9 r; L
  42. /*#define EDMA3_DEBUG*/2 D$ x0 V1 P% Q6 G

  43. : H8 M" q0 `8 l6 y6 V0 P
  44. #ifdef EDMA3_DEBUG5 ~. y$ a+ H2 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 c7 Z  q3 k; z4 C* j$ O/ D! p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 B: M6 T: O, r6 P3 ]' K1 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 ?) ?# v+ X% X( Z( L
  48. #else1 ]4 A2 B5 L0 w* ^
  49. #define DMA_PRINTK( x... )5 H; K. q" x3 Y
  50. #define DMA_FN_IN+ i& [+ u" q( O. ~! L* m2 M% C
  51. #define DMA_FN_OUT. }- U: B# H% k5 G0 e$ r/ K! K
  52. #endif
    & u/ f) x5 y1 b, x1 y
  53. 3 T3 d; n1 P2 S+ u+ a$ J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / `6 o/ ?5 w9 Z" r
  55. #define STATIC_SHIFT                3+ b0 s& z7 M6 p$ I
  56. #define TCINTEN_SHIFT               207 n/ }' _: ?5 |: X
  57. #define ITCINTEN_SHIFT              21
    ; A5 B0 Q: X" x5 k9 N' x, n0 `
  58. #define TCCHEN_SHIFT                22, q' E/ n) i1 A' _& ?) ^$ O9 N
  59. #define ITCCHEN_SHIFT               238 h, X4 {7 E$ d  i1 P6 U, {

  60. + L0 f4 G0 A* Y/ m, e
  61. static volatile int irqraised1 = 0;  [0 }3 X$ O2 e0 e7 \
  62. static volatile int irqraised2 = 0;
    & q7 g+ B  n7 f( |, X. r
  63. 4 D' o4 ~. s8 j% a1 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ L0 F0 \4 [+ y' ?. M* m- I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 F& w9 G! m5 }5 O9 G) Z# e) ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# O$ s/ ~7 `2 m# c- z$ d

  67. 0 D- A- m  A% a3 ?5 b" A2 v( X9 _/ ~
  68. dma_addr_t dmaphyssrc1 = 0;! b2 l$ v- T& a; x2 Q) W
  69. dma_addr_t dmaphyssrc2 = 0;! O% g: ^. J3 X- |' v$ }+ z
  70. dma_addr_t dmaphysdest1 = 0;5 J1 O' U) _4 f; H
  71. dma_addr_t dmaphysdest2 = 0;
    9 X& |! e. ]. x6 Q" e, D/ C
  72. 9 m, s4 _# R  k- c
  73. char *dmabufsrc1 = NULL;( {: A  G) S/ S& f6 B  s3 V  R# L) G
  74. char *dmabufsrc2 = NULL;
    1 n3 _( t/ S: D/ n
  75. char *dmabufdest1 = NULL;2 {0 M% ^4 Z/ [# V+ Y) t
  76. char *dmabufdest2 = NULL;; _: [1 a' T5 [3 t1 @* t( R

  77. 5 {: r" k2 i$ H2 F2 [
  78. static int acnt = 512;  u  D0 ^& v, w7 ]
  79. static int bcnt = 8;
    5 h! _5 @$ \3 C$ D% o' @
  80. static int ccnt = 8;
    5 ]/ a4 W, v% R: z6 |
  81. : W/ O2 ~$ M4 @7 O! y; H) f. B
  82. module_param(acnt, int, S_IRUGO);9 ]% ^) L0 v; c6 }' o
  83. module_param(bcnt, int, S_IRUGO);
    2 u2 f- S) w4 s. {# c2 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% o; v0 N4 [, K

5 p& C3 B; N" W. H- v0 ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 [9 @3 _! |  g4 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. U" v  L' J* S1 t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; q- S' Z6 T6 o' X6 m
- R2 g5 ~, @/ o4 s  ^' ]" X

2 I7 A4 L1 L% D4 v  [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 05:35 , Processed in 0.037839 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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