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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' V8 s8 ?7 L2 b- Y8 W, V$ e
  1. [code]EDMA sample test application; |' s5 y; |7 {  N5 G
  2. /*
    " V, ]2 W2 C3 t6 j$ X/ y5 q
  3. * edma_test.c
    7 J' M" [$ a% I1 `; Y
  4. *
    6 x- [* O% P/ s" f$ z! w  \
  5. * brief  EDMA3 Test Application
    ' Y0 N2 _  {8 X. g
  6. *$ e+ t) I# T) n) g8 r: z0 e1 f) @  `
  7. *   This file contains EDMA3 Test code.
    ! f" G; P" _0 G* R! c2 Q% v) q
  8. *
    + q: q; L  z% b( b# [8 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' C* s* x: L5 o6 u2 @) h* H9 q; J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( N3 a) \/ B5 p
  11. *         TO CHANGE.) B0 I0 d" _* L, V! s5 U: z
  12. *7 d7 E: N8 p! \( i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # }. @, z1 t0 W) |9 u+ C! {
  14. *
    - T' S3 P" z- o3 a: N5 d) ~
  15. * This program is free software; you can redistribute it and/or3 x5 i9 m! o, X' f+ [
  16. * modify it under the terms of the GNU General Public License as1 `4 I# |" P  M# ?9 }
  17. * published by the Free Software Foundation version 2.
    0 M" N* d- Z2 z# j
  18. *- l* q+ I7 d( B! ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 k) ]) k' X) U
  20. * kind, whether express or implied; without even the implied warranty4 @; Q* D1 h4 P* v  g( A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) j7 l7 n: ~4 g# n
  22. * GNU General Public License for more details.; P0 _0 {4 R0 N4 b9 y
  23. */! V5 ^5 h5 B6 i2 l" v+ T% b

  24. ; |0 I/ n8 _' H% n
  25. #include <linux/module.h>* t2 @+ p! |  ^! s" T
  26. #include <linux/init.h>* i7 B9 i2 Z* p7 M0 {8 @
  27. #include <linux/errno.h>! |. r' E  g1 \7 L# h
  28. #include <linux/types.h>) l9 d) H& m* q0 W& A4 V, g7 r
  29. #include <linux/interrupt.h>
    5 |) ^  `, y# o( v1 L; V# I1 X
  30. #include <asm/io.h>
    1 e$ O) R' X3 @0 @) ^' O3 ~' u( x8 N
  31. #include <linux/moduleparam.h>! b; e5 H1 A1 |: O' @+ X7 i& J/ {
  32. #include <linux/sysctl.h>  C0 O  d1 Z. Y' B* h
  33. #include <linux/mm.h>2 {6 m& i# ?# H/ o$ y( r
  34. #include <linux/dma-mapping.h>4 y' `5 i4 L, [& A" z+ y: x+ h

  35. ' x7 t  }6 ^4 S3 Y& B; X
  36. #include <mach/memory.h>% l: @0 I1 J* B- D+ T% x( m
  37. #include <mach/hardware.h>
    0 \/ e6 ?  }- S% S* D2 s. ]; s) ]
  38. #include <mach/irqs.h>
    $ I' M5 C$ e, U1 K7 W8 L( x9 R4 C
  39. #include <asm/hardware/edma.h>
    + Q$ {$ ?6 ]) N# x. D
  40. . l4 i8 R6 i' A* M( ?
  41. #undef EDMA3_DEBUG
    0 u# V. N; T3 n: h5 h4 u
  42. /*#define EDMA3_DEBUG*/+ C: k: f6 |. p, P, u

  43. % l" ?& M4 y, \% y* G
  44. #ifdef EDMA3_DEBUG
    / M& V% q3 G( c0 G8 A% l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      V& j8 @. Y0 I* M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ u9 f8 V: ~0 x; O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): G# Q* B6 C% U4 }3 k
  48. #else
    # f# ]) O! j/ `; C' J8 E
  49. #define DMA_PRINTK( x... )
    ) X% J4 `2 q0 O" L& q
  50. #define DMA_FN_IN8 K5 I; Y' `$ k& D' @
  51. #define DMA_FN_OUT6 q& j( y, Y- y- D. e9 J$ V
  52. #endif# _) _$ h" v9 J7 ^8 Z( R

  53. 2 I. f! |  ^% n' L$ {$ y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); R7 e, s; n2 h4 P+ }4 N
  55. #define STATIC_SHIFT                3$ ~" h& I( O% M* Y
  56. #define TCINTEN_SHIFT               20
    & {8 a5 _! {" J/ V# K* ~
  57. #define ITCINTEN_SHIFT              21
    . `5 Q6 w# [9 ?( e" ?* W
  58. #define TCCHEN_SHIFT                223 a' E0 e  r8 ?2 [8 w5 l/ [
  59. #define ITCCHEN_SHIFT               236 S# V  Y( ^& _, m9 {7 l
  60. / m$ R0 V1 q' H8 J
  61. static volatile int irqraised1 = 0;( L/ F. H' |4 W6 G- _
  62. static volatile int irqraised2 = 0;: A2 j7 ^3 `& z1 ~/ J
  63. 7 Z! R: K! Q- h1 _7 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* [5 ?& C8 l, J1 a2 E! E# t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ N( e! t8 ]; e2 ~: i, r* T2 d6 ?- U# m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 G/ O  B8 Z  w# ]( R
  67. - a' n1 y& n/ k
  68. dma_addr_t dmaphyssrc1 = 0;
    6 T6 }; p8 T) m# _. o# R: w3 ~& u
  69. dma_addr_t dmaphyssrc2 = 0;
    5 h* {' x( v; ?# Z* }$ U- ~( {" L
  70. dma_addr_t dmaphysdest1 = 0;: z% t' H0 i/ {2 n
  71. dma_addr_t dmaphysdest2 = 0;' \( ]0 K0 L: \8 U  Y  y4 J

  72. : x* z4 ^5 o! [' j
  73. char *dmabufsrc1 = NULL;
    7 M- n. q' T5 _, i* ]0 K
  74. char *dmabufsrc2 = NULL;1 S3 I3 L# h0 o4 L7 V
  75. char *dmabufdest1 = NULL;
    - j: B1 U5 S5 T4 Z  I
  76. char *dmabufdest2 = NULL;
    + o; T/ {" d" n

  77. - m5 t# q, H0 B) o* v5 _
  78. static int acnt = 512;
    ( f5 n8 r! c4 r7 f- a3 ^
  79. static int bcnt = 8;
    / }" o% u- Y, ~
  80. static int ccnt = 8;
    ! A: ~7 e8 I1 F4 ?$ M; _
  81. : k) M% b3 r# ^
  82. module_param(acnt, int, S_IRUGO);* x* j) z* C7 j' J: X2 }% M( Z( k
  83. module_param(bcnt, int, S_IRUGO);
    9 r7 m1 o7 W4 D* a- P; ^2 b* H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. M& Q; {. E4 @" ?$ A
8 B+ n0 y- c8 X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 Z' h3 f% q1 O2 S$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ \8 |/ G; {) t: N; L6 z2 A1 _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 c' s! Q: b  `9 `/ ~, m  N

- ^( i+ A9 b, [: s* v3 ~
3 T& _' v+ M5 u2 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-5 23:46 , Processed in 0.038918 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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