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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# m1 v6 g4 F  L+ T" _
  1. [code]EDMA sample test application8 ]& m  o/ i5 _' h( Q5 C
  2. /*
    6 d9 d% _# M$ {  V& G" Z- n  X
  3. * edma_test.c
    2 u: S6 I" e, j* Z1 B% K. D  S7 E
  4. *
    / r' J8 n$ e6 I& a( w$ [, J
  5. * brief  EDMA3 Test Application
    , L1 i4 v# E. L9 W3 K' }2 Q3 w
  6. *
    - r  k3 Q' X1 v
  7. *   This file contains EDMA3 Test code.
    8 ]* n/ M  p4 {5 x
  8. *
    - Z( V( C4 o* M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + \. z: S; V2 r$ U. J' z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( P& B' k3 C# F0 F( c$ l* t
  11. *         TO CHANGE.' ~8 Y. a8 U9 V& S, \% }! m6 P. S: j$ S
  12. *8 N) t8 e# F7 Y) {0 J+ u7 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . C. i. n' s; j  q. u% a. O
  14. *
    4 K# X3 [1 \6 z1 ^. h3 q
  15. * This program is free software; you can redistribute it and/or2 U, `4 S8 ?' Z/ _
  16. * modify it under the terms of the GNU General Public License as
    0 ]+ P( a" Y1 N9 [
  17. * published by the Free Software Foundation version 2.
    , B; B; N2 m/ `2 y( c; j
  18. *( J' w* v( T+ P" y: C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ X* `7 D/ r# g
  20. * kind, whether express or implied; without even the implied warranty
    ) h* o) w' n7 F) x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! N8 H# C8 I4 s) `5 {9 k
  22. * GNU General Public License for more details.; `1 a5 w$ b) p# T0 Q- i% b
  23. */
    - C  {! S# w  A, B9 Y

  24. $ O! N3 a3 B+ a1 Q3 U5 Z( z
  25. #include <linux/module.h>
    ; h* y# t9 D, V; W5 P* k+ ?
  26. #include <linux/init.h>
    - G2 S# S- E5 Q) A7 D
  27. #include <linux/errno.h>5 u8 {7 E3 |- F! O, R, U
  28. #include <linux/types.h>
    % X- S, X, e7 p" d
  29. #include <linux/interrupt.h>; c/ T% \4 R6 d5 ?3 D$ _3 P
  30. #include <asm/io.h>
    $ U+ S+ \4 b" @  h; P0 V" ~3 p
  31. #include <linux/moduleparam.h>
    ! K; {, Q* k" I: U$ ]) m
  32. #include <linux/sysctl.h>
    6 n5 ^) B( l+ P0 W; ]+ c
  33. #include <linux/mm.h>( s  ^) I! @  `
  34. #include <linux/dma-mapping.h>' `8 _9 {0 J' \3 [0 Y5 M7 o/ P

  35.   Q; V) O7 L/ ~6 r4 E
  36. #include <mach/memory.h>
    * U( b* k8 S+ y6 o: d! x7 Z' S. M
  37. #include <mach/hardware.h>/ h/ r# @7 n  \5 Q; ^( \% n
  38. #include <mach/irqs.h>6 ?% v2 V, o2 R+ [9 M  g4 P+ Q3 U  B
  39. #include <asm/hardware/edma.h>7 j7 N$ G. x& v) B4 u
  40. ; ?! F: g- \/ X7 e* j% ]/ b1 `
  41. #undef EDMA3_DEBUG* R% {7 i$ R" ]$ Q) U3 {9 h
  42. /*#define EDMA3_DEBUG*/9 J$ e3 z' i) T9 O
  43. 3 O% q8 B( N# J4 I9 D. A+ w
  44. #ifdef EDMA3_DEBUG
    5 b$ O0 D' m; ?9 n) A2 o& A5 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): N7 U- w7 u% c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 r& y( {8 w: ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + z# }/ c/ L# P, r2 t* q5 U
  48. #else
    # T. u: }8 n5 F# E  ~! L9 F, y
  49. #define DMA_PRINTK( x... )" w2 F) M( Z. s2 A& [  f% E& g
  50. #define DMA_FN_IN
    : q1 R* X& T- ^6 e
  51. #define DMA_FN_OUT
    % g: t9 W1 a( @3 Y4 X3 k2 x
  52. #endif. P3 P; O/ T9 p1 u
  53. 6 ^# \: W3 x* W8 g; P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & p( I9 S! h- c) V. ~: i* L$ c
  55. #define STATIC_SHIFT                3, {" T" B/ V1 ]; `+ A' I6 }5 C
  56. #define TCINTEN_SHIFT               20
    4 h7 A- Z; J! m( B
  57. #define ITCINTEN_SHIFT              21
    3 }% j8 D8 y! @$ }; b
  58. #define TCCHEN_SHIFT                22" S# N7 u1 j. M, d3 y1 r4 x' q4 ~
  59. #define ITCCHEN_SHIFT               23
    % L. _2 W- s9 z* t0 c. P5 s; r
  60. . M( P+ I0 ]0 \: m+ }: o+ y
  61. static volatile int irqraised1 = 0;2 L* |) v# m4 h$ [5 o
  62. static volatile int irqraised2 = 0;
    9 P# H3 o- Z# x2 s7 k  T. S7 U% D

  63. 3 G" v. d; i8 t" g! a# l1 c1 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' \$ n" m5 F0 t! L3 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ?4 D# c# o% L2 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % w0 w% q3 U5 t! _- }# E

  67. 8 U$ m5 d; r3 X. D4 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    * g+ R4 V+ @% Y; i8 r0 n/ S
  69. dma_addr_t dmaphyssrc2 = 0;; j) Y1 a% S  J  |8 l7 i
  70. dma_addr_t dmaphysdest1 = 0;
      d" S" y$ b: W
  71. dma_addr_t dmaphysdest2 = 0;; }4 V! Q8 ~7 u$ J+ {1 u9 ~
  72. ( m/ T4 Y% w4 G5 P2 w1 a' _+ P
  73. char *dmabufsrc1 = NULL;
    - q2 X4 K$ O: c" s8 I: F1 g3 b
  74. char *dmabufsrc2 = NULL;
    & Y1 l* _! o' A( |, g
  75. char *dmabufdest1 = NULL;
    , Q% ~3 Z; p0 s' R2 y
  76. char *dmabufdest2 = NULL;# R" j+ E0 ?' ?3 q9 e( ]
  77. ! R* b' f$ K3 W9 n$ g
  78. static int acnt = 512;
    + s0 g! Q, `2 N& A" `; k
  79. static int bcnt = 8;
    : J* k! Z& Y- l5 }
  80. static int ccnt = 8;" z9 S! Y# {6 G4 x0 U7 p- x! W

  81. & {  v5 b& G8 Q/ e
  82. module_param(acnt, int, S_IRUGO);# |1 `) t- E5 q7 h4 }" r4 ~3 A: N
  83. module_param(bcnt, int, S_IRUGO);/ T! p* c, q) T( Q. ~! v" G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: t7 }  C) B1 E' q" j) f- T7 \; q$ k* d; c! ?3 w# T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ {: M" f: z3 g0 I. ^6 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 r( U$ i" f* a* d5 Z. l1 V% E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ P/ U& Z  D1 q8 e
- i% Q$ t6 Q. y! `* p* I4 l+ F! R4 b1 }! Q# O# e1 b! G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 08:34 , Processed in 0.038795 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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