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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 y: _+ W! w6 r- ^7 z! I7 v
  1. [code]EDMA sample test application0 \3 T6 X( \5 y6 m6 e6 n' b2 `
  2. /*
    ; b& x2 [" ]7 W8 D! l8 r0 e+ V# M- u
  3. * edma_test.c
    6 ]% d3 {; I; ]1 a: m
  4. *
    . Y- s3 m0 p  w- w0 E
  5. * brief  EDMA3 Test Application
    3 V2 n0 _" v7 T- }/ H8 N- b
  6. *
    ! T: L. Q/ Y; [& }6 k: P  u8 a
  7. *   This file contains EDMA3 Test code.
    + Y  K. y7 _  n
  8. *
      q3 W% Z2 `7 g9 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 P# {+ g! I# A# u* p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / u- P" ^" c/ v( }: I% x: G" q# w
  11. *         TO CHANGE.
      {1 [1 p, h% a7 u3 i6 v% w
  12. *
    , U; y0 c+ M1 B8 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' H2 R+ v* G$ _  k4 K" ?) S; x+ v& ~8 Y
  14. *
    6 F6 R3 L( g- n* d: {
  15. * This program is free software; you can redistribute it and/or- z$ I7 j1 e& {! D$ f
  16. * modify it under the terms of the GNU General Public License as0 Y' K5 n6 s/ I0 X) h' V
  17. * published by the Free Software Foundation version 2." J9 |6 K$ m( U6 O% @7 \
  18. *
    / f9 V- |* S" ]1 Q3 v. i4 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % v1 L7 X/ Z6 k' v% L- ^. {
  20. * kind, whether express or implied; without even the implied warranty
    6 u( B/ c6 c) [# N* e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 g* Z+ ?; C' u- f' H
  22. * GNU General Public License for more details.2 U2 L; W6 U: T1 B: t7 h7 p
  23. */
    * _" O' w3 S0 T; B/ j, |2 `

  24. 7 X+ g6 N* T8 @$ O$ ?6 e5 {' ^) w
  25. #include <linux/module.h>. U1 M1 B; a, p/ M) e% p
  26. #include <linux/init.h>) G! Q* L2 V( H  a- r8 R
  27. #include <linux/errno.h>" a5 R& p- b+ Z. H4 v7 ~
  28. #include <linux/types.h>
    5 N, O, B- G. ]8 D1 y+ A- o
  29. #include <linux/interrupt.h>
    % h) G* C& [& W4 g" |9 n! b7 Q
  30. #include <asm/io.h>
    + y4 g: z1 E( H+ }4 C! i0 t: l
  31. #include <linux/moduleparam.h>
    * T- i2 P: J8 T7 {! U' P
  32. #include <linux/sysctl.h>
    6 P# N" p8 i# b  c" w7 ~" J9 U
  33. #include <linux/mm.h>
    1 t- Q7 r+ A5 |6 N+ \
  34. #include <linux/dma-mapping.h>$ S4 H& S/ U4 \) S/ \
  35. 0 ?8 f. ^/ Y- U7 a
  36. #include <mach/memory.h>+ L: n, d& A: R. p: a
  37. #include <mach/hardware.h>! U1 \% h' q: D4 f  T) P# d. J+ ]
  38. #include <mach/irqs.h>
    / }; ?8 G& }1 [
  39. #include <asm/hardware/edma.h>6 {) X: r4 o! J: g3 q3 M7 }" V
  40. ' `8 e3 {( d, k5 y2 R/ p9 m
  41. #undef EDMA3_DEBUG
    . u2 A1 C7 F" q* F; I
  42. /*#define EDMA3_DEBUG*/+ P/ v; Y6 K4 F$ o8 B
  43. , n" I! O4 t" z2 I8 e+ ?. r
  44. #ifdef EDMA3_DEBUG& I7 O2 G7 `8 M- l+ }9 }) R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 T2 y. m$ b' o* p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 O* `3 C8 B+ V, G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + S) r! z3 ~9 e7 o9 D2 D' L( J
  48. #else) b% V* a. C5 y+ J9 d1 o% r; [! D8 _
  49. #define DMA_PRINTK( x... )& Z/ w- V" d  K. N
  50. #define DMA_FN_IN
    . s9 [( T( Z) @- X- `8 u
  51. #define DMA_FN_OUT3 a, K% S% q8 _+ |! J: ~/ d
  52. #endif
    . f$ `5 w6 T+ k- \" S
  53. / p/ D! V% a2 s$ l5 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + r6 R1 S( u" d
  55. #define STATIC_SHIFT                3# X+ i  ]3 A2 i, w2 ~" j$ `
  56. #define TCINTEN_SHIFT               20
    $ @* v( P9 j# R
  57. #define ITCINTEN_SHIFT              21
    3 ]3 m: l# _; b3 `5 k8 g
  58. #define TCCHEN_SHIFT                22
    ' O) z/ z! t, R
  59. #define ITCCHEN_SHIFT               23
    . }1 q0 G( [& k5 F6 w8 ^# u
  60. 9 C/ `+ J- F! b4 @6 l8 o/ U7 f5 Y
  61. static volatile int irqraised1 = 0;1 k8 B* \5 {  H2 x* g3 x
  62. static volatile int irqraised2 = 0;
    + M1 I' g9 |! A' Z2 D
  63. : W, W, L5 w1 U- n5 d: X& c* D' D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- p, S' o0 t9 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) r; D( F) \! z) K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. a$ n# U( L* y2 z6 c
  67. 3 m3 a2 r- h9 c* T# N' r0 ~1 B
  68. dma_addr_t dmaphyssrc1 = 0;% ]5 w( P9 J2 x4 z6 h( R
  69. dma_addr_t dmaphyssrc2 = 0;, u$ J6 h" b, T1 F
  70. dma_addr_t dmaphysdest1 = 0;: u9 B( b# v- q- J8 A9 j
  71. dma_addr_t dmaphysdest2 = 0;0 W  B" I% ]; @6 {5 x
  72. 7 s% M) y2 E1 G
  73. char *dmabufsrc1 = NULL;5 Z' R7 _8 g3 U- u
  74. char *dmabufsrc2 = NULL;
    ( X7 [: J. o; k# D) A+ P
  75. char *dmabufdest1 = NULL;$ c0 l; x& M+ l- T+ @
  76. char *dmabufdest2 = NULL;
    1 x6 P0 {# O# v
  77. 3 J) r2 U  M) }+ U
  78. static int acnt = 512;
    ; S  S4 }. }9 c9 _. K/ j3 V
  79. static int bcnt = 8;
    9 D/ m) p. i+ ?8 \8 V- U
  80. static int ccnt = 8;
    & }; q' U3 R4 Z. U
  81. , A# ^) D  {* t/ `
  82. module_param(acnt, int, S_IRUGO);
    6 k% ~: l' g$ `
  83. module_param(bcnt, int, S_IRUGO);; o" l- I4 C4 d* P  f3 \5 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ a9 W8 Y, A& j
' Z' s, C: c5 \: _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 R' d4 Z) J/ m+ ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 a' f0 F3 H8 h0 Q' X" J0 P, Z# L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 g, W5 ]/ N! O  ]0 f0 ~; B* R
6 `" ^. ]2 Z- i  J( S, U) S4 k6 Q4 R6 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 21:40 , Processed in 0.038064 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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