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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & j& \! s6 G2 S, @5 V, k, ~
  1. [code]EDMA sample test application3 J8 ~8 X5 K; v% p6 R, L9 n7 D
  2. /*7 x. H! D1 F8 r9 F4 u& g! K: m
  3. * edma_test.c
    ( a3 C2 [$ g% Q. D
  4. *# P5 d9 E7 s  [  E, H- H
  5. * brief  EDMA3 Test Application
    ( P% q" u, A5 e# i  c8 A  [
  6. *8 R) r( S' B0 O: k- E
  7. *   This file contains EDMA3 Test code.
      I( h9 h) h* C& n2 ~
  8. *
    ( u4 l( j* L9 ^0 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# W9 b0 y& J: G7 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + V5 M% X$ V3 z+ B4 T4 L
  11. *         TO CHANGE.5 c( u2 E" W0 [  ]7 P. ]! s; p
  12. *
    " j, Y) j  t' m) \$ a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 i9 k5 I. {5 ]4 E  ^+ ~! M
  14. *1 Y( J1 i+ ?  q0 [0 ]. y9 k
  15. * This program is free software; you can redistribute it and/or
    ' }' w: o5 E3 r4 n' b3 t% ~
  16. * modify it under the terms of the GNU General Public License as
    0 l% a2 w% c' d8 |2 @" ~# S; {. y$ Z
  17. * published by the Free Software Foundation version 2.9 d8 w' _8 `( ?
  18. *3 n6 h) U6 J/ _8 K( `0 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : ?5 Z0 @9 j8 a' ]
  20. * kind, whether express or implied; without even the implied warranty
    8 I, D2 k" k" t5 k* S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 o6 q! S) K6 Q+ R% U% i
  22. * GNU General Public License for more details.6 W: f3 `: k/ A( R0 ~* D0 h
  23. */
    + A* T' ]0 h& |2 r1 f; ?  |4 N

  24. 9 u# l* i, L" c! a/ z6 S$ f7 v
  25. #include <linux/module.h>
    + ~8 a. o  m2 x& V: f& b: _# b
  26. #include <linux/init.h>
    8 R. x$ J7 Q4 r2 X
  27. #include <linux/errno.h>
    % J1 K6 ]" Q, @, i, t% n; [7 o
  28. #include <linux/types.h>
    : J! P2 Z/ i& D, K/ m
  29. #include <linux/interrupt.h>) h# ]  T7 X. P# P9 A+ M
  30. #include <asm/io.h>
    2 A! I: j2 P! d, J
  31. #include <linux/moduleparam.h>! w7 Z) T7 r  v. o
  32. #include <linux/sysctl.h># v/ n  }9 l3 a3 Y
  33. #include <linux/mm.h># f! N9 x; V7 ]! }, n4 a7 T
  34. #include <linux/dma-mapping.h>
    - M6 ?# `7 I5 w6 E4 Q

  35. ) B9 c8 t" M  Z" k1 G6 Q5 W
  36. #include <mach/memory.h>' u1 j# z- G1 k/ `) g6 V
  37. #include <mach/hardware.h>; Y6 T1 C0 y# `
  38. #include <mach/irqs.h>" z6 L, u! c+ J, ?) E# o% ]% ^( F
  39. #include <asm/hardware/edma.h>4 D! j: D* Q/ t4 p2 l6 Z
  40. 3 l9 @+ h! Z( D6 J
  41. #undef EDMA3_DEBUG
    $ n$ E; l8 J/ x( q1 t
  42. /*#define EDMA3_DEBUG*/
    % S: O" F; W' |. T

  43. ; I& E; n: U6 ?$ c
  44. #ifdef EDMA3_DEBUG, q, i- p4 B- h% \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; C6 E, k" B5 |& @1 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): g& U! ?1 ]% U/ [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% O* U, J7 ^- P
  48. #else
    ( g* v2 \" }, S
  49. #define DMA_PRINTK( x... )6 G9 N9 _+ S4 D" A9 H
  50. #define DMA_FN_IN
    & K5 @% |/ C8 R! I3 D+ z8 ]
  51. #define DMA_FN_OUT! Q% G5 u% q4 {; I4 `
  52. #endif6 c. _( B+ u# F' m: \
  53. / Y; w: ^. c3 N, C/ ^, S# o% p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! c5 V# R# ^6 c8 I1 J# a& U8 P
  55. #define STATIC_SHIFT                3
    2 D  R$ W. Z- F  b+ z1 A
  56. #define TCINTEN_SHIFT               208 F) Q/ P2 H  l) d2 C6 p( ]) A
  57. #define ITCINTEN_SHIFT              21+ J8 s6 d* h# c$ o* p: t/ R
  58. #define TCCHEN_SHIFT                22
    4 v5 Y$ Z$ ~) j! @
  59. #define ITCCHEN_SHIFT               23/ o( M2 T- A/ r. S  t

  60. 3 `' M" r( K8 ?4 i
  61. static volatile int irqraised1 = 0;+ ]& `8 R5 q0 f( n- D0 G' s
  62. static volatile int irqraised2 = 0;
    7 J0 ^. {. ?3 C9 R6 s  v+ [0 {$ u

  63. ( z: a3 Z9 n  u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ l0 G) M4 w" X) O9 q8 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* A+ T/ A: J1 I# B' n& I; i/ @( I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 C! J: y  L! N& d7 z1 F

  67. , Z" S/ u+ x- ^/ B
  68. dma_addr_t dmaphyssrc1 = 0;' O3 k* p3 b7 o
  69. dma_addr_t dmaphyssrc2 = 0;
    - T5 I4 l; S- z, B$ n8 C" v
  70. dma_addr_t dmaphysdest1 = 0;
    2 D$ M( O! C+ z! J
  71. dma_addr_t dmaphysdest2 = 0;# Z- i6 b/ Y( O+ q0 |

  72. 1 z. y; F) C) ]5 ~  C+ {- [
  73. char *dmabufsrc1 = NULL;
    $ L! g. s, o9 f) p- j# q
  74. char *dmabufsrc2 = NULL;
    $ J7 v( T5 g9 c/ m; c4 `
  75. char *dmabufdest1 = NULL;9 b+ C$ g+ C9 k4 M) R" v
  76. char *dmabufdest2 = NULL;5 P( w7 V+ ?) y6 c/ V6 O8 l8 j; K" Z% Z+ z

  77. ; U, l( z: g9 o* f
  78. static int acnt = 512;
    2 }7 x+ B5 ]* }8 r" U$ I
  79. static int bcnt = 8;1 w" r/ j# `" `" c; ?  {( Y$ c
  80. static int ccnt = 8;2 [3 s  r! R: o& k$ t9 j

  81. 9 H/ R+ Z/ }# x& K* H5 \" l, B
  82. module_param(acnt, int, S_IRUGO);
    6 s1 h) F) h6 D& t; R
  83. module_param(bcnt, int, S_IRUGO);4 ]) N7 r8 r0 {8 Y% \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 p( Z+ x% X9 Q0 H: C

1 V% i6 A: W' q" e6 L. a4 j0 |. p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% x. i. l7 S! s( b* Q0 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ }" E- M8 r5 w9 G- v. ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ Z& \; ^. V9 o! O4 K- U3 Y7 O6 ]' C

3 [7 Q3 E/ ?2 u9 u& H, l/ C& c9 L9 [2 f% x2 Y; d/ V+ o( W. e6 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-15 22:22 , Processed in 0.037015 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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