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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " h) F  O& z6 [
  1. [code]EDMA sample test application
    ) \' i% y4 E# h- @/ x; F
  2. /*
    % S5 R% |4 o' m' O
  3. * edma_test.c
    3 p9 b  M% d- G3 ?4 U
  4. *' X6 @( J/ Q) @5 D" x
  5. * brief  EDMA3 Test Application5 ^4 T3 F- o  N5 d  O5 B
  6. *4 o4 j' m+ e) O5 j; u! \; a* p
  7. *   This file contains EDMA3 Test code.$ _" l9 ?' ~5 y
  8. *
    3 ?( k2 G' [# s) b. l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# b+ \0 R  L$ b  s' K2 L9 w6 u- B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , n" A3 {  w" [7 S5 s" H2 I7 Q
  11. *         TO CHANGE.) t& u5 q, Y6 S: _8 j5 M  U
  12. *3 R; \8 _0 Z1 K/ r4 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 a8 q' n  Q+ v) x( G
  14. *2 n( L" e7 J# Y9 {
  15. * This program is free software; you can redistribute it and/or
    ( g1 b3 |  g+ v7 q# d
  16. * modify it under the terms of the GNU General Public License as' g/ Z7 W4 w4 y# a% o& _0 h
  17. * published by the Free Software Foundation version 2.
    $ O# P- Z; @# ^8 p' I& ^$ U' [
  18. *  n) Q- M" i+ R; }( _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % c$ C9 O3 D0 z" ?( S; w- h! w( j
  20. * kind, whether express or implied; without even the implied warranty
    ) C; u. \9 a) `0 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 E# j3 ^; l) M
  22. * GNU General Public License for more details.. z9 Y. i/ Q! p
  23. */
    ; z- B, l  ^+ t
  24. ' l' p6 O3 d8 _. S  R
  25. #include <linux/module.h>5 n. Y2 T% h& ?( P/ p3 i( ]7 a
  26. #include <linux/init.h>
    0 C4 w, ^1 I; K9 {6 L# Z% T2 p
  27. #include <linux/errno.h>6 a5 a" v  |+ j% |, ^+ n+ N& s
  28. #include <linux/types.h>8 ~$ b0 H5 p/ V! F
  29. #include <linux/interrupt.h>* k% T9 E+ G  G
  30. #include <asm/io.h>
      x( f, z- T; Q4 z7 J) e! A4 l0 c% D
  31. #include <linux/moduleparam.h>, b) c  Q  d9 P" V2 c. w
  32. #include <linux/sysctl.h>
    6 p+ o  s0 v8 O. |4 w0 ?5 ]
  33. #include <linux/mm.h>3 R, l+ V9 e3 U2 {% f( T; s  s
  34. #include <linux/dma-mapping.h>& V9 D1 x+ X# d) _+ R% c
  35. 4 N+ R) r: a% w1 }) x# G0 s/ Y
  36. #include <mach/memory.h>
    9 V  @7 g8 o- ~( b. T
  37. #include <mach/hardware.h>
    + f4 K4 t7 M8 N$ f1 I- A8 |
  38. #include <mach/irqs.h>
    & L$ j) A5 W1 W0 _
  39. #include <asm/hardware/edma.h># w, |# G+ e1 a( K9 ?

  40. 7 s5 o5 @$ ~  Y8 ?, _
  41. #undef EDMA3_DEBUG! ?* {, S5 L3 H" V$ |/ v, i) z
  42. /*#define EDMA3_DEBUG*/
    " o  C# N3 x( Z0 Y0 X
  43. 8 a( z; \: F  a* g0 W9 [: t
  44. #ifdef EDMA3_DEBUG
    1 d' U: J0 i, b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      ^( I" R/ @, Q0 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( U0 v3 n8 z, p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! Q. c$ U/ T$ }; e4 s$ U
  48. #else
    * M; N$ s3 o9 _) |9 j
  49. #define DMA_PRINTK( x... )% m( Y" }' g+ {- v
  50. #define DMA_FN_IN
    , h1 P# t$ |" @% G
  51. #define DMA_FN_OUT
    8 @' p% M9 ]+ t  @0 O* K' l, n
  52. #endif! q4 i8 g* p8 V, E0 }1 A; u3 \

  53. 7 h& u0 x' _! V: A0 H& V3 T1 D! Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 O# O2 L# Z0 y2 g6 ?6 a" @
  55. #define STATIC_SHIFT                3
    ' s- c: H% z% R. p, Z% A
  56. #define TCINTEN_SHIFT               20
    3 N$ A/ ]2 ?2 M  H& a
  57. #define ITCINTEN_SHIFT              215 C- y: z5 ]8 b. r& N1 \, V
  58. #define TCCHEN_SHIFT                22' S' C8 U* k0 }& v9 `4 Y0 \
  59. #define ITCCHEN_SHIFT               23
    $ l, a" r" k/ O/ E# h
  60. 1 T# u. F) z6 ]/ ]% l3 f1 h
  61. static volatile int irqraised1 = 0;# C9 N/ x7 O' W- R; \; D8 L
  62. static volatile int irqraised2 = 0;
    / Q0 X0 a( ?) Q

  63. 8 A8 Z' i6 S- y( [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 O, P* q9 `, T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      U4 Z, y/ k7 r( B! G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + d+ M. b3 H9 B
  67. - l- @0 |4 j) b" m% h' f* S
  68. dma_addr_t dmaphyssrc1 = 0;
    8 J! C% |# H: Z( x4 W: n! A
  69. dma_addr_t dmaphyssrc2 = 0;
    , {* U- j5 r7 N
  70. dma_addr_t dmaphysdest1 = 0;
    ) W- }: E, k/ R" s
  71. dma_addr_t dmaphysdest2 = 0;: L0 B# I5 Z( P( ]5 ~$ r
  72. ( X  z* ]. X5 V+ k% z/ l; c5 f
  73. char *dmabufsrc1 = NULL;
    ; r) H, r. V+ p) t* d
  74. char *dmabufsrc2 = NULL;  b% v: z, @7 k# f9 t" j
  75. char *dmabufdest1 = NULL;
    4 v$ E4 O) g" V7 j5 b2 f) T6 y
  76. char *dmabufdest2 = NULL;: Q% e' D& f0 U5 G. N2 D2 I
  77. " E# r; D2 N6 s6 Z4 ]+ Z# b' G
  78. static int acnt = 512;: r% @( A$ J0 Y# ?3 x* Y7 N( N: G) j
  79. static int bcnt = 8;' o0 w' |$ M. D1 p) R( h- G
  80. static int ccnt = 8;2 Y9 p/ {% i2 ]! W
  81. 9 L4 I$ r. A1 w8 p
  82. module_param(acnt, int, S_IRUGO);
    4 \! R9 `5 U1 b: _+ z: O, c( D/ Y
  83. module_param(bcnt, int, S_IRUGO);) t2 U- F# |" k3 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 H) P& a9 `: B) h; Z! r
9 x# N- Y9 m" h/ U, H! S7 U8 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" Y+ d# n0 s  farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 k* O( {! c; S; m( a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# [7 e0 `( f0 F
! Z" @/ J$ B1 l; w5 n
& P: v  p% ?4 E% Y. \8 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 17:20 , Processed in 0.041040 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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