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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, j, [( _5 }% |) L
  1. [code]EDMA sample test application
    / n; x6 o' g6 g1 }! f! ^" @
  2. /*
    # s: r  a3 B2 ?, r, e
  3. * edma_test.c
    6 R) i$ l9 [/ E8 p4 W
  4. *7 O, `- \1 R" R/ M; f" s7 n
  5. * brief  EDMA3 Test Application
    9 Z% I+ z& m+ e: J( e5 W9 g1 J$ z$ C
  6. *
    1 }0 W" q5 X; ~* Q$ o8 N. F
  7. *   This file contains EDMA3 Test code.
    8 y) u/ g. ^0 X% J  ?/ Q5 g
  8. */ p! O! v% m2 u3 ~! ~7 t$ n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 ^3 n) v9 G6 R5 M& E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : e9 s, S0 i1 }- s' H( {. b
  11. *         TO CHANGE.
    & t% ^4 m5 j% t# Y
  12. *
    * ?# @" F( A! [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! o. B0 ~6 e: F6 L, b
  14. *
    ) {) E. Q; t2 F' s6 i+ @- ], `: t
  15. * This program is free software; you can redistribute it and/or) i* D( z, S- h. p% y0 j1 X$ v
  16. * modify it under the terms of the GNU General Public License as
    2 m' ?& q/ b. `8 X
  17. * published by the Free Software Foundation version 2.
    + n7 o. k$ Y; A( x. ^8 I  s6 O, R1 X
  18. *2 o: _  k+ ]+ J, K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 M$ ~2 o$ G$ ^
  20. * kind, whether express or implied; without even the implied warranty/ a/ @. ~4 X; f( c* U0 n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 M( Q  e. x; F6 s6 [
  22. * GNU General Public License for more details.
    - |! _. i! v! ]4 `
  23. */
    + h* ?/ R; H7 E/ M- {/ ]

  24.   z/ p* u- Y7 W" w8 L) y3 _
  25. #include <linux/module.h>
    : g) ^+ n; ~4 x7 i" C2 E
  26. #include <linux/init.h>
      k1 S$ C' L  {! j- |- K# w
  27. #include <linux/errno.h>
    ' }' l! t5 w+ H+ c' w
  28. #include <linux/types.h>  j1 o, B8 g- Q1 E& O9 x
  29. #include <linux/interrupt.h>
    ( u6 D  e' b& [, ]1 q% _
  30. #include <asm/io.h>
    2 q! E8 z8 ?- {6 X+ Z. d/ ?
  31. #include <linux/moduleparam.h>
    & ^( H: }# J" p1 N
  32. #include <linux/sysctl.h>; ]3 m4 ^3 ^4 y9 S) E6 }3 E
  33. #include <linux/mm.h>3 {# q- I4 e0 f# `% s# D1 W
  34. #include <linux/dma-mapping.h>1 @9 B- Z9 u* ~8 m2 u

  35. ' N% W2 o: i" E- b3 M
  36. #include <mach/memory.h>
    6 L$ {* g: I; S8 B2 [1 q
  37. #include <mach/hardware.h>
      J9 G" c+ `1 J1 W9 w) P
  38. #include <mach/irqs.h>
    5 l: K: O  w7 |" C8 ]6 J, ]
  39. #include <asm/hardware/edma.h>
    3 j, P5 y9 }- a" z

  40. 1 N" R0 V/ z% R3 V" I
  41. #undef EDMA3_DEBUG) m4 _( j; H! v
  42. /*#define EDMA3_DEBUG*/1 g* F' Y9 b+ q% ]1 ~7 R5 u5 A
  43. $ r1 k' v( p+ k( y2 b) p
  44. #ifdef EDMA3_DEBUG; q6 ^; \3 l$ g! `# ]: F' S2 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 J  V; Y( \3 x) A! ~/ t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; [- }; b! \# u$ m+ |* k7 l4 S7 B6 K3 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( E# d6 ?6 W( b/ H# ~
  48. #else% g8 S7 a% D- Y( M# _
  49. #define DMA_PRINTK( x... )
    # A; R* z  G& P) ^% O. m% i
  50. #define DMA_FN_IN9 G2 z" [+ K3 F! W
  51. #define DMA_FN_OUT2 P4 ~: W' \; s9 U/ ~# T4 o
  52. #endif4 e8 L6 z1 j2 J; S- p( T0 U

  53. & o( y7 M2 V- q2 X4 {8 _2 E% K2 y7 v. r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), I+ B' F7 E3 O4 ]5 H  ]2 b
  55. #define STATIC_SHIFT                37 |. Z8 T/ ]$ `- `+ ~& g
  56. #define TCINTEN_SHIFT               20
    4 p" _! X/ N) j1 U
  57. #define ITCINTEN_SHIFT              214 M2 ?: x; M1 A1 s8 w
  58. #define TCCHEN_SHIFT                22
    6 v. C/ O) v' W- l
  59. #define ITCCHEN_SHIFT               23
    ! E0 I$ k% E6 v7 T( Y
  60. / D# z" f% s0 \) d# f) T
  61. static volatile int irqraised1 = 0;' Y* @* G$ }/ {& }5 l% [
  62. static volatile int irqraised2 = 0;+ S. g0 l, @( m
  63. . B/ W7 {# @& V& b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + i; M3 m2 K5 ]7 d* m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* l, \8 L0 u6 X3 y9 n$ w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . ^; f( ~. x+ X% P4 k
  67. ) S4 N; f( n% {. `  l7 h. j# `
  68. dma_addr_t dmaphyssrc1 = 0;
    ) B" i# E6 a+ _* r
  69. dma_addr_t dmaphyssrc2 = 0;
    8 Q" f" G) H& \! G
  70. dma_addr_t dmaphysdest1 = 0;
    ! P5 ]" ]+ b  M% t* {* [3 T
  71. dma_addr_t dmaphysdest2 = 0;  }/ _6 a$ t+ `+ Q; d2 ]
  72. ( D3 n7 F1 k* i8 J# \
  73. char *dmabufsrc1 = NULL;( k6 c6 P3 K% Q- y
  74. char *dmabufsrc2 = NULL;1 K0 x- i0 `6 `' ~( q! |* r
  75. char *dmabufdest1 = NULL;  ^# y: d5 i: P( {; L% u
  76. char *dmabufdest2 = NULL;
    # n6 B' v+ V6 f$ M8 B8 E6 u6 f/ Q0 @$ D# e
  77. & n5 ~) ?+ a: u2 W# A2 \% ~, }/ Q
  78. static int acnt = 512;
    4 q5 E! a' L$ z3 Y# j2 [, o
  79. static int bcnt = 8;: \" l7 \. I, b5 _0 u- ~
  80. static int ccnt = 8;0 Q  d: `; w3 D/ b. \! u

  81. , \* x! M$ d, |( d+ h
  82. module_param(acnt, int, S_IRUGO);
    3 ^; K6 ^$ i! J" R6 I% c# p" G
  83. module_param(bcnt, int, S_IRUGO);
    ( Z/ ?9 v' Y# v9 }/ ]+ X: E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% e: W( K: Y* r* v

/ }; I  ]7 f! V7 @  t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  H6 n/ Z9 i5 E) o  _) @5 h  {/ a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# {9 e$ x, _; |, h, X! Z- D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 ^# e! x. O; T8 I! X
, M4 p, s  z$ G4 f  A# U

% U9 F( _' J/ Q# }0 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-25 01:17 , Processed in 0.041948 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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