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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" }. R# U* }* d8 P: }
  1. [code]EDMA sample test application
    0 }3 n  ^7 X4 r' @8 L1 R5 [$ l
  2. /*
    8 a7 q0 y' L5 R9 T, r
  3. * edma_test.c7 w: x. r3 V# Z4 F7 s& }
  4. *
    ( |9 g4 H+ K2 v
  5. * brief  EDMA3 Test Application
    5 g6 ~- `/ Y3 R$ f
  6. *& s: T- h/ h  u4 l( {6 Y& X; T
  7. *   This file contains EDMA3 Test code.% G6 @1 p* X9 L8 W7 Z
  8. *
    % N) b- b' p) [6 Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  R: a- H& [# b. o, N, h2 }- T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! ^6 Y3 P1 s8 M6 l3 S, V# J
  11. *         TO CHANGE.2 u( ^" e& x. u& f) V
  12. *0 R; W; w! d7 P+ f' O4 n6 r$ P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 k2 l$ _- L4 d5 E% ], s+ T
  14. *
    " k: p; [& B/ F/ Y+ Z* w5 ]- o% |
  15. * This program is free software; you can redistribute it and/or4 G# \$ i' I2 J$ h7 s
  16. * modify it under the terms of the GNU General Public License as
    ; r2 F/ O# U" Z, K  J! ~
  17. * published by the Free Software Foundation version 2.6 l# K& K+ g) N
  18. *7 C" r- e& P4 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 s. \+ ]0 I' J
  20. * kind, whether express or implied; without even the implied warranty/ l& N* Z- t$ z/ E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 `' H5 v- i% {: L. F
  22. * GNU General Public License for more details.3 B4 E9 w0 B* E- ~" a. ]0 V
  23. */
    + X7 n3 j" N: Y

  24. 3 {# z1 X: y$ L9 O& F% _9 E
  25. #include <linux/module.h>5 f8 }) J( z4 o+ ]; O
  26. #include <linux/init.h>
    , b6 d; b+ S& a' d. p4 \
  27. #include <linux/errno.h>; {0 K6 C4 u0 x# ]. H
  28. #include <linux/types.h>
    ' K5 m/ @6 s, c+ b* |( z1 C5 `3 T: D
  29. #include <linux/interrupt.h>
    6 B2 G+ W* s& K, d- ~( M
  30. #include <asm/io.h>
    6 H* g7 V! T7 n: g4 _
  31. #include <linux/moduleparam.h>
    3 S) u: y& r3 p- [7 y
  32. #include <linux/sysctl.h>/ p$ H: s; h6 \0 i
  33. #include <linux/mm.h>6 S4 V0 B- ^( A* D" }; ]. D
  34. #include <linux/dma-mapping.h>. S- i2 D# Q+ D8 |2 V
  35. 3 o3 u6 j; I1 C7 G+ f
  36. #include <mach/memory.h>6 r3 B8 S/ o: g# y# G
  37. #include <mach/hardware.h>+ o$ w- _0 H1 h* r9 {7 g6 C
  38. #include <mach/irqs.h>' u% B6 [: B, @- |9 x( X0 y
  39. #include <asm/hardware/edma.h>+ Z# D* R/ Z3 B9 r7 v
  40. ! V3 r1 H* @+ x* G/ F
  41. #undef EDMA3_DEBUG
    ( m1 ?+ t- c  N7 L, ^
  42. /*#define EDMA3_DEBUG*/, D8 T2 N9 X- [, K! a, z1 X3 n

  43. & c6 M" r5 r# Y( v+ c# a2 l
  44. #ifdef EDMA3_DEBUG
    ; o6 \0 s# ^! q0 Q, E6 M# a2 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 k: h6 k& v! V  F* a( [4 ]' _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # w: B) h& Y) C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ {: D4 P. V. [
  48. #else
    ( H' E, @+ y/ p# h
  49. #define DMA_PRINTK( x... )
    1 j3 \1 N, s' G$ w- D' y) ?5 }2 m
  50. #define DMA_FN_IN; l+ a+ Z# a9 E/ @9 A
  51. #define DMA_FN_OUT
    ) j' w) O, V6 u. L
  52. #endif& y+ I% s" ^7 d9 a
  53. & G2 T8 h/ S( P0 c1 [, Y/ M1 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). u3 K; e3 i- F3 {* v( W4 {
  55. #define STATIC_SHIFT                3
    6 s: N3 S+ F' ^8 ~5 J
  56. #define TCINTEN_SHIFT               20
    5 `* \) T; ]& ^# ?& g5 o
  57. #define ITCINTEN_SHIFT              21
    $ X0 f, R, W! O" E) v" c. c
  58. #define TCCHEN_SHIFT                22# {( o2 ?0 j0 V) N: ^6 D' R
  59. #define ITCCHEN_SHIFT               233 |' W; p2 ]/ b* m! R6 a

  60. 4 z2 R. G) I! a5 L1 \
  61. static volatile int irqraised1 = 0;$ H/ O- F9 \& G! g& L
  62. static volatile int irqraised2 = 0;6 q8 G4 Z: {7 |! H7 g: \/ |
  63. + u2 M  a. }1 [; R* c$ A9 U4 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( l3 @. L; m. F) q) w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ s8 A3 c* x% h, f5 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 d+ g& S( o- I4 J
  67. 4 D: a  C! G5 f8 L) R4 A
  68. dma_addr_t dmaphyssrc1 = 0;4 v7 n+ L% _: Y' z# y
  69. dma_addr_t dmaphyssrc2 = 0;" V" p; h4 [* h5 G
  70. dma_addr_t dmaphysdest1 = 0;" h0 [9 K# z. _$ E$ F  ^
  71. dma_addr_t dmaphysdest2 = 0;8 i! m/ O, t0 ^2 F5 M/ K$ E. \
  72. 0 F$ F! p, g. u6 ?% U2 F5 _
  73. char *dmabufsrc1 = NULL;1 a/ Z) Q6 J; C( h
  74. char *dmabufsrc2 = NULL;- y! u" O) M! N& m
  75. char *dmabufdest1 = NULL;
    3 L* A0 X8 Y4 _' \, u
  76. char *dmabufdest2 = NULL;8 X! N: n7 I. V: V% q9 e' w
  77. & ~. U  T8 G1 ?6 R7 I8 n6 j; \2 F
  78. static int acnt = 512;
    $ W6 m5 J/ I) \8 W; a
  79. static int bcnt = 8;
    * z2 y9 }4 G# z  B5 R
  80. static int ccnt = 8;
    8 C0 F1 T! R# @2 n$ j

  81. ( Y1 o* C; h+ u& T
  82. module_param(acnt, int, S_IRUGO);
    # J  K( }+ k; L5 m3 j- I
  83. module_param(bcnt, int, S_IRUGO);
    . a- L: Q9 _9 f1 c, K6 E" M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 p; }# `2 J7 d$ i+ R6 m! i* \% s' F

! A' Z( y+ K* F6 i8 C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, w, _. V+ i' W) Q9 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! Q  |$ G$ l7 ]! }2 P2 S2 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 ^( q1 O$ T/ Y7 e9 V7 s
4 Z8 S# C2 u( ~. c/ ?& N1 s8 U7 T" m* \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-14 16:41 , Processed in 0.039270 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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