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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) K, R9 ]8 f% T7 |5 N* \7 g0 j0 S
  1. [code]EDMA sample test application
    " D6 {1 J" [9 Q* C
  2. /*
    7 G2 C9 l" f6 q; P1 p, S! |
  3. * edma_test.c
    . M) J" C8 ^& K; q; B
  4. *; M, Y& a; v5 ]- x
  5. * brief  EDMA3 Test Application
    $ J& e, y4 l! C6 W. F
  6. *, b# P8 o: J# C9 R5 @, `
  7. *   This file contains EDMA3 Test code.
    % D6 d& A! R+ B5 f+ w
  8. ** Y. e$ N1 k" {4 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; C) l$ [6 i/ T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . l. v/ `& [( x5 x3 @6 v: N9 K
  11. *         TO CHANGE., P2 v5 z( U2 m
  12. *
    1 u7 f1 f' G! g/ l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' Y1 n7 t' H/ d  m. T0 o1 M
  14. *7 f/ ~) ?5 G5 T3 N' ?% u0 {
  15. * This program is free software; you can redistribute it and/or: R/ H/ L4 J7 r2 d- a
  16. * modify it under the terms of the GNU General Public License as6 i: N# n$ i0 t3 P5 c' K
  17. * published by the Free Software Foundation version 2.. S; p) D+ J. D* N% W3 Y6 u0 s
  18. *
    5 y) I: \7 D0 p, |' w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 c; @$ D1 ~- g9 H; s, _9 S
  20. * kind, whether express or implied; without even the implied warranty+ P4 d9 S( V+ S' X1 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* v# c* i* N! `6 A" B
  22. * GNU General Public License for more details.
    2 t- X4 g) A- K; m& u
  23. */
    + j; t( S& T: D( p1 w) _4 ?

  24. 0 ^' P1 z8 {/ O! i$ m6 _; m
  25. #include <linux/module.h>
    0 v" j- J7 T3 b& ]- y
  26. #include <linux/init.h>
    % n: K3 ~$ P& I4 {3 a$ e( A8 A
  27. #include <linux/errno.h>
    8 I& a. A+ {- u5 n3 P# n
  28. #include <linux/types.h>6 |! y, ]7 d7 b
  29. #include <linux/interrupt.h>
    - k5 l$ u7 A( k5 g
  30. #include <asm/io.h>
    ! d, ]+ y, @7 A9 P' `2 r1 {
  31. #include <linux/moduleparam.h>3 w( y' f5 F7 E' J( W/ {/ n
  32. #include <linux/sysctl.h>
      [9 v  V1 G5 {& }
  33. #include <linux/mm.h>
    % y; h3 L& m' k; J( e' v: @
  34. #include <linux/dma-mapping.h>
    $ M! }# A1 D+ |- l+ x
  35. - L) g' x- d. J" l! b  E; @
  36. #include <mach/memory.h>
    + b* p0 ^$ R7 c+ g2 p; h6 F0 u" M; r
  37. #include <mach/hardware.h>, u% d' N8 O# O
  38. #include <mach/irqs.h>( c( I! H. H4 ^& B- h9 I
  39. #include <asm/hardware/edma.h>
    ) @. h8 p  [' w. m
  40. 8 a: o1 z: z% w
  41. #undef EDMA3_DEBUG
    " [: y) W" A1 M8 m
  42. /*#define EDMA3_DEBUG*/$ \$ a- J* M) z# `% D$ n. o

  43. 0 o+ t% p) t, ?- a- Z1 r" p3 ?
  44. #ifdef EDMA3_DEBUG( @7 O& o% f6 v( T6 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) y* j- Y) L* d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" d3 n0 z! B2 s2 h- H* z" `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; N% X) Z7 a$ I
  48. #else
    + u! t! |! |% {# G) t; {
  49. #define DMA_PRINTK( x... )( t+ D. v; T; C5 m0 ^
  50. #define DMA_FN_IN- E" t5 K9 N( G5 v0 s) Q6 L
  51. #define DMA_FN_OUT
    6 n; A5 ?- ?6 g# r- j: q- j4 R
  52. #endif3 U8 B. Q* j# l2 N7 @7 a

  53. ; {( N0 V0 d( n3 ~% o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 z6 R, ]4 Y+ d% w6 M% {
  55. #define STATIC_SHIFT                31 c( a9 n# c0 H- ]0 \
  56. #define TCINTEN_SHIFT               20
    3 m" a5 G% o7 f, h( z$ p' k
  57. #define ITCINTEN_SHIFT              21
    ) l8 F" K1 B' S0 K# d" W! k- b
  58. #define TCCHEN_SHIFT                22
    5 ]* h8 Z4 T5 z- i
  59. #define ITCCHEN_SHIFT               23
    9 }3 M3 s" H4 ^# v

  60. + W# K& N) n. e/ M5 b3 L( B8 L
  61. static volatile int irqraised1 = 0;
    * @* {, c! E% B) u0 }% y3 _- M" y
  62. static volatile int irqraised2 = 0;
    $ P3 v3 t7 b/ {( \

  63. ) g, u1 t; P$ R' R+ x3 s/ u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; F- Y5 f2 `8 x& L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 x) H, p8 k8 s# v0 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 j4 t' l( U, H; D2 ~
  67. & }2 h$ U, x# s9 a9 P+ ?
  68. dma_addr_t dmaphyssrc1 = 0;
    " @7 X- W: t, `
  69. dma_addr_t dmaphyssrc2 = 0;
    5 j2 x" S: x+ R- h& g
  70. dma_addr_t dmaphysdest1 = 0;
    * U# H2 h: e1 o2 U
  71. dma_addr_t dmaphysdest2 = 0;
    ! n( r) _. k/ e  I2 @( H8 m
  72. ; Y  M5 N7 P/ \, o, p5 p
  73. char *dmabufsrc1 = NULL;  O: U" _7 o; u/ i
  74. char *dmabufsrc2 = NULL;
    : b0 V+ g3 |5 h8 E3 D
  75. char *dmabufdest1 = NULL;
    ( \0 Q2 F# Z# J" I: n' y& p' ]
  76. char *dmabufdest2 = NULL;. X* v3 D( l& b9 q5 C2 @! R
  77. 1 G3 m. j4 i4 h, T# N7 `! X' D
  78. static int acnt = 512;
    7 c: v. p8 `2 g/ z. t* y5 p. b
  79. static int bcnt = 8;& ]6 z" _4 g. P4 H, h. g0 S
  80. static int ccnt = 8;1 n3 l1 d1 y+ f& I& F6 ?
  81. ) ~) }* Z1 k' Q* f. d1 v+ D
  82. module_param(acnt, int, S_IRUGO);, W* I2 ~# U6 B  }) M
  83. module_param(bcnt, int, S_IRUGO);
    9 H$ ^0 v3 L& @9 \! n* A" E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" D7 K3 f- H$ e- D
9 c& k/ i. a6 F4 \$ v" _) Z6 Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' S) k0 q7 K+ Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# x+ c8 F. h- K; _( Q8 c% d$ M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' ]6 k$ R7 \& v8 W$ h/ [# T' z  t0 b# @: \( `1 [
  J* J# Y8 S. ?: U0 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 16:41 , Processed in 0.039573 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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